예제 #1
0
        public static void UpdatePlatformInclusion(string InPlatform, bool bIncluded)
        {
            try
            {
                BuilderSettingsJson BSJ = GetSettingsFile();
                foreach (GitPlatform gp in BSJ.GitDependencyPlatforms)
                {
                    if (gp.Name.ToLower() == InPlatform.ToLower())
                    {
                        gp.bIsIncluded = bIncluded;
                        break;
                    }
                }

                string JsonOutput = JsonConvert.SerializeObject(BSJ, Formatting.Indented);
                File.WriteAllText(PROGRAM_SETTINGS_PATH, JsonOutput);
            }
            catch (Exception ex)
            {
                string ErrorMessage = $"Failed to update platform setting. ERROR: {ex.Message}";
                GameAnalyticsCSharp.LogEvent(ErrorMessage, GameAnalyticsSDK.Net.EGAErrorSeverity.Error);
                MainWindow mainWindow = ((MainWindow)Application.Current.MainWindow);
                mainWindow.AddLogEntry(ErrorMessage, true);
                HandyControl.Controls.MessageBox.Fatal(ErrorMessage);
            }
        }
예제 #2
0
        public static BuilderSettingsJson GetSettingsFile(bool bLog = false)
        {
            if (Directory.Exists(PROGRAM_LOG_PATH_BASE))
            {
                ((MainWindow)Application.Current.MainWindow).OpenLogFolderBtn.IsEnabled = true;
            }

            BuilderSettingsJson ReturnValue = null;

            if (File.Exists(PROGRAM_SETTINGS_PATH))
            {
                string JsonOutput = File.ReadAllText(PROGRAM_SETTINGS_PATH);
                ReturnValue = JsonConvert.DeserializeObject <BuilderSettingsJson>(JsonOutput);
                if (bLog)
                {
                    LogEntry logEntry = new LogEntry();
                    logEntry.Message = $"Settings loaded from {PROGRAM_SETTINGS_PATH}.";
                    ((MainWindow)Application.Current.MainWindow).LogControl.AddLogEntry(logEntry, LogViewer.EMessageType.Info);
                    ((MainWindow)Application.Current.MainWindow).OpenSettingsBtn.IsEnabled = true;
                }
            }
            else
            {
                if (Directory.Exists(PROGRAM_SAVED_PATH) == false)
                {
                    Directory.CreateDirectory(PROGRAM_SAVED_PATH);
                    if (bLog)
                    {
                        LogEntry logEntry = new LogEntry();
                        logEntry.Message = $"Directory created: {PROGRAM_SAVED_PATH}.";
                        ((MainWindow)Application.Current.MainWindow).LogControl.AddLogEntry(logEntry, LogViewer.EMessageType.Info);
                    }
                }

                if (Directory.Exists(PROGRAM_SETTINGS_PATH_BASE) == false)
                {
                    Directory.CreateDirectory(PROGRAM_SETTINGS_PATH_BASE);
                    if (bLog)
                    {
                        LogEntry logEntry = new LogEntry();
                        logEntry.Message = $"Directory created: {PROGRAM_SETTINGS_PATH_BASE}.";
                        ((MainWindow)Application.Current.MainWindow).LogControl.AddLogEntry(logEntry, LogViewer.EMessageType.Info);
                    }
                }

                if (Directory.Exists(DEFAULT_GIT_CUSTOM_CACHE_PATH) == false)
                {
                    Directory.CreateDirectory(DEFAULT_GIT_CUSTOM_CACHE_PATH);
                }

                ReturnValue = GenerateDefaultSettingsJSON();
            }
            return(ReturnValue);
        }
        public static void UpdatePlatformInclusion(string InPlatform, bool bIncluded)
        {
            BuilderSettingsJson BSJ = GetSettingsFile();

            foreach (GitPlatform gp in BSJ.GitDependencyPlatforms)
            {
                if (gp.Name.ToLower() == InPlatform.ToLower())
                {
                    gp.bIsIncluded = bIncluded;
                    break;
                }
            }

            string JsonOutput = JsonConvert.SerializeObject(BSJ, Formatting.Indented);

            File.WriteAllText(PROGRAM_SETTINGS_PATH, JsonOutput);
        }
예제 #4
0
        public static void SaveSettings()
        {
            MainWindow          mainWindow = ((MainWindow)Application.Current.MainWindow);
            BuilderSettingsJson BSJ        = new BuilderSettingsJson();

            BSJ.Theme = mainWindow.CurrentTheme;
            BSJ.bCheckForUpdatesAtStartup = mainWindow.SettingsJSON.bCheckForUpdatesAtStartup;
            BSJ.EngineVersionIndex        = mainWindow.EngineVersionSelection.SelectedIndex;
            BSJ.SetupBatFile       = mainWindow.SetupBatFilePath.Text;
            BSJ.AutomationToolPath = mainWindow.AutomationToolPath.Text;
            BSJ.CustomBuildFile    = mainWindow.CustomBuildXMLFile.Text;
            BSJ.GameConfigurations = mainWindow.GameConfigurations.Text;
            BSJ.CustomOptions      = mainWindow.CustomOptions.Text;
            BSJ.AnalyticsOverride  = mainWindow.AnalyticsOverride.Text;

            BSJ.GitDependencyAll             = (bool)mainWindow.bGitSyncAll.IsChecked;
            BSJ.GitDependencyThreads         = Convert.ToInt32(mainWindow.GitNumberOfThreads.Text);
            BSJ.GitDependencyMaxRetries      = Convert.ToInt32(mainWindow.GitNumberOfRetries.Text);
            BSJ.GitDependencyProxy           = "";
            BSJ.GitDependencyCache           = mainWindow.GitCachePath.Text;
            BSJ.GitDependencyCacheMultiplier = Convert.ToDouble(mainWindow.GitCacheMultiplier.Text);
            BSJ.GitDependencyCacheDays       = Convert.ToInt32(mainWindow.GitCacheDays.Text);
            BSJ.GitDependencyEnableCache     = (bool)mainWindow.bGitEnableCache.IsChecked;

            BSJ.bHostPlatformOnly       = (bool)mainWindow.bHostPlatformOnly.IsChecked;
            BSJ.bHostPlatformEditorOnly = (bool)mainWindow.bHostPlatformEditorOnly.IsChecked;
            BSJ.bWithWin64        = (bool)mainWindow.bWithWin64.IsChecked;
            BSJ.bWithWin32        = (bool)mainWindow.bWithWin32.IsChecked;
            BSJ.bWithMac          = (bool)mainWindow.bWithMac.IsChecked;
            BSJ.bWithLinux        = (bool)mainWindow.bWithLinux.IsChecked;
            BSJ.bWithLinuxAArch64 = (bool)mainWindow.bWithLinuxAArch64.IsChecked;
            BSJ.bWithAndroid      = (bool)mainWindow.bWithAndroid.IsChecked;
            BSJ.bWithIOS          = (bool)mainWindow.bWithIOS.IsChecked;
            BSJ.bWithHTML5        = (bool)mainWindow.bWithHTML5.IsChecked;
            BSJ.bWithTVOS         = (bool)mainWindow.bWithTVOS.IsChecked;
            BSJ.bWithSwitch       = (bool)mainWindow.bWithSwitch.IsChecked;
            BSJ.bWithPS4          = (bool)mainWindow.bWithPS4.IsChecked;
            BSJ.bWithXboxOne      = (bool)mainWindow.bWithXboxOne.IsChecked;
            BSJ.bWithLumin        = (bool)mainWindow.bWithLumin.IsChecked;
            BSJ.bWithHoloLens     = (bool)mainWindow.bWithHololens.IsChecked;

            BSJ.bWithDDC                 = (bool)mainWindow.bWithDDC.IsChecked;
            BSJ.bHostPlatformDDCOnly     = (bool)mainWindow.bHostPlatformDDCOnly.IsChecked;
            BSJ.bSignExecutables         = (bool)mainWindow.bSignExecutables.IsChecked;
            BSJ.bEnableSymStore          = (bool)mainWindow.bEnableSymStore.IsChecked;
            BSJ.bWithFullDebugInfo       = (bool)mainWindow.bWithFullDebugInfo.IsChecked;
            BSJ.bCleanBuild              = (bool)mainWindow.bCleanBuild.IsChecked;
            BSJ.bWithServer              = (bool)mainWindow.bWithServer.IsChecked;
            BSJ.bWithClient              = (bool)mainWindow.bWithClient.IsChecked;
            BSJ.bCompileDatasmithPlugins = (bool)mainWindow.bCompileDatasmithPlugins.IsChecked;
            BSJ.bVS2019                 = (bool)mainWindow.bVS2019.IsChecked;
            BSJ.bShutdownPC             = (bool)mainWindow.bShutdownWindows.IsChecked;
            BSJ.bShutdownIfBuildSuccess = (bool)mainWindow.bShutdownIfSuccess.IsChecked;
            BSJ.bContinueToEngineBuild  = (bool)mainWindow.bContinueToEngineBuild.IsChecked;

            BSJ.bZipEngineBuild           = (bool)mainWindow.bZipBuild.IsChecked;
            BSJ.bZipEngineDebug           = (bool)mainWindow.bIncludeDEBUG.IsChecked;
            BSJ.bZipEngineDocumentation   = (bool)mainWindow.bIncludeDocumentation.IsChecked;
            BSJ.bZipEngineExtras          = (bool)mainWindow.bIncludeExtras.IsChecked;
            BSJ.bZipEngineFastCompression = (bool)mainWindow.bFastCompression.IsChecked;
            BSJ.bZipEngineFeaturePacks    = (bool)mainWindow.bIncludeFeaturePacks.IsChecked;
            BSJ.bZipEnginePDB             = (bool)mainWindow.bIncludePDB.IsChecked;
            BSJ.bZipEngineSamples         = (bool)mainWindow.bIncludeSamples.IsChecked;
            BSJ.bZipEngineSource          = (bool)mainWindow.bIncludeSource.IsChecked;
            BSJ.bZipEngineTemplates       = (bool)mainWindow.bIncludeTemplates.IsChecked;
            BSJ.ZipEnginePath             = mainWindow.ZipPath.Text;

            List <GitPlatform>     GitPlatformList    = mainWindow.SettingsJSON.GitDependencyPlatforms;
            IEnumerable <CheckBox> ComboBoxCollection = GetChildrenOfType <CheckBox>(mainWindow.PlatformStackPanelMain);

            foreach (GitPlatform gp in GitPlatformList)
            {
                string ComboBoxName = $"Git{gp.Name}Platform";
                foreach (CheckBox c in ComboBoxCollection)
                {
                    if (c.Name.ToLower() == ComboBoxName.ToLower())
                    {
                        gp.bIsIncluded = (bool)c.IsChecked;
                        break;
                    }
                }
            }
            BSJ.GitDependencyPlatforms = GitPlatformList;

            string JsonOutput = JsonConvert.SerializeObject(BSJ, Formatting.Indented);

            File.WriteAllText(PROGRAM_SETTINGS_PATH, JsonOutput);
            LogEntry logEntry = new LogEntry();

            logEntry.Message = $"New Settings file written to {PROGRAM_SETTINGS_PATH}.";
            mainWindow.LogControl.AddLogEntry(logEntry, LogViewer.EMessageType.Info);
        }
