public override void Evaluate() { // For now only log to the archive. String volumeName = "Archive"; Volume targetVolume = GetVolume(volumeName); // If the archive is out of ranch, the signal is lost in space. if (!targetVolume.CheckRange()) { State = ExecutionState.DONE; return; } String targetFile = RegexMatch.Groups[1].Value.Trim(); Expression e = new Expression(RegexMatch.Groups[2].Value, ParentContext); if (e.IsNull()) { State = ExecutionState.DONE; } else { targetVolume.AppendToName(targetFile, e.ToString()); State = ExecutionState.DONE; } }
public override void Evaluate() { // Todo: let the user specify a volume "LOG something TO file ON volume" Volume targetVolume = SelectedVolume; // If the archive is out of reach, the signal is lost in space. if (!targetVolume.CheckRange()) { State = ExecutionState.DONE; return; } String targetFile = RegexMatch.Groups[2].Value.Trim(); Expression e = new Expression(RegexMatch.Groups[1].Value, ParentContext); if (e.IsNull()) { State = ExecutionState.DONE; } else { targetVolume.AppendToFile(targetFile, e.ToString()); State = ExecutionState.DONE; } }
private Volume GetVolumeWithRangeCheck(Volume volume) { if (volume.CheckRange(_shared.Vessel)) { return(volume); } else { throw new Exception("Volume is out of range"); } }
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); }
public override void VerifyMount() { selectedVolume.CheckRange(); }