public void DeleteProject(IMakerClient client, string id)
 {
     if (!String.IsNullOrEmpty(id))
     {
         var project = client.ReadProject(id);
         if (project != null && String.IsNullOrEmpty(project.Error))
         {
             if (!String.IsNullOrEmpty(project.Project.MasterLocation))
             {
                 DeleteMasterImage(project.Project.MasterLocation);
             }
             if (!String.IsNullOrEmpty(project.Project.MosaicLocation))
             {
                 DeleteMosaicImage(project.Project.MosaicLocation);
             }
             if (!String.IsNullOrEmpty(project.Project.EdgeLocation))
             {
                 DeleteEdgeImage(project.Project.EdgeLocation);
             }
             var response = client.DeleteProject(id);
             if (!String.IsNullOrEmpty(response.Error))
             {
                 Error = response.Error;
             }
         }
         else
         {
             Error = "Error in fetching project with id";
         }
     }
     else
     {
         Error = "Id cannot be null or empty";
     }
 }
        private ProjectResponse ProjectErrorCheck(IMakerClient client, string id)
        {
            // Get project
            if (String.IsNullOrEmpty(id))
            {
                return(new ProjectResponse()
                {
                    Error = "Project Id cannot be null or empty"
                });
            }
            var project = client.ReadProject(id);

            return(project);
        }
Esempio n. 3
0
        // Returns all files in indexed location that have not been imported
        public void ReadImageFileIndex(IMakerClient client, string indexedLocation, string id)
        {
            var indexedFiles = client.ReadImageFileIndex(indexedLocation);
            var response     = client.ReadProject(id);

            if (response == null || response.Project == null)
            {
                Error = "Invalid request project does not exist";
            }
            else if (response.Project.SmallFileIds == null || response.Project.SmallFileIds.Count == 0)
            {
                Files = indexedFiles.Files.ToList();
                Error = indexedFiles.Error;
            }
            else
            {
                Files = indexedFiles.Files.Where(x => !response.Project.SmallFileIds.Contains(x.Id)).ToList();
                Error = indexedFiles.Error;
            }
        }
Esempio n. 4
0
        //Return project response
        private ProjectResponse ProjectErrorCheck(IMakerClient client, string id)
        {
            // Get project
            if (String.IsNullOrEmpty(id))
            {
                return(new ProjectResponse()
                {
                    Error = "Project Id cannot be null or empty"
                });
            }
            var project = client.ReadProject(id);

            if (!String.IsNullOrEmpty(project.Error))
            {
                return(project);
            }
            else if (project.Project.SmallFileIds.Count == 0 || String.IsNullOrEmpty(project.Project.LargeFileId))
            {
                project.Error = "Master or tile images not specified";
            }
            return(project);
        }
Esempio n. 5
0
        public IActionResult SelectProject(string Id)
        {
            // pass client into constructor
            var model = new IndexedLocationModel(client, Id);

            model.RequestIndexedLocation(client);

            var progress = client.ReadProject(Id).Project.Progress;

            if (progress == ProjectStructure.Types.State.Smalladded || progress == ProjectStructure.Types.State.Completed)
            {
                return(new TileController().Generate(Id));
            }
            else if (progress == ProjectStructure.Types.State.Largeadded)
            {
                return(new MasterController().ImportTiles(Id));
            }
            else
            {
                return(ImportMaster(Id));
            }
        }