• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.Signature类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Signature的典型用法代码示例。如果您正苦于以下问题:C# Signature类的具体用法?C# Signature怎么用?C# Signature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Signature类属于System命名空间,在下文中一共展示了Signature类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetDynamicClass

        public Type GetDynamicClass(IEnumerable<DynamicProperty> properties, Type resultType = null, Type baseType = null)
        {
            rwLock.AcquireReaderLock(Timeout.Infinite);
            try
            {
                Signature signature = new Signature(properties);
                Type type;
                if (!classes.TryGetValue(signature, out type))
                {
                    if (resultType == null)
                        type = CreateDynamicClass(signature.properties);
                    else
                    {
                        type = CreateDynamicClass(signature.properties, resultType, baseType);
                    }

                    classes.Add(signature, type);
                }
                return type;
            }
            finally
            {
                rwLock.ReleaseReaderLock();
            }
        }
开发者ID:incloud,项目名称:incloud.jquery.datatables,代码行数:25,代码来源:ClassFactory.cs


示例2: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
        {
            if (!session.TextView.Properties.ContainsProperty(SessionKey))
            {
                return;
            }

            // Map the trigger point down to our buffer.
            var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot);
            if (!subjectTriggerPoint.HasValue)
            {
                return;
            }

            var currentSnapshot = subjectTriggerPoint.Value.Snapshot;
            var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);
            var applicableToSpan = currentSnapshot.CreateTrackingSpan(
                querySpan.Start.Position,
                0,
                SpanTrackingMode.EdgeInclusive);

            string encouragement = encouragements.GetRandomEncouragement();
            var signature = new Signature(applicableToSpan, encouragement, "", "");
            signatures.Add(signature);
        }
开发者ID:jeremyiverson,项目名称:Encourage,代码行数:25,代码来源:EncourageSignatureHelpSource.cs


示例3: CheckArguments

 internal object[] CheckArguments(object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
 {
     int num = (parameters != null) ? parameters.Length : 0;
     object[] objArray = new object[num];
     ParameterInfo[] parametersNoCopy = null;
     for (int i = 0; i < num; i++)
     {
         object defaultValue = parameters[i];
         RuntimeType type = sig.Arguments[i];
         if (defaultValue == Type.Missing)
         {
             if (parametersNoCopy == null)
             {
                 parametersNoCopy = this.GetParametersNoCopy();
             }
             if (parametersNoCopy[i].DefaultValue == DBNull.Value)
             {
                 throw new ArgumentException(Environment.GetResourceString("Arg_VarMissNull"), "parameters");
             }
             defaultValue = parametersNoCopy[i].DefaultValue;
         }
         objArray[i] = type.CheckValue(defaultValue, binder, culture, invokeAttr);
     }
     return objArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:MethodBase.cs


示例4: AuthorizationHeader

 public AuthorizationHeader(ClientCredentials credentials, Nonce nonce, TimeStamp timestamp, Signature signature)
 {
     this.credentials = credentials;
     this.timestamp = timestamp;
     this.nonce = nonce;
     this.signature = signature;
 }
开发者ID:MathieuTurcotte,项目名称:CSharp-OAuth-Client-Library,代码行数:7,代码来源:AuthorizationHeader.cs


示例5: CanCommitALittleBit

        public void CanCommitALittleBit()
        {
            SelfCleaningDirectory scd = BuildSelfCleaningDirectory();

            using (var repo = Repository.Init(scd.DirectoryPath))
            {
                string dir = repo.Info.Path;
                Path.IsPathRooted(dir).ShouldBeTrue();
                Directory.Exists(dir).ShouldBeTrue();

                const string relativeFilepath = "new.txt";
                string filePath = Path.Combine(repo.Info.WorkingDirectory, relativeFilepath);

                File.WriteAllText(filePath, "null");
                repo.Index.Stage(relativeFilepath);
                File.AppendAllText(filePath, "token\n");
                repo.Index.Stage(relativeFilepath);

                repo.Head[relativeFilepath].ShouldBeNull();

                var author = new Signature("Author N. Ame", "[email protected]", DateTimeOffset.Now.AddSeconds(-10));
                Commit commit = repo.Commit("Initial egotistic commit", author, author);

                AssertBlobContent(repo.Head[relativeFilepath], "nulltoken\n");
                AssertBlobContent(commit[relativeFilepath], "nulltoken\n");

                commit.Parents.Count().ShouldEqual(0);
                repo.Info.IsEmpty.ShouldBeFalse();

                File.WriteAllText(filePath, "nulltoken commits!\n");
                repo.Index.Stage(relativeFilepath);

                var author2 = new Signature(author.Name, author.Email, author.When.AddSeconds(5));
                Commit commit2 = repo.Commit("Are you trying to fork me?", author2, author2);

                AssertBlobContent(repo.Head[relativeFilepath], "nulltoken commits!\n");
                AssertBlobContent(commit2[relativeFilepath], "nulltoken commits!\n");

                commit2.Parents.Count().ShouldEqual(1);
                commit2.Parents.First().Id.ShouldEqual(commit.Id);

                Branch firstCommitBranch = repo.CreateBranch("davidfowl-rules", commit.Id.Sha); //TODO: This cries for a shortcut method :-/
                repo.Branches.Checkout(firstCommitBranch.Name); //TODO: This cries for a shortcut method :-/

                File.WriteAllText(filePath, "davidfowl commits!\n");

                var author3 = new Signature("David Fowler", "[email protected]", author.When.AddSeconds(2));
                repo.Index.Stage(relativeFilepath);

                Commit commit3 = repo.Commit("I'm going to branch you backwards in time!", author3, author3);

                AssertBlobContent(repo.Head[relativeFilepath], "davidfowl commits!\n");
                AssertBlobContent(commit3[relativeFilepath], "davidfowl commits!\n");

                commit3.Parents.Count().ShouldEqual(1);
                commit3.Parents.First().Id.ShouldEqual(commit.Id);

                AssertBlobContent(firstCommitBranch[relativeFilepath], "nulltoken\n");
            }
        }
开发者ID:uluhonolulu,项目名称:libgit2sharp,代码行数:60,代码来源:CommitFixture.cs


示例6: AugmentSignatureHelpSession

        public void AugmentSignatureHelpSession(ISignatureHelpSession session, IList<ISignature> signatures)
        {
            if (!session.TextView.Properties.ContainsProperty(SessionKey))
            {
                return;
            }

            // At the moment there is a bug in the javascript provider which causes it to
            // repeatedly insert the same Signature values into an ISignatureHelpSession
            // instance.  There is no way, other than reflection, for us to prevent this
            // from happening.  Instead we just ensure that our provider runs after
            // Javascript and then remove the values they add here
            signatures.Clear();

            // Map the trigger point down to our buffer.
            var subjectTriggerPoint = session.GetTriggerPoint(subjectBuffer.CurrentSnapshot);
            if (!subjectTriggerPoint.HasValue)
            {
                return;
            }

            var currentSnapshot = subjectTriggerPoint.Value.Snapshot;
            var querySpan = new SnapshotSpan(subjectTriggerPoint.Value, 0);
            var applicableToSpan = currentSnapshot.CreateTrackingSpan(
                querySpan.Start.Position,
                0,
                SpanTrackingMode.EdgeInclusive);

            string encouragement = encouragements.GetRandomEncouragement();
            if (encouragement != null)
            {
                var signature = new Signature(applicableToSpan, encouragement, "", "");
                signatures.Add(signature);
            }
        }
开发者ID:RC1140,项目名称:Encourage,代码行数:35,代码来源:EncourageSignatureHelpSource.cs


示例7: SingMesssage

        /// <summary>
        /// Creates a signature for the given messsage and the given private key.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="privateKey">The array of 32 bytes of the private key.</param>
        /// <param name="useCompressedPublicKey">true to specify that the public key should have the compressed format; otherwise, false.</param>
        /// <exception cref="ArgumentException">The message is null or private key is null or invalid.</exception>
        /// <returns>The signature for the given message and the given private key in base-64 encoding.</returns>
        public static string SingMesssage(string message, byte[] privateKey, bool useCompressedPublicKey)
        {
            if (message == null)
            {
                throw new ArgumentException("The message is null.", nameof(message));
            }

            if (privateKey == null)
            {
                throw new ArgumentException("The private key is null.", nameof(privateKey));
            }

            if (!BitcoinPrivateKey.IsValid(privateKey))
            {
                throw new ArgumentException("The private key is invalid.", nameof(privateKey));
            }

            ECPrivateKeyParameters parameters = new ECPrivateKeyParameters(new BigInteger(1, privateKey), domainParameters);

            ECDsaSigner signer = new ECDsaSigner(new HMacDsaKCalculator(new Sha256Digest()));
            signer.Init(true, parameters);

            var hash = GetMessageHash(message);

            BigInteger[] signatureArray = signer.GenerateSignature(hash);
            BigInteger r = signatureArray[0];
            BigInteger s = signatureArray[1];

            s = NormalizeS(s);

            byte[] encodedPublicKey = BitcoinPrivateKey.ToEncodedPublicKey(privateKey, useCompressedPublicKey);

            int pubKeyMaskOffset = useCompressedPublicKey ? 4 : 0;

            Signature signature = null;

            for (int i = 0; i < 4; i++)
            {
                Signature candidateSignature = new Signature();
                candidateSignature.PublicKeyMask = i + pubKeyMaskOffset;
                candidateSignature.R = r;
                candidateSignature.S = s;

                byte[] recoveredPublicKey = RecoverPublicKeyFromSignature(hash, candidateSignature);
                if (recoveredPublicKey != null && recoveredPublicKey.SequenceEqual(encodedPublicKey))
                {
                    signature = candidateSignature;
                    break;
                }
            }

            if (signature == null)
            {
                // this should not happen
                throw new Exception("The public key is not recoverable from signature.");
            }

            return EncodeSignature(signature);
        }
开发者ID:yu-kopylov,项目名称:bitcoin-utilities,代码行数:67,代码来源:SignatureUtils.cs


示例8: UpdateFromMem

        private void UpdateFromMem(IntPtr sigPtr)
        {
            _gpgme_op_verify_result ver = new _gpgme_op_verify_result();
            Marshal.PtrToStructure(sigPtr, ver);
            file_name = Gpgme.PtrToStringUTF8(ver.file_name);

            if (ver.signature != IntPtr.Zero)
                signature = new Signature(ver.signature);
        }
开发者ID:anonghosteam,项目名称:outlook-privacy-plugin,代码行数:9,代码来源:VerificationResult.cs


示例9: UpdateInfo

        public UpdateInfo(string updateVersion, Uri downloadURI, long downloadSize, Signature signature)
        {
            _updateVersion = updateVersion;
            _downloadURI = downloadURI;
            _downloadSize = downloadSize;
            _signature = signature;

            if (_signature.SigningCertificate.Capability != CertificateCapability.SignFile)
                throw new Exception("Signing certificate is not capable to sign files.");
        }
开发者ID:rodoviario,项目名称:BitChatClient,代码行数:10,代码来源:UpdateInfo.cs


示例10: TypeDecoderMethodAttribute

 public TypeDecoderMethodAttribute(Type[] dependency)
 {
     try
     {
         m_dependency = new Signature(dependency[0], dependency[1]);
     }
     catch (Exception)
     {
         // TODO: wrongly constructed dependency
     }
 }        
开发者ID:jozilla,项目名称:Uiml.net,代码行数:11,代码来源:TypeDecoderMethodAttribute.cs


示例11: GetDynamicClass

 public Type GetDynamicClass(IEnumerable<DynamicProperty> properties)
 {
     Type type;
     Signature key = new Signature(properties);
     if (!this.classes.TryGetValue(key, out type))
     {
         type = this.CreateDynamicClass(key.properties);
         this.classes.Add(key, type);
     }
     return type;
 }
开发者ID:adrielcodeco,项目名称:AsyncEngine,代码行数:11,代码来源:ClassFactory.cs


示例12: GetDynamicClass

		public Type GetDynamicClass( IEnumerable< DynamicProperty > properties ) {
			rwLock.AcquireReaderLock( Timeout.Infinite );
			try {
				var signature = new Signature( properties );
				Type type;
				if ( !classes.TryGetValue( signature , out type ) ) {
					type = CreateDynamicClass( signature.properties );
					classes.Add( signature , type );
				}
				return type;
			}
			finally {
				rwLock.ReleaseReaderLock();
			}
		}
开发者ID:kisflying,项目名称:kion,代码行数:15,代码来源:ClassFactory.cs


示例13: CanCreateAndRetrieveCommit

        public async Task CanCreateAndRetrieveCommit()
        {
            string owner = this._repository.Owner.Login;

            var author = new Signature { Name = "author", Email = "[email protected]", Date = DateTime.UtcNow };
            var commiter = new Signature { Name = "commiter", Email = "[email protected]", Date = DateTime.Today };

            var newCommit = new NewCommit("test-commit", "[Change this to tree sha]", Enumerable.Empty<string>())
            {
                Author = author,
                Committer = commiter
            };

            var commit = await this._commitsClient.Create(owner, this._repository.Name, newCommit);

            Assert.NotNull(commit);
            var retrieved = await this._commitsClient.Get(owner, this._repository.Name, commit.Sha);
            Assert.NotNull(retrieved);
        }
开发者ID:rahulvramesh,项目名称:octokit.net,代码行数:19,代码来源:CommitsClientTests.cs


示例14: AddCommitToRepo

        private static Commit AddCommitToRepo(IRepository repo)
        {
            string relativeFilepath = "test.txt";
            Touch(repo.Info.WorkingDirectory, relativeFilepath, content);
            repo.Index.Stage(relativeFilepath);

            var ie = repo.Index[relativeFilepath];
            Assert.NotNull(ie);
            Assert.Equal("9daeafb9864cf43055ae93beb0afd6c7d144bfa4", ie.Id.Sha);

            var author = new Signature("nulltoken", "[email protected]", DateTimeOffset.Parse("Wed, Dec 14 2011 08:29:03 +0100"));
            var commit = repo.Commit("Initial commit", author, author);

            relativeFilepath = "big.txt";
            var zeros = new string('0', 32*1024 + 3);
            Touch(repo.Info.WorkingDirectory, relativeFilepath, zeros);
            repo.Index.Stage(relativeFilepath);

            ie = repo.Index[relativeFilepath];
            Assert.NotNull(ie);
            Assert.Equal("6518215c4274845a759cb498998fe696c42e3e0f", ie.Id.Sha);

            return commit;
        }
开发者ID:AndersKroghDk,项目名称:libgit2sharp,代码行数:24,代码来源:OdbBackendFixture.cs


示例15: DiffSigs

 internal static bool DiffSigs(Signature sig1, RuntimeTypeHandle typeHandle1, Signature sig2, RuntimeTypeHandle typeHandle2)
 {
     SignatureStruct left = (SignatureStruct) sig1;
     SignatureStruct right = (SignatureStruct) sig2;
     return CompareSig(ref left, typeHandle1, ref right, typeHandle2);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:6,代码来源:Signature.cs


示例16: RuntimeParameterInfo

        private RuntimeParameterInfo(
            Signature signature, MetadataImport scope, int tkParamDef,
            int position, ParameterAttributes attributes, MemberInfo member)
        {
            Contract.Requires(member != null);
            Contract.Assert(MdToken.IsNullToken(tkParamDef) == scope.Equals(MetadataImport.EmptyImport));
            Contract.Assert(MdToken.IsNullToken(tkParamDef) || MdToken.IsTokenOfType(tkParamDef, MetadataTokenType.ParamDef));

            PositionImpl = position;
            MemberImpl = member;
            m_signature = signature;
            m_tkParamDef = MdToken.IsNullToken(tkParamDef) ? (int)MetadataTokenType.ParamDef : tkParamDef;
            m_scope = scope;
            AttrsImpl = attributes;

            ClassImpl = null;
            NameImpl = null;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:18,代码来源:parameterinfo.cs


示例17: GetParameters

        [System.Security.SecurityCritical]  // auto-generated
        internal unsafe static ParameterInfo[] GetParameters(
            IRuntimeMethodInfo methodHandle, MemberInfo member, Signature sig, out ParameterInfo returnParameter, bool fetchReturnParameter)
        {
            returnParameter = null;
            int sigArgCount = sig.Arguments.Length;
            ParameterInfo[] args = fetchReturnParameter ? null : new ParameterInfo[sigArgCount];

            int tkMethodDef = RuntimeMethodHandle.GetMethodDef(methodHandle);
            int cParamDefs = 0;

            // Not all methods have tokens. Arrays, pointers and byRef types do not have tokens as they
            // are generated on the fly by the runtime. 
            if (!MdToken.IsNullToken(tkMethodDef))
            {
                MetadataImport scope = RuntimeTypeHandle.GetMetadataImport(RuntimeMethodHandle.GetDeclaringType(methodHandle));

                MetadataEnumResult tkParamDefs;
                scope.EnumParams(tkMethodDef, out tkParamDefs);

                cParamDefs = tkParamDefs.Length;

                // Not all parameters have tokens. Parameters may have no token 
                // if they have no name and no attributes.
                if (cParamDefs > sigArgCount + 1 /* return type */)
                    throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));

                for (int i = 0; i < cParamDefs; i++)
                {
                    #region Populate ParameterInfos
                    ParameterAttributes attr;
                    int position, tkParamDef = tkParamDefs[i];

                    scope.GetParamDefProps(tkParamDef, out position, out attr);

                    position--;

                    if (fetchReturnParameter == true && position == -1)
                    {
                        // more than one return parameter?
                        if (returnParameter != null)
                            throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));

                        returnParameter = new RuntimeParameterInfo(sig, scope, tkParamDef, position, attr, member);
                    }
                    else if (fetchReturnParameter == false && position >= 0)
                    {
                        // position beyong sigArgCount?
                        if (position >= sigArgCount)
                            throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));

                        args[position] = new RuntimeParameterInfo(sig, scope, tkParamDef, position, attr, member);
                    }
                    #endregion
                }
            }

            // Fill in empty ParameterInfos for those without tokens
            if (fetchReturnParameter)
            {
                if (returnParameter == null)
                {
                    returnParameter = new RuntimeParameterInfo(sig, MetadataImport.EmptyImport, 0, -1, (ParameterAttributes)0, member);
                }
            }
            else
            {
                if (cParamDefs < args.Length + 1)
                {
                    for (int i = 0; i < args.Length; i++)
                    {
                        if (args[i] != null)
                            continue;

                        args[i] = new RuntimeParameterInfo(sig, MetadataImport.EmptyImport, 0, i, (ParameterAttributes)0, member);
                    }
                }
            }

            return args;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:81,代码来源:parameterinfo.cs


示例18: InvokeMethod

 internal extern static object InvokeMethod(object target, object[] arguments, Signature sig, bool constructor);
开发者ID:jashook,项目名称:coreclr,代码行数:1,代码来源:RuntimeHandles.cs


示例19: InvokeMethodFast

		internal static object InvokeMethodFast(IRuntimeMethodInfo method, object target, object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
		{
			SignatureStruct signature = sig.m_signature;
			object result = RuntimeMethodHandle._InvokeMethodFast(method, target, arguments, ref signature, methodAttributes, typeOwner);
			sig.m_signature = signature;
			return result;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:7,代码来源:RuntimeMethodHandle.cs


示例20: GetNextSignature

 private Signature GetNextSignature()
 {
     _signature = _signature.TimeShift(TimeSpan.FromMinutes(1));
     return _signature;
 }
开发者ID:PKRoma,项目名称:libgit2sharp,代码行数:5,代码来源:FileHistoryFixture.cs



注:本文中的System.Signature类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Single类代码示例发布时间:2022-05-26
下一篇:
C# System.Script类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap