public void RunProgramOn(List<Opcode> program, Volume volume) { kOSProcessor processor = GetProcessor(volume); RunCommand runCommand = new RunCommand(); runCommand.Program = program; processor.ExecuteInterProcCommand(runCommand); }
private kOSProcessor GetProcessor(Volume volume) { if (processors.ContainsKey(volume)) { return processors[volume]; } throw new Exception("The volume is not attached to any processor"); }
public void AttachTo( TermWindow termWindow, Volume attachVolume, string attachFileName = "" ) { term = termWindow; outerCoords = new Rect(0,0,0,0); // will be resized and moved in onGUI. frozen = false; loadingVolume = attachVolume; loadingFileName = attachFileName; LoadContents(attachVolume, attachFileName); }
public void Add(Volume volume) { if (!volumes.ContainsValue(volume)) { volumes.Add(lastId++, volume); if (currentVolume == null) { currentVolume = volumes[0]; UpdateRequiredPower(); } } }
public void Remove(int id) { Volume volume = GetVolume(id); if (volume != null) { volumes.Remove(id); if (currentVolume == volume) { if (volumes.Count > 0) { currentVolume = volumes[0]; UpdateRequiredPower(); } else { currentVolume = null; } } } }
public string GetVolumeBestIdentifier(Volume volume) { int id = GetVolumeId(volume); if (!string.IsNullOrEmpty(volume.Name)) return string.Format("#{0}: \"{1}\"", id, volume.Name); return "#" + id; }
private Volume GetVolumeWithRangeCheck(Volume volume) { if (volume.CheckRange(shared.Vessel)) { return volume; } throw new Exception("Volume is out of range"); }
public VolumeManager(SharedObjects shared) { volumes = new Dictionary<int, Volume>(); currentVolume = null; this.shared = shared; }
private int GetVolumeId(Volume volume) { int volumeId = -1; foreach (KeyValuePair<int, Volume> kvp in volumes) { if (kvp.Value == volume) { volumeId = kvp.Key; break; } } return volumeId; }
public bool VolumeIsCurrent(Volume volume) { return volume == currentVolume; }
public void SwitchTo(Volume volume) { if (volume != null) { currentVolume = volume; UpdateRequiredPower(); } }
public void OpenPopupEditor( Volume v, string fName ) { popupEditor.AttachTo(this, v, fName ); popupEditor.Open(); }
public void LoadContents( Volume vol, string fName ) { if (isDirty) { Freeze(true); InvokeDirtySaveLoadDialog(); loadingVolume = vol; loadingFileName = fName; } else { loadingVolume = vol; loadingFileName = fName; DelegateLoadContents(this); } }