public void LoadExternalRuleCollections() { ExternalRuleCollections = new List <BestPracticeCollection>(); if (_model != null) { var externalRuleCollectionsJson = _model.GetAnnotation(BPAAnnotationExternalRules); if (externalRuleCollectionsJson != null) { try { var externalRuleFilePaths = JsonConvert.DeserializeObject <List <string> >(externalRuleCollectionsJson); Environment.CurrentDirectory = FileSystemHelper.DirectoryFromPath(UIController.Current.File_Current) ?? Environment.CurrentDirectory; foreach (var filePath in externalRuleFilePaths) { try { if (filePath.StartsWith("http", StringComparison.InvariantCultureIgnoreCase)) { ExternalRuleCollections.Add(BestPracticeCollection.GetCollectionFromUrl(filePath)); } else { ExternalRuleCollections.Add(BestPracticeCollection.GetCollectionFromFile(filePath)); } } catch { } } } catch { } } } }
public void LoadExternalRuleCollections() { ExternalRuleCollections = new List <BestPracticeCollection>(); if (_model != null) { var externalRuleCollectionsJson = _model.GetAnnotation(BPAAnnotationExternalRules); if (externalRuleCollectionsJson != null) { try { var externalRuleFilePaths = JsonConvert.DeserializeObject <List <string> >(externalRuleCollectionsJson); foreach (var filePath in externalRuleFilePaths) { try { if (filePath.StartsWith("http", StringComparison.InvariantCultureIgnoreCase)) { ExternalRuleCollections.Add(BestPracticeCollection.GetCollectionFromUrl(filePath)); } else { ExternalRuleCollections.Add(BestPracticeCollection.GetCollectionFromFile(BasePath, filePath)); } } catch { } } } catch { } } } }
public bool Url() { if (UrlInputDialog.Show(out string url)) { if (!analyzer.ExternalRuleCollections.Any(rc => rc.Url != null && rc.Url.EqualsI(url))) { analyzer.ExternalRuleCollections.Add(BestPracticeCollection.GetCollectionFromUrl(url)); } return(true); } else { return(false); } }