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);
                        }
                    }
                }
            }
            ;
        }
		public void SetMostRecent( RecentFileEntry entry )
		{
			int index = fileEntries.IndexOf(entry.Path);

			if(index != -1)
				fileEntries.RemoveAt(index);

			fileEntries.Insert( 0, entry );
			if( fileEntries.Count > MaxFiles )
				fileEntries.RemoveAt( MaxFiles );
		}
        public void SetMostRecent(RecentFileEntry entry)
        {
            int index = fileEntries.IndexOf(entry.Path);

            if (index != -1)
            {
                fileEntries.RemoveAt(index);
            }

            fileEntries.Insert(0, entry);
            if (fileEntries.Count > MaxFiles)
            {
                fileEntries.RemoveAt(MaxFiles);
            }
        }
Ejemplo n.º 4
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));
                }
            }
        }
 public void Insert(int index, RecentFileEntry entry)
 {
     InnerList.Insert(index, entry);
 }
 public void Add(RecentFileEntry entry)
 {
     InnerList.Add(entry);
 }
			public void SetMostRecent( RecentFileEntry entry )
			{
				files.Insert( 0, entry );
			}
		public void Insert( int index, RecentFileEntry entry )
		{
			InnerList.Insert( index, entry );
		}
		public void Add( RecentFileEntry entry )
		{
			InnerList.Add( entry );
		}