public static void LoadState() { try { Commands = XSerial.Load <List <Command> >(Global.CommandSaveFileName); } catch (Exception e) { Log.WriteLine("Error loading commands"); Log.WriteLine(e); Commands = new List <Command>(); } }
public static void SaveState() { try { XSerial.Save <List <Command> >(Global.CommandSaveFileName, Commands); } catch (Exception e) { Log.WriteLine("Error saving commands"); Log.WriteLine(e); } }
public static void SaveState() { try { XSerial.Save <List <string> >(Global.PluginSaveFileName, AllowedPlugins); } catch (Exception e) { Log.WriteLine("Could not save plugin file"); Log.WriteLine(e); } }
public static void LoadSate() { try { AllowedPlugins = XSerial.Load <List <string> >(Global.PluginSaveFileName); } catch (Exception e) { Log.WriteLine("Could not load plugin file"); Log.WriteLine(e); AllowedPlugins = new List <string>(); } }
public void Dispose() { try { string[] o = SaveSettings(); XSerial.Save <string[]>(Global.AppDataFolder + "\\PluginSettings." + _PluginType.Name + ".xml", o); } catch (Exception ex) { Log.WriteLine("Couldn't save plugin settings (" + FriendlyName + ")"); Log.WriteLine(ex); } }
public vActivationState Activate() { if (_assembly == null) { return(vActivationState.NoActivationRequired); } try { _plugin = Activator.CreateInstance(_PluginType) as IGCPlugin; foreach (Plugin p in Plugin.Plugins) { if (p.ShortName.Trim().ToLower() == _plugin.ShortName.Trim().ToLower()) { _plugin = null; // the assembly is loaded, but there isn't any way to unload it // without tearing down the appDomain, so we'll just have to leave // it until the user corrects it, if ever. return(vActivationState.NameConflict); } } string[] o = null; try { o = XSerial.Load <string[]>(Global.AppDataFolder + "\\PluginSettings." + _PluginType.Name + ".xml"); } catch (Exception ex) { Log.WriteLine("Couldn't load plugin settings (" + FriendlyName + ")"); Log.WriteLine(ex); } _plugin.LoadSettings(o); return(vActivationState.Activated); } catch (Exception e) { Log.WriteLine("[ER] Could not avticate plugin"); Log.WriteLine(e); return(vActivationState.Error); } }