Example #1
0
        private void saveFileDialog_FileOk(object sender, CancelEventArgs e)
        {
            string fileName = saveFileDialog.FileName;

            fileName               = fileName.Substring(fileName.LastIndexOf(@"\") + 1);
            tbModelName.Text       = fileName;
            modelProgram.ModelName = fileName;
            modelProgram           = new Class.ModelProgram();
            Directory.CreateDirectory(saveFileDialog.FileName.Remove(saveFileDialog.FileName.Length - fileName.Length) + fileName.Remove(fileName.Length - 5));
        }
Example #2
0
        private void openFileModel_FileOk(object sender, CancelEventArgs e)
        {
            string ModelJson = File.ReadAllText(openFileModel.FileName);

            modelProgram = JsonSerializer.Deserialize <Class.ModelProgram>(ModelJson);

            var options = new JsonSerializerOptions
            {
                WriteIndented = true
            };

            ModelJson = JsonSerializer.Serialize(modelProgram, options);
            Console.WriteLine(ModelJson);
        }