Beispiel #1
0
        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");
        }
Beispiel #2
0
        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();
        }