Example #1
0
        private void saveWorkflowData()
        {
            if (!FileInterface.DoesFolderExists(Path + OUTPUT_SUBDIRECTORY))
            {
                FileInterface.CreateFolder(Path + OUTPUT_SUBDIRECTORY);
            }

            foreach (LayerType layerType in workflowData.Keys)
            {
                List <WorkflowData> workflowData_ = new List <WorkflowData>();
                workflowData_.Add(workflowData[layerType]);
                string outputData = ObjectSerializer.Serialize(workflowData_);
                FileInterface.WriteString(Path + System.IO.Path.DirectorySeparatorChar + "workflow_" + layerType + ".twd", outputData);
            }
        }
Example #2
0
        private void saveTerrainInputs(TerrainPipelineLayer terrainPipelineLayer, List <TerrainInput> terrainInputs, HashSet <string> inputFilesCreated)
        {
            if (terrainPipelineLayer == null || terrainInputs == null)
            {
                return;
            }

            List <TerrainInput> allTerrainInputs = new List <TerrainInput>();

            mergeInnerTerrainInputs(allTerrainInputs, terrainInputs);
            terrainInputs = allTerrainInputs;

            List <TerrainInputValue> terrainInputValues = new List <TerrainInputValue>();

            foreach (TerrainInput terrainInput in terrainInputs)
            {
                TerrainInputValue terrainInputValue = null;

                switch (terrainInput.Type)
                {
                case InputType.Form:
                    terrainInputValue = new TerrainInputValueForm();
                    break;

                case InputType.Sketch:
                    terrainInputValue = new TerrainInputValueSketch();
                    break;
                }

                if (terrainInputValue != null)
                {
                    terrainInputValue.SetValue(terrainInput);
                    terrainInputValues.Add(terrainInputValue);
                }
            }

            if (terrainInputValues.Count > 0)
            {
                if (!FileInterface.DoesFolderExists(Path + INPUT_SUBDIRECTORY))
                {
                    FileInterface.CreateFolder(Path + INPUT_SUBDIRECTORY);
                }
                string inputData = ObjectSerializer.Serialize(terrainInputValues);
                FileInterface.WriteString(Path + INPUT_SUBDIRECTORY + terrainPipelineLayer.LayerCode + "_" + terrainPipelineLayer.PluginId + ".tin", inputData);
                inputFilesCreated.Add(Path + INPUT_SUBDIRECTORY + terrainPipelineLayer.LayerCode + "_" + terrainPipelineLayer.PluginId + ".tin");
            }
        }
Example #3
0
        internal void Commit()
        {
            string data = ObjectSerializer.Serialize(this);

            FileInterface.WriteString(currentPath + Path.DirectorySeparatorChar + CONFIGURATIONS_FILE, data);
        }
Example #4
0
        private void saveTerrainOutputs()
        {
            HashSet <string> createdFiles = new HashSet <string>();

            Console.WriteLine("Will save terrain output");
            if (!FileInterface.DoesFolderExists(Path + OUTPUT_SUBDIRECTORY))
            {
                FileInterface.CreateFolder(Path + OUTPUT_SUBDIRECTORY);
            }

            foreach (TerrainPipelineLayer terrainPipelineLayer in TerrainOutputs.Keys)
            {
                List <TerrainOutput> allTerrainOutputs = new List <TerrainOutput>();
                mergeInnerTerrainOutputs(allTerrainOutputs, TerrainOutputs[terrainPipelineLayer]);

                int i = 0;
                foreach (TerrainOutput terrainOutput in allTerrainOutputs)
                {
                    switch (terrainOutput.Type)
                    {
                    case OutputType.Mesh:
                        Console.WriteLine("Will save terrain output");
                        if (((TerrainOutputMesh)terrainOutput).MeshPath == null || ((TerrainOutputMesh)terrainOutput).MeshPath.Count == 0)
                        {
                            FileInterface.SaveMeshFile(Path + OUTPUT_SUBDIRECTORY + (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + "_" + i + ".obj", (TerrainOutputMesh)terrainOutput);
                        }
                        break;

                    case OutputType.Image:
                        if (((TerrainOutputImage)terrainOutput).ImagePath == null || ((TerrainOutputImage)terrainOutput).ImagePath.Length == 0)
                        {
                            FileInterface.SaveImageFile(Path + OUTPUT_SUBDIRECTORY + (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + "_" + i + ".bmp", (TerrainOutputImage)terrainOutput);
                        }
                        break;
                    }

                    i++;
                }

                if (TerrainOutputs[terrainPipelineLayer].Count > 0)
                {
                    Console.WriteLine("Saving terrain output");
                    string outputData = ObjectSerializer.Serialize(TerrainOutputs[terrainPipelineLayer]);
                    FileInterface.WriteString(Path + OUTPUT_SUBDIRECTORY + terrainPipelineLayer.LayerCode + "_" + terrainPipelineLayer.PluginId + ".tou", outputData);
                    createdFiles.Add(Path + OUTPUT_SUBDIRECTORY + terrainPipelineLayer.LayerCode + "_" + terrainPipelineLayer.PluginId + ".tou");
                }
            }

            if (FileInterface.DoesFolderExists(Path + OUTPUT_SUBDIRECTORY))
            {
                string[] files = FileInterface.GetChildFiles(Path + OUTPUT_SUBDIRECTORY);

                foreach (string file in files)
                {
                    if (file.EndsWith(".tou"))
                    {
                        if (!createdFiles.Contains(file))
                        {
                            FileInterface.DeleteFile(file);
                        }
                    }
                }
            }
        }
Example #5
0
        private void saveInfo()
        {
            string infoFileContent = ObjectSerializer.Serialize(Info);

            FileInterface.WriteString(Path + System.IO.Path.DirectorySeparatorChar + PROJECT_INFO_FILE, infoFileContent);
        }