public void RestoreFactorySettings() { // Stop program engine try { masterControlProgram.Enabled = false; masterControlProgram = null; } catch { } // Uncompress factory settings and restart HG service Utility.UncompressZip("homegenie_factory_config.zip", AppDomain.CurrentDomain.BaseDirectory); Reload(); SaveData(); }
public void LoadConfiguration() { LoadSystemConfig(); // // load modules data // LoadModules(); // // load last saved groups data into controlGroups list try { var serializer = new XmlSerializer(typeof(List<Group>)); using (var reader = new StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "groups.xml"))) controlGroups = (List<Group>)serializer.Deserialize(reader); } catch { //TODO: log error } // // load last saved automation groups data into automationGroups list try { var serializer = new XmlSerializer(typeof(List<Group>)); using (var reader = new StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "automationgroups.xml"))) automationGroups = (List<Group>)serializer.Deserialize(reader); } catch { //TODO: log error } // // load last saved programs data into masterControlProgram.Programs list // if (masterControlProgram != null) { masterControlProgram.Enabled = false; masterControlProgram = null; } masterControlProgram = new ProgramManager(this); try { var serializer = new XmlSerializer(typeof(List<ProgramBlock>)); using (var reader = new StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "programs.xml"))) { var programs = (List<ProgramBlock>)serializer.Deserialize(reader); foreach (var program in programs) { program.IsRunning = false; // backward compatibility with hg < 0.91 if (program.Address == 0) { // assign an id to program if unassigned program.Address = masterControlProgram.GeneratePid(); } masterControlProgram.ProgramAdd(program); } } } catch (Exception ex) { LogError( Domains.HomeAutomation_HomeGenie, "LoadConfiguration()", ex.Message, "Exception.StackTrace", ex.StackTrace ); } // // load last saved scheduler items data into masterControlProgram.SchedulerService.Items list // try { var serializer = new XmlSerializer(typeof(List<SchedulerItem>)); using (var reader = new StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "scheduler.xml"))) { var schedulerItems = (List<SchedulerItem>)serializer.Deserialize(reader); masterControlProgram.SchedulerService.Items.AddRange(schedulerItems); } } catch { //TODO: log error } // force re-generation of Modules list modules_RefreshAll(); // // enable automation programs engine // masterControlProgram.Enabled = true; }
public MacroRecorder(ProgramManager mcp) { masterControlProgram = mcp; }
public void RestoreFactorySettings() { string archiveName = "homegenie_factory_config.zip"; // try { masterControlProgram.Enabled = false; masterControlProgram.StopEngine(); // delete old programs assemblies foreach (var program in masterControlProgram.Programs) { program.Engine.SetHost(this); } masterControlProgram = null; } catch { } // Utility.UncompressZip(archiveName, AppDomain.CurrentDomain.BaseDirectory); // Reload(); // // regenerate encrypted files UpdateModulesDatabase(); SystemConfiguration.Update(); }
public void RestoreFactorySettings() { string archiveName = "homegenie_factory_config.zip"; // try { masterControlProgram.Enabled = false; // delete old programs assemblies foreach (var program in masterControlProgram.Programs) { program.Engine.SetHost(this); } masterControlProgram = null; } catch { } // Utility.UncompressZip(archiveName, AppDomain.CurrentDomain.BaseDirectory); // Reload(); // SaveData(); }
public MacroRecorder(ProgramManager mcp) { masterControlProgram = mcp; }