Example #1
0
        private kList GetEngineList(SharedObjects shared)
        {
            kList list = new kList();

            list.AddColumn("ID", 12, ColumnAlignment.Left);
            list.AddColumn("Stage", 8, ColumnAlignment.Left);
            list.AddColumn("Name", 28, ColumnAlignment.Left);

            foreach (Part part in VesselUtils.GetListOfActivatedEngines(shared.Vessel))
            {
                foreach (PartModule module in part.Modules)
                {
                    var engineMod = module as ModuleEngines;
                    if (engineMod != null)
                    {
                        list.AddItem(part.uid, part.inverseStage, engineMod.moduleName);
                    }

                    var engineModFx = module as ModuleEnginesFX;
                    if (engineModFx != null)
                    {
                        list.AddItem(part.uid, part.inverseStage, engineModFx.moduleName);
                    }
                }
            }

            return(list);
        }
Example #2
0
        private kList GetFileList(Safe.SafeSharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("Name", 30, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            list.Title = shared.VolumeMgr.CurrentDirectory.Path.ToString();

            IOrderedEnumerable <VolumeItem> items = shared.VolumeMgr.CurrentDirectory.ListAsLexicon().Values.Cast <VolumeItem>().OrderBy(i => i.Name);

            foreach (VolumeDirectory info in items.OfType <VolumeDirectory>())
            {
                list.AddItem(info.Name, "<DIR>");
            }

            foreach (VolumeFile info in items.OfType <VolumeFile>())
            {
                list.AddItem(info.Name, info.Size);
            }

            long freeSpace = shared.VolumeMgr.CurrentVolume.FreeSpace;

            list.Footer = "Free space remaining: " + (freeSpace != Volume.INFINITE_CAPACITY ? freeSpace.ToString() : " infinite");

            return(list);
        }
Example #3
0
        private kList GetVolumeList(Safe.SharedObjects shared)
        {
            var list = new kList {
                Title = "Volumes"
            };

            list.AddColumn("ID", 6, ColumnAlignment.Left);
            list.AddColumn("Name", 24, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr == null)
            {
                return(list);
            }

            foreach (KeyValuePair <int, Volume> kvp in shared.VolumeMgr.Volumes)
            {
                Volume volume = kvp.Value;
                string id     = kvp.Key.ToString() + (shared.VolumeMgr.VolumeIsCurrent(volume) ? "*" : "");
                string size   = volume.Capacity.ToString();
                list.AddItem(id, volume.Name, size);
            }

            return(list);
        }
Example #4
0
        private kList GetFileList(Safe.SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("Name", 30, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr != null)
            {
                Volume volume = shared.VolumeMgr.CurrentVolume;
                if (volume != null)
                {
                    list.Title = "Volume " + shared.VolumeMgr.GetVolumeBestIdentifier(volume);

                    foreach (KeyValuePair <string, VolumeFile> pair in volume.FileList)
                    {
                        list.AddItem(pair.Key, pair.Value.Size);
                    }

                    long freeSpace = volume.FreeSpace;
                    list.Footer = "Free space remaining: " + (freeSpace != Volume.INFINITE_CAPACITY ? freeSpace.ToString() : " infinite");
                }
            }

            return(list);
        }
Example #5
0
        private kList GetFileList(Safe.SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("Name", 30, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr != null)
            {
                Volume volume = shared.VolumeMgr.CurrentVolume;
                if (volume != null)
                {
                    list.Title = "Volume " + shared.VolumeMgr.GetVolumeBestIdentifier(volume);

                    foreach (FileInfo info in volume.GetFileList())
                    {
                        list.AddItem(info.Name, info.Size);
                    }

                    int freeSpace = volume.GetFreeSpace();
                    list.Footer = "Free space remaining: " + (freeSpace > -1 ? freeSpace.ToString() : " infinite");
                }
            }

            return(list);
        }
Example #6
0
        private kList GetBodyList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("Name", 15, ColumnAlignment.Left);
            list.AddColumn("Distance", 22, ColumnAlignment.Right, "0");

            foreach (var body in FlightGlobals.fetch.bodies)
            {
                list.AddItem(body.bodyName, Vector3d.Distance(body.position, shared.Vessel.GetWorldPos3D()));
            }

            return list;
        }
