public List <DomainExportType> GetBestExports(DomainVersion version) { // // Check for exact version match // DomainExportVersion found = Exports.SingleOrDefault(v => v.Version == version); if (found != null) { return(found.Types); } // // Else look for the max of all versions less than the specified version // DomainVersion max = Exports.Where(v => v.Version < version).Max(v => v.Version); if (max != null) { found = Exports.Single(v => v.Version == max); return(found.Types); } // // Otherwise just return for the max version // max = Exports.Max(v => v.Version); if (max != null) { found = Exports.Single(v => v.Version == max); return(found.Types); } // // Otherwise there is nothing to return // return(new List <DomainExportType>()); }
private void ReadLocalTLKs() { LocalTalkFiles.Clear(); List <ExportEntry> tlkFileSets = Exports.Where(x => x.ClassName == "BioTlkFileSet" && !x.IsDefaultObject).ToList(); var exportsToLoad = new List <ExportEntry>(); foreach (var tlkFileSet in tlkFileSets) { MemoryStream r = new MemoryStream(tlkFileSet.Data); r.Position = tlkFileSet.propsEnd(); int count = r.ReadInt32(); for (int i = 0; i < count; i++) { int langRef = r.ReadInt32(); r.ReadInt32(); //second half of name string lang = GetNameEntry(langRef); int numTlksForLang = r.ReadInt32(); //I believe this is always 2. Hopefully I am not wrong. int maleTlk = r.ReadInt32(); int femaleTlk = r.ReadInt32(); if (Properties.Settings.Default.TLKLanguage.Equals(lang, StringComparison.InvariantCultureIgnoreCase)) { exportsToLoad.Add(GetUExport(Properties.Settings.Default.TLKGender_IsMale ? maleTlk : femaleTlk)); break; } //r.ReadInt64(); //talkFiles.Add(new TalkFile(pcc, r.ReadInt32(), true, langRef, index)); //talkFiles.Add(new TalkFile(pcc, r.ReadInt32(), false, langRef, index)); } } foreach (var exp in exportsToLoad) { //Debug.WriteLine("Loading local TLK: " + exp.GetIndexedFullPath); LocalTalkFiles.Add(new ME1Explorer.Unreal.Classes.TalkFile(exp)); } }
private void Button_Click(object sender, RoutedEventArgs e) { PublishActions.Clear(); List <Models.Hardware> hardware = new List <Models.Hardware>(); List <Models.Device> devices = new List <Models.Device>(); List <Models.Application> apps = new List <Models.Application>(); List <Models.AppVersion> versions = new List <Models.AppVersion>(); foreach (Models.ExportItem item in Exports.Where(ex => ex.Selected).ToList()) { if (!hardware.Contains(item.Hardware)) { hardware.Add(item.Hardware); } if (!devices.Contains(item.Device)) { devices.Add(item.Device); } if (!apps.Contains(item.App)) { apps.Add(item.App); } if (!versions.Contains(item.Version)) { versions.Add(item.Version); } } PublishActions.Add(new Models.PublishAction() { Text = "Starte Check" }); PublishActions.Add(new Models.PublishAction() { Text = $"{devices.Count} Geräte - {hardware.Count} Hardware - {apps.Count} Applikationen - {versions.Count} Versionen" }); #region Hardware Check PublishActions.Add(new Models.PublishAction() { Text = "Überprüfe Hardware" }); Regex reg = new Regex("^([0-9a-zA-Z_-]|\\s)+$"); List <string> serials = new List <string>(); var check1 = General.Hardware.GroupBy(h => h.Name).Where(h => h.Count() > 1); foreach (var group in check1) { PublishActions.Add(new Models.PublishAction() { Text = "Hardwarename '" + group.Key + "' wird von " + group.Count() + " Hardware verwendet", State = Models.PublishState.Fail }); } check1 = General.Hardware.GroupBy(h => h.SerialNumber).Where(h => h.Count() > 1); foreach (var group in check1) { PublishActions.Add(new Models.PublishAction() { Text = "Hardwareserial '" + group.Key + "' wird von " + group.Count() + " Hardware verwendet", State = Models.PublishState.Fail }); } check1 = null; var check2 = General.Hardware.Where(h => h.Devices.Count == 0); foreach (var group in check2) { PublishActions.Add(new Models.PublishAction() { Text = "Hardware '" + group.Name + "' hat keine Geräte zugeordnet", State = Models.PublishState.Warning }); } check2 = General.Hardware.Where(h => h.HasApplicationProgram && h.Apps.Count == 0); foreach (var group in check2) { PublishActions.Add(new Models.PublishAction() { Text = "Hardware '" + group.Name + "' hat keine Applikation zugeordnet", State = Models.PublishState.Warning }); } check2 = General.Hardware.Where(h => !h.HasApplicationProgram && h.Apps.Count != 0); foreach (var group in check2) { PublishActions.Add(new Models.PublishAction() { Text = "Hardware '" + group.Name + "' hat Applikation zugeordnet obwohl angegeben ist, dass keine benötigt wird", State = Models.PublishState.Warning }); } check2 = General.Hardware.Where(h => !reg.IsMatch(h.Name)); foreach (var group in check2) { PublishActions.Add(new Models.PublishAction() { Text = "Hardware '" + group.Name + "' hat ungültige Zeichen im Namen", State = Models.PublishState.Fail }); } check2 = null; #endregion #region Applikation Check PublishActions.Add(new Models.PublishAction() { Text = "Überprüfe Applikationen" }); var check3 = General.Applications.GroupBy(h => h.Name).Where(h => h.Count() > 1); foreach (var group in check3) { PublishActions.Add(new Models.PublishAction() { Text = "Applikationsname '" + group.Key + "' wird von " + group.Count() + " Applikationen verwendet", State = Models.PublishState.Fail }); } check3 = null; var check4 = General.Applications.GroupBy(h => h.Number).Where(h => h.Count() > 1); foreach (var group in check4) { PublishActions.Add(new Models.PublishAction() { Text = "Applikations Nummer " + group.Key + " (" + group.Key.ToString("X4") + ") wird von " + group.Count() + " Applikationen verwendet", State = Models.PublishState.Fail }); } check4 = null; foreach (Models.Application app in General.Applications) { var check5 = app.Versions.GroupBy(v => v.Number).Where(l => l.Count() > 1); foreach (var group in check5) { PublishActions.Add(new Models.PublishAction() { Text = "Applikation '" + app.Name + "' verwendet Version " + group.Key + " (" + Math.Floor(group.Key / 16.0) + "." + (group.Key % 16) + ") " + group.Count() + " mal", State = Models.PublishState.Fail }); } } #endregion if (PublishActions.Count(pa => pa.State == Models.PublishState.Fail) > 0) { PublishActions.Add(new Models.PublishAction() { Text = "Erstellen abgebrochen. Es traten Fehler bei der Überprüfung auf.", State = Models.PublishState.Fail }); return; } else { PublishActions.Add(new Models.PublishAction() { Text = "Überprüfung bestanden", State = Models.PublishState.Success }); } PublishActions.Add(new Models.PublishAction() { Text = "Erstellen abgebrochen. Es traten Fehler bei der Überprüfung auf.", State = Models.PublishState.Fail }); }
private void ExportInFilter_TextChanged(object sender, TextChangedEventArgs e) { ExportList.ItemsSource = Exports.Where(i => i.Version.NameText.Contains(ExportInFilter.Text) || i.App.NameText.Contains(ExportInFilter.Text) || i.Hardware.Name.Contains(ExportInFilter.Text) || i.Device.Name.Contains(ExportInFilter.Text)).ToList(); }