Пример #1
0
        private ArrayList loadFromFile()
        {
            _mruIsDirty = false;
            var mruLF = new MRUListFile();
            var fi    = new FileInfo(Application.ExecutablePath);

            mruLF.ReadXml(fi.DirectoryName + '\\' + MRUFile(), XmlReadMode.IgnoreSchema);
            var mru = new ArrayList(mruLF.MRUList.Rows.Count);

            foreach (MRUListFile.MRUListRow row in mruLF.MRUList.Rows)
            {
                mru.Add(row.mruentry);
            }

            return(mru);
        }
Пример #2
0
        private void saveToFile()
        {
            var mruLF = new MRUListFile();

            foreach (String str in MRUList())
            {
                mruLF.MRUList.AddMRUListRow(str);
            }
            var fi = new FileInfo(Application.ExecutablePath);

            /*---------------*/
            //Birb: changed to address the issue mentioned at http://www.codeproject.com/cs/menu/MRUHandler.asp?forumid=124432&select=1371902&df=100#xx1371902xx
            var filename = (fi.DirectoryName + '\\' + MRUFile());

            if (!File.Exists(filename))
            {
                File.Create(filename);
            }
            mruLF.WriteXml(filename, XmlWriteMode.IgnoreSchema);
            /*---------------*/
        }