Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For completeness.. I ended up with this hack. Ugly, but it works.</p> <p>In Main method<br> // Only do upgrade check if we have no settings if (string.IsNullOrEmpty(Properties.Settings.Default.Categories)) { UpgradeAppSettings(); }</p> <p>With these methods in the same class.</p> <pre><code> private static void UpgradeAppSettings() { try // Fail silently! This hack is not important enough to cause problems { List&lt;string&gt; paths = new List&lt;string&gt;(); paths.Add(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)); paths.Add(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); foreach (string path in paths) { string companypath = System.IO.Directory.GetDirectories(path, "COMPANYNAME").FirstOrDefault(); if (companypath != null) { string appfolder = System.IO.Directory.GetDirectories(companypath, "OldName.exe_*").FirstOrDefault(); if (appfolder != null) { // Get the highest version of the app that contains a user.config file var version = System.IO.Directory.GetDirectories(appfolder) .Select( d =&gt; new { Path = d, Version = CreateVersion(new System.IO.DirectoryInfo(d).Name), ConfigFile = System.IO.Directory.GetFiles(d, "user.config").FirstOrDefault() } ) .Where(v =&gt; v.Version != null &amp;&amp; v.ConfigFile != null) .OrderByDescending(v =&gt; v.Version) .FirstOrDefault(); if (version != null) { string text = System.IO.File.ReadAllText(version.ConfigFile); // Change the namespace for serialized categories text = text.Replace( "http://schemas.microsoft.com/clr/nsassem/OldName/OldName", "http://schemas.microsoft.com/clr/nsassem/OldName/NewName"); var doc = XDocument.Parse(text); var settings = doc.Descendants("setting"); // These are the settings we are interested in ApplySetting(settings, "Categories", s =&gt; Properties.Settings.Default.Categories = s); ApplySetting(settings, "ActiveCategoryFilter", s =&gt; Properties.Settings.Default.ActiveCategoryFilter = s); ApplySetting(settings, "ActiveCategoryFilterDisplayName", s =&gt; Properties.Settings.Default.ActiveCategoryFilterDisplayName = s); ApplySetting(settings, "ListViewLayout", s =&gt; Properties.Settings.Default.ListViewLayout = s); ApplySetting(settings, "SplitterSizes", s =&gt; Properties.Settings.Default.SplitterSizes = s); ApplySetting(settings, "EditorSizes", s =&gt; Properties.Settings.Default.EditorSizes = s); ApplySetting(settings, "WindowStates", s =&gt; Properties.Settings.Default.WindowStates = s); ApplySetting(settings, "WindowStates", s =&gt; Properties.Settings.Default.WindowStates = s); break; } } } } } catch { } } private static void ApplySetting(IEnumerable&lt;XElement&gt; settings, string name, Action&lt;string&gt; action) { var cat = settings.FirstOrDefault(s =&gt; s.Attribute("name") != null &amp;&amp; s.Attribute("name").Value == name); if (cat != null) { action(cat.Value); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload