public static string SaveProjectToFile(RedstoneSidekickProject project) { string projectAsBase64String = ProjectStringEncoder.Encode(project, ProjectStringEncoder.CraftingTreeOptions.Full); string fileName = $"{project.ProjectName}.rsp"; SaveFileDialog dialog = new SaveFileDialog { Filter = "Redstone Sidekick Projects (*.rsp)|*.rsp", InitialDirectory = $"{GlobalDataVars.AppDirectory}", FileName = fileName, ValidateNames = true, DefaultExt = ".rsp", AddExtension = true }; if (dialog.ShowDialog() == true) { fileName = dialog.FileName; File.WriteAllText(fileName, projectAsBase64String); return(dialog.SafeFileName); } return("Error"); }
internal void CreateProjectCode() { var projectCode = ProjectStringEncoder.Encode(Project, ProjectStringEncoder.CraftingTreeOptions.Light); Clipboard.Clear(); Clipboard.SetText(projectCode); MessageBoxWindow window = new MessageBoxWindow() { Title = "Created Project Code", MessageText = "Redstone Sidekick Project Code copied to clipboard!", WindowStartupLocation = WindowStartupLocation.CenterScreen, ShowActivated = true }; window.Show(); }