private void Application_ApplicationExit(object sender, EventArgs e) { string styleDir = Path.Combine(PluginPaths.GetPluginConfigDirectory(PluginAssemblyData), "styles"); string[] lines = StyleManager.StyleOptions.Where(x => x.HasChanged).Select(x => $"{x.Keyword}: {x.Value}") .ToArray(); File.WriteAllLines(Path.Combine(styleDir, "style.options"), lines); }
private void OnShowAppearance() { if (f == null || f.IsDisposed) { string stylePath = Path.Combine(PluginPaths.GetPluginConfigDirectory(PluginAssemblyData), "styles"); f = new EditorThemeSettingsForm(stylePath); f.Show(); } }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); Application.ApplicationExit += Application_ApplicationExit; string styleDir = Path.Combine(PluginPaths.GetPluginConfigDirectory(PluginAssemblyData), "styles"); Directory.CreateDirectory(styleDir); StyleManager_OnReload(); }
public override void Install(BasePluginPointer ptr, string folder) { string cdir = GetConfigDir(folder); string bdir = GetBinPath(folder); if (Directory.Exists(cdir)) { HelperClass.CopyTo(cdir, PluginPaths.GetPluginConfigDirectory(ptr)); } if (Directory.Exists(bdir)) { HelperClass.CopyTo(bdir, PluginPaths.GetPluginAssemblyDirectory(ptr)); } }
private void StyleManager_OnReload() { string styleDir = Path.Combine(PluginPaths.GetPluginConfigDirectory(PluginAssemblyData), "styles"); if (File.Exists(Path.Combine(styleDir, "style.options"))) { string[] file = File.ReadAllLines( Path.Combine(styleDir, "style.options") ); foreach (string s in file) { string[] parts = s.Split(':').Select(x => x.Trim()).ToArray(); StyleOption opt = StyleManager.StyleOptions.FirstOrDefault(x => x.Keyword == parts[0]); if (opt != null) { opt.Value = parts[1]; } } } }
/// <summary> /// To String Implementation Listing all Retrievable Information about the Plugin. /// </summary> /// <returns>Information Text about this Object.</returns> public override string ToString() { StringBuilder builder = new StringBuilder(); builder.AppendLine("General:"); builder.AppendLine("\tIs Initialized: " + PluginManager.IsInitialized); builder.AppendLine("\tSystem Config Path: " + PluginPaths.InternalSystemConfigPath); builder.AppendLine("\tPlugin Dir: " + PluginPaths.PluginDirectory); builder.AppendLine("\tInstalled Packages Path: " + PluginPaths.PluginListFile); builder.AppendLine("\tGlobal Packages Path: " + PluginPaths.GlobalPluginListFile); builder.AppendLine(); builder.AppendLine(); builder.AppendLine("Plugin:"); builder.AppendLine("Name: " + PluginName); builder.AppendLine("\tFile: " + PluginName); builder.AppendLine("\tPlugin Directory: " + PluginPaths.GetPluginDirectory(PluginName)); builder.AppendLine("\tPlugin Config Directory: " + PluginPaths.GetPluginConfigDirectory(PluginName)); builder.AppendLine("\tPlugin Assembly Directory: " + PluginPaths.GetPluginAssemblyDirectory(PluginName)); builder.AppendLine("\tPlugin Temp Directory: " + PluginPaths.GetPluginTempDirectory(PluginName)); //builder.AppendLine($"\tPlugin Archive Backup: " + PluginPaths.GetPluginArchiveBackup(PluginName)); //builder.AppendLine($"\t\tPlugin Archive Backup Exists: " + File.Exists(PluginPaths.GetPluginArchiveBackup(PluginName))); builder.AppendLine("\tPlugin Assembly File: " + PluginPaths.GetPluginAssemblyFile(PluginName, PluginFile)); builder.AppendLine( "\t\tPlugin Assembly File Exists: " + File.Exists(PluginPaths.GetPluginAssemblyFile(PluginName, PluginFile)) ); //builder.AppendLine($"\tPlugin Version File: " + PluginPaths.GetPluginVersionFile(PluginName)); //builder.AppendLine($"\t\tPlugin Version File Exists: " + File.Exists(PluginPaths.GetPluginVersionFile(PluginName))); //builder.AppendLine($"\t\tPlugin Version File Key: " + PluginPaths.GetPluginVersion(PluginName)); //builder.AppendLine($"\t\tPlugin Version File Value: " + PluginPaths.GetPluginOriginURL(PluginName)); return(builder.ToString()); }