Skip to content

Commit

Permalink
Add a changelog. Add this log to the startpage.
Browse files Browse the repository at this point in the history
Allow updating the tool from the startpage.
Add a title displaying the current version to the startpage.
Add the current version to the app title.
  • Loading branch information
Lyeeedar committed Dec 22, 2016
1 parent 2472d6c commit 05064b9
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 84 deletions.
36 changes: 36 additions & 0 deletions StructuredXmlEditor/Changelog.txt
Original file line number Diff line number Diff line change
@@ -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.
1 change: 0 additions & 1 deletion StructuredXmlEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
8 changes: 3 additions & 5 deletions StructuredXmlEditor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public partial class MainWindow : Window

public MainWindow()
{
Title = "Structured Xml Editor (" + VersionInfo.Version + ")";

Instance = this;
InitializeComponent();

Expand All @@ -48,11 +50,7 @@ public MainWindow()

LoadLayout();

try
{
VersionInfo.CheckForUpdates(Workspace);
}
catch (Exception) { }
VersionInfo.CheckForUpdates(Workspace);
}));
};
}
Expand Down
3 changes: 3 additions & 0 deletions StructuredXmlEditor/StructuredXmlEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
<ItemGroup>
<Resource Include="Resources\Edit.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Changelog.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.1.28.3\build\Fody.targets" Condition="Exists('..\packages\Fody.1.28.3\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
51 changes: 51 additions & 0 deletions StructuredXmlEditor/Tools/StartPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<object> UpdateMajorCMD { get { return new Command<object>((o) => { VersionInfo.UpdateApplication(VersionInfo.AvailableMajorVersion, Workspace); }); } }
public Command<object> UpdateFeatureCMD { get { return new Command<object>((o) => { VersionInfo.UpdateApplication(VersionInfo.AvailableFeatureVersion, Workspace); }); } }
public Command<object> UpdateBugfixCMD { get { return new Command<object>((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");
};
}
}
}
179 changes: 101 additions & 78 deletions StructuredXmlEditor/Util/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -60,69 +74,78 @@ public static void CheckForUpdates(Workspace workspace)
break;
}
}
else
{
break;
}
}
}

if (newMajor != null)
{
var ignored = workspace.GetSetting<string>("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<string>("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<string>("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<string>("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<string>("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<string>("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()
Expand Down
Loading

0 comments on commit 05064b9

Please sign in to comment.