本文整理汇总了C#中AList.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# AList.Remove方法的具体用法?C# AList.Remove怎么用?C# AList.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AList
的用法示例。
在下文中一共展示了AList.Remove方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
示例2: 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"));
}
示例3: AssignStructure
//.........这里部分代码省略.........
for (int i = 0; i < count; i++)
{
Variant v = arrayni.mItems[i];
if (v.IsObject())
{
// object
Dispatch2 dsp1 = v.AsObject();
// determin dsp's object type
//DictionaryNI dicni = null;
//ArrayNI arrayni1 = null;
if (dsp1 != null && dsp1.GetNativeInstance(DictionaryClass.ClassID) != null)
{
//dicni = (DictionaryNI)ni.mValue;
// dictionary
bool objrec = false;
int scount = stack.Count;
for (int j = 0; j < scount; j++)
{
Dispatch2 d = stack[j];
if (d == dsp1)
{
// object recursion detected
objrec = true;
break;
}
}
if (objrec)
{
mItems.AddItem(new Variant());
}
else
{
// becomes null
Dispatch2 newobj = TJS.CreateDictionaryObject();
mItems.AddItem(new Variant(newobj, newobj));
DictionaryNI newni;
if ((newni = (DictionaryNI)newobj.GetNativeInstance(DictionaryClass.ClassID)) !=
null)
{
newni.AssignStructure(dsp1, stack);
}
}
}
else
{
if (dsp1 != null && dsp1.GetNativeInstance(ArrayClass.ClassID) != null)
{
// array
bool objrec = false;
int scount = stack.Count;
for (int j = 0; j < scount; j++)
{
Dispatch2 d = stack[j];
if (d == dsp1)
{
// object recursion detected
objrec = true;
break;
}
}
if (objrec)
{
mItems.AddItem(new Variant());
}
else
{
// becomes null
Dispatch2 newobj = TJS.CreateArrayObject();
mItems.AddItem(new Variant(newobj, newobj));
ArrayNI newni;
if ((newni = (ArrayNI)newobj.GetNativeInstance(ArrayClass.ClassID)) != null)
{
newni.AssignStructure(dsp1, stack);
}
}
}
else
{
// other object types
mItems.AddItem(v);
}
}
}
else
{
// others
mItems.AddItem(v);
}
}
}
finally
{
stack.Remove(stack.Count - 1);
}
}
else
{
throw new TJSException(Error.SpecifyDicOrArray);
}
}
示例4: TestDocs
public virtual void TestDocs()
{
Send("PUT", "/db", Status.Created, null);
// PUT:
IDictionary<string, object> doc1 = new Dictionary<string, object>();
doc1["message"] = "hello";
IDictionary<string, object> result = (IDictionary<string, object>)SendBody("PUT",
"/db/doc1", doc1, Status.Created, null);
string revID = (string)result["rev"];
NUnit.Framework.Assert.IsTrue(revID.StartsWith("1-"));
// PUT to update:
doc1["message"] = "goodbye";
doc1["_rev"] = revID;
result = (IDictionary<string, object>)SendBody("PUT", "/db/doc1", doc1, Status.Created
, null);
Log.V(Tag, string.Format("PUT returned %s", result));
revID = (string)result["rev"];
NUnit.Framework.Assert.IsTrue(revID.StartsWith("2-"));
doc1["_id"] = "doc1";
doc1["_rev"] = revID;
result = (IDictionary<string, object>)Send("GET", "/db/doc1", Status.Ok, doc1);
// Add more docs:
IDictionary<string, object> docX = new Dictionary<string, object>();
docX["message"] = "hello";
result = (IDictionary<string, object>)SendBody("PUT", "/db/doc3", docX, Status.Created
, null);
string revID3 = (string)result["rev"];
result = (IDictionary<string, object>)SendBody("PUT", "/db/doc2", docX, Status.Created
, null);
string revID2 = (string)result["rev"];
// _all_docs:
result = (IDictionary<string, object>)Send("GET", "/db/_all_docs", Status.Ok, null
);
NUnit.Framework.Assert.AreEqual(3, result["total_rows"]);
NUnit.Framework.Assert.AreEqual(0, result["offset"]);
IDictionary<string, object> value1 = ValueMapWithRev(revID);
IDictionary<string, object> value2 = ValueMapWithRev(revID2);
IDictionary<string, object> value3 = ValueMapWithRev(revID3);
IDictionary<string, object> row1 = new Dictionary<string, object>();
row1["id"] = "doc1";
row1["key"] = "doc1";
row1["value"] = value1;
IDictionary<string, object> row2 = new Dictionary<string, object>();
row2["id"] = "doc2";
row2["key"] = "doc2";
row2["value"] = value2;
IDictionary<string, object> row3 = new Dictionary<string, object>();
row3["id"] = "doc3";
row3["key"] = "doc3";
row3["value"] = value3;
IList<IDictionary<string, object>> expectedRows = new AList<IDictionary<string, object
>>();
expectedRows.AddItem(row1);
expectedRows.AddItem(row2);
expectedRows.AddItem(row3);
IList<IDictionary<string, object>> rows = (IList<IDictionary<string, object>>)result
["rows"];
NUnit.Framework.Assert.AreEqual(expectedRows, rows);
// DELETE:
result = (IDictionary<string, object>)Send("DELETE", string.Format("/db/doc1?rev=%s"
, revID), Status.Ok, null);
revID = (string)result["rev"];
NUnit.Framework.Assert.IsTrue(revID.StartsWith("3-"));
Send("GET", "/db/doc1", Status.NotFound, null);
// _changes:
IList<object> changes1 = new AList<object>();
changes1.AddItem(ValueMapWithRevNoConflictArray(revID));
IList<object> changes2 = new AList<object>();
changes2.AddItem(ValueMapWithRevNoConflictArray(revID2));
IList<object> changes3 = new AList<object>();
changes3.AddItem(ValueMapWithRevNoConflictArray(revID3));
IDictionary<string, object> result1 = new Dictionary<string, object>();
result1["id"] = "doc1";
result1["seq"] = 5;
result1["deleted"] = true;
result1["changes"] = changes1;
IDictionary<string, object> result2 = new Dictionary<string, object>();
result2["id"] = "doc2";
result2["seq"] = 4;
result2["changes"] = changes2;
IDictionary<string, object> result3 = new Dictionary<string, object>();
result3["id"] = "doc3";
result3["seq"] = 3;
result3["changes"] = changes3;
IList<object> results = new AList<object>();
results.AddItem(result3);
results.AddItem(result2);
results.AddItem(result1);
IDictionary<string, object> expectedChanges = new Dictionary<string, object>();
expectedChanges["last_seq"] = 5;
expectedChanges["results"] = results;
Send("GET", "/db/_changes", Status.Ok, expectedChanges);
// _changes with ?since:
results.Remove(result3);
results.Remove(result2);
expectedChanges["results"] = results;
Send("GET", "/db/_changes?since=4", Status.Ok, expectedChanges);
results.Remove(result1);
expectedChanges["results"] = results;
Send("GET", "/db/_changes?since=5", Status.Ok, expectedChanges);
//.........这里部分代码省略.........
示例5: TestDatabase
public virtual void TestDatabase()
{
Send("PUT", "/database", Status.Created, null);
IDictionary entries = new Dictionary<string, IDictionary<string, object>>();
entries.Put("results", new AList<object>());
entries.Put("last_seq", 0);
Send("GET", "/database/_changes?feed=normal&heartbeat=300000&style=all_docs", Status
.Ok, entries);
IDictionary<string, object> dbInfo = (IDictionary<string, object>)Send("GET", "/database"
, Status.Ok, null);
NUnit.Framework.Assert.AreEqual(6, dbInfo.Count);
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);
NUnit.Framework.Assert.AreEqual("database", dbInfo.Get("db_name"));
NUnit.Framework.Assert.IsTrue(Runtime.CurrentTimeMillis() * 1000 > (long)dbInfo.Get
("instance_start_time"));
NUnit.Framework.Assert.IsTrue(dbInfo.ContainsKey("db_uuid"));
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"));
}
示例6: TestDocs
public virtual void TestDocs()
{
Send("PUT", "/db", Status.Created, null);
// PUT:
IDictionary<string, object> doc1 = new Dictionary<string, object>();
doc1.Put("message", "hello");
IDictionary<string, object> result = (IDictionary<string, object>)SendBody("PUT",
"/db/doc1", doc1, Status.Created, null);
string revID = (string)result.Get("rev");
NUnit.Framework.Assert.IsTrue(revID.StartsWith("1-"));
// PUT to update:
doc1.Put("message", "goodbye");
doc1.Put("_rev", revID);
result = (IDictionary<string, object>)SendBody("PUT", "/db/doc1", doc1, Status.Created
, null);
Log.V(Tag, string.Format("PUT returned %s", result));
revID = (string)result.Get("rev");
NUnit.Framework.Assert.IsTrue(revID.StartsWith("2-"));
doc1.Put("_id", "doc1");
doc1.Put("_rev", revID);
result = (IDictionary<string, object>)Send("GET", "/db/doc1", Status.Ok, doc1);
// Add more docs:
IDictionary<string, object> docX = new Dictionary<string, object>();
docX.Put("message", "hello");
result = (IDictionary<string, object>)SendBody("PUT", "/db/doc3", docX, Status.Created
, null);
string revID3 = (string)result.Get("rev");
result = (IDictionary<string, object>)SendBody("PUT", "/db/doc2", docX, Status.Created
, null);
string revID2 = (string)result.Get("rev");
// _all_docs:
result = (IDictionary<string, object>)Send("GET", "/db/_all_docs", Status.Ok, null
);
NUnit.Framework.Assert.AreEqual(3, result.Get("total_rows"));
NUnit.Framework.Assert.AreEqual(0, result.Get("offset"));
IDictionary<string, object> value1 = ValueMapWithRev(revID);
IDictionary<string, object> value2 = ValueMapWithRev(revID2);
IDictionary<string, object> value3 = ValueMapWithRev(revID3);
IDictionary<string, object> row1 = new Dictionary<string, object>();
row1.Put("id", "doc1");
row1.Put("key", "doc1");
row1.Put("value", value1);
IDictionary<string, object> row2 = new Dictionary<string, object>();
row2.Put("id", "doc2");
row2.Put("key", "doc2");
row2.Put("value", value2);
IDictionary<string, object> row3 = new Dictionary<string, object>();
row3.Put("id", "doc3");
row3.Put("key", "doc3");
row3.Put("value", value3);
IList<IDictionary<string, object>> expectedRows = new AList<IDictionary<string, object
>>();
expectedRows.AddItem(row1);
expectedRows.AddItem(row2);
expectedRows.AddItem(row3);
IList<IDictionary<string, object>> rows = (IList<IDictionary<string, object>>)result
.Get("rows");
NUnit.Framework.Assert.AreEqual(expectedRows, rows);
// DELETE:
result = (IDictionary<string, object>)Send("DELETE", string.Format("/db/doc1?rev=%s"
, revID), Status.Ok, null);
revID = (string)result.Get("rev");
NUnit.Framework.Assert.IsTrue(revID.StartsWith("3-"));
Send("GET", "/db/doc1", Status.NotFound, null);
// _changes:
IList<object> changes1 = new AList<object>();
changes1.AddItem(ValueMapWithRevNoConflictArray(revID));
IList<object> changes2 = new AList<object>();
changes2.AddItem(ValueMapWithRevNoConflictArray(revID2));
IList<object> changes3 = new AList<object>();
changes3.AddItem(ValueMapWithRevNoConflictArray(revID3));
IDictionary<string, object> result1 = new Dictionary<string, object>();
result1.Put("id", "doc1");
result1.Put("seq", 5);
result1.Put("deleted", true);
result1.Put("changes", changes1);
IDictionary<string, object> result2 = new Dictionary<string, object>();
result2.Put("id", "doc2");
result2.Put("seq", 4);
result2.Put("changes", changes2);
IDictionary<string, object> result3 = new Dictionary<string, object>();
result3.Put("id", "doc3");
result3.Put("seq", 3);
result3.Put("changes", changes3);
IList<object> results = new AList<object>();
results.AddItem(result3);
results.AddItem(result2);
results.AddItem(result1);
IDictionary<string, object> expectedChanges = new Dictionary<string, object>();
expectedChanges.Put("last_seq", 5);
expectedChanges.Put("results", results);
Send("GET", "/db/_changes", Status.Ok, expectedChanges);
// _changes with ?since:
results.Remove(result3);
results.Remove(result2);
expectedChanges.Put("results", results);
Send("GET", "/db/_changes?since=4", Status.Ok, expectedChanges);
results.Remove(result1);
expectedChanges.Put("results", results);
Send("GET", "/db/_changes?since=5", Status.Ok, expectedChanges);
//.........这里部分代码省略.........
示例7: Main
/// <summary>An application entry point.</summary>
/// <remarks>
/// An application entry point. Takes the name of one or more files as arguments and prints the contents of all
/// metadata directories to <code>System.out</code>.
/// <p/>
/// If <code>-thumb</code> is passed, then any thumbnail data will be written to a file with name of the
/// input file having <code>.thumb.jpg</code> appended.
/// <p/>
/// If <code>-wiki</code> is passed, then output will be in a format suitable for Google Code's wiki.
/// <p/>
/// If <code>-hex</code> is passed, then the ID of each tag will be displayed in hexadecimal.
/// </remarks>
/// <param name="args">the command line arguments</param>
/// <exception cref="Com.Drew.Metadata.MetadataException"/>
/// <exception cref="System.IO.IOException"/>
public static void Main(string[] args)
{
ICollection<string> argList = new AList<string>(Arrays.AsList(args));
bool thumbRequested = argList.Remove("-thumb");
bool wikiFormat = argList.Remove("-wiki");
bool showHex = argList.Remove("-hex");
if (argList.Count < 1)
{
string version = typeof(Com.Drew.Imaging.ImageMetadataReader).Assembly.GetImplementationVersion();
System.Console.Out.Println("metadata-extractor version " + version);
System.Console.Out.Println();
System.Console.Out.Println(Sharpen.Extensions.StringFormat("Usage: java -jar metadata-extractor-%s.jar <filename> [<filename>] [-thumb] [-wiki] [-hex]", version == null ? "a.b.c" : version));
System.Environment.Exit(1);
}
foreach (string filePath in argList)
{
long startTime = Runtime.NanoTime();
FilePath file = new FilePath(filePath);
if (!wikiFormat && argList.Count > 1)
{
System.Console.Out.Printf("\n***** PROCESSING: %s\n%n", filePath);
}
Com.Drew.Metadata.Metadata metadata = null;
try
{
metadata = Com.Drew.Imaging.ImageMetadataReader.ReadMetadata(file);
}
catch (Exception e)
{
Sharpen.Runtime.PrintStackTrace(e, System.Console.Error);
System.Environment.Exit(1);
}
long took = Runtime.NanoTime() - startTime;
if (!wikiFormat)
{
System.Console.Out.Printf("Processed %.3f MB file in %.2f ms%n%n", file.Length() / (1024d * 1024), took / 1000000d);
}
if (wikiFormat)
{
string fileName = file.GetName();
string urlName = StringUtil.UrlEncode(fileName);
ExifIFD0Directory exifIFD0Directory = metadata.GetDirectory<ExifIFD0Directory>();
string make = exifIFD0Directory == null ? string.Empty : StringUtil.EscapeForWiki(exifIFD0Directory.GetString(ExifIFD0Directory.TagMake));
string model = exifIFD0Directory == null ? string.Empty : StringUtil.EscapeForWiki(exifIFD0Directory.GetString(ExifIFD0Directory.TagModel));
System.Console.Out.Println();
System.Console.Out.Println("-----");
System.Console.Out.Println();
System.Console.Out.Printf("= %s - %s =%n", make, model);
System.Console.Out.Println();
System.Console.Out.Printf("<a href=\"http://sample-images.metadata-extractor.googlecode.com/git/%s\">%n", urlName);
System.Console.Out.Printf("<img src=\"http://sample-images.metadata-extractor.googlecode.com/git/%s\" width=\"300\"/><br/>%n", urlName);
System.Console.Out.Println(StringUtil.EscapeForWiki(fileName));
System.Console.Out.Println("</a>");
System.Console.Out.Println();
System.Console.Out.Println("|| *Directory* || *Tag Id* || *Tag Name* || *Extracted Value* ||");
}
// iterate over the metadata and print to System.out
foreach (Com.Drew.Metadata.Directory directory in metadata.GetDirectories())
{
string directoryName = directory.GetName();
foreach (Tag tag in directory.GetTags())
{
string tagName = tag.GetTagName();
string description = tag.GetDescription();
// truncate the description if it's too long
if (description != null && description.Length > 1024)
{
description = Sharpen.Runtime.Substring(description, 0, 1024) + "...";
}
if (wikiFormat)
{
System.Console.Out.Printf("||%s||0x%s||%s||%s||%n", StringUtil.EscapeForWiki(directoryName), Sharpen.Extensions.ToHexString(tag.GetTagType()), StringUtil.EscapeForWiki(tagName), StringUtil.EscapeForWiki(description));
}
else
{
if (showHex)
{
System.Console.Out.Printf("[%s - %s] %s = %s%n", directoryName, tag.GetTagTypeHex(), tagName, description);
}
else
{
System.Console.Out.Printf("[%s] %s = %s%n", directoryName, tagName, description);
}
}
}
//.........这里部分代码省略.........
示例8: AssignStructure
/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
public virtual void AssignStructure(Dispatch2 dsp, AList<Dispatch2> stack)
{
// assign structured data from dsp
//ArrayNI dicni = null;
if (dsp.GetNativeInstance(DictionaryClass.ClassID) != null)
{
// copy from dictionary
stack.AddItem(dsp);
try
{
CustomObject owner = mOwner.Get();
owner.Clear();
DictionaryNI.AssignStructCallback callback = new DictionaryNI.AssignStructCallback
(stack, owner);
dsp.EnumMembers(Interface.IGNOREPROP, callback, dsp);
}
finally
{
stack.Remove(stack.Count - 1);
}
}
else
{
throw new TJSException(Error.SpecifyDicOrArray);
}
}