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


C# ListValue类代码示例

本文整理汇总了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;
        }
开发者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


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