private void LoadEntriesFromSettings(ISettings settings)
        {
            fileEntries.Clear();

            string prefix = Environment.Version.Major >= 2
                                ? "RecentProjects.V2"
                                : "RecentProjects.V1";

            for (int index = 1; index <= MaxFiles; index++)
            {
                string fileSpec = settings.GetSetting(GetRecentFileKey(prefix, index)) as string;
                if (fileSpec != null)
                {
                    fileEntries.Add(new RecentFileEntry(fileSpec));
                }
            }

            // Try legacy entries if nothing was found
            if (fileEntries.Count == 0)
            {
                for (int index = 1; index <= MaxFiles; index++)
                {
                    string fileSpec = settings.GetSetting(GetRecentFileKey("RecentProjects", index)) as string;
                    if (fileSpec != null)
                    {
                        RecentFileEntry entry = RecentFileEntry.Parse(fileSpec);
                        if (entry.CLRVersion.Major <= Environment.Version.Major)
                        {
                            fileEntries.Add(entry);
                        }
                    }
                }
            }
            ;
        }
예제 #2
0
        private void AddEntriesForPrefix(string prefix)
        {
            for (int index = 1; index < MaxFiles; index++)
            {
                if (fileEntries.Count >= MaxFiles)
                {
                    break;
                }

                string fileSpec = settings.GetSetting(GetRecentFileKey(prefix, index)) as string;
                if (fileSpec != null)
                {
                    fileEntries.Add(RecentFileEntry.Parse(fileSpec));
                }
            }
        }