Skip to content

Commit d99a5dc

Browse files
committed
Update plugin version.
1 parent e08c694 commit d99a5dc

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

Hearthstone Collection Tracker/HearthstoneCollectionTrackerPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public string Author
161161
get { return "Vasilev Konstantin"; }
162162
}
163163

164-
public static readonly Version PluginVersion = new Version(0, 3, 1);
164+
public static readonly Version PluginVersion = new Version(0, 3, 2);
165165

166166
public Version Version
167167
{
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
5+
namespace Hearthstone_Collection_Tracker.Internal.DataUpdaters
6+
{
7+
public class DataUpdaterV032 : IDataUpdater
8+
{
9+
private static readonly Version _version = new Version(0, 3, 2);
10+
11+
public Version Version
12+
{
13+
get
14+
{
15+
return _version;
16+
}
17+
}
18+
19+
private string ConfigFilePath
20+
{
21+
get { return Path.Combine(HearthstoneCollectionTrackerPlugin.PluginDataDir, "config.xml"); }
22+
}
23+
24+
public bool RequiresUpdate
25+
{
26+
get
27+
{
28+
var configFilePath = ConfigFilePath;
29+
if (!Directory.Exists(HearthstoneCollectionTrackerPlugin.PluginDataDir) || !File.Exists(configFilePath))
30+
{
31+
return false;
32+
}
33+
34+
try
35+
{
36+
var settings = Hearthstone_Deck_Tracker.XmlManager<PluginSettings>.Load(configFilePath);
37+
return settings.CurrentVersion < new ModuleVersion(_version);
38+
}
39+
catch (Exception ex)
40+
{
41+
return false;
42+
}
43+
}
44+
}
45+
46+
public void PerformUpdate()
47+
{
48+
var configFilePath = ConfigFilePath;
49+
var settings = Hearthstone_Deck_Tracker.XmlManager<PluginSettings>.Load(configFilePath);
50+
settings.CurrentVersion = new ModuleVersion(_version);
51+
Hearthstone_Deck_Tracker.XmlManager<PluginSettings>.Save(configFilePath, settings);
52+
}
53+
54+
[Serializable]
55+
public class PluginSettings
56+
{
57+
public ModuleVersion CurrentVersion { get; set; }
58+
59+
public string ActiveAccount { get; set; }
60+
61+
public List<AccountSummary> Accounts { get; set; }
62+
63+
public double CollectionWindowWidth { get; set; }
64+
65+
public double CollectionWindowHeight { get; set; }
66+
67+
public bool DefaultShowAllCards { get; set; }
68+
69+
public bool NotifyNewDeckMissingCards { get; set; }
70+
71+
public bool EnableDesiredCardsFeature { get; set; }
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)