private void Load() { if (Settings.Default.UpgradeRequired) { Settings.Default.Upgrade(); Settings.Default.UpgradeRequired = false; Settings.Default.Save(); } LastUnReadUserNotifications = ParseSettings <List <GitHubUserNotification> >(Settings.Default.LastUnReadUserNotifications); LastReadUserNotification = Settings.Default.LastReadUserNotification; NotificationsIntervalCheck = Settings.Default.NotificationsIntervalCheck; StartMinimized = Settings.Default.StartMinimized; ShowNotificationsOnlyOnce = Settings.Default.ShowNotificationsOnlyOnce; DoNotShowDecrementPopups = Settings.Default.DoNotShowDecrementPopups; Repositories = ParseSettings <List <RepositorySettings> >(Settings.Default.Repositories); RepositoryRoot = Settings.Default.RepositoryRoot; if (Repositories == null || !Repositories.Any()) { Repositories = new List <RepositorySettings> { new RepositorySettings("Analogy Log Viewer", "Analogy-LogViewer/Analogy.LogViewer", 15), new RepositorySettings("Analogy Serilog", "Analogy-LogViewer/Analogy.LogViewer.Serilog", 15) }; } }
public IApiRepositoryConfig RegisterRepository <TEntity, TMappedEntity, TRepository>() where TEntity : class, IEntity where TMappedEntity : class where TRepository : IRepository { var fullType = typeof(ApiMappedRepository <TEntity, TMappedEntity>); var alias = AliasHelper.GetRepositoryAlias(fullType); if (Repositories.Any(x => x.Alias == alias)) { throw new NotUniqueException(nameof(TRepository)); } var config = new ApiRepositoryConfig { Alias = alias, EntityType = typeof(TEntity), DatabaseType = typeof(TMappedEntity), RepositoryType = typeof(TRepository), ApiRepositoryType = fullType }; Repositories.Add(config); return(config); }
public bool Exists(string packageId, SemanticVersion version) { // When we're looking for an exact package, we can optimize but searching each // repository one by one until we find the package that matches. Func <IPackageRepository, bool> exists = Wrap(r => r.Exists(packageId, version)); return(Repositories.Any(exists)); }
public void SaveFile() { XmlDocument doc = new XmlDocument(); doc.Load(upfilePath); XmlElement root = doc.DocumentElement; // Set Unity Version root.SelectSingleNode("UnityVersion").InnerText = UnityVersion; // Set Repositories foreach (Repository repo in Repositories) { if (!GetRepositoryOverrides().Any(extraRepo => extraRepo is FileRepository && Uplift.Common.FileSystemUtil.MakePathOSFriendly((extraRepo as FileRepository).Path) == Uplift.Common.FileSystemUtil.MakePathOSFriendly((repo as FileRepository).Path) )) { AddOrReplaceRepository(doc, repo); } } foreach (XmlNode node in root.SelectSingleNode("Repositories").SelectNodes("FileRepository")) { if (!Repositories.Any(repo => (repo as FileRepository).Path == node.Attributes["Path"].Value)) { root.SelectSingleNode("Repositories").RemoveChild(node); } } // Set Configuration SetPathConfiguration(doc, "BaseInstallPath", Configuration.BaseInstallPath); SetPathConfiguration(doc, "DocsPath", Configuration.DocsPath); SetPathConfiguration(doc, "EditorPluginPath", Configuration.EditorPluginPath); SetPathConfiguration(doc, "ExamplesPath", Configuration.ExamplesPath); SetPathConfiguration(doc, "GizmoPath", Configuration.GizmoPath); SetPathConfiguration(doc, "MediaPath", Configuration.MediaPath); SetPathConfiguration(doc, "PluginPath", Configuration.PluginPath); SetPathConfiguration(doc, "RepositoryPath", Configuration.RepositoryPath); SetPathConfiguration(doc, "EditorDefaultResourcePath", Configuration.EditorDefaultResourcePath); // Set Dependencies foreach (DependencyDefinition def in Dependencies) { AddOrReplaceDependency(doc, def); } foreach (XmlNode node in root.SelectSingleNode("Dependencies").SelectNodes("Package")) { if (!Dependencies.Any(def => def.Name == node.Attributes["Name"].Value)) { root.SelectSingleNode("Dependencies").RemoveChild(node); } } doc.Save(upfilePath); }
public override string ToString() { var builder = new StringBuilder(); if (!string.IsNullOrEmpty(Name)) { builder.AppendLine("name: " + Name); } if (Pool != null) { builder.AppendLine(Pool.ToString()); } if (Clean != true) { builder.AppendLine("resources:"); builder.AppendLine("- repo: self"); builder.AppendLine("- clean: " + Clean); builder.AppendLine(); } if (Repositories.Any()) { builder.AppendLine(" repositories:"); foreach (var repo in Repositories) { builder.AppendLine(" - repository: " + repo.Identifier); builder.AppendLine(" type: " + repo.Type); builder.AppendLine(" name: " + repo.Name); } } if (BuildJobs.Count == 1 && string.IsNullOrEmpty(BuildJobs.Single().DisplayName) && string.IsNullOrEmpty(BuildJobs.Single().Name)) { builder.AppendLine("steps: "); foreach (var step in BuildJobs.Single().Steps) { builder.AppendLine(step.ToString()); } } else { foreach (var job in BuildJobs) { builder.AppendLine(job.ToString()); } } var pipeline = builder.ToString(); return(pipeline.TrimEnd('\r', '\n') + Environment.NewLine); }
public bool AllowChanges() => (CustomRepoUrl == null && !Repositories.Any()) || IsOpen || PublishedId != null;
private bool AreAnyTagsSelected() { return(Repositories.Any(r => r.Tags != null && r.Tags.Any(t => t.IsSelected))); }