Exemplo n.º 1
0
        public void LoadProject(string Path)
        {
            BasePath    = Path;
            ProjectPath = BasePath + @"\project.xml";

            //Load item list
            if (File.Exists(ProjectPath))
            {
                ComparitronSaveFormat loadData   = new ComparitronSaveFormat();
                XmlSerializer         serializer = new XmlSerializer(typeof(ComparitronSaveFormat));
                using (var myFileStream = new FileStream(ProjectPath, FileMode.Open))
                {
                    loadData = (ComparitronSaveFormat)serializer.Deserialize(myFileStream);
                }

                itemList     = loadData.itemList;
                ProjectID    = loadData.projectID;
                ProjectTitle = loadData.projectTitle;
            }

            //Debug
            Console.WriteLine("Loading " + ProjectPath);
            Console.WriteLine(itemList.Count.ToString() + " items found");

            ScanForFiles(BasePath + @"\" + settings.MXFolder);
        }
Exemplo n.º 2
0
        public void SaveProject(string Path)
        {
            //this just assumes the path is valid, because that's definately safe.
            //ProjectPath = BasePath + @"\Project.xml";
            ComparitronSaveFormat saveData = new ComparitronSaveFormat(itemList, ProjectID, ProjectTitle);

            XmlSerializer serializer = new XmlSerializer(typeof(ComparitronSaveFormat));

            using (TextWriter writer = new StreamWriter(ProjectPath))
            {
                serializer.Serialize(writer, saveData);
            }
        }