Exemple #1
0
        // File Read
        private static RenameTrackerList Deserialize(string file)
        {
            try
            {
                Stream streamRead = File.OpenRead(file);
                System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(List <RenameTrackerItem>));
                RenameTrackerList mtl = new RenameTrackerList();
                mtl.List = (List <RenameTrackerItem>)xs.Deserialize(streamRead);

                foreach (var item in TermOptions.AutoReplaceTags)
                {
                    if (!mtl.Contains(item.Key))
                    {
                        mtl.Add(item.Key, item.Value, true, new DateTime?(SystemTrackerItemDateTime));
                    }
                }

                streamRead.Close();
                return(mtl);
            }
            catch
            {
                // File.Delete(file);
                throw;
            }
        }
Exemple #2
0
        public static RenameTrackerList LoadFromFile(string file)
        {
            if (!File.Exists(file))
            {
                RenameTrackerList rtList = new RenameTrackerList();

                foreach (var item in TermOptions.AutoReplaceTags)
                {
                    rtList.Add(item.Key, item.Value, true, new DateTime?(SystemTrackerItemDateTime));
                }

                return(rtList);
            }
            else
            {
                return(RenameTrackerList.Deserialize(file));
            }
        }