예제 #5
0
        private static BuilderSettingsJson GenerateDefaultSettingsJSON()
        {
            BuilderSettingsJson BSJ = new BuilderSettingsJson();

            BSJ.Theme = "Dark";
            BSJ.bCheckForUpdatesAtStartup             = true;
            BSJ.bEnableDDCMessages                    = true;
            BSJ.bEnableEngineBuildConfirmationMessage = true;
            BSJ.bShowHTML5DeprecatedMessage           = true;
            BSJ.bShowConsoleDeprecatedMessage         = true;

            BSJ.EngineVersionIndex = 0;
            BSJ.SetupBatFile       = null;
            BSJ.AutomationToolPath = null;
            BSJ.CustomBuildFile    = null;
            BSJ.GameConfigurations = "Development;Shipping";
            BSJ.CustomOptions      = null;
            BSJ.AnalyticsOverride  = null;

            BSJ.GitDependencyAll       = true;
            BSJ.GitDependencyPlatforms = new List <GitPlatform> {
                new GitPlatform("Win64", true),
                new GitPlatform("Win32", true),
                new GitPlatform("Linux", false),
                new GitPlatform("Android", false),
                new GitPlatform("Mac", false),
                new GitPlatform("IOS", false),
                new GitPlatform("TVOS", false),
                new GitPlatform("HoloLens", false),
                new GitPlatform("Lumin", false)
            };
            BSJ.GitDependencyThreads         = 4;
            BSJ.GitDependencyMaxRetries      = 4;
            BSJ.GitDependencyProxy           = "";
            BSJ.GitDependencyCache           = DEFAULT_GIT_CUSTOM_CACHE_PATH;
            BSJ.GitDependencyCacheMultiplier = 2.0;
            BSJ.GitDependencyCacheDays       = 7;
            BSJ.GitDependencyEnableCache     = true;

            BSJ.bHostPlatformOnly       = false;
            BSJ.bHostPlatformEditorOnly = false;
            BSJ.bWithWin64        = true;
            BSJ.bWithWin32        = true;
            BSJ.bWithMac          = false;
            BSJ.bWithLinux        = false;
            BSJ.bWithLinuxAArch64 = false;
            BSJ.bWithAndroid      = false;
            BSJ.bWithIOS          = false;
            BSJ.bWithHTML5        = false;
            BSJ.bWithTVOS         = false;
            BSJ.bWithSwitch       = false;
            BSJ.bWithPS4          = false;
            BSJ.bWithXboxOne      = false;
            BSJ.bWithLumin        = false;
            BSJ.bWithHoloLens     = false;

            BSJ.bWithDDC                 = true;
            BSJ.bHostPlatformDDCOnly     = true;
            BSJ.bSignExecutables         = false;
            BSJ.bEnableSymStore          = false;
            BSJ.bWithFullDebugInfo       = false;
            BSJ.bCleanBuild              = false;
            BSJ.bWithServer              = false;
            BSJ.bWithClient              = false;
            BSJ.bCompileDatasmithPlugins = false;
            BSJ.bVS2019                 = false;
            BSJ.bShutdownPC             = false;
            BSJ.bShutdownIfBuildSuccess = false;
            BSJ.bContinueToEngineBuild  = true;

            BSJ.bZipEngineBuild           = false;
            BSJ.bZipEngineDebug           = false;
            BSJ.bZipEngineDocumentation   = true;
            BSJ.bZipEngineExtras          = true;
            BSJ.bZipEngineFastCompression = true;
            BSJ.bZipEngineFeaturePacks    = true;
            BSJ.bZipEnginePDB             = true;
            BSJ.bZipEngineSamples         = true;
            BSJ.bZipEngineSource          = true;
            BSJ.bZipEngineTemplates       = true;
            BSJ.ZipEnginePath             = "";

            string JsonOutput = JsonConvert.SerializeObject(BSJ, Formatting.Indented);

            File.WriteAllText(PROGRAM_SETTINGS_PATH, JsonOutput);
            LogEntry logEntry = new LogEntry();

            logEntry.Message = $"New Settings file written to {PROGRAM_SETTINGS_PATH}.";
            ((MainWindow)Application.Current.MainWindow).LogControl.AddLogEntry(logEntry, LogViewer.EMessageType.Info);
            ((MainWindow)Application.Current.MainWindow).OpenSettingsBtn.IsEnabled = true;
            return(JsonConvert.DeserializeObject <BuilderSettingsJson>(JsonOutput));
        }