Example #7
0
        private kList GetFontList()
        {
            var list = new kList();

            list.AddColumn("Font Name", 15, ColumnAlignment.Left);

            foreach (Font f in Resources.FindObjectsOfTypeAll <Font>())
            {
                list.AddItem(f.name);
            }

            return(list);
        }
Example #8
0
        private kList GetBodyList(SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("Name", 15, ColumnAlignment.Left);
            list.AddColumn("Distance", 22, ColumnAlignment.Right, "0");

            foreach (var body in FlightGlobals.fetch.bodies)
            {
                list.AddItem(body.bodyName, Vector3d.Distance(body.position, shared.Vessel.findWorldCenterOfMass()));
            }

            return(list);
        }
Example #9
0
        private kList GetPartList(SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("ID", 28, ColumnAlignment.Left);
            list.AddColumn("Name", 20, ColumnAlignment.Left);

            foreach (Part part in shared.Vessel.Parts)
            {
                list.AddItem(part.ConstructID(), part.partInfo.name);
            }

            return(list);
        }
Example #10
0
        private kList GetConfigList(SharedObjects shared)
        {
            kList list = new kList();

            list.AddColumn("", 5, ColumnAlignment.Left);
            list.AddColumn("Name", 30, ColumnAlignment.Left);
            list.AddColumn("Value", 10, ColumnAlignment.Left);

            foreach (ConfigKey key in Config.GetInstance().GetConfigKeys())
            {
                list.AddItem(key.Alias, key.Name, key.Value);
            }

            return(list);
        }
Example #11
0
        private kList GetConfigList()
        {
            var list = new kList();

            list.AddColumn("", 9, ColumnAlignment.Left);
            list.AddColumn("Name", 34, ColumnAlignment.Left);
            list.AddColumn("Value", 6, ColumnAlignment.Left);

            foreach (ConfigKey key in Config.Instance.GetConfigKeys())
            {
                list.AddItem(key.Alias, key.Name, key.Value);
            }

            return(list);
        }
Example #12
0
        private kList GetEngineList(SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("ID", 12, ColumnAlignment.Left);
            list.AddColumn("Stage", 8, ColumnAlignment.Left);
            list.AddColumn("Name", 28, ColumnAlignment.Left);

            ListValue partList = EngineValue.PartsToList(shared.Vessel.Parts, shared);

            foreach (Structure structure in partList)
            {
                var part = (PartValue)structure;
                list.AddItem(part.Part.uid(), part.Part.inverseStage, part.Part.partInfo.name);
            }

            return(list);
        }
Example #13
0
        private kList GetTargetList(SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("Vessel Name", 25, ColumnAlignment.Left);
            list.AddColumn("Distance", 12, ColumnAlignment.Right, "0.0");

            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (vessel != shared.Vessel)
                {
                    var vT = new VesselTarget(vessel, shared);
                    list.AddItem(vT.Vessel.vesselName, vT.GetDistance());
                }
            }

            return(list);
        }
Example #14
0
        private kList GetRCSList(SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("ID", 12, ColumnAlignment.Left);
            list.AddColumn("Name", 28, ColumnAlignment.Left);

            foreach (Part part in shared.Vessel.Parts)
            {
                foreach (PartModule module in part.Modules)
                {
                    var rcs = module as ModuleRCS;
                    if (rcs != null)
                    {
                        list.AddItem(part.ConstructID(), part.partInfo.name);
                    }
                }
            }

            return(list);
        }
Example #15
0
        private kList GetSensorList(SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("Part Name", 37, ColumnAlignment.Left);
            list.AddColumn("Sensor Type", 11, ColumnAlignment.Left);

            foreach (Part part in shared.Vessel.Parts)
            {
                foreach (PartModule module in part.Modules)
                {
                    var sensor = module as ModuleEnviroSensor;
                    if (sensor != null)
                    {
                        list.AddItem(part.partInfo.title, sensor.sensorType);
                    }
                }
            }

            return(list);
        }
Example #16
0
        private kList GetResourceList(SharedObjects shared)
        {
            var list = new kList();

            list.AddColumn("Stage", 11, ColumnAlignment.Left);
            list.AddColumn("Resource Name", 28, ColumnAlignment.Left);
            list.AddColumn("Amount", 9, ColumnAlignment.Right, "0.00");

            var resourceDict = new SortedDictionary <string, double>();

            foreach (Part part in shared.Vessel.Parts)
            {
                string       stageStr = part.inverseStage.ToString();
                PartResource resource;
                for (int i = 0; i < part.Resources.Count; ++i)
                {
                    resource = part.Resources[i];
                    string key = stageStr + "|" + resource.resourceName;
                    if (resourceDict.ContainsKey(key))
                    {
                        resourceDict[key] += resource.amount;
                    }
                    else
                    {
                        resourceDict.Add(key, resource.amount);
                    }
                }
            }

            foreach (KeyValuePair <string, double> kvp in resourceDict)
            {
                string key          = kvp.Key;
                string stageStr     = key.Substring(0, key.IndexOf('|'));
                string resourceName = key.Substring(key.IndexOf('|') + 1);

                list.AddItem(stageStr, resourceName, kvp.Value);
            }

            return(list);
        }
Example #17
0
        private kList GetVolumeList(SharedObjects shared)
        {
            kList list = new kList();

            list.Title = "Volumes";
            list.AddColumn("ID", 6, ColumnAlignment.Left);
            list.AddColumn("Name", 24, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr != null)
            {
                foreach (KeyValuePair <int, Volume> kvp in shared.VolumeMgr.Volumes)
                {
                    Volume volume = kvp.Value;
                    string id     = kvp.Key.ToString() + (shared.VolumeMgr.VolumeIsCurrent(volume) ? "*" : "");
                    string size   = volume.CheckRange(shared.Vessel) ? (volume.Capacity > -1 ? volume.Capacity.ToString() : "Inf") : "Disc";
                    list.AddItem(id, volume.Name, size);
                }
            }

            return(list);
        }
Example #18
0
        private kList GetTargetList(SharedObjects shared)
        {
            kList list = new kList();

            list.AddColumn("Vessel Name", 25, ColumnAlignment.Left);
            list.AddColumn("Distance", 12, ColumnAlignment.Right, "0.0");

            double commRange = VesselUtils.GetCommRange(shared.Vessel);

            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (vessel != shared.Vessel)
                {
                    var vT = new VesselTarget(vessel, shared.Vessel);
                    if (vT.IsInRange(commRange))
                    {
                        list.AddItem(vT.target.vesselName, vT.GetDistance());
                    }
                }
            }

            return(list);
        }
Example #19
0
        private kList GetProcessorList(SharedObjects shared)
        {
            var list = new kList {
                Title = "Processors"
            };

            list.AddColumn("Name", 16, ColumnAlignment.Left);
            list.AddColumn("Tag", 12, ColumnAlignment.Left);
            list.AddColumn("Volume ID", 6, ColumnAlignment.Left);

            if (shared.VolumeMgr == null)
            {
                return(list);
            }

            foreach (kOSProcessor processor in shared.ProcessorMgr.processors.Values)
            {
                string name     = processor.name + (shared.Processor == processor ? "*" : "");
                int    volumeId = shared.VolumeMgr.GetVolumeId(processor.HardDisk);
                list.AddItem(name, processor.Tag, volumeId);
            }

            return(list);
        }
Example #20
0
        private kList GetTargetList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("Vessel Name", 25, ColumnAlignment.Left);
            list.AddColumn("Distance", 12, ColumnAlignment.Right, "0.0");

            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (vessel == shared.Vessel) continue;

                var vT = new VesselTarget(vessel, shared);
                list.AddItem(vT.Vessel.vesselName, vT.GetDistance());
            }

            return list;
        }
