void PopulateModelFromConfig(ProjectConfig config) { _model.ClearPluginItems(); foreach (var name in config.PluginsFolder) { _model.AddPluginItem(name); } _model.ClearAssetItems(); foreach (var name in config.AssetsFolder) { _model.AddAssetItem(name); } _model.ClearSolutionProjects(); foreach (var name in config.SolutionProjects) { _model.AddVsProject(name); } _model.ClearSolutionFolders(); foreach (var pair in config.SolutionFolders) { _model.AddSolutionFolder(pair.Key, pair.Value); } }
IEnumerator AddAsRegexAsync() { var userInput = _view.PromptForInput("Enter Python Regex below.\n (note: see python documentation for reference)", ".*"); yield return(userInput); if (userInput.Current == null) { // User Cancelled yield break; } Assert.That(!userInput.Current.StartsWith("/"), "When entering the regex, you do not need to prefix it with a slash"); _model.AddVsProject("/" + userInput.Current); }
void PopulateModelFromConfig(ProjectConfig config) { _model.ProjectSettingsPath = config.ProjectSettingsPath; _model.UnityPackagesPath = config.UnityPackagesPath; _model.ClearPluginItems(); foreach (var name in config.PluginsFolder) { _model.AddPluginItem(name); } _model.ClearAssetItems(); foreach (var name in config.AssetsFolder) { _model.AddAssetItem(name); } _model.ClearSolutionProjects(); foreach (var name in config.SolutionProjects) { _model.AddVsProject(name); } _model.ClearPrebuiltProjects(); foreach (var name in config.Prebuilt) { _model.AddPrebuilt(name); } _model.ClearSolutionFolders(); foreach (var pair in config.SolutionFolders) { _model.AddSolutionFolder(pair.Key, pair.Value); } _model.ClearSavedPackageFolders(); foreach (var pair in config.PackageFolders) { _model.AddSavedPackageFolder(pair); } _model.ProjectPlatforms = config.ProjectPlatforms; }
void OnDraggedDroppedListEntries(DragListTypes sourceType, DragListTypes dropType, List <DragListEntry> entries) { switch (dropType) { case DragListTypes.Package: { switch (sourceType) { case DragListTypes.PluginItem: { foreach (var entry in entries) { var name = (string)entry.Model; _model.RemovePluginItem(name); } break; } case DragListTypes.AssetItem: { foreach (var entry in entries) { var name = (string)entry.Model; _model.RemoveAssetItem(name); } break; } case DragListTypes.Release: { _asyncProcessor.Process( InstallReleasesAsync( entries.Select(x => (ReleaseInfo)x.Model).ToList()), true, "Installing Releases"); break; } default: { Assert.Throw(); break; } } break; } case DragListTypes.PluginItem: { switch (sourceType) { case DragListTypes.AssetItem: { foreach (var entry in entries) { var name = (string)entry.Model; _model.RemoveAssetItem(name); _model.AddPluginItem(name); } break; } case DragListTypes.PluginItem: { // Do nothing break; } case DragListTypes.Package: { foreach (var entry in entries) { var info = (PackageInfo)entry.Model; if (!_model.HasPluginItem(info.Name)) { if (_model.HasAssetItem(info.Name)) { _model.RemoveAssetItem(info.Name); } _model.AddPluginItem(info.Name); } } break; } default: { Assert.Throw(); break; } } break; } case DragListTypes.AssetItem: { switch (sourceType) { case DragListTypes.AssetItem: { // Do nothing break; } case DragListTypes.PluginItem: { foreach (var entry in entries) { var name = (string)entry.Model; _model.RemovePluginItem(name); _model.AddAssetItem(name); } break; } case DragListTypes.Package: { foreach (var entry in entries) { var info = (PackageInfo)entry.Model; if (!_model.HasAssetItem(info.Name)) { if (_model.HasPluginItem(info.Name)) { _model.RemovePluginItem(info.Name); } _model.AddAssetItem(info.Name); } } break; } default: { Assert.Throw(); break; } } break; } case DragListTypes.Release: { // nothing can drag to releases break; } case DragListTypes.VsSolution: { if (sourceType == DragListTypes.AssetItem || sourceType == DragListTypes.PluginItem) { foreach (var entry in entries) { var name = (string)entry.Model; if (!_model.HasVsProject(name)) { _model.AddVsProject(name); } } } break; } default: { Assert.Throw(); break; } } }