Exemplo n.º 1
0
        public List <PrintItem> ImportFromJson(string filePath = null)
        {
            if (filePath == null)
            {
                filePath = defaultPathAndFileName;
            }

            if (!System.IO.File.Exists(filePath))
            {
                return(null);
            }

            string json = File.ReadAllText(filePath);

            ManifestFile newProject = JsonConvert.DeserializeObject <ManifestFile>(json);

            if (newProject == null)
            {
                return(new List <PrintItem>());
            }

            //newProject.ProjectFiles = NewPrintItemListForImport(newProject.ProjectFiles);

            return(newProject.ProjectFiles);
        }
Exemplo n.º 2
0
 public ManifestFileHandler(List <PrintItem> projectFiles)
 {
     if (projectFiles != null)
     {
         project = new ManifestFile();
         project.ProjectFiles = projectFiles;
     }
 }
Exemplo n.º 3
0
        public List <PrintItem> ImportFromJson(string loadedFileName = null)
        {
            if (loadedFileName == null)
            {
                loadedFileName = defaultPathAndFileName;
            }

            if (System.IO.File.Exists(loadedFileName))
            {
                StreamReader sr         = new System.IO.StreamReader(loadedFileName);
                ManifestFile newProject = (ManifestFile)Newtonsoft.Json.JsonConvert.DeserializeObject(sr.ReadToEnd(), typeof(ManifestFile));
                sr.Close();
                if (newProject == null)
                {
                    return(new List <PrintItem>());
                }
                return(newProject.ProjectFiles);
            }
            else
            {
                return(null);
            }
        }
 public ManifestFileHandler(List<PrintItem> projectFiles)
 {
     if (projectFiles != null)
     {
         project = new ManifestFile();
         project.ProjectFiles = projectFiles;
     }
 }