/// <summary> /// TODO /// </summary> public TreeViewModel(RefreshType refreshType, HashSet <Severity> severities) { DataService dataService = DataService.Instance; bool failed = false; RaisePropertyChanged("SelectedKey"); switch (refreshType) { case RefreshType.Hard: { dataService.Refresh(true); break; } case RefreshType.Soft: { dataService.Refresh(false); break; } } //failed = dataService.isFail(); this.Artifacts = new ObservableCollection <ArtifactViewModel>(); dataService.Severities = severities; foreach (string key in dataService.RootElements) { Artifacts.Add(new ArtifactViewModel(key)); } }
public void InventoryUpdate() { Weapons.Clear(); Artifacts.Clear(); Spells.Clear(); Treasure.Clear(); foreach (var gameItem in _inventory) { if (gameItem is Weapon) { Weapons.Add(gameItem); //1000 } if (gameItem is Artifact) { Artifacts.Add(gameItem); //2000 } if (gameItem is Spell) { Spells.Add(gameItem); //3000 } if (gameItem is Treasure) { Treasure.Add(gameItem); //4000 } } }
/// <summary> /// Initializes a new instance of the <see cref="DebuggingHandler"/> class. /// </summary> /// <param name="events">The <see cref="IArtifactMapper{T}" /> for <see cref="IEvent" />.</param> /// <param name="eventStore">The <see cref="IEventStore" />..</param> public DebuggingHandler(IArtifactMapper <IEvent> events, IEventStore eventStore) { _eventStore = eventStore; foreach (var @event in events.Artifacts) { Artifacts.Add(events.GetPathFor(@event), @event); } }
/// <summary> /// Initializes a new instance of the <see cref="DebuggingHandler"/> class. /// </summary> /// <param name="commands">The <see cref="IArtifactMapper{ICommand}"/> that discovers and maps all <see cref="ICommand"/>.</param> /// <param name="commandCoordinator">write somethingehre.</param> public DebuggingHandler(IArtifactMapper <ICommand> commands, ICommandCoordinator commandCoordinator) { _commands = commands; _commandCoordinator = commandCoordinator; foreach (var command in _commands.Artifacts) { Artifacts.Add(_commands.GetPathFor(command), command); } }
/// <summary> /// Initializes a new instance of the <see cref="DebuggingHandler"/> class. /// </summary> /// <param name="queries">me the qwuer.</param> /// <param name="queryCoordinator">me thq qvuer cord.</param> public DebuggingHandler(IArtifactMapper <IQuery> queries, IQueryCoordinator queryCoordinator) { _queries = queries; _queryCoordinator = queryCoordinator; foreach (var query in _queries.Artifacts) { Artifacts.Add(_queries.GetPathFor(query), query); } }
public void AddArtifact(String name, String val) { if (Artifacts == null) { Artifacts = new Dictionary <string, string>(); } Artifacts.Add(name, val); RaisePropertyChanged("Artifacts"); RaisePropertyChanged("Text"); }
public void PresetParty5() { // Offense Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Wizard()); Party.Add(SlayerRecruit.Wizard()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicArrows()); Artifacts.Add(SlayerArtifact.MagicStaff()); }
public void PresetParty7() { // Magicly Enhanced Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicArmour()); Artifacts.Add(SlayerArtifact.MagicSword()); Artifacts.Add(SlayerArtifact.MagicStaff()); Artifacts.Add(SlayerArtifact.MagicScrolls()); }
public void PresetParty3() { // Magic Avengers Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Wizard()); Party.Add(SlayerRecruit.Wizard()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicArmour()); Artifacts.Add(SlayerArtifact.MagicScrolls()); Artifacts.Add(SlayerArtifact.MagicStaff()); }
public void PresetParty9() { // Ranged Attacks Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Wizard()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicArrows()); }
public void PresetParty2() { // Swords & Arrows Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Archer()); Artifacts.Add(SlayerArtifact.MagicArrows()); Artifacts.Add(SlayerArtifact.MagicSword()); }
public void PresetParty6() { // Rejuvinators Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicPotion()); }
public void PresetParty4() { // Balanced Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Wizard()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicPotion()); Artifacts.Add(SlayerArtifact.MagicStaff()); }
public void PresetParty11() { // Nothing Special Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Archer()); Party.Add(SlayerRecruit.Wizard()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicStaff()); Artifacts.Add(SlayerArtifact.MagicScrolls()); }
public void PresetParty12() { // Sword Force! Party.Clear(); Artifacts.Clear(); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.Warrior()); Party.Add(SlayerRecruit.Wizard()); Artifacts.Add(SlayerArtifact.MagicArmour()); Artifacts.Add(SlayerArtifact.MagicSword()); Artifacts.Add(SlayerArtifact.MagicPotion()); }
public void Load(RefreshType refreshType, HashSet <Severity> severities) { DataService dataService = DataService.Instance; RaisePropertyChanged("SelectedKey"); try { String solutionDir = GetSolutionDir(); if (String.IsNullOrWhiteSpace(solutionDir)) { return; } XrayVersion xrayVersion = HttpUtils.GetVersion(); if (!XrayUtil.IsXrayVersionCompatible(xrayVersion.xray_version)) { String errorMessage = "ERROR: Unsupported Xray version: " + xrayVersion.xray_version + ", version " + XrayUtil.MIN_XRAY_VERSION + " or above required."; OutputLog.ShowMessage(errorMessage); return; } // Steps to run: // Trigger CLI to collect json info to a file // Read the info // Send dependencies to Xray // Get response and build the dependencies tree // Running CLI - this is the returned output. String returnedText = Util.GetCLIOutput(solutionDir); // Load projects from output Projects projects = Util.LosdNugetProjects(returnedText); if (projects.projects == null || projects.projects.Length == 0) { OutputLog.ShowMessage("No projects were found."); return; } List <Components> components = new List <Components>(); Artifacts artifacts = null; switch (refreshType) { case RefreshType.Hard: { // Get information for all dependencies. Ignore the cache artifacts = dataService.RefreshArtifacts(true, projects); break; } case RefreshType.Soft: { // Get information only for the delta. Means only new dependencies will be added. artifacts = dataService.RefreshArtifacts(false, projects); break; } } dataService.Severities = severities; dataService.populateRootElements(projects); this.Artifacts = new ObservableCollection <ArtifactViewModel>(); foreach (string key in dataService.RootElements) { Artifacts.Add(new ArtifactViewModel(key)); } } catch (IOException ioe) { dataService.ClearAllComponents(); OutputLog.ShowMessage(ioe.Message); OutputLog.ShowMessage(ioe.StackTrace); } catch (HttpRequestException he) { dataService.ClearAllComponents(); OutputLog.ShowMessage(he.Message); OutputLog.ShowMessage(he.StackTrace); } }
public void Highlight(string text, Rectangle bufferedElementRectangle, Color backgroundColor, Color lineColor) { Artifacts.Add(new Artifact(text, bufferedElementRectangle, backgroundColor, lineColor)); }
public void RandomParty() { Party.Clear(); Artifacts.Clear(); for (var i = 0; i < 8; i++) { switch (Dice.Roll(1, 6)) { case 1: Party.Add(SlayerRecruit.Wizard()); break; case 2: Party.Add(SlayerRecruit.Warrior()); break; case 3: Party.Add(SlayerRecruit.Archer()); break; case 4: Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); break; case 5: Artifacts.Add(SlayerArtifact.RandomArtifact()); break; case 6: if (!Party.Any(_ => _.Type == ERecruitType.MenAtArms)) { Party.Add(SlayerRecruit.MenAtArms()); Party.Add(SlayerRecruit.MenAtArms()); } else if (!Party.Any(_ => _.Type == ERecruitType.Warrior)) { Party.Add(SlayerRecruit.Warrior()); } else { switch (Dice.Roll(1, 3)) { case 1: Party.Add(SlayerRecruit.Wizard()); break; case 2: Party.Add(SlayerRecruit.Archer()); break; default: Artifacts.Add(SlayerArtifact.RandomArtifact()); break; } } break; } } }
public async Task LoadAsync(RefreshType refreshType, HashSet <Severity> severities) { this.EnableRefreshButton = false; DataService dataService = DataService.Instance; RaisePropertyChanged("SelectedKey"); try { String solutionDir = await GetSolutionDirAsync(); if (String.IsNullOrWhiteSpace(solutionDir)) { return; } XrayVersion xrayVersion = await HttpUtils.GetVersionAsync(); if (!XrayUtil.IsXrayVersionCompatible(xrayVersion.xray_version)) { String errorMessage = XrayUtil.GetMinimumXrayVersionErrorMessage(xrayVersion.xray_version); await OutputLog.ShowMessageAsync(errorMessage); return; } // Steps to run: // 1. Trigger CLI to collect json info to a file. // 2. Read the info. // 3. Send dependencies to Xray. // 4. Get response and build the dependencies tree. // Running CLI - this is the returned output. String returnedText = await Task.Run(() => Util.GetCLIOutputAsync(solutionDir)); // Load projects from output. Projects projects = Util.LoadNugetProjects(returnedText); if (projects.projects == null || projects.projects.Length == 0) { await OutputLog.ShowMessageAsync("No projects were found."); return; } Artifacts artifacts = null; switch (refreshType) { case RefreshType.Hard: { // Get information for all dependencies. Ignore the cache. artifacts = await dataService.RefreshArtifactsAsync(true, projects); break; } case RefreshType.Soft: { // Get information only for the delta. Means only new dependencies will be added. artifacts = await dataService.RefreshArtifactsAsync(false, projects); break; } } dataService.Severities = severities; dataService.populateRootElements(projects); this.Artifacts = new ObservableCollection <ArtifactViewModel>(); foreach (string key in dataService.RootElements) { Artifacts.Add(new ArtifactViewModel(key)); } } catch (Exception e) { dataService.ClearAllComponents(); await OutputLog.ShowMessageAsync(e.Message); await OutputLog.ShowMessageAsync(e.StackTrace); } finally { this.EnableRefreshButton = true; } }