Пример #1
0
        public void AddServer(string path, bool addToMostRecentlyUsedFiles)
        {
            if (ServerEntries.Any(se => se.ServerPath == path))
            {
                return;
            }

            //  Load any servers from the assembly.
            var serverEntries = ServerManagerApi.LoadServers(path);

            foreach (var serverEntry in serverEntries)
            {
                AddServerEntryToList(serverEntry);
            }

            if (addToMostRecentlyUsedFiles && Properties.Settings.Default.RecentlyUsedFiles.Contains(path) == false)
            {
                //  We've successfully added the server - so add the path of the server to our recent files.
                Properties.Settings.Default.RecentlyUsedFiles.Insert(0, path);
                Properties.Settings.Default.Save();
            }
        }
        public void AddServer(string path, bool addToMostRecentlyUsedFiles)
        {
            if (ServerEntries.Any(se => se.ServerPath == path))
            {
                return;
            }

            //  Create a server entry for the server.
            var serverEntry = ServerManagerApi.LoadServer(path);

            if (serverEntry != null)
            {
                AddServerEntryToList(serverEntry);

                if (addToMostRecentlyUsedFiles && Properties.Settings.Default.RecentlyUsedFiles.Contains(path) == false)
                {
                    //  We've successfully added the server - so add the path of the server to our recent files.
                    Properties.Settings.Default.RecentlyUsedFiles.Insert(0, path);
                    Properties.Settings.Default.Save();
                }
            }
        }