当前位置: 首页>>代码示例>>C#>>正文


C# Signature类代码示例

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


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

示例1: CanStoreTest

        public void CanStoreTest()
        {
            object[] obj = new object[5];
            obj[0] = new object();
            obj[1] = new int();
            obj[2] = new float();
            obj[3] = new Action(() => { });
            obj[4] = new List<int>();

            Type[] types1 = obj.GetTypes();
            Type[] types2 = new Type[] { typeof(object), typeof(int), typeof(float), typeof(Delegate), typeof(IList<int>) };
            Assert.IsTrue(types2.CanStore(types1));
            Assert.IsFalse(types1.CanStore(types2));

            Signature s1 = new Signature() { ParameterTypes = types1, ReturnType = typeof(Int16) };
            Signature s2 = new Signature() { ParameterTypes = types2, ReturnType = typeof(object) };

            Assert.IsTrue(s2.CanStore(s1));
            Assert.IsFalse(s1.CanStore(s2));

            types1 = new Type[0];
            types2 = new Type[0];

            Assert.IsTrue(types2.CanStore(types1));
            Assert.IsTrue(types1.CanStore(types2));

             s1 = new Signature() { ParameterTypes = types1, ReturnType = typeof(void) };
             s2 = new Signature() { ParameterTypes = types2, ReturnType = typeof(void) };

             Assert.IsTrue(s2.CanStore(s1));
             Assert.IsTrue(s1.CanStore(s2));
        }
开发者ID:lebaon,项目名称:AEF,代码行数:32,代码来源:ReflectionHelperTests.cs

示例2: SelectNodeByIdFromObjects

        /// <summary>
        /// Locate and return the node identified by idValue
        /// </summary>
        /// <param name="signature"></param>
        /// <param name="idValue"></param>
        /// <returns>node if found - else null</returns>
        /// <remarks>Tries to match each object in the Object list.</remarks>
        private static XmlElement SelectNodeByIdFromObjects(Signature signature, string idValue)
        {
            XmlElement node = null;

            // enumerate the objects
            foreach (DataObject dataObject in signature.ObjectList)
            {
                // direct reference to Object id - supported for all reference typs
                if (String.CompareOrdinal(idValue, dataObject.Id) == 0)
                {
                    // anticipate duplicate ID's and throw if any found
                    if (node != null)
                        throw new XmlException(SR.Get(SRID.DuplicateObjectId));

                    node = dataObject.GetXml();
                }
            }

            // now search for XAdES specific references
            if (node == null)
            {
                // For XAdES we implement special case where the reference may
                // be to an internal tag with matching "Id" attribute.
                node = SelectSubObjectNodeForXAdES(signature, idValue);
            }

            return node;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:CustomSignedXml.cs

示例3: CommitToBranch

 public Commit CommitToBranch(Repository repo, string branchName, string message, Signature author, Tree tree)
 {
     Branch branch = repo.Branches[branchName];
     Commit commit = repo.ObjectDatabase.CreateCommit(author, author, message, tree, new List<Commit> { branch.Tip }, prettifyMessage: true);
     repo.Refs.UpdateTarget(repo.Refs[branch.CanonicalName], commit.Id);
     return commit;
 }
开发者ID:rmichela,项目名称:BastionPrototype,代码行数:7,代码来源:Bastion.cs

示例4: ElementLabel

 /// <summary>
 /// Constructor for the <c>ElementLabel</c> object. This is
 /// used to create a label that can convert a XML node into a
 /// composite object or a primitive type from an XML element.
 /// </summary>
 /// <param name="contact">
 /// this is the field that this label represents
 /// </param>
 /// <param name="label">
 /// this is the annotation for the contact
 /// </param>
 public ElementLabel(Contact contact, Element label) {
    this.detail = new Signature(contact, this);
    this.decorator = new Qualifier(contact);
    this.type = contact.Type;
    this.name = label.name();
    this.label = label;
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:18,代码来源:ElementLabel.cs

示例5: RenameMyWishListPage

 private static void RenameMyWishListPage(Repository repo, string myWishListPath, Signature sig)
 {
     repo.Index.Unstage(myWishListPath);
     File.Move(myWishListPath, myWishListPath + "List");
     repo.Index.Stage(myWishListPath + "List");
     repo.Commit(sig, sig, "Fix MyWishList page name");
 }
开发者ID:nulltoken,项目名称:Witinyki,代码行数:7,代码来源:WikiRepoHelper.cs

示例6: UpdateHomePageContent

 private static void UpdateHomePageContent(Repository repo, string homePath, Signature sig)
 {
     File.AppendAllText(homePath, "\nThis will be a bare bone user experience.\n");
     repo.Index.Stage(homePath);
     repo.Commit(sig, sig,
                 "Add warning to the Home page\n\nA very informational explicit message preventing the user from expecting too much.");
 }
开发者ID:nulltoken,项目名称:Witinyki,代码行数:7,代码来源:WikiRepoHelper.cs

示例7: SaveFile

        public void SaveFile(string fileName, string content, string username, string email)
        {
            using (var repo = new Repository(_basePath))
            {
                File.WriteAllText(Path.Combine(repo.Info.WorkingDirectory, fileName), content);

                // stage the file
                repo.Stage(fileName);

                // Create the committer's signature and commit
                //var user = repo.Config.Get<string>("user", "name", null);
                //var email = repo.Config.Get<string>("user", "email", null);

                var author = new Signature(username, email, DateTime.Now);
                var committer = author;

                // Commit to the repo
                var commitMessage = string.Format("Revision: {0}", GetRevisionCount(repo, fileName));
                try
                {
                    var commit = repo.Commit(commitMessage, author, committer);
                    foreach (var parent in commit.Parents)
                    {
                        Console.WriteLine("Id: {0}, Sha: {1}", parent.Id, parent.Sha);
                    }
                }
                catch (EmptyCommitException) { } // I don't care if the user didn't change anything at this time
            }
        }
开发者ID:kenwilcox,项目名称:PlayingWithLibGit2,代码行数:29,代码来源:FileSaver.cs

示例8: BuildSampleWikiRepo

        public static void BuildSampleWikiRepo()
        {
            var repoPath = Repository.Init(Constants.WorkingDirectory);

            using (var repo = new Repository(repoPath))
            {
                string workDir = repo.Info.WorkingDirectory;

                string homePath = Path.Combine(workDir, "Home");
                var sig = new Signature("A. U. Thor", "[email protected]",
                                        new DateTimeOffset(2011, 06, 16, 10, 58, 27, TimeSpan.FromHours(2)));

                CreateHomePage(repo, homePath, sig);

                Signature sig2 = Shift(sig, TimeSpan.FromMinutes(2));
                UpdateHomePageContent(repo, homePath, sig2);

                string myWishListPath = Path.Combine(workDir, "MyWish");

                Signature sig3 = Shift(sig2, TimeSpan.FromMinutes(17));
                CreateMyWishListPage(repo, myWishListPath, sig3);

                Signature sig4 = Shift(sig3, TimeSpan.FromMinutes(31));
                RenameMyWishListPage(repo, myWishListPath, sig4);
            }
        }
开发者ID:nulltoken,项目名称:Witinyki,代码行数:26,代码来源:WikiRepoHelper.cs

示例9: TextLabel

 /// <summary>
 /// Constructor for the <c>TextLabel</c> object. This is
 /// used to create a label that can convert a XML node into a
 /// primitive value from an XML element text value.
 /// </summary>
 /// <param name="contact">
 /// this is the contact this label represents
 /// </param>
 /// <param name="label">
 /// this is the annotation for the contact
 /// </param>
 public TextLabel(Contact contact, Text label) {
    this.detail = new Signature(contact, this);
    this.type = contact.Type;
    this.empty = label.empty();
    this.contact = contact;
    this.label = label;
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:18,代码来源:TextLabel.cs

示例10: SignatureResponse

 /// <summary>
 /// Create an accepting response.
 /// </summary>
 /// <param name="signature">Signature of CA.</param>
 public SignatureResponse(Guid subjectId, Signature signature)
 {
     SubjectId = subjectId;
       Status = SignatureResponseStatus.Accepted;
       Signature = signature;
       Reason = string.Empty;
 }
开发者ID:dbrgn,项目名称:pi-vote,代码行数:11,代码来源:SignatureResponse.cs

示例11: Matches

 public bool Matches(Signature sig)
 {
     if (ComponentTypes.Intersect(sig.ComponentTypes).Count() == sig.ComponentTypes.Count())
         return true;
     else
         return false;
 }
开发者ID:TheCommieDuck,项目名称:Pancakes,代码行数:7,代码来源:Signature.cs

示例12: DoubleSpendAttack_SouldHaveValidTransferChain

        public static void DoubleSpendAttack_SouldHaveValidTransferChain()
        {
            //Arrange
            var goofy = new Goofy();
            var attacker = new Signature(256);

            Global.GoofyPk = goofy.PublicKey;

            var trans1 = goofy.CreateCoin(attacker.PublicKey);

            //Action
            var sgndTrans1 = attacker.SignMessage(trans1);
            var destiny1 = new Person();
            var transInfo1 = new TransferInfo(sgndTrans1, destiny1.PublicKey);
            var trans2 = trans1.PayTo(transInfo1);
            var destiny2 = new Person();
            var transInfo2 = new TransferInfo(sgndTrans1, destiny2.PublicKey);
            var trans3 = trans1.PayTo(transInfo2);

            //Assert

            try
            {
                //!previousTransSignedByMe.isValidSignedMsg(previous);
                if ((trans2.isValidSignedMsg(trans2[trans1]))
                    && (trans3.isValidSignedMsg(trans3[trans1])))
                    throw new Exception("Its not allowed to double spend the same coin.");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
开发者ID:vinils,项目名称:ScroogeCoin,代码行数:33,代码来源:Tests.cs

示例13: ChengeTransfer_SouldNotAffectTransferChain

        /// <summary>
        /// Attacker change a transfer in the middle of the chain and make the chain invalid
        /// </summary>
        public static void ChengeTransfer_SouldNotAffectTransferChain()
        {
            //Arrange
            var goofy = new Goofy();
            var changer = new Signature(256);
            var person1 = new Person();
            var person2 = new Person();

            var trans1 = goofy.CreateCoin(changer.PublicKey);
            var changerSgndTrans = changer.SignMessage(trans1);
            var transInfo = new TransferInfo(changerSgndTrans, person1.PublicKey);
            var changerTransfer = trans1.PayTo(transInfo);

            person1.AddTransfer(changerTransfer);

            var tran3 = person1.PayTo(person2.PublicKey);

            //Act
            changerTransfer.Hash = null;
            changerTransfer.Info.DestinyPk = null;

            //Assert
            try
            {
                person2.CheckTransfers(tran3);
            }
            catch
            {
                Console.WriteLine("Transfer chain is broked because someone change a another transfer in the middle.");
            }
        }
开发者ID:vinils,项目名称:ScroogeCoin,代码行数:34,代码来源:Tests.cs

示例14: Signature

        /// <summary>
        /// Loads the signature.
        /// </summary>
        /// <param name="signature">The signature.</param>
        public Signature(Signature signature)
        {
            if (signature == null)
                throw new ArgumentNullException(@"signature");

            this.token = signature.token;
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:11,代码来源:Signature.cs

示例15: btnCommit_Click

        private void btnCommit_Click(object sender, RibbonControlEventArgs e)
        {
            //Get Active  Project
            var pj = Globals.ThisAddIn.Application.ActiveProject;

            //Get Project Filename.
            var projectFile = pj.FullName;

            //Get Directory from File Name
            var directory = Path.GetDirectoryName(projectFile);

            //Create a new Git Repository
            Repository.Init(directory);

            //Open the git repository in a using context so its automatically disposed of.
            using (var repo = new Repository(directory))
            {
                // Stage the file
                repo.Index.Stage(projectFile);

                // Create the committer's signature and commit
                var author = new Signature("Richard", "@ARM", DateTime.Now);
                var committer = author;

                // Commit to the repository
                var commit = repo.Commit("Initial commit", author, committer);
            }
        }
开发者ID:rcookerly,项目名称:ProjectVersionControl,代码行数:28,代码来源:GitRibbon.cs


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