Skip to content

Commit

Permalink
Update version.
Browse files Browse the repository at this point in the history
  • Loading branch information
ko-vasilev committed Mar 1, 2016
1 parent df3374b commit 18776ef
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public string Author
get { return "Vasilev Konstantin"; }
}

public static readonly Version PluginVersion = new Version(0, 3, 0);
public static readonly Version PluginVersion = new Version(0, 3, 1);

public Version Version
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.IO;

namespace Hearthstone_Collection_Tracker.Internal.DataUpdaters
{
public class DataUpdaterV031 : IDataUpdater
{
private static readonly Version _version = new Version(0, 3, 1);

public Version Version
{
get
{
return _version;
}
}

private string ConfigFilePath
{
get { return Path.Combine(HearthstoneCollectionTrackerPlugin.PluginDataDir, "config.xml"); }
}

public bool RequiresUpdate
{
get
{
var configFilePath = ConfigFilePath;
if (!Directory.Exists(HearthstoneCollectionTrackerPlugin.PluginDataDir) || !File.Exists(configFilePath))
{
return false;
}

try
{
var settings = Hearthstone_Deck_Tracker.XmlManager<PluginSettings>.Load(configFilePath);
return settings.CurrentVersion < new ModuleVersion(_version);
}
catch (Exception ex)
{
return false;
}
}
}

public void PerformUpdate()
{
var configFilePath = ConfigFilePath;
var settings = Hearthstone_Deck_Tracker.XmlManager<PluginSettings>.Load(configFilePath);
settings.CurrentVersion = new ModuleVersion(_version);
settings.EnableDesiredCardsFeature = true;
Hearthstone_Deck_Tracker.XmlManager<PluginSettings>.Save(configFilePath, settings);
}

[Serializable]
public class PluginSettings
{
public ModuleVersion CurrentVersion { get; set; }

public string ActiveAccount { get; set; }

public List<AccountSummary> Accounts { get; set; }

public double CollectionWindowWidth { get; set; }

public double CollectionWindowHeight { get; set; }

public bool DefaultShowAllCards { get; set; }

public bool NotifyNewDeckMissingCards { get; set; }

public bool EnableDesiredCardsFeature { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public static class DefaultDataUpdater
new DataUpdaterV02(),
new DataUpdaterV021(),
new DataUpdaterV022(),
new DataUpdaterV03()
new DataUpdaterV03(),
new DataUpdaterV031()
};

/// <summary>
Expand Down

0 comments on commit 18776ef

Please sign in to comment.