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


C# AList.AddItem方法代码示例

本文整理汇总了C#中AList.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# AList.AddItem方法的具体用法?C# AList.AddItem怎么用?C# AList.AddItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AList的用法示例。


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

示例1: LogAllCommits

 public virtual void LogAllCommits()
 {
     IList<RevCommit> commits = new AList<RevCommit>();
     Git git = Git.Wrap(db);
     WriteTrashFile("Test.txt", "Hello world");
     git.Add().AddFilepattern("Test.txt").Call();
     commits.AddItem(git.Commit().SetMessage("initial commit").Call());
     git.BranchCreate().SetName("branch1").Call();
     Ref checkedOut = git.Checkout().SetName("branch1").Call();
     NUnit.Framework.Assert.AreEqual("refs/heads/branch1", checkedOut.GetName());
     WriteTrashFile("Test1.txt", "Hello world!");
     git.Add().AddFilepattern("Test1.txt").Call();
     commits.AddItem(git.Commit().SetMessage("branch1 commit").Call());
     checkedOut = git.Checkout().SetName("master").Call();
     NUnit.Framework.Assert.AreEqual("refs/heads/master", checkedOut.GetName());
     WriteTrashFile("Test2.txt", "Hello world!!");
     git.Add().AddFilepattern("Test2.txt").Call();
     commits.AddItem(git.Commit().SetMessage("branch1 commit").Call());
     Iterator<RevCommit> log = git.Log().All().Call().Iterator();
     NUnit.Framework.Assert.IsTrue(log.HasNext());
     NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
     NUnit.Framework.Assert.IsTrue(log.HasNext());
     NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
     NUnit.Framework.Assert.IsTrue(log.HasNext());
     NUnit.Framework.Assert.IsTrue(commits.Contains(log.Next()));
     NUnit.Framework.Assert.IsFalse(log.HasNext());
 }
开发者ID:JamesChan,项目名称:ngit,代码行数:27,代码来源:LogCommandTest.cs

示例2: Process

 /// <exception cref="NBoilerpipe.BoilerpipeProcessingException"></exception>
 public bool Process(TextDocument doc)
 {
     bool changes = false;
     IList<TextBlock> blocks = doc.GetTextBlocks();
     IList<TextBlock> blocksNew = new AList<TextBlock>();
     foreach (TextBlock tb in blocks)
     {
         string text = tb.GetText();
         string[] paragraphs = text.Split("[\n\r]+");
         if (paragraphs.Length < 2)
         {
             blocksNew.AddItem(tb);
             continue;
         }
         bool isContent = tb.IsContent();
         ICollection<string> labels = tb.GetLabels();
         foreach (string p in paragraphs)
         {
             TextBlock tbP = new TextBlock(p);
             tbP.SetIsContent(isContent);
             tbP.AddLabels(labels);
             blocksNew.AddItem(tbP);
             changes = true;
         }
     }
     if (changes)
     {
         blocks.Clear();
         Sharpen.Collections.AddAll(blocks, blocksNew);
     }
     return changes;
 }
开发者ID:oganix,项目名称:NBoilerpipe,代码行数:33,代码来源:SplitParagraphBlocksFilter.cs

