diff --git a/StructuredXmlEditor/Changelog.txt b/StructuredXmlEditor/Changelog.txt new file mode 100644 index 0000000..2918502 --- /dev/null +++ b/StructuredXmlEditor/Changelog.txt @@ -0,0 +1,36 @@ + +--------- 1.0.0 --------- + +- First major release. +- Add support for loading and saving json. +- Adds support for GraphNodes, and Graph based editing. +- Added ability to generate a rough definition for a xml or json file. This show speed up the creation of definitions for existing data. +- Added a 'Swap' option to references. This attempts to swap the current data with another definition. This should make creating definitions far less painful. + +- Adds dockable miscellaneous tools: + -- Add UndoHistory tool that allows viewing and browsing the Undo history. + -- Add StartPage that shows a fair amount of useful data. + -- Add FocusTool that allows for easily seeing the data for the selected node in the Graph view. + +- Optimised a lot. +- Removed the ability to change the element name dynamically (via ChildAsName or ValueAsName). +- Added support for updating the tool semi-automatically. + + +--------- 0.2.1 --------- + +- Contains improvements to visibleif (add support for the || operator). +- Fixes loading of structs made invisible by visibleif. +- Improvements to saving that fix collections of primitives, collections of references and trees. + + +--------- 0.2.0 --------- + +- Adds timeline element type. + + +--------- 0.1.0 --------- + +- First release of the tool +- General editors for all the major types. +- Ability to create a definition from within the tool. \ No newline at end of file diff --git a/StructuredXmlEditor/MainWindow.xaml b/StructuredXmlEditor/MainWindow.xaml index 0ea341c..20dd52d 100644 --- a/StructuredXmlEditor/MainWindow.xaml +++ b/StructuredXmlEditor/MainWindow.xaml @@ -8,7 +8,6 @@ xmlns:t="clr-namespace:StructuredXmlEditor.Tools" xmlns:dock="http://schemas.xceed.com/wpf/xaml/avalondock" xmlns:dockctrl="clr-namespace:Xceed.Wpf.AvalonDock.Controls;assembly=Xceed.Wpf.AvalonDock" - Title="Structured Xml Editor" WindowStartupLocation="CenterScreen" Icon="pack://application:,,,/StructuredXmlEditor;component/Resources/Icon.png" WindowState="Maximized"> diff --git a/StructuredXmlEditor/MainWindow.xaml.cs b/StructuredXmlEditor/MainWindow.xaml.cs index 8fb45d4..f2db75f 100644 --- a/StructuredXmlEditor/MainWindow.xaml.cs +++ b/StructuredXmlEditor/MainWindow.xaml.cs @@ -35,6 +35,8 @@ public partial class MainWindow : Window public MainWindow() { + Title = "Structured Xml Editor (" + VersionInfo.Version + ")"; + Instance = this; InitializeComponent(); @@ -48,11 +50,7 @@ public MainWindow() LoadLayout(); - try - { - VersionInfo.CheckForUpdates(Workspace); - } - catch (Exception) { } + VersionInfo.CheckForUpdates(Workspace); })); }; } diff --git a/StructuredXmlEditor/StructuredXmlEditor.csproj b/StructuredXmlEditor/StructuredXmlEditor.csproj index 47bdc5e..0b73f3f 100644 --- a/StructuredXmlEditor/StructuredXmlEditor.csproj +++ b/StructuredXmlEditor/StructuredXmlEditor.csproj @@ -362,6 +362,9 @@ + + + diff --git a/StructuredXmlEditor/Tools/StartPage.cs b/StructuredXmlEditor/Tools/StartPage.cs index 5d2c381..74c128a 100644 --- a/StructuredXmlEditor/Tools/StartPage.cs +++ b/StructuredXmlEditor/Tools/StartPage.cs @@ -4,13 +4,64 @@ using System.Text; using System.Threading.Tasks; using StructuredXmlEditor.Data; +using System.Resources; +using System.Reflection; +using System.IO; +using StructuredXmlEditor.View; namespace StructuredXmlEditor.Tools { public class StartPage : ToolBase { + public string TitleText { get { return "Structured Xml Editor (" + VersionInfo.Version + ")"; } } + public string Changelog { get; set; } + + public bool AvailableVersion { get { return AvailableMajorVersion || AvailableFeatureVersion || AvailableBugfixVersion; } } + public bool AvailableMajorVersion { get { return VersionInfo.AvailableMajorVersion != null; } } + public bool AvailableFeatureVersion { get { return VersionInfo.AvailableFeatureVersion != null; } } + public bool AvailableBugfixVersion { get { return VersionInfo.AvailableBugfixVersion != null; } } + + public string MajorText { get { return AvailableMajorVersion ? "Major: " + VersionInfo.AvailableMajorVersion.Split(' ')[0] : ""; } } + public string FeatureText { get { return AvailableFeatureVersion ? "Feature: " + VersionInfo.AvailableFeatureVersion.Split(' ')[0] : ""; } } + public string BugfixText { get { return AvailableBugfixVersion ? "Bugfix: " + VersionInfo.AvailableBugfixVersion.Split(' ')[0] : ""; } } + + public Command UpdateMajorCMD { get { return new Command((o) => { VersionInfo.UpdateApplication(VersionInfo.AvailableMajorVersion, Workspace); }); } } + public Command UpdateFeatureCMD { get { return new Command((o) => { VersionInfo.UpdateApplication(VersionInfo.AvailableFeatureVersion, Workspace); }); } } + public Command UpdateBugfixCMD { get { return new Command((o) => { VersionInfo.UpdateApplication(VersionInfo.AvailableBugfixVersion, Workspace); }); } } + public StartPage(Workspace workspace) : base(workspace, "StartPage") { + Assembly assembly = Assembly.GetExecutingAssembly(); + + var culture = System.Threading.Thread.CurrentThread.CurrentCulture; + var resourceManager = new ResourceManager(assembly.GetName().Name + ".g", assembly); + + var resourceSet = resourceManager.GetResourceSet(culture, true, true); + + foreach (System.Collections.DictionaryEntry resource in resourceSet) + { + var name = resource.Key.ToString(); + if (name == "changelog.txt") + { + using (var reader = new StreamReader(resource.Value as Stream)) + { + var contents = reader.ReadToEnd(); + Changelog = contents; + } + } + } + + VersionInfo.VersionsUpdated += (e, args) => + { + RaisePropertyChangedEvent("AvailableVersion"); + RaisePropertyChangedEvent("AvailableMajorVersion"); + RaisePropertyChangedEvent("AvailableFeatureVersion"); + RaisePropertyChangedEvent("AvailableBugfixVersion"); + + RaisePropertyChangedEvent("MajorText"); + RaisePropertyChangedEvent("FeatureText"); + RaisePropertyChangedEvent("BugfixText"); + }; } } } diff --git a/StructuredXmlEditor/Util/VersionInfo.cs b/StructuredXmlEditor/Util/VersionInfo.cs index 1d41505..0460e03 100644 --- a/StructuredXmlEditor/Util/VersionInfo.cs +++ b/StructuredXmlEditor/Util/VersionInfo.cs @@ -16,39 +16,53 @@ public class VersionInfo public const int FeatureVersion = 0; public const int BugFixVersion = 0; + public static string Version { get { return MajorVersion + "." + FeatureVersion + "." + BugFixVersion; } } + + public static string AvailableMajorVersion { get; set; } + public static string AvailableFeatureVersion { get; set; } + public static string AvailableBugfixVersion { get; set; } + public static EventHandler VersionsUpdated; + public static void CheckForUpdates(Workspace workspace) { - string newMajor = null; - string newFeature = null; - string newBugfix = null; - - using (WebClient client = new WebClient()) + Task.Run(() => { - string s = client.DownloadString("https://github.com/infinity8/StructuredXmlEditor/wiki/VersionList.txt"); - var lines = s.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + string newMajor = null; + string newFeature = null; + string newBugfix = null; - foreach (var version in lines) + using (WebClient client = new WebClient()) { - var parts = version.Split(' ')[0].Split('.'); - int major = int.Parse(parts[0]); - int feature = int.Parse(parts[1]); - int bugfix = int.Parse(parts[2]); + string s = client.DownloadString("https://github.com/infinity8/StructuredXmlEditor/wiki/VersionList.txt"); + var lines = s.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); - if (major > MajorVersion) + foreach (var version in lines) { - if (newMajor == null) newMajor = version; - } - else if (major == MajorVersion) - { - if (feature > FeatureVersion) + var parts = version.Split(' ')[0].Split('.'); + int major = int.Parse(parts[0]); + int feature = int.Parse(parts[1]); + int bugfix = int.Parse(parts[2]); + + if (major > MajorVersion) { - if (newFeature == null) newFeature = version; + if (newMajor == null) newMajor = version; } - else if (feature == FeatureVersion) + else if (major == MajorVersion) { - if (bugfix > BugFixVersion) + if (feature > FeatureVersion) { - if (newBugfix == null) newBugfix = version; + if (newFeature == null) newFeature = version; + } + else if (feature == FeatureVersion) + { + if (bugfix > BugFixVersion) + { + if (newBugfix == null) newBugfix = version; + } + else + { + break; + } } else { @@ -60,69 +74,78 @@ public static void CheckForUpdates(Workspace workspace) break; } } - else - { - break; - } } - } - if (newMajor != null) - { - var ignored = workspace.GetSetting("IgnoredMajor"); - if (newMajor != ignored) + Application.Current.Dispatcher.BeginInvoke(new Action(() => { - var version = newMajor.Split(' ')[0]; - var result = Message.Show("A new major version of the tool is available (" + version + ")! This may break your current data so update at your own risk. For full change information check the wiki.", "Major Update Available", "Update", "Ignore"); - if (result == "Update") - { - UpdateApplication(newMajor, workspace); - return; - } - else - { - workspace.StoreSetting("IgnoredMajor", newMajor); - } - } - } + AvailableMajorVersion = newMajor; + AvailableFeatureVersion = newFeature; + AvailableBugfixVersion = newBugfix; - if (newFeature != null) - { - var ignored = workspace.GetSetting("IgnoredFeature"); - if (newFeature != ignored) - { - var version = newFeature.Split(' ')[0]; - var result = Message.Show("A new feature version of the tool is available (" + version + ")! This adds new functionality, for full information check the wiki.", "Feature Update Available", "Update", "Ignore"); - if (result == "Update") - { - UpdateApplication(newFeature, workspace); - return; - } - else - { - workspace.StoreSetting("IgnoredFeature", newFeature); - } - } - } + VersionsUpdated?.Invoke(null, null); - if (newBugfix != null) - { - var ignored = workspace.GetSetting("IgnoredBugFix"); - if (newBugfix != ignored) - { - var version = newBugfix.Split(' ')[0]; - var result = Message.Show("A new bugfix version of the tool is available (" + version + ")! This fixes numerous small issues, for full information check the wiki.", "Bugfix Update Available", "Update", "Ignore"); - if (result == "Update") + try { - UpdateApplication(newBugfix, workspace); - return; - } - else - { - workspace.StoreSetting("IgnoredBugFix", newBugfix); + if (newMajor != null) + { + var ignored = workspace.GetSetting("IgnoredMajor"); + if (newMajor != ignored) + { + var version = newMajor.Split(' ')[0]; + var result = Message.Show("A new major version of the tool is available (" + version + ")! This may break your current data so update at your own risk. For full change information check the wiki.", "Major Update Available", "Update", "Ignore"); + if (result == "Update") + { + UpdateApplication(newMajor, workspace); + return; + } + else + { + workspace.StoreSetting("IgnoredMajor", newMajor); + } + } + } + + if (newFeature != null) + { + var ignored = workspace.GetSetting("IgnoredFeature"); + if (newFeature != ignored) + { + var version = newFeature.Split(' ')[0]; + var result = Message.Show("A new feature version of the tool is available (" + version + ")! This adds new functionality, for full information check the wiki.", "Feature Update Available", "Update", "Ignore"); + if (result == "Update") + { + UpdateApplication(newFeature, workspace); + return; + } + else + { + workspace.StoreSetting("IgnoredFeature", newFeature); + } + } + } + + if (newBugfix != null) + { + var ignored = workspace.GetSetting("IgnoredBugFix"); + if (newBugfix != ignored) + { + var version = newBugfix.Split(' ')[0]; + var result = Message.Show("A new bugfix version of the tool is available (" + version + ")! This fixes numerous small issues, for full information check the wiki.", "Bugfix Update Available", "Update", "Ignore"); + if (result == "Update") + { + UpdateApplication(newBugfix, workspace); + return; + } + else + { + workspace.StoreSetting("IgnoredBugFix", newBugfix); + } + } + } } - } - } + catch (Exception) { } + })); + }); } public static void DeleteUpdater() diff --git a/StructuredXmlEditor/View/CustomControls/StartPageView.xaml b/StructuredXmlEditor/View/CustomControls/StartPageView.xaml index ee1dc18..fbeba25 100644 --- a/StructuredXmlEditor/View/CustomControls/StartPageView.xaml +++ b/StructuredXmlEditor/View/CustomControls/StartPageView.xaml @@ -49,6 +49,12 @@ + + + + @@ -56,7 +62,18 @@ Width="2*" /> + + + + + + + + + + + + + +