public void AddRecentFile(string path, string descr, int tag, int enc)
 {
     if (this.isFileRecent(path) == false) //prevent duplication on recent list
     {
         SRecentItem item = new SRecentItem(path, descr, tag.ToString(), enc.ToString());
         MRUlist.Add(item);
     }
     this.saveRecentFile();
 }
        private void LoadRecentList()
        {
            MRUlist.Clear();
            // http://social.msdn.microsoft.com/Forums/vstudio/en-US/6b8c4dd6-3c63-4c90-a98a-478c07ada10f/pause-streamreader-the-process-cannot-access-the-file-because-it-is-being-used-by-another?forum=csharpgeneral
            using (FileStream stream = new FileStream(this.stgPath + recentFile, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite))
            {
                using (StreamReader listToRead = new StreamReader(stream))
                {
                    try
                    {
                        while (true)
                        {
                            SRecentItem record = new SRecentItem();
                            string      test   = listToRead.ReadLine();

                            if (test == null)
                            {
                                break;
                            }

                            // Compability with old versions
                            if (Regex.IsMatch(test, "^[\\d]+$"))
                            {
                                record.tag = test;

                                if ((record.enc = listToRead.ReadLine()) == null ||
                                    (record.path = listToRead.ReadLine()) == null)
                                {
                                    break;
                                }
                                record.descr = Utils.Utils.getShortName(record.path);
                            }
                            else // new vesion format
                            {
                                record.descr = test;

                                if ((record.tag = listToRead.ReadLine()) == null ||
                                    (record.enc = listToRead.ReadLine()) == null ||
                                    (record.path = listToRead.ReadLine()) == null)
                                {
                                    break;
                                }
                            }
                            this.MRUlist.Add(record);
                        }
                        listToRead.Close();
                    }
                    catch (Exception ee) { MessageBox.Show(ee.Message + "\r\n" + ee.StackTrace); }
                }
            }
        }
        public void DeleteRecentFile(string path)
        {
            SRecentItem delIt = new SRecentItem();

            foreach (SRecentItem item in this.MRUlist)
            {
                if (string.Compare(item.path, path, true) == 0)
                {
                    delIt = item;
                }
            }
            if (delIt.path == "")
            {
                return;
            }

            this.MRUlist.Remove(delIt);
            this.saveRecentFile();
        }