public static LocalSettings TryLoad()
        {
            LocalSettings newsettings = null;

            ILocalSettingsStore[] SettingsSource = new ILocalSettingsStore[] {
#if !PORTABLE
                new RegistryLocalSettingsStore(),
                new RegistryJsonLocalSettingsStore(),
#endif
                new FileLocalSettingsStore()
            };
            foreach (ILocalSettingsStore ls in SettingsSource)
            {
                try
                {
                    JsonObject jo = ls.Load();
                    newsettings = new LocalSettings(jo);
                    newsettings.DefaultLocalStore = ls;
                    break;
                }
                catch { };
            }
            if (newsettings == null)
            { // not load from any source :(, try old mode
                try
                {
                    LocalSettings tempsettings = new LocalSettings();
#if !PORTABLE
                    LocalSettingsSingleton oldsettings = LocalSettingsSingleton.OneInstance();
                    tempsettings.Locale          = oldsettings.Locale;
                    tempsettings.CompletedBaloon = oldsettings.CompletedBaloon;
                    tempsettings.MinOnClose      = oldsettings.MinOnClose;
                    tempsettings.MinToTray       = oldsettings.MinToTray;
                    tempsettings.PlinkPath       = oldsettings.PlinkPath;
                    tempsettings.StartedBalloon  = oldsettings.StartedBalloon;
                    tempsettings.UploadPrompt    = oldsettings.UploadPrompt;
                    tempsettings.AutoCheckupdate = oldsettings.AutoCheckupdate;
                    string origcurrentprofile = oldsettings.CurrentProfile;
                    foreach (string p in oldsettings.Profiles)
                    {
                        oldsettings.CurrentProfile = p;
                        TransmissionServer ts = new TransmissionServer();
                        ts.CustomPath      = oldsettings.CustomPath;
                        ts.DownLimit       = oldsettings.DownLimit;
                        ts.UpLimit         = oldsettings.UpLimit;
                        ts.Host            = oldsettings.Host;
                        ts.Password        = oldsettings.Pass;
                        ts.PlinkCmd        = oldsettings.PlinkCmd;
                        ts.PlinkEnable     = oldsettings.PlinkEnable;
                        ts.Port            = oldsettings.Port;
                        ts.RefreshRate     = oldsettings.RefreshRate;
                        ts.RefreshRateTray = oldsettings.RefreshRate * 10;
                        ts.StartPaused     = oldsettings.StartPaused;
                        ts.Username        = oldsettings.User;
                        ts.UseSSL          = oldsettings.UseSSL;
                        JsonObject mappings = oldsettings.SambaShareMappings;
                        foreach (string key in mappings.Names)
                        {
                            ts.AddSambaMapping(key, (string)mappings[key]);
                        }
                        ts.destpathhistory.AddRange(oldsettings.DestPathHistory);
                        ProxyServer ps = new ProxyServer();
                        ps.Host      = oldsettings.ProxyHost;
                        ps.Password  = oldsettings.ProxyPass;
                        ps.Port      = oldsettings.ProxyPort;
                        ps.Username  = oldsettings.ProxyUser;
                        ps.ProxyMode = (ProxyMode)oldsettings.ProxyMode;
                        ts.Proxy     = ps;
                        tempsettings.Servers.Add(p, ts);
                        if (origcurrentprofile.Equals(p))
                        {
                            tempsettings.CurrentProfile = p;
                        }
                    }
                    if (tempsettings.CurrentProfile.Equals("") && tempsettings.Servers.Count > 0)
                    {
                        tempsettings.CurrentProfile = "aa"; //tempsettings.Servers. . Key;
                    }
                    foreach (string s in oldsettings.ListObject(true))
                    {
                        if (s.StartsWith("mainwindow-") || s.StartsWith("listview-"))
                        {
                            tempsettings.Misc[s] = oldsettings.GetObject(s, true);
                        }
                    }
                    // move old stuff to backup!
                    //oldsettings.BackupSettings();
#endif
                    /* Only use the old settings, if we can read completely */
                    newsettings = tempsettings;
                }
                catch
                {
                    newsettings = new LocalSettings();
                };
                newsettings.Commit();
            }
            return(newsettings);
        }
        public static LocalSettings TryLoad()
        {
            LocalSettings newsettings = null;
            ILocalSettingsStore[] SettingsSource = new ILocalSettingsStore[] { 
#if !PORTABLE
                new RegistryLocalSettingsStore(), 
                new RegistryJsonLocalSettingsStore(), 
#endif
                new FileLocalSettingsStore() 
            };
            foreach (ILocalSettingsStore ls in SettingsSource)
            {
                try
                {
                    JsonObject jo = ls.Load();
                    newsettings = new LocalSettings(jo);
                    newsettings.DefaultLocalStore = ls;
                    break;
                }
                catch { };
            }
            if (newsettings == null)
            { // not load from any source :(, try old mode
                try
                {
                    LocalSettings tempsettings = new LocalSettings();
#if !PORTABLE
                    LocalSettingsSingleton oldsettings = LocalSettingsSingleton.OneInstance();
                    tempsettings.Locale = oldsettings.Locale;
                    tempsettings.CompletedBaloon = oldsettings.CompletedBaloon;
                    tempsettings.MinOnClose = oldsettings.MinOnClose;
                    tempsettings.MinToTray = oldsettings.MinToTray;
                    tempsettings.PlinkPath = oldsettings.PlinkPath;
                    tempsettings.StartedBalloon = oldsettings.StartedBalloon;
                    tempsettings.UploadPrompt = oldsettings.UploadPrompt;
                    tempsettings.AutoCheckupdate = oldsettings.AutoCheckupdate;
                    string origcurrentprofile = oldsettings.CurrentProfile;
                    foreach (string p in oldsettings.Profiles)
                    {
                        oldsettings.CurrentProfile = p;
                        TransmissionServer ts = new TransmissionServer();
                        ts.CustomPath = oldsettings.CustomPath;
                        ts.DownLimit = oldsettings.DownLimit;
                        ts.UpLimit = oldsettings.UpLimit;
                        ts.Host = oldsettings.Host;
                        ts.Password = oldsettings.Pass;
                        ts.PlinkCmd = oldsettings.PlinkCmd;
                        ts.PlinkEnable = oldsettings.PlinkEnable;
                        ts.Port = oldsettings.Port;
                        ts.RefreshRate = oldsettings.RefreshRate;
                        ts.RefreshRateTray = oldsettings.RefreshRate * 10;
                        ts.StartPaused = oldsettings.StartPaused;
                        ts.Username = oldsettings.User;
                        ts.UseSSL = oldsettings.UseSSL;
                        JsonObject mappings = oldsettings.SambaShareMappings;
                        foreach (string key in mappings.Names)
                        {
                            ts.AddSambaMapping(key, (string)mappings[key]);
                        }
                        ts.destpathhistory.AddRange(oldsettings.DestPathHistory);
                        ProxyServer ps = new ProxyServer();
                        ps.Host = oldsettings.ProxyHost;
                        ps.Password = oldsettings.ProxyPass;
                        ps.Port = oldsettings.ProxyPort;
                        ps.Username = oldsettings.ProxyUser;
                        ps.ProxyMode = (ProxyMode)oldsettings.ProxyMode;
                        ts.Proxy = ps;
                        tempsettings.Servers.Add(p, ts);
                        if (origcurrentprofile.Equals(p))
                            tempsettings.CurrentProfile = p;
                    }
                    if (tempsettings.CurrentProfile.Equals("") && tempsettings.Servers.Count > 0)
                        tempsettings.CurrentProfile = "aa"; //tempsettings.Servers. . Key;
                    foreach (string s in oldsettings.ListObject(true))
                    {
                        if (s.StartsWith("mainwindow-") || s.StartsWith("listview-"))
                            tempsettings.Misc[s] = oldsettings.GetObject(s, true);
                    }
                    // move old stuff to backup!
                    //oldsettings.BackupSettings();
#endif
                    /* Only use the old settings, if we can read completely */
                    newsettings = tempsettings;
                }
                catch
                {
                    newsettings = new LocalSettings();
                };
                newsettings.Commit();
            }
            return newsettings;
        }