示例3: GetQuery

 public static Query GetQuery(Database database, string listDocId)
 {
     View view = database.GetView(ViewName);
     if (view.Map == null)
     {
         view.Map += (IDictionary<string, object> document, EmitDelegate emitter)=> 
         {
             if (Task.DocType.Equals(document.Get("type")))
             {
                 var keys = new AList<object>();
                 keys.AddItem(document.Get("list_id"));
                 keys.AddItem(document.Get("created_at"));
                 emitter(keys, document);
             }
         };
     }
     Query query = view.CreateQuery();
     query.Descending = true;
     IList<object> startKeys = new AList<object>();
     startKeys.AddItem(listDocId);
     startKeys.AddItem(new Dictionary<string, object>());
     IList<object> endKeys = new AList<object>();
     endKeys.AddItem(listDocId);
     query.StartKey = startKeys;
     query.EndKey = endKeys;
     return query;
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:27,代码来源:Task.cs

示例4: TestDatabase

		public virtual void TestDatabase()
		{
			Send("PUT", "/database", Status.Created, null);
			IDictionary<string, object> dbInfo = (IDictionary<string, object>)Send("GET", "/database"
				, Status.Ok, null);
			NUnit.Framework.Assert.AreEqual(0, dbInfo.Get("doc_count"));
			NUnit.Framework.Assert.AreEqual(0, dbInfo.Get("update_seq"));
			NUnit.Framework.Assert.IsTrue((int)dbInfo.Get("disk_size") > 8000);
			Send("PUT", "/database", Status.PreconditionFailed, null);
			Send("PUT", "/database2", Status.Created, null);
			IList<string> allDbs = new AList<string>();
			allDbs.AddItem("cblite-test");
			allDbs.AddItem("database");
			allDbs.AddItem("database2");
			Send("GET", "/_all_dbs", Status.Ok, allDbs);
			dbInfo = (IDictionary<string, object>)Send("GET", "/database2", Status.Ok, null);
			NUnit.Framework.Assert.AreEqual("database2", dbInfo.Get("db_name"));
			Send("DELETE", "/database2", Status.Ok, null);
			allDbs.Remove("database2");
			Send("GET", "/_all_dbs", Status.Ok, allDbs);
			Send("PUT", "/database%2Fwith%2Fslashes", Status.Created, null);
			dbInfo = (IDictionary<string, object>)Send("GET", "/database%2Fwith%2Fslashes", Status
				.Ok, null);
			NUnit.Framework.Assert.AreEqual("database/with/slashes", dbInfo.Get("db_name"));
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:25,代码来源:RouterTest.cs

示例5: SaveStructuredDataForObject

 /// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
 /// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
 public static void SaveStructuredDataForObject(Dispatch2 dsp, AList<Dispatch2> stack
     , TextWriteStreamInterface stream, string indentstr)
 {
     // check object recursion
     int count = stack.Count;
     for (int i = 0; i < count; i++)
     {
         Dispatch2 d = stack[i];
         if (d == dsp)
         {
             // object recursion detected
             stream.Write("null /* object recursion detected */");
             return;
         }
     }
     // determin dsp's object type
     DictionaryNI dicni;
     ArrayNI arrayni;
     if (dsp != null)
     {
         dicni = (DictionaryNI)dsp.GetNativeInstance(DictionaryClass.ClassID);
         if (dicni != null)
         {
             // dictionary
             stack.AddItem(dsp);
             dicni.SaveStructuredData(stack, stream, indentstr);
             stack.Remove(stack.Count - 1);
             return;
         }
         else
         {
             arrayni = (ArrayNI)dsp.GetNativeInstance(ArrayClass.ClassID);
             if (arrayni != null)
             {
                 // array
                 stack.AddItem(dsp);
                 arrayni.SaveStructuredData(stack, stream, indentstr);
                 stack.Remove(stack.Count - 1);
                 return;
             }
             else
             {
                 // other objects
                 stream.Write("null /* (object) \"");
                 // stored as a null
                 Variant val = new Variant(dsp, dsp);
                 stream.Write(LexBase.EscapeC(val.AsString()));
                 stream.Write("\" */");
                 return;
             }
         }
     }
     stream.Write("null");
 }
开发者ID:fantasydr,项目名称:krkr-cs,代码行数:56,代码来源:ArrayNI.cs

示例6: ExtendUnsignedAttributes

		/// <exception cref="System.IO.IOException"></exception>
        //private IDictionary<DerObjectIdentifier, Asn1Encodable> ExtendUnsignedAttributes(IDictionary
        //    <DerObjectIdentifier, Asn1Encodable> unsignedAttrs, X509Certificate signingCertificate
        //    , DateTime signingDate, CertificateSource optionalCertificateSource)
        private IDictionary ExtendUnsignedAttributes(IDictionary unsignedAttrs
            , X509Certificate signingCertificate, DateTime signingDate
            , CertificateSource optionalCertificateSource)
		{
			ValidationContext validationContext = certificateVerifier.ValidateCertificate(signingCertificate
				, signingDate, optionalCertificateSource, null, null);
			try
			{
				IList<X509CertificateStructure> certificateValues = new AList<X509CertificateStructure
					>();
				AList<CertificateList> crlValues = new AList<CertificateList>();
				AList<BasicOcspResponse> ocspValues = new AList<BasicOcspResponse>();
				foreach (CertificateAndContext c in validationContext.GetNeededCertificates())
				{
					if (!c.Equals(signingCertificate))
					{
                        certificateValues.AddItem(X509CertificateStructure.GetInstance(((Asn1Sequence)Asn1Object.FromByteArray
                            (c.GetCertificate().GetEncoded()))));
					}
				}
				foreach (X509Crl relatedcrl in validationContext.GetNeededCRL())
				{                    
					crlValues.AddItem(CertificateList.GetInstance((Asn1Sequence)Asn1Object.FromByteArray(((X509Crl
						)relatedcrl).GetEncoded())));
				}
				foreach (BasicOcspResp relatedocspresp in validationContext.GetNeededOCSPResp())
				{                    
					ocspValues.AddItem((BasicOcspResponse.GetInstance((Asn1Sequence)Asn1Object.FromByteArray(
						relatedocspresp.GetEncoded()))));
				}
				CertificateList[] crlValuesArray = new CertificateList[crlValues.Count];
				BasicOcspResponse[] ocspValuesArray = new BasicOcspResponse[ocspValues.Count];
				RevocationValues revocationValues = new RevocationValues(Sharpen.Collections.ToArray
					(crlValues, crlValuesArray), Sharpen.Collections.ToArray(ocspValues, ocspValuesArray
					), null);
				//unsignedAttrs.Put(PkcsObjectIdentifiers.IdAAEtsRevocationValues, new Attribute
                unsignedAttrs.Add(PkcsObjectIdentifiers.IdAAEtsRevocationValues, new BcCms.Attribute
					(PkcsObjectIdentifiers.IdAAEtsRevocationValues, new DerSet(revocationValues))
					);
				X509CertificateStructure[] certValuesArray = new X509CertificateStructure[certificateValues
					.Count];
				//unsignedAttrs.Put(PkcsObjectIdentifiers.IdAAEtsCertValues, new Attribute(PkcsObjectIdentifiers.IdAAEtsCertValues, new DerSet(new DerSequence(Sharpen.Collections.ToArray(certificateValues
                unsignedAttrs.Add(PkcsObjectIdentifiers.IdAAEtsCertValues, new BcCms.Attribute(PkcsObjectIdentifiers.IdAAEtsCertValues, new DerSet(new DerSequence(Sharpen.Collections.ToArray(certificateValues
					, certValuesArray)))));
			}
			catch (CertificateEncodingException e)
			{
				throw new RuntimeException(e);
			}
			catch (CrlException e)
			{
				throw new RuntimeException(e);
			}
			return unsignedAttrs;
		}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:59,代码来源:CAdESProfileXL.cs

示例7: GetSignatures

		public override IList<AdvancedSignature> GetSignatures()
		{
			IList<AdvancedSignature> infos = new AList<AdvancedSignature>();
			foreach (object o in this.cmsSignedData.GetSignerInfos().GetSigners())
			{
				SignerInformation i = (SignerInformation)o;
				CAdESSignature info = new CAdESSignature(this.cmsSignedData, i.SignerID);
				infos.AddItem(info);
			}
			return infos;
		}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:11,代码来源:CMSDocumentValidator.cs

示例8: GetAllMatches

 public static string[] GetAllMatches(string input)
 {
     Sharpen.Pattern p = Sharpen.Pattern.Compile("([0-9]*\\.[0-9]+|[0-9]+|[a-zA-Z]+|[^\\w\\s])"
         );
     Matcher m = p.Matcher(input);
     AList<string> matches = new AList<string>();
     while (m.Find())
     {
         matches.AddItem(m.Group());
     }
     string[] matchArr = new string[matches.Count];
     return Sharpen.Collections.ToArray(matches, matchArr);
 }
开发者ID:TotzkePaul,项目名称:JavaToCSharpPortExample,代码行数:13,代码来源:ExpressionTree.cs

示例9: GetQueryById

 public static Query GetQueryById(Database database, string userId)
 {
     View view = database.GetView(ByIdViewName);
     if (view.GetMap() == null)
     {
         Mapper map = new _Mapper_52();
         view.SetMap(map, null);
     }
     Query query = view.CreateQuery();
     IList<object> keys = new AList<object>();
     keys.AddItem(userId);
     query.SetKeys(keys);
     return query;
 }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:14,代码来源:Profile.cs

示例10: Start

 /// <exception cref="Sharpen.SAXException"></exception>
 public bool Start(NBoilerpipeContentHandler instance, string localName, HtmlAttributeCollection atts)
 {
     IList<string> labels = new AList<string> (5);
     labels.AddItem (DefaultLabels.MARKUP_PREFIX + localName);
     string classVal = atts ["class"].Value;
     if (classVal != null && classVal.Length > 0) {
         classVal = PAT_NUM.Matcher (classVal).ReplaceAll ("#");
         classVal = classVal.Trim ();
         string[] vals = classVal.Split ("[ ]+");
         labels.AddItem (DefaultLabels.MARKUP_PREFIX + "." + classVal.Replace (' ', '.'));
         if (vals.Length > 1) {
             foreach (string s in vals) {
                 labels.AddItem (DefaultLabels.MARKUP_PREFIX + "." + s);
             }
         }
     }
     var att = atts["id"];
     var id =  ( atts !=null) ? att.Name : "";
     if (id != null && id.Length > 0) {
         id = PAT_NUM.Matcher (id).ReplaceAll ("#");
         labels.AddItem (DefaultLabels.MARKUP_PREFIX + "#" + id);
     }
     ICollection<string> ancestors = GetAncestorLabels ();
     IList<string> labelsWithAncestors = new AList<string> ((ancestors.Count + 1) * labels
         .Count);
     foreach (string l in labels) {
         foreach (string an in ancestors) {
             labelsWithAncestors.AddItem (an);
             labelsWithAncestors.AddItem (an + " " + l);
         }
         labelsWithAncestors.AddItem (l);
     }
     instance.AddLabelAction (new LabelAction (Sharpen.Collections.ToArray (labelsWithAncestors
         , new string[labelsWithAncestors.Count])));
     labelStack.AddItem (labels);
     return isBlockLevel;
 }
开发者ID:zacg,项目名称:NBoilerpipe,代码行数:38,代码来源:MarkupTagAction.cs

示例11: GetCertificateBySubjectName

 public IList<CertificateAndContext> GetCertificateBySubjectName(X509Name subjectName
     )
 {
     IList<CertificateAndContext> list = new AList<CertificateAndContext>();
     foreach (X509Certificate cert in GetCertificates())
     {
         if (subjectName.Equals(cert.SubjectDN))
         {
             CertificateAndContext cc = new CertificateAndContext(cert);
             cc.SetCertificateSource(sourceType);
             list.AddItem(cc);
         }
     }
     return list;
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:15,代码来源:OfflineCertificateSource.cs

示例12: TestJsonArray

 /// <exception cref="System.Exception"></exception>
 public virtual void TestJsonArray()
 {
     IList<object> array = new AList<object>();
     array.AddItem("01234567890");
     array.AddItem("bar");
     array.AddItem(5);
     array.AddItem(3.5);
     array.AddItem(true);
     array.AddItem(new DateTime().ToString());
     ObjectWriter mapper = new ObjectWriter();
     byte[] json = mapper.WriteValueAsBytes(array);
     JsonDocument jsdoc = new JsonDocument(json);
     NUnit.Framework.Assert.AreEqual(array, jsdoc.JsonObject());
 }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:15,代码来源:JsonDocumentTest.cs

示例13: ExtendSignatures

		/// <exception cref="System.IO.IOException"></exception>
		public virtual Document ExtendSignatures(Document document, Document originalData
			, SignatureParameters parameters)
		{
			try
			{
				CmsSignedData signedData = new CmsSignedData(document.OpenStream());
				SignerInformationStore signerStore = signedData.GetSignerInfos();
				AList<SignerInformation> siArray = new AList<SignerInformation>();				

                foreach (SignerInformation si in signerStore.GetSigners())
                {                    
                    try
                    {
                        //jbonilla - Hack para evitar errores cuando una firma ya ha sido extendida.
                        //Se asume que sólo se extiende las firmas desde BES.
                        //TODO jbonilla - Se debería validar hasta qué punto se extendió (BES, T, C, X, XL).
                        if(si.UnsignedAttributes.Count == 0)
                        {
                            siArray.AddItem(ExtendCMSSignature(signedData, si, parameters, originalData));
                        }
                        else
                        {
                            LOG.Error("Already extended?");
                            siArray.AddItem(si);
                        }                        
                    }
                    catch (IOException)
                    {
                        LOG.Error("Exception when extending signature");
                        siArray.AddItem(si);
                    }
                }
				
				SignerInformationStore newSignerStore = new SignerInformationStore(siArray);
				CmsSignedData extended = CmsSignedData.ReplaceSigners(signedData, newSignerStore);
				return new InMemoryDocument(extended.GetEncoded());
			}
			catch (CmsException)
			{
				throw new IOException("Cannot parse CMS data");
			}
		}
开发者ID:Gianluigi,项目名称:dssnet,代码行数:43,代码来源:CAdESSignatureExtension.cs

示例14: GetRevisionHistory

		public override IList<Couchbase.Lite.SavedRevision> GetRevisionHistory()
		{
			IList<Couchbase.Lite.SavedRevision> revisions = new AList<Couchbase.Lite.SavedRevision
				>();
			IList<RevisionInternal> internalRevisions = GetDatabase().GetRevisionHistory(revisionInternal
				);
			foreach (RevisionInternal internalRevision in internalRevisions)
			{
				if (internalRevision.GetRevId().Equals(GetId()))
				{
					revisions.AddItem(this);
				}
				else
				{
					Couchbase.Lite.SavedRevision revision = document.GetRevisionFromRev(internalRevision
						);
					revisions.AddItem(revision);
				}
			}
			Sharpen.Collections.Reverse(revisions);
			return Sharpen.Collections.UnmodifiableList(revisions);
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:22,代码来源:SavedRevision.cs

示例15: TestServer

		public virtual void TestServer()
		{
			IDictionary<string, object> responseBody = new Dictionary<string, object>();
			responseBody["CBLite"] = "Welcome";
			responseBody["couchdb"] = "Welcome";
			responseBody.Put("version", Couchbase.Lite.Router.Router.GetVersionString());
			Send("GET", "/", Status.Ok, responseBody);
			IDictionary<string, object> session = new Dictionary<string, object>();
			IDictionary<string, object> userCtx = new Dictionary<string, object>();
			IList<string> roles = new AList<string>();
			roles.AddItem("_admin");
			session["ok"] = true;
			userCtx["name"] = null;
			userCtx["roles"] = roles;
			session["userCtx"] = userCtx;
			Send("GET", "/_session", Status.Ok, session);
			IList<string> allDbs = new AList<string>();
			allDbs.AddItem("cblite-test");
			Send("GET", "/_all_dbs", Status.Ok, allDbs);
			Send("GET", "/non-existant", Status.NotFound, null);
			Send("GET", "/BadName", Status.BadRequest, null);
			Send("PUT", "/", Status.BadRequest, null);
			Send("POST", "/", Status.BadRequest, null);
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:24,代码来源:RouterTest.cs


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