Example #21
0
        private kList GetVolumeList(SharedObjects shared)
        {
            kList list = new kList();
            list.Title = "Volumes";
            list.AddColumn("ID", 6, ColumnAlignment.Left);
            list.AddColumn("Name", 24, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr != null)
            {
                foreach (KeyValuePair<int, Volume> kvp in shared.VolumeMgr.Volumes)
                {
                    Volume volume = kvp.Value;
                    string id = kvp.Key.ToString() + (shared.VolumeMgr.VolumeIsCurrent(volume) ? "*" : "");
                    string size = volume.CheckRange(shared.Vessel) ? (volume.Capacity > -1 ? volume.Capacity.ToString() : "Inf") : "Disc";
                    list.AddItem(id, volume.Name, size);
                }
            }

            return list;
        }
Example #22
0
        private kList GetConfigList(SharedObjects shared)
        {
            kList list = new kList();
            list.AddColumn("", 5, ColumnAlignment.Left);
            list.AddColumn("Name", 30, ColumnAlignment.Left);
            list.AddColumn("Value", 10, ColumnAlignment.Left);

            foreach (ConfigKey key in Config.GetInstance().GetConfigKeys())
            {
                list.AddItem(key.Alias, key.Name, key.Value);
            }

            return list;
        }
Example #23
0
        private kList GetEngineList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("ID", 12, ColumnAlignment.Left);
            list.AddColumn("Stage", 8, ColumnAlignment.Left);
            list.AddColumn("Name", 28, ColumnAlignment.Left);

            foreach (Part part in VesselUtils.GetListOfActivatedEngines(shared.Vessel))
            {
                foreach (PartModule module in part.Modules)
                {
                    var engineMod = module as ModuleEngines;
                    if (engineMod != null) {
                        list.AddItem(part.uid, part.inverseStage, engineMod.moduleName);
                    }

                    var engineModFx = module as ModuleEnginesFX;
                    if (engineModFx != null) {
                        list.AddItem(part.uid, part.inverseStage, engineModFx.moduleName);
                    }
                }
            }

            return list;
        }
Example #24
0
        private kList GetFileList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("Name", 30, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr != null)
            {
                Volume volume = shared.VolumeMgr.CurrentVolume;
                if (volume != null)
                {
                    list.Title = "Volume " + shared.VolumeMgr.GetVolumeBestIdentifier(volume);

                    foreach (FileInfo info in volume.GetFileList())
                    {
                        list.AddItem(info.Name, info.Size);
                    }

                    int freeSpace = volume.GetFreeSpace();
                    list.Footer = "Free space remaining: " + (freeSpace > -1 ? freeSpace.ToString() : " infinite");
                }
            }

            return list;
        }
Example #25
0
        private kList GetEngineList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("ID", 12, ColumnAlignment.Left);
            list.AddColumn("Stage", 8, ColumnAlignment.Left);
            list.AddColumn("Name", 28, ColumnAlignment.Left);

            ListValue partList = EngineValue.PartsToList(shared.Vessel.Parts, shared);

            foreach (Structure structure in partList)
            {
                var part = (PartValue) structure;
                list.AddItem(part.Part.uid(), part.Part.inverseStage, part.Part.partInfo.name);
            }

            return list;
        }
Example #26
0
        private kList GetConfigList()
        {
            var list = new kList();
            list.AddColumn("", 9, ColumnAlignment.Left);
            list.AddColumn("Name", 34, ColumnAlignment.Left);
            list.AddColumn("Value", 6, ColumnAlignment.Left);

            foreach (ConfigKey key in Config.Instance.GetConfigKeys())
            {
                list.AddItem(key.Alias, key.Name, key.Value);
            }

            return list;
        }
Example #27
0
        private kList GetPartList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("ID", 28, ColumnAlignment.Left);
            list.AddColumn("Name", 20, ColumnAlignment.Left);

            foreach (Part part in shared.Vessel.Parts)
            {
                list.AddItem(part.ConstructID(), part.partInfo.name);
            }

            return list;
        }
Example #28
0
        private kList GetFileList(Safe.SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("Name", 30, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr != null)
            {
                Volume volume = shared.VolumeMgr.CurrentVolume;
                if (volume != null)
                {
                    list.Title = "Volume " + shared.VolumeMgr.GetVolumeBestIdentifier(volume);

                    foreach (KeyValuePair<string, VolumeFile> pair in volume.FileList)
                    {
                        list.AddItem(pair.Key, pair.Value.Size);
                    }

                    long freeSpace = volume.FreeSpace;
                    list.Footer = "Free space remaining: " + (freeSpace != Volume.INFINITE_CAPACITY ? freeSpace.ToString() : " infinite");
                }
            }

            return list;
        }
Example #29
0
        private kList GetProcessorList(SharedObjects shared)
        {
            var list = new kList { Title = "Processors" };
            list.AddColumn("Name", 16, ColumnAlignment.Left);
            list.AddColumn("Tag", 12, ColumnAlignment.Left);
            list.AddColumn("Volume ID", 6, ColumnAlignment.Left);

            if (shared.VolumeMgr == null) return list;

            foreach (kOSProcessor processor in shared.ProcessorMgr.processors.Values)
            {
                string name = processor.name + (shared.Processor == processor ? "*" : "");
                int volumeId = shared.VolumeMgr.GetVolumeId(processor.HardDisk);
                list.AddItem(name, processor.Tag, volumeId);
            }

            return list;
        }
Example #30
0
        private kList GetResourceList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("Stage", 11, ColumnAlignment.Left);
            list.AddColumn("Resource Name", 28, ColumnAlignment.Left);
            list.AddColumn("Amount", 9, ColumnAlignment.Right, "0.00");

            var resourceDict = new SortedDictionary<string, double>();

            foreach (Part part in shared.Vessel.Parts)
            {
                string stageStr = part.inverseStage.ToString();
                foreach (PartResource resource in part.Resources)
                {
                    string key = stageStr + "|" + resource.resourceName;
                    if (resourceDict.ContainsKey(key))
                    {
                        resourceDict[key] += resource.amount;
                    }
                    else
                    {
                        resourceDict.Add(key, resource.amount);
                    }
                }
            }

            foreach (KeyValuePair<string, double> kvp in resourceDict)
            {
                string key = kvp.Key;
                string stageStr = key.Substring(0, key.IndexOf('|'));
                string resourceName = key.Substring(key.IndexOf('|') + 1);

                list.AddItem(stageStr, resourceName, kvp.Value);
            }

            return list;
        }
Example #31
0
        private kList GetSensorList(SharedObjects shared)
        {
            var list = new kList();
            list.AddColumn("Part Name", 37, ColumnAlignment.Left);
            list.AddColumn("Sensor Type", 11, ColumnAlignment.Left);

            foreach (Part part in shared.Vessel.Parts)
            {
                foreach (PartModule module in part.Modules)
                {
                    var sensor = module as ModuleEnviroSensor;
                    if (sensor != null)
                    {
                        list.AddItem(part.partInfo.title, sensor.sensorType);
                    }
                }
            }

            return list;
        }
Example #32
0
        private kList GetTargetList(SharedObjects shared)
        {
            kList list = new kList();
            list.AddColumn("Vessel Name", 25, ColumnAlignment.Left);
            list.AddColumn("Distance", 12, ColumnAlignment.Right, "0.0");

            double commRange = VesselUtils.GetCommRange(shared.Vessel);

            foreach (Vessel vessel in FlightGlobals.Vessels)
            {
                if (vessel != shared.Vessel)
                {
                    var vT = new VesselTarget(vessel, shared.Vessel);
                    if (vT.IsInRange(commRange))
                    {
                        list.AddItem(vT.Vessel.vesselName, vT.GetDistance());
                    }
                }
            }

            return list;
        }
Example #33
0
        private kList GetVolumeList(Safe.SharedObjects shared)
        {
            var list = new kList { Title = "Volumes" };
            list.AddColumn("ID", 6, ColumnAlignment.Left);
            list.AddColumn("Name", 24, ColumnAlignment.Left);
            list.AddColumn("Size", 7, ColumnAlignment.Right);

            if (shared.VolumeMgr == null) return list;

            foreach (KeyValuePair<int, Volume> kvp in shared.VolumeMgr.Volumes)
            {
                Volume volume = kvp.Value;
                string id = kvp.Key.ToString() + (shared.VolumeMgr.VolumeIsCurrent(volume) ? "*" : "");
                string size = volume.Capacity.ToString();
                list.AddItem(id, volume.Name, size);
            }

            return list;
        }