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


C# ListValue.Add方法代码示例

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


在下文中一共展示了ListValue.Add方法的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;
        }
开发者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: 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

示例5: 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

示例6: 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

示例7: CanGetDoubleIndex

        public void CanGetDoubleIndex()
        {
            var list = new ListValue();
            list.Add(new StringValue("bar"));
            list.Add(new StringValue("foo"));
            list.Add(new StringValue("fizz"));
            cpu.PushStack(list);

            const double INDEX = 2.5;
            cpu.PushStack(INDEX);

            var opcode = new OpcodeGetIndex();

            opcode.Execute(cpu);

            Assert.AreEqual(3, list.Count());
            Assert.AreEqual(new StringValue("fizz"), cpu.PopStack());
        }
开发者ID:CalebJ2,项目名称:KOS,代码行数:18,代码来源:OpcodeGetIndexText.cs

示例8: CanGetCorrectListIndex

        public void CanGetCorrectListIndex()
        {
            var list = new ListValue();
            list.Add("bar");
            list.Add("foo");
            list.Add("fizz");
            cpu.PushStack(list);

            const int INDEX = 1;
            cpu.PushStack(INDEX);

            var opcode = new OpcodeGetIndex();

            opcode.Execute(cpu);

            Assert.AreEqual(3, list.Count);
            Assert.AreEqual("foo", cpu.PopStack());
        }
开发者ID:Whitecaribou,项目名称:KOS,代码行数:18,代码来源:OpcodeGetIndexText.cs

示例9: 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

示例10: 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)
         {
             var engineModule = module as ModuleEngines;
             if (engineModule != null)
             {
                 toReturn.Add(new EngineValue(part, engineModule));
             }
             var engineModuleFx = module as ModuleEnginesFX;
             if (engineModuleFx != null)
             {
                 toReturn.Add(new EngineValue(part, engineModuleFx));
             }
         }
     }
     return toReturn;
 }
开发者ID:vosechu,项目名称:KOS,代码行数:21,代码来源:EngineValue.cs

示例11: 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

示例12: 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

示例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 dockingNode = module as ModuleDockingNode;
             if (dockingNode != null)
             {
                 toReturn.Add(new DockingPortValue(dockingNode, sharedObj));
             }
         }
     }
     return toReturn;
 }
开发者ID:KSP-KOS,项目名称:KOS,代码行数:16,代码来源:DockingPortValue.cs

示例14: 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

示例15: GetAlarms

        private ListValue GetAlarms()
        {
            var list = new ListValue();

            if (!KACWrapper.APIReady)
            {
                return list;
            }

            //Get the list of alarms from the KAC Object
            KACWrapper.KACAPI.KACAlarmList alarms = KACWrapper.KAC.Alarms;

            foreach (KACWrapper.KACAPI.KACAlarm alarm in alarms)
            {
                list.Add(new KACAlarmWrapper(alarm));
            }
            return list;
        }
开发者ID:Whitecaribou,项目名称:KOS,代码行数:18,代码来源:Addon.cs


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