本文整理汇总了C#中ListValue类的典型用法代码示例。如果您正苦于以下问题:C# ListValue类的具体用法?C# ListValue怎么用?C# ListValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListValue类属于命名空间,在下文中一共展示了ListValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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]);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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 { }
}
示例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;
}