diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs index 0f6a371..7ea24d7 100644 --- a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs @@ -17,19 +17,17 @@ public class AgsGetComponent : IEditorComponent private const string COMPONENT_ID = "AgsGetComponent"; private const string CONTROL_ID_CONTEXT_MENU_OPTION = "AgsGetPluginOptionClick"; private const string CONTROL_ID_ROOT_NODE = "AgsGetPluginRoot"; - private const string CONTROL_ID_MAIN_MENU_OPTION = "AgsGetPluginMainMenuOptionClick"; - private const string NEW_MAIN_MENU_ID = "AgsGetPluginMenu"; + private const string ICON_KEY = "AgsGetPluginIcon"; - private IAGSEditor _editor; - private ContentDocument _pane; - private MenuCommands _mainMenuItems; + private readonly IAGSEditor _editor; + private readonly ContentDocument _pane; public AgsGetComponent(IAGSEditor editor) { _editor = editor; - _editor.GUIController.RegisterIcon("AgsGetPluginIcon", GetIcon("PluginIcon.ico")); - _editor.GUIController.ProjectTree.AddTreeRoot(this, CONTROL_ID_ROOT_NODE, "AgsGet plugin", "AgsGetPluginIcon"); - _pane = new ContentDocument(new AgsGetPane(editor), "Plugin pane", this); + _editor.GUIController.RegisterIcon(ICON_KEY, GetIcon("PluginIcon.ico")); + _editor.GUIController.ProjectTree.AddTreeRoot(this, CONTROL_ID_ROOT_NODE, "AgsGet plugin", ICON_KEY); + _pane = new ContentDocument(new AgsGetPane(editor), "AgsGet", this, ICON_KEY); } private Icon GetIcon(string fileName) @@ -81,21 +79,21 @@ void IEditorComponent.GameSettingsChanged() void IEditorComponent.ToXml(System.Xml.XmlTextWriter writer) { - writer.WriteElementString("TextBoxContents", ((AgsGetPane)_pane.Control).TextBoxContents); + // writer.WriteElementString("TextBoxContents", ((AgsGetPane)_pane.Control).TextBoxContents); } void IEditorComponent.FromXml(System.Xml.XmlNode node) { - if (node == null) - { - // node will be null if loading a 2.72 game or if - // the game hasn't used this plugin before - ((AgsGetPane)_pane.Control).TextBoxContents = "Default text"; - } - else - { - ((AgsGetPane)_pane.Control).TextBoxContents = node.SelectSingleNode("TextBoxContents").InnerText; - } + //if (node == null) + //{ + // // node will be null if loading a 2.72 game or if + // // the game hasn't used this plugin before + // ((AgsGetPane)_pane.Control).TextBoxContents = ""; + //} + //else + //{ + // ((AgsGetPane)_pane.Control).TextBoxContents = node.SelectSingleNode("TextBoxContents").InnerText; + //} } void IEditorComponent.EditorShutdown() diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/ApplyDo.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/ApplyDo.cs index 7f6a0a6..c61152e 100644 --- a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/ApplyDo.cs +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/ApplyDo.cs @@ -102,7 +102,7 @@ public static async System.Threading.Tasks.Task DoAsync(Action writ return 1; } - writerMethod("-"); + writerMethod(""); return 0; } } diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/UpdateDo.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/UpdateDo.cs index 8e19874..82ff762 100644 --- a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/UpdateDo.cs +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/Actions/UpdateDo.cs @@ -24,9 +24,13 @@ public static async System.Threading.Tasks.Task DoAsync(Action writ //3.Downloads the index of packages to `./ ags_packages_cache / package_index`. //If it already exists, overwrites it. - await PackageCacheIO.GetPackageIndexAsync(writerMethod, packageIndexURL); + if(!await PackageCacheIO.GetPackageIndexAsync(writerMethod, packageIndexURL)) + { + writerMethod("Could not update package index."); + return 1; + } - writerMethod("Success."); + writerMethod("Index updated with success."); return 0; } } diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/PackageCacheIO.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/PackageCacheIO.cs index 75e3b3d..430860d 100644 --- a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/PackageCacheIO.cs +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetCore/PackageCacheIO.cs @@ -12,16 +12,20 @@ namespace AgsGetCore // some commands are distributed on BaseFiles, maybe they need to be here and not there? public class PackageCacheIO { - public static async System.Threading.Tasks.Task GetPackageIndexAsync(Action writerMethod, string packageIndexUrl) + public static async System.Threading.Tasks.Task GetPackageIndexAsync(Action writerMethod, string packageIndexUrl) { + var destinationFile = BaseFiles.GetIndexFilePath(); + bool downloadResult; if (string.IsNullOrEmpty(packageIndexUrl)) { - await DownloadPretty.FileAsync(writerMethod, Configuration.PackageIndexURL + "index/package_index.json", BaseFiles.GetIndexFilePath()); + downloadResult = await DownloadPretty.FileAsync(writerMethod, Configuration.PackageIndexURL + "index/package_index.json", destinationFile); } else { - await DownloadPretty.FileAsync(writerMethod, packageIndexUrl + "index/package_index.json", BaseFiles.GetIndexFilePath()); + downloadResult = await DownloadPretty.FileAsync(writerMethod, packageIndexUrl + "index/package_index.json", destinationFile); } + writerMethod("Index downloaded to:" + destinationFile); + return downloadResult; } public static bool PackageOnIndex(string packageName) @@ -75,7 +79,7 @@ public static async System.Threading.Tasks.Task GetPackageAsync(Action