本文整理汇总了C#中ListValue类的典型用法代码示例。如果您正苦于以下问题:C# ListValue类的具体用法?C# ListValue怎么用?C# ListValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListValue类属于命名空间,在下文中一共展示了ListValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetServoGroups
private ListValue GetServoGroups()
{
var list = new ListValue();
if (!IRWrapper.APIReady)
{
throw new KOSUnavailableAddonException("IR:GROUPS", "Infernal Robotics");
}
var controlGroups = IRWrapper.IRController.ServoGroups;
if (controlGroups == null)
{
//Control Groups are somehow null, just return the empty list
return list;
}
foreach (IRWrapper.IControlGroup cg in controlGroups)
{
if (cg.Vessel == null || cg.Vessel == shared.Vessel)
list.Add(new IRControlGroupWrapper(cg, shared));
}
return list;
}
开发者ID:CalebJ2,项目名称:KOS,代码行数:25,代码来源:Addon.cs
示例2: GetAllServos
private ListValue GetAllServos()
{
var list = new ListValue();
if (!IRWrapper.APIReady)
{
throw new KOSUnavailableAddonException("IR:ALLSERVOS", "Infernal Robotics");
}
var controlGroups = IRWrapper.IRController.ServoGroups;
if (controlGroups == null)
{
//Control Groups are somehow null, just return the empty list
return list;
}
foreach (IRWrapper.IControlGroup cg in controlGroups)
{
if (cg.Servos == null || (cg.Vessel!=null && cg.Vessel != shared.Vessel))
continue;
foreach (IRWrapper.IServo s in cg.Servos)
{
list.Add (new IRServoWrapper (s, shared));
}
}
return list;
}
开发者ID:CalebJ2,项目名称:KOS,代码行数:30,代码来源:Addon.cs
示例3: GetSuffix
public override object GetSuffix(string suffixName)
{
switch (suffixName)
{
case "NAME":
return Part.name;
case "STAGE":
return Part.inverseStage;
case "UID":
return Part.uid;
case "RESOURCES":
var resources = new ListValue();
foreach (PartResource resource in Part.Resources)
{
resources.Add(new ResourceValue(resource));
}
return resources;
case "MODULES":
var modules = new ListValue();
foreach (var module in Part.Modules)
{
modules.Add(module.GetType());
}
return modules;
case "TARGETABLE":
return Part.Modules.OfType<ITargetable>().Any();
case "SHIP":
return new VesselTarget(Part.vessel);
}
return base.GetSuffix(suffixName);
}
开发者ID:WazWaz,项目名称:KOS,代码行数:31,代码来源:PartValue.cs
示例4: CopyIsACopy
public void CopyIsACopy()
{
var list = new ListValue();
var zedObject = new object();
InvokeDelegate(list, "ADD", zedObject);
var firstObject = new object();
InvokeDelegate(list, "ADD", firstObject);
var secondObject = new object();
InvokeDelegate(list, "ADD", secondObject);
var thirdObject = new object();
InvokeDelegate(list, "ADD", thirdObject);
var length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(4,length);
var copy = InvokeDelegate(list, "COPY") as ListValue;
Assert.AreNotSame(list, copy);
var copyLength = InvokeDelegate(copy, "LENGTH");
Assert.AreEqual(4,copyLength);
InvokeDelegate(copy, "CLEAR");
copyLength = InvokeDelegate(copy, "LENGTH");
Assert.AreEqual(0,copyLength);
length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(4,length);
}
开发者ID:Whitecaribou,项目名称:KOS,代码行数:30,代码来源:ListValueTest.cs
示例5: Execute
public override void Execute(SharedObjects shared)
{
var list = new ListValue();
string alarmTypes = PopValueAssert(shared).ToString();
AssertArgBottomAndConsume(shared);
if (!KACWrapper.APIReady)
{
ReturnValue = list;
throw new KOSUnavailableAddonException("listAlarms()", "Kerbal Alarm Clock");
}
//Get the list of alarms from the KAC Object
KACWrapper.KACAPI.KACAlarmList alarms = KACWrapper.KAC.Alarms;
foreach (KACWrapper.KACAPI.KACAlarm alarm in alarms)
{
// if its not my alarm or a general alarm, ignore it
if (!string.IsNullOrEmpty(alarm.VesselID) && alarm.VesselID != shared.Vessel.id.ToString())
{
continue;
}
if (alarmTypes.ToUpperInvariant() == "ALL" || alarm.AlarmTime.ToString() == alarmTypes)
list.Add(new KACAlarmWrapper(alarm));
}
ReturnValue = list;
}
开发者ID:Whitecaribou,项目名称:KOS,代码行数:29,代码来源:KACFunctions.cs
示例6: CanGetIndex
public void CanGetIndex()
{
var list = new ListValue();
var zedObject = ScalarIntValue.Zero;
InvokeDelegate(list, "ADD", zedObject);
var firstObject = ScalarIntValue.One;
InvokeDelegate(list, "ADD", firstObject);
var secondObject = ScalarIntValue.Two;
InvokeDelegate(list, "ADD", secondObject);
var thirdObject = new ScalarIntValue(4);
InvokeDelegate(list, "ADD", thirdObject);
var length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(new ScalarIntValue(4),length);
Assert.AreSame(zedObject, list[0]);
Assert.AreSame(firstObject, list[1]);
Assert.AreSame(secondObject, list[2]);
Assert.AreSame(thirdObject, list[3]);
Assert.AreNotSame(list[0], list[1]);
Assert.AreNotSame(list[0], list[2]);
Assert.AreNotSame(list[0], list[3]);
Assert.AreNotSame(list[1], list[2]);
Assert.AreNotSame(list[1], list[3]);
Assert.AreNotSame(list[2], list[3]);
}
开发者ID:CalebJ2,项目名称:KOS,代码行数:27,代码来源:ListValueTest.cs
示例7: PartsToList
public static ListValue PartsToList(IEnumerable<global::Part> parts)
{
var toReturn = new ListValue();
foreach (var part in parts)
{
toReturn.Add(new PartValue(part));
}
return toReturn;
}
开发者ID:WazWaz,项目名称:KOS,代码行数:9,代码来源:PartValue.cs
示例8: BuildPatchList
private object BuildPatchList()
{
var list = new ListValue();
var orbit = orbitRef;
while (orbit.nextPatch != null && list.Count >= PATCHES_LIMIT)
{
list.Add(new OrbitInfo(orbit, vesselRef));
}
return list;
}
开发者ID:jwvanderbeck,项目名称:KOS_old,代码行数:10,代码来源:Orbit.cs
示例9: CanAddItem
public void CanAddItem()
{
var list = new ListValue();
Assert.IsNotNull(list);
var length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(0,length);
InvokeDelegate(list, "ADD", new object());
length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(1,length);
}
开发者ID:Whitecaribou,项目名称:KOS,代码行数:12,代码来源:ListValueTest.cs
示例10: CanAddItem
public void CanAddItem()
{
var list = new ListValue();
Assert.IsNotNull(list);
var length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(ScalarIntValue.Zero, length);
InvokeDelegate(list, "ADD", ScalarIntValue.Zero);
length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(ScalarIntValue.One, length);
}
开发者ID:CalebJ2,项目名称:KOS,代码行数:12,代码来源:ListValueTest.cs
示例11: CanClear
public void CanClear()
{
var list = new ListValue();
InvokeDelegate(list, "ADD", ScalarIntValue.Zero);
InvokeDelegate(list, "ADD", ScalarIntValue.Zero);
var length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(ScalarIntValue.Two,length);
InvokeDelegate(list, "CLEAR");
length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(ScalarIntValue.Zero,length);
}
开发者ID:CalebJ2,项目名称:KOS,代码行数:13,代码来源:ListValueTest.cs
示例12: CanClear
public void CanClear()
{
var list = new ListValue();
InvokeDelegate(list, "ADD", new object());
InvokeDelegate(list, "ADD", new object());
var length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(2,length);
InvokeDelegate(list, "CLEAR");
length = InvokeDelegate(list, "LENGTH");
Assert.AreEqual(0,length);
}
开发者ID:Whitecaribou,项目名称:KOS,代码行数:13,代码来源:ListValueTest.cs
示例13: PartsToList
public static ListValue PartsToList(IEnumerable<global::Part> parts, SharedObjects sharedObj)
{
var toReturn = new ListValue();
foreach (var part in parts)
{
foreach (PartModule module in part.Modules)
{
var sensor = module as ModuleEnviroSensor;
if (sensor == null) continue;
toReturn.Add(new SensorValue(part, sensor, sharedObj));
}
}
return toReturn;
}
开发者ID:KSP-KOS,项目名称:KOS,代码行数:14,代码来源:SensorValue.cs
示例14: addItem
public void addItem(string text, string value)
{
try
{
if(!this._list.ContainsKey(text)) {
ListValue d = new ListValue();
d.text = text;
d.value = value;
this._list.Add(text, d);
this._list2.Add(value, d);
this.Items.Add(text);
}
}
catch { }
}
开发者ID:andrewjc,项目名称:sqlconsole,代码行数:15,代码来源:AODropDown.cs
示例15: PartsToList
public static ListValue PartsToList(IEnumerable<global::Part> parts, SharedObjects sharedObj)
{
var toReturn = new ListValue();
foreach (var part in parts)
{
foreach (PartModule module in part.Modules)
{
var engines = module as ModuleEngines;
if (engines != null)
{
toReturn.Add(new EngineValue(part, new ModuleEngineAdapter(engines), sharedObj));
}
}
}
return toReturn;
}
开发者ID:Whitecaribou,项目名称:KOS,代码行数:16,代码来源:EngineValue.cs
示例16: CanGetListIndex
public void CanGetListIndex()
{
var list = new ListValue();
list.Add("bar");
cpu.PushStack(list);
const int INDEX = 0;
cpu.PushStack(INDEX);
var opcode = new OpcodeGetIndex();
opcode.Execute(cpu);
Assert.AreEqual(1, list.Count);
Assert.AreEqual("bar", cpu.PopStack());
}
开发者ID:Whitecaribou,项目名称:KOS,代码行数:16,代码来源:OpcodeGetIndexText.cs
示例17: PartsToList
public static ListValue PartsToList(IEnumerable<global::Part> parts, SharedObjects sharedObj)
{
var toReturn = new ListValue();
foreach (var part in parts)
{
foreach (PartModule module in part.Modules)
{
var dockingNode = module as ModuleDockingNode;
if (dockingNode != null)
{
toReturn.Add(new DockingPortValue(dockingNode, sharedObj));
}
}
}
return toReturn;
}
开发者ID:KSP-KOS,项目名称:KOS,代码行数:16,代码来源:DockingPortValue.cs
示例18: CanSerializeLists
public void CanSerializeLists()
{
var list = new ListValue();
var nested = new ListValue();
list.Add(new StringValue("item1"));
list.Add(new ScalarIntValue(2));
list.Add(nested);
nested.Add(new StringValue("nested1"));
ListValue deserialized = Deserialize(Serialize(list)) as ListValue;
Assert.AreEqual(new StringValue("item1"), deserialized[0]);
Assert.AreEqual(new ScalarIntValue(2), deserialized[1]);
Assert.IsTrue(deserialized[2] is ListValue);
}
开发者ID:CalebJ2,项目名称:KOS,代码行数:17,代码来源:JSONFormatterTest.cs
示例19: CanShallowPrintListInLexicon
public void CanShallowPrintListInLexicon()
{
var list = new ListValue();
list.Add("First In List");
list.Add("Second In List");
list.Add("Last In List");
var lexicon = new Lexicon<object, object>();
lexicon.Add("list", list);
lexicon.Add("not list", 2);
var result = lexicon.ToString();
Assert.IsTrue(result.Contains("LEXICON of 2 items"));
Assert.IsTrue(result.Contains(" [\"list\"]= LIST of 3 items"));
Assert.IsFalse(result.Contains("Last In List"));
}
开发者ID:Whitecaribou,项目名称:KOS,代码行数:17,代码来源:MixedCollectionPrintingTest.cs
示例20: PartsToList
public static new ListValue PartsToList(IEnumerable<global::Part> parts)
{
var toReturn = new ListValue();
foreach (var part in parts)
{
foreach (PartModule module in part.Modules)
{
UnityEngine.Debug.Log("Module Found: "+ module);
var dockingNode = module as ModuleDockingNode;
if (dockingNode != null)
{
toReturn.Add(new DockingPortValue(dockingNode));
}
}
}
return toReturn;
}
开发者ID:WazWaz,项目名称:KOS,代码行数:17,代码来源:DockingPortValue.cs
注:本文中的ListValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论