public void FromSave(string order) { //EvaDebug.DebugWarning("Order.FromSave()"); EvaTokenReader reader = new EvaTokenReader(order); string sAllowRunning = reader.NextTokenEnd(','); string sPosition = reader.NextToken('[', ']'); reader.Consume(); // , string sOffset = reader.NextToken('[', ']'); AllowRunning = bool.Parse(sAllowRunning); Position = Util.ParseVector3d(sPosition, false); Offset = Util.ParseVector3d(sOffset, false); }
public void FromSave(string order) { //EvaDebug.DebugWarning("Order.FromSave()"); EvaTokenReader reader = new EvaTokenReader(order); string sAllowRunning = reader.NextTokenEnd(','); string sPosition = reader.NextToken('[', ']'); reader.Consume(); // , string sOffset = reader.NextToken('[', ']'); AllowRunning = bool.Parse(sAllowRunning); Position = Util.ParseVector3d(sPosition, false); Offset = Util.ParseVector3d(sOffset, false); }
internal void FromSave(string evaSettings) { EvaTokenReader reader = new EvaTokenReader(evaSettings); try { string sflightID = reader.NextTokenEnd(','); string sName = reader.NextTokenEnd(','); string mode = reader.NextTokenEnd(','); string status = reader.NextTokenEnd(','); string selected = reader.NextTokenEnd(','); string showHelmet = reader.NextTokenEnd(','); string formation = reader.NextToken('(', ')'); reader.Consume(); string patrol = reader.NextToken('(', ')'); reader.Consume(); string order = reader.NextToken('(', ')'); reader.Consume(); string wanderer = reader.NextToken('(', ')'); this.Name = sName; this.mode = (Mode)Enum.Parse(typeof(Mode), mode); this.status = (Status)Enum.Parse(typeof(Status), status); this.selected = bool.Parse(selected); this.showHelmet = bool.Parse(showHelmet); this.formation.FromSave(formation); this.patrol.FromSave(patrol); this.order.FromSave(order); this.wanderer.FromSave(wanderer); EvaDebug.DebugLog("Loaded: " + mode); EvaDebug.DebugLog("name: " + sName); EvaDebug.DebugLog("status: " + status); EvaDebug.DebugLog("selected: " + selected); if (this.showHelmet == false) { eva.ShowHelmet(this.showHelmet); } } catch { throw new Exception("[EFX] FromSave Failed."); } }
internal void FromSave(string action) { EvaTokenReader reader = new EvaTokenReader(action); string sType = reader.NextTokenEnd(','); string sDelay = reader.NextTokenEnd(','); string sPosition = reader.NextToken('[', ']'); type = (PatrolActionType)Enum.Parse(typeof(PatrolActionType), sType); delay = int.Parse(sDelay); position = Util.ParseVector3d(sPosition, false); }
public void FromSave(string patrol) { try { //EvaDebug.DebugWarning("Patrol.FromSave()"); EvaTokenReader reader = new EvaTokenReader(patrol); string sAllowRunning = reader.NextTokenEnd(','); string sCurrentPatrolPoint = reader.NextTokenEnd(','); string sReferenceBody = reader.NextTokenEnd(','); string sPointlist = reader.NextToken('{', '}'); AllowRunning = bool.Parse(sAllowRunning); currentPatrolPoint = int.Parse(sCurrentPatrolPoint); referenceBody = sReferenceBody; actions.Clear(); if (!string.IsNullOrEmpty(sPointlist)) { reader = new EvaTokenReader(sPointlist); while (!reader.EOF) { PatrolAction action = new PatrolAction(); string token = reader.NextToken('(', ')'); action.FromSave(token); actions.Add(action); } if (EvaSettings.displayDebugLines) { GenerateLine(); } } } catch { throw new Exception("[EFX] Patrol.FromSave Failed."); } }
private static void LoadFile() { string fileName = String.Format("Evas-{0}.txt", HighLogic.CurrentGame.Title); if (FileExcist(fileName)) { KSP.IO.TextReader tr = KSP.IO.TextReader.CreateForType <EvaSettings>(fileName); string file = tr.ReadToEnd(); tr.Close(); EvaTokenReader reader = new EvaTokenReader(file); EvaDebug.DebugLog("Size KeySize: " + collection.Count); //read every eva. while (!reader.EOF) { //Load all the eva's in the list. LoadEva(reader.NextToken('[', ']')); } } }
internal void FromSave(string action) { EvaTokenReader reader = new EvaTokenReader(action); string sType = reader.NextTokenEnd(','); string sDelay = reader.NextTokenEnd(','); string sPosition = reader.NextToken('[', ']'); type = (PatrolActionType)Enum.Parse(typeof(PatrolActionType), sType); delay = int.Parse(sDelay); position = Util.ParseVector3d(sPosition, false); }
public void FromSave(string patrol) { try { //EvaDebug.DebugWarning("Patrol.FromSave()"); EvaTokenReader reader = new EvaTokenReader(patrol); string sAllowRunning = reader.NextTokenEnd(','); string sCurrentPatrolPoint = reader.NextTokenEnd(','); string sReferenceBody = reader.NextTokenEnd(','); string sPointlist = reader.NextToken('{', '}'); AllowRunning = bool.Parse(sAllowRunning); currentPatrolPoint = int.Parse(sCurrentPatrolPoint); referenceBody = sReferenceBody; actions.Clear(); if (!string.IsNullOrEmpty(sPointlist)) { reader = new EvaTokenReader(sPointlist); while (!reader.EOF) { PatrolAction action = new PatrolAction(); string token = reader.NextToken('(', ')'); action.FromSave(token); actions.Add(action); } if (EvaSettings.displayDebugLines) GenerateLine(); } } catch { throw new Exception("[EFX] Patrol.FromSave Failed."); } }
internal void FromSave(string evaSettings) { EvaTokenReader reader = new EvaTokenReader(evaSettings); try { string sflightID = reader.NextTokenEnd(','); string sName = reader.NextTokenEnd(','); string mode = reader.NextTokenEnd(','); string status = reader.NextTokenEnd(','); string selected = reader.NextTokenEnd(','); string showHelmet = reader.NextTokenEnd(','); string formation = reader.NextToken('(', ')'); reader.Consume(); string patrol = reader.NextToken('(', ')'); reader.Consume(); string order = reader.NextToken('(', ')'); reader.Consume(); string wanderer = reader.NextToken('(', ')'); this.Name = sName; this.mode = (Mode)Enum.Parse(typeof(Mode), mode); this.status = (Status)Enum.Parse(typeof(Status), status); this.selected = bool.Parse(selected); this.showHelmet = bool.Parse(showHelmet); this.formation.FromSave(formation); this.patrol.FromSave(patrol); this.order.FromSave(order); this.wanderer.FromSave(wanderer); EvaDebug.DebugLog("Loaded: " + mode); EvaDebug.DebugLog("name: " + sName); EvaDebug.DebugLog("status: " + status); EvaDebug.DebugLog("selected: " + selected); if (this.showHelmet == false) { eva.ShowHelmet(this.showHelmet); } } catch { throw new Exception("[EFX] FromSave Failed."); } }
private static void LoadFile() { string fileName = String.Format("Evas-{0}.txt", HighLogic.CurrentGame.Title); if (FileExcist(fileName)) { KSP.IO.TextReader tr = KSP.IO.TextReader.CreateForType<EvaSettings>(fileName); string file = tr.ReadToEnd(); tr.Close(); EvaTokenReader reader = new EvaTokenReader(file); EvaDebug.DebugLog("Size KeySize: " + collection.Count); //read every eva. while (!reader.EOF) { //Load all the eva's in the list. LoadEva(reader.NextToken('[', ']')); } } }