private void lblsave_Click(object sender, EventArgs e) { this.lblsave.BackColor = Color.LightGreen; try { StreamWriter sw = new StreamWriter(this.engine.SavePath); sw.Write(TodoXmlWrapper.Persist(this.engine)); sw.Close(); } catch { } this.lblsave.BackColor = Color.White; }
void IDisposable.Dispose() { if (this.FSaveExit) { try { StreamWriter sw = new StreamWriter(this.FPath); sw.Write(TodoXmlWrapper.Persist(this.FEngine)); sw.Close(); } catch { } } this.FEngine.Dispose(); }
public void Evaluate(int SpreadMax) { this.FSaveExit = this.FInSaveExit[0]; this.FPath = this.FInPath[0]; if (this.FInClearMappings[0] || this.FClearMapNextFrame) { this.ucMappingManager.ResetMappings(); this.FEngine.ClearMappings(); this.FClearMapNextFrame = false; } if (this.FInReset[0] || this.FCLearAllNextFrame) { this.ucMappingManager.Reset(); this.FEngine.ClearVariables(); this.FCLearAllNextFrame = false; } if (this.FInIgnoreListOsc.IsChanged) { this.FEngine.Osc.IgnoreList = new List <string>(this.FInIgnoreListOsc); } if (this.FInLearnMode.IsChanged) { this.FEngine.LearnMode = this.FInLearnMode[0]; this.ucMappingManager.LearnModeUpdated(); } if (this.FInSelect[0]) { this.FEngine.SelectVariable(this.FInSelVar[0]); } if (this.FInSave[0] || this.FSaveNextFrame) { string path = this.FInPath[0]; try { StreamWriter sw = new StreamWriter(path); sw.Write(TodoXmlWrapper.Persist(this.FEngine)); sw.Close(); } catch { } this.FSaveNextFrame = false; } if (this.FInPath.IsChanged) { this.FEngine.SavePath = this.FInPath[0]; } if (this.FInLoad[0] || (this.FInPath.IsChanged && this.FInAutoLoad[0])) { string path = this.FInPath[0]; if (File.Exists(path)) { this.FEngine.ClearVariables(); this.ucMappingManager.Reset(); StreamReader sr = null; try { sr = new StreamReader(path); string xml = sr.ReadToEnd(); sr.Close(); this.FEngine.ClearVariables(); TodoXmlUnwrapper.LoadXml(this.FEngine, xml); } catch { if (sr != null) { sr.Close(); } } } } if (this.FEngine.SelectedVariable != null) { this.FOutSelVarName.SliceCount = 1; this.FOutSelVarName[0] = this.FEngine.SelectedVariable.Name; } else { this.FOutSelVarName.SliceCount = 0; } }