public void LoadConfiguration() { EditorConfig = LoadEditorConfiguration(EditorConfigurationFilePath); EngineConfig = LoadEngineConfiguration(EngineConfigurationFilePath); // Copy of fields from EditorConfig and EngineConfig for holding unsaved values set in the UI. CloudCredentialsFileName = EditorConfig.cloudCredentialsFileName; AssetBundleFileName = EditorConfig.assetBundleFileName; CloudStorageBucketName = EditorConfig.cloudStorageBucketName; CloudStorageObjectName = EditorConfig.cloudStorageObjectName; AssetBundleUrl = EngineConfig.assetBundleUrl; }
public void TestLoadingEngineConfiguration() { var quickDeployConfig = new QuickDeployConfig(); var inputConfig = new LoadingScreenConfig.EngineConfiguration { assetBundleUrl = "testurl" }; File.WriteAllText(TestConfigurationPath, JsonUtility.ToJson(inputConfig)); var outputConfig = quickDeployConfig.LoadEngineConfiguration(TestConfigurationPath); Assert.AreEqual(inputConfig.assetBundleUrl, outputConfig.assetBundleUrl); }
public void TestSavingConfigOnLoadingScreenWithEmptyString() { var quickDeployConfig = new QuickDeployConfig { AssetBundleUrl = "" }; var inputConfig = new LoadingScreenConfig.EngineConfiguration(); quickDeployConfig.SaveEngineConfiguration(QuickDeployWindow.ToolBarSelectedButton.LoadingScreen, inputConfig, TestConfigurationPath); var outputConfigurationJson = File.ReadAllText(TestConfigurationPath); var outputConfig = JsonUtility.FromJson <LoadingScreenConfig.EngineConfiguration>(outputConfigurationJson); Assert.IsEmpty(outputConfig.assetBundleUrl); }
// Visible for testing internal void SaveEngineConfiguration(QuickDeployWindow.ToolBarSelectedButton currentTab, LoadingScreenConfig.EngineConfiguration configuration, string engineConfigurationPath) { switch (currentTab) { case QuickDeployWindow.ToolBarSelectedButton.LoadingScreen: configuration.assetBundleUrl = AssetBundleUrl; break; default: throw new ArgumentOutOfRangeException("currentTab", currentTab, "Can't save engine configurations from this tab."); } Directory.CreateDirectory(ResourcesDirectoryPath); // Shouldn't hurt to write to persistent storage as long as SaveEngineConfiguration(currentTab) is only called // when a major action happens. File.WriteAllText(engineConfigurationPath, JsonUtility.ToJson(configuration)); }