//---------------------------------------------------------------------------// // output 1- or 2-dice encounter tables //---------------------------------------------------------------------------// protected void PrintTable(TextWriter sw, int dice, UWP uwp) { // initialise counter to iterate through the arrays cr_count = 0; PrintRegion(sw, dice, "Clear, Road, Open", uwp); PrintRegion(sw, dice, "Prairie, Plain, Steppe", uwp); PrintRegion(sw, dice, "Rough, Hills, Foothills", uwp); PrintRegion(sw, dice, "Broken, Badlands", uwp); PrintRegion(sw, dice, "Mountain, Alpine", uwp); PrintRegion(sw, dice, "Forest, Woods", uwp); PrintRegion(sw, dice, "Jungle, Rainforest", uwp); PrintRegion(sw, dice, "River, Stream, Creek", uwp); PrintRegion(sw, dice, "Swamp, Bog", uwp); PrintRegion(sw, dice, "Marsh, Wetland", uwp); PrintRegion(sw, dice, "Desert, Dunes", uwp); PrintRegion(sw, dice, "Beach, Shore, Sea Edge", uwp); PrintRegion(sw, dice, "Surface, Ocean, Sea", uwp); PrintRegion(sw, dice, "Shallows, Ocean, Sea", uwp); if (uwp.Hydro.Value > 0) { PrintRegion(sw, dice, "Depths, Ocean, Sea", uwp); PrintRegion(sw, dice, "Bottom, Ocean, Sea", uwp); } PrintRegion(sw, dice, "Sea Cave, Sea Cavern", uwp); PrintRegion(sw, dice, "Sargasso, Seaweed", uwp); PrintRegion(sw, dice, "Ruins, Old City", uwp); PrintRegion(sw, dice, "Cave, Cavern", uwp); PrintRegion(sw, dice, "Chasm, Crevass. Abyss", uwp); PrintRegion(sw, dice, "Crater, Hollow", uwp); }
//---------------------------------------------------------------------------// // output 1- or 2-dice encounter tables for a named region //---------------------------------------------------------------------------// protected void PrintRegion(TextWriter sw, int dice, string name, UWP uwp) { sw.WriteLine(); sw.WriteLine("{0,65} UPP {1,6}", name, uwp.PhysicalUWP()); sw.WriteLine("Die Animal Weight Hits Armour Weapons Wounds"); if (dice == 1) { PrintCritter(sw, 1); PrintCritter(sw, 2); PrintCritter(sw, 3); PrintCritter(sw, 4); PrintCritter(sw, 5); PrintCritter(sw, 6); } else { PrintCritter(sw, 2); PrintCritter(sw, 3); PrintCritter(sw, 4); PrintCritter(sw, 5); PrintCritter(sw, 6); PrintCritter(sw, 7); PrintCritter(sw, 8); PrintCritter(sw, 9); PrintCritter(sw, 10); PrintCritter(sw, 11); PrintCritter(sw, 12); } }
private void XmlRegion(System.Xml.XmlNode parent, int dice, string name, UWP uwp) { System.Xml.XmlElement region = parent.OwnerDocument.CreateElement("Region"); System.Xml.XmlElement nameEle = parent.OwnerDocument.CreateElement("name"); nameEle.InnerText = name; region.AppendChild(nameEle); if (dice == 1) { XmlCritter(region, 1); XmlCritter(region, 2); XmlCritter(region, 3); XmlCritter(region, 4); XmlCritter(region, 5); XmlCritter(region, 6); } else { XmlCritter(region, 2); XmlCritter(region, 3); XmlCritter(region, 4); XmlCritter(region, 5); XmlCritter(region, 6); XmlCritter(region, 7); XmlCritter(region, 8); XmlCritter(region, 9); XmlCritter(region, 10); XmlCritter(region, 11); XmlCritter(region, 12); } parent.AppendChild(region); }
//---------------------------------------------------------------------------// // generate 1- or 2-dice encounter tables //---------------------------------------------------------------------------// protected void GenerateTable(int dice, UWP uwp) { GenerateRegion(dice, "Clear, Road, Open", uwp, 3, 0, 0); GenerateRegion(dice, "Prairie, Plain, Steppe", uwp, 4, 0, 0); GenerateRegion(dice, "Rough, Hills, Foothills", uwp, 0, 0, 0); GenerateRegion(dice, "Broken, Badlands", uwp, -3, -3, 0); GenerateRegion(dice, "Mountain, Alpine", uwp, 0, 0, 0); GenerateRegion(dice, "Forest, Woods", uwp, -4, -4, 0); GenerateRegion(dice, "Jungle, Rainforest", uwp, -3, -2, 0); GenerateRegion(dice, "River, Stream, Creek", uwp, 1, 1, 3); GenerateRegion(dice, "Swamp, Bog", uwp, -2, 4, 5); GenerateRegion(dice, "Marsh, Wetland", uwp, 0, -1, 2); GenerateRegion(dice, "Desert, Dunes", uwp, 3, -3, 0); GenerateRegion(dice, "Beach, Shore, Sea Edge", uwp, 3, 2, 1); GenerateRegion(dice, "Surface, Ocean, Sea", uwp, 2, 3, 4); GenerateRegion(dice, "Shallows, Ocean, Sea", uwp, 2, 2, 4); if (uwp.Hydro.Value > 0) { GenerateRegion(dice, "Depths, Ocean, Sea", uwp, 2, 4, 4); GenerateRegion(dice, "Bottom, Ocean, Sea", uwp, -4, 0, 4); } GenerateRegion(dice, "Sea Cave, Sea Cavern", uwp, -2, 0, 4); GenerateRegion(dice, "Sargasso, Seaweed", uwp, -4, -2, 4); GenerateRegion(dice, "Ruins, Old City", uwp, -3, 0, 0); GenerateRegion(dice, "Cave, Cavern", uwp, -4, 1, 0); GenerateRegion(dice, "Chasm, Crevass. Abyss", uwp, -1, -3, 0); GenerateRegion(dice, "Crater, Hollow", uwp, 0, -1, 0); }
//---------------------------------------------------------------------------// // generate 1- or 2-dice encounter tables for a named region //---------------------------------------------------------------------------// protected void GenerateRegion(int dice, string name, UWP uwp, int typeDM, int sizeDM, int special) { //printf("\n%-60s UPP %-6s\n",name,upp); //printf("Die Animal Weight Hits Armour Weapons Wounds\n"); if (dice == 1) { GenerateCritter(1, "S", uwp, typeDM, sizeDM, special); GenerateCritter(2, "H", uwp, typeDM, sizeDM, special); GenerateCritter(3, "H", uwp, typeDM, sizeDM, special); GenerateCritter(4, "H", uwp, typeDM, sizeDM, special); GenerateCritter(5, "O", uwp, typeDM, sizeDM, special); GenerateCritter(6, "C", uwp, typeDM, sizeDM, special); } else { GenerateCritter(2, "S", uwp, typeDM, sizeDM, special); GenerateCritter(3, "O", uwp, typeDM, sizeDM, special); GenerateCritter(4, "S", uwp, typeDM, sizeDM, special); GenerateCritter(5, "O", uwp, typeDM, sizeDM, special); GenerateCritter(6, "H", uwp, typeDM, sizeDM, special); GenerateCritter(7, "H", uwp, typeDM, sizeDM, special); GenerateCritter(8, "H", uwp, typeDM, sizeDM, special); GenerateCritter(9, "C", uwp, typeDM, sizeDM, special); GenerateCritter(10, "E", uwp, typeDM, sizeDM, special); GenerateCritter(11, "C", uwp, typeDM, sizeDM, special); GenerateCritter(12, "C", uwp, typeDM, sizeDM, special); } }
public void WriteToXML(System.Xml.XmlNode parent) { // initialise counter to iterate through the arrays cr_count = 0; int dice = _tsize; UWP upp = _upp; XmlRegion(parent, dice, "Clear, Road, Open", upp); XmlRegion(parent, dice, "Prairie, Plain, Steppe", upp); XmlRegion(parent, dice, "Rough, Hills, Foothills", upp); XmlRegion(parent, dice, "Broken, Badlands", upp); XmlRegion(parent, dice, "Mountain, Alpine", upp); XmlRegion(parent, dice, "Forest, Woods", upp); XmlRegion(parent, dice, "Jungle, Rainforest", upp); XmlRegion(parent, dice, "River, Stream, Creek", upp); XmlRegion(parent, dice, "Swamp, Bog", upp); XmlRegion(parent, dice, "Marsh, Wetland", upp); XmlRegion(parent, dice, "Desert, Dunes", upp); XmlRegion(parent, dice, "Beach, Shore, Sea Edge", upp); XmlRegion(parent, dice, "Surface, Ocean, Sea", upp); XmlRegion(parent, dice, "Shallows, Ocean, Sea", upp); if (upp.Hydro.Value > 0) { XmlRegion(parent, dice, "Depths, Ocean, Sea", upp); XmlRegion(parent, dice, "Bottom, Ocean, Sea", upp); } XmlRegion(parent, dice, "Sea Cave, Sea Cavern", upp); XmlRegion(parent, dice, "Sargasso, Seaweed", upp); XmlRegion(parent, dice, "Ruins, Old City", upp); XmlRegion(parent, dice, "Cave, Cavern", upp); XmlRegion(parent, dice, "Chasm, Crevass. Abyss", upp); XmlRegion(parent, dice, "Crater, Hollow", upp); }
public void OnPackageInstalling(PackageCatalog p, PackageInstallingEventArgs args) { if (args.IsComplete) { try { var packageWrapper = PackageWrapper.GetWrapperFromPackage(args.Package); if (!string.IsNullOrEmpty(packageWrapper.InstalledLocation)) { var uwp = new UWP(packageWrapper); uwp.InitializeAppInfo(packageWrapper.InstalledLocation); foreach (var app in uwp.Apps) { Add(app); } } } // InitializeAppInfo will throw if there is no AppxManifest.xml for the package. // Note there are sometimes multiple packages per product and this doesn't necessarily mean that we haven't found the app. // eg. "Could not find file 'C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminalPreview_2020.616.45.0_neutral_~_8wekyb3d8bbwe\\AppxManifest.xml'." catch (System.IO.FileNotFoundException e) { ProgramLogger.Exception(e.Message, e, GetType(), args.Package.InstalledLocation.ToString()); } } }
static void Main(string[] args) { UWP uwp = new UWP(); uwp.Atmosphere.Value = 7; uwp.Hydro.Value = 7; uwp.Size.Value = 7; int tsize = 2; bool cepheus = true; foreach (string arg in args) { if (arg.Length > 0) { if (arg[0].ToString().Equals("/")) { if (arg.Length > 1) { tsize = int.Parse(arg[1].ToString()); if (tsize != 1 && tsize != 2) { throw new ArgumentException("Invalid table size"); } } } else { // it's a UPP if (arg.Length > 0) { uwp.Size.Value = int.Parse(arg[0].ToString(), System.Globalization.NumberStyles.HexNumber); } if (arg.Length > 1) { uwp.Atmosphere.Value = int.Parse(arg[1].ToString(), System.Globalization.NumberStyles.HexNumber); } if (arg.Length > 2) { uwp.Hydro.Value = int.Parse(arg[2].ToString(), System.Globalization.NumberStyles.HexNumber); } } } } if (!cepheus) { TableGenerator table = new TableGenerator(); table.Generate(tsize, uwp); table.WriteStreamAsText(Console.Out); } else { var tg = new Cepheus.TableGenerator(); var tables = tg.Generate(tsize, uwp); foreach (var t in tables) { t.WriteStreamAsText(Console.Out); } } }
public static void IndexPrograms() { Win32[] w = { }; UWP.Application[] u = { }; var t1 = Task.Run(() => { w = Win32.All(_settings); }); var t2 = Task.Run(() => { u = UWP.All(); }); Task.WaitAll(t1, t2); var characters = w.Select(p => p.Name) .Concat(w.Select(p => p.Description)) .Concat(u.Select(p => p.DisplayName)) .Concat(u.Select(p => p.Description)); Parallel.ForEach(characters, c => { if (!string.IsNullOrWhiteSpace(c) && Alphabet.ContainsChinese(c)) { Alphabet.PinyinComination(c); } }); lock (IndexLock) { _win32s = w; _uwps = u; } }
private Encounters GetEncounters(int tsize, UWP uwp) { var encounters = new Encounters(); cr_count = 0; encounters.Regions.Add(GetRegion(tsize, "Clear, Road, Open")); encounters.Regions.Add(GetRegion(tsize, "Prairie, Plain, Steppe")); encounters.Regions.Add(GetRegion(tsize, "Rough, Hills, Foothills")); encounters.Regions.Add(GetRegion(tsize, "Broken, Badlands")); encounters.Regions.Add(GetRegion(tsize, "Mountain, Alpine")); encounters.Regions.Add(GetRegion(tsize, "Forest, Woods")); encounters.Regions.Add(GetRegion(tsize, "Jungle, Rainforest")); encounters.Regions.Add(GetRegion(tsize, "River, Stream, Creek")); encounters.Regions.Add(GetRegion(tsize, "Swamp, Bog")); encounters.Regions.Add(GetRegion(tsize, "Marsh, Wetland")); encounters.Regions.Add(GetRegion(tsize, "Desert, Dunes")); encounters.Regions.Add(GetRegion(tsize, "Beach, Shore, Sea Edge")); encounters.Regions.Add(GetRegion(tsize, "Surface, Ocean, Sea")); encounters.Regions.Add(GetRegion(tsize, "Shallows, Ocean, Sea")); if (uwp.Hydro.Value > 0) { encounters.Regions.Add(GetRegion(tsize, "Depths, Ocean, Sea")); encounters.Regions.Add(GetRegion(tsize, "Bottom, Ocean, Sea")); } encounters.Regions.Add(GetRegion(tsize, "Sea Cave, Sea Cavern")); encounters.Regions.Add(GetRegion(tsize, "Sargasso, Seaweed")); encounters.Regions.Add(GetRegion(tsize, "Ruins, Old City")); encounters.Regions.Add(GetRegion(tsize, "Cave, Cavern")); encounters.Regions.Add(GetRegion(tsize, "Chasm, Crevass. Abyss")); encounters.Regions.Add(GetRegion(tsize, "Crater, Hollow")); return(encounters); }
public static void IndexPrograms() { Win32[] w = { }; UWP.Application[] u = { }; var t1 = Task.Run(() => { w = Win32.All(_settings); }); var t2 = Task.Run(() => { var windows10 = new Version(10, 0); var support = Environment.OSVersion.Version.Major >= windows10.Major; if (support) { u = UWP.All(); } else { u = new UWP.Application[] { }; } }); Task.WaitAll(t1, t2); lock (IndexLock) { _win32s = w; _uwps = u; } }
public static void IndexUWPPrograms() { var windows10 = new Version(10, 0); var support = Environment.OSVersion.Version.Major >= windows10.Major; var applications = support ? UWP.All() : new UWP.Application[] { }; _uwps = applications; }
public Encounters Generate(int tsize, UWP uwp) { _tsize = tsize; _upp = uwp; GenerateTable(tsize, uwp); FindFamily(0); //prtTable(tsize, upp); return(GetEncounters(tsize, uwp)); }
public void OnPackageUninstalling(PackageCatalog p, PackageUninstallingEventArgs args) { if (args.Progress == 0) { //find apps associated with this package. var uwp = new UWP(args.Package); var apps = Items.Where(a => a.Package.Equals(uwp)).ToArray(); foreach (var app in apps) { Remove(app); } } }
public static void IndexPrograms() { var t1 = Task.Run(() => { _win32s = Win32.All(_settings); }); var t2 = Task.Run(() => { _uwps = UWP.All(); }); Task.WaitAll(t1, t2); }
public void Cepheus1D6TableTest() { UWP uwp = new UWP(); uwp.Atmosphere.Value = 7; uwp.Hydro.Value = 7; uwp.Size.Value = 7; var tg = new TableGenerator(); var tables = tg.Generate(1, uwp); foreach (var t in tables) { t.WriteStreamAsText(Console.Out); } }
public List <EncounterTable> Generate(int size, UWP uwp) { List <EncounterTable> tables = new List <EncounterTable>(); EcologicalTypes[] table = twod6Table; if (size == 1) { table = d6Table; } foreach (var t in Terrain.Terrains) { if (t.Region == Regions.Deeps && uwp.Hydro.Value == 0) { continue; } var etable = new EncounterTable() { Region = t.Region }; tables.Add(etable); for (var i = 0; i < table.Length; i++) { if (table[i] != EcologicalTypes.Event) { var st = dice.roll() - 1; Terrain.SubTerrain subTerrain = t.SubTerrains[st]; var c = new Critter(table[i], t.SubtypeDM, t.SizeDM, subTerrain.SizeDM, subTerrain.Motion) { Region = t.Region }; etable.Critters.Add(c); } else { var c = new Critter(); etable.Critters.Add(c); } } } return(tables); }
public void AllShouldNotReturnPackageFrameworksWhenCalled() { // Arrange Main._settings = new ProgramPluginSettings(); List <IPackage> packages = new List <IPackage>() { FrameworkApp, PackagedApp }; var mock = new Mock <IPackageManager>(); mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages); UWP.PackageManagerWrapper = mock.Object; // Act var applications = UWP.All(); // Assert Assert.AreEqual(applications.Length, 1); Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0); }
public static void IndexPrograms() { Win32[] w = { }; UWP.Application[] u = { }; var t1 = Task.Run(() => { w = Win32.All(_settings); }); var t2 = Task.Run(() => { u = UWP.All(); }); Task.WaitAll(t1, t2); lock (IndexLock) { _win32s = w; _uwps = u; } }
public void PowerToysRunShouldNotAddInvalidAppWhenIndexingUWPApplications() { // Arrange PackageWrapper invalidPackagedApp = new PackageWrapper(); Main._settings = new ProgramPluginSettings(); List <IPackage> packages = new List <IPackage>() { invalidPackagedApp }; var mock = new Mock <IPackageManager>(); mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages); UWP.PackageManagerWrapper = mock.Object; // Act var applications = UWP.All(); // Assert Assert.AreEqual(applications.Length, 0); }
public void All_ShouldReturnPackagesWithDevelopmentMode_WhenCalled() { // Arrange Main._settings = new Settings(); List <IPackage> packages = new List <IPackage>() { developmentModeApp, packagedApp }; var mock = new Mock <IPackageManager>(); mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages); UWP.PackageManagerWrapper = mock.Object; // Act var applications = UWP.All(); // Assert Assert.AreEqual(applications.Length, 2); Assert.IsTrue(applications.FindAll(x => x.Name == "DevelopmentApp").Length > 0); Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0); }
public void OnPackageInstalling(PackageCatalog p, PackageInstallingEventArgs args) { if (args.IsComplete) { try { var uwp = new UWP(args.Package); uwp.InitializeAppInfo(args.Package.InstalledLocation.Path); foreach (var app in uwp.Apps) { Add(app); } } //InitializeAppInfo will throw if there is no AppxManifest.xml for the package. //Note there are sometimes multiple packages per product and this doesn't necessarily mean that we haven't found the app. //eg. "Could not find file 'C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminalPreview_2020.616.45.0_neutral_~_8wekyb3d8bbwe\\AppxManifest.xml'." catch (System.IO.FileNotFoundException e) { ProgramLogger.LogException($"|UWP|OnPackageInstalling|{args.Package.InstalledLocation}|{e.Message}", e); } } }
private static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger(); var options = new CommandLineOptions(); // allow app to be debugged in visual studio. if (Debugger.IsAttached) { // args = "--help ".Split(' '); args = "--platform=essentials".Split(' '); // args = new[] // { // "--platform=none", // @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Xamarin.iOS.dll" // }; } // Parse in 'strict mode'; i.e. success or quit if (Parser.Default.ParseArgumentsStrict(args, options)) { try { if (!string.IsNullOrWhiteSpace(options.Template)) { _mustacheTemplate = options.Template; Log.Debug("Using {template} instead of the default template.", _mustacheTemplate); } if (!string.IsNullOrWhiteSpace(options.ReferenceAssemblies)) { _referenceAssembliesLocation = options.ReferenceAssemblies; Log.Debug($"Using {_referenceAssembliesLocation} instead of the default reference assemblies location."); } IPlatform platform = null; switch (options.Platform) { case AutoPlatform.None: if (!options.Assemblies.Any()) { throw new Exception("Assemblies to be used for manual generation were not specified."); } platform = new Bespoke(); platform.Assemblies = options.Assemblies; if (PlatformHelper.IsRunningOnMono()) { platform.CecilSearchDirectories = platform.Assemblies.Select(Path.GetDirectoryName).Distinct().ToList(); } else { platform.CecilSearchDirectories.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"); } break; case AutoPlatform.Android: platform = new Android(_referenceAssembliesLocation); break; case AutoPlatform.iOS: platform = new iOS(_referenceAssembliesLocation); break; case AutoPlatform.Mac: platform = new Mac(_referenceAssembliesLocation); break; case AutoPlatform.TVOS: platform = new TVOS(_referenceAssembliesLocation); break; case AutoPlatform.WPF: platform = new WPF(); break; case AutoPlatform.XamForms: platform = new XamForms(); break; case AutoPlatform.Tizen: platform = new Tizen(); break; case AutoPlatform.UWP: platform = new UWP(); break; case AutoPlatform.Winforms: platform = new Winforms(); break; case AutoPlatform.Essentials: platform = new Essentials(); _mustacheTemplate = "XamarinEssentialsTemplate.mustache"; break; default: throw new ArgumentOutOfRangeException(); } ExtractEventsFromAssemblies(platform); Environment.Exit((int)ExitCode.Success); } catch (Exception ex) { Log.Fatal(ex.ToString()); if (Debugger.IsAttached) { Debugger.Break(); } } } Environment.Exit((int)ExitCode.Error); }
public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger(); // allow app to be debugged in visual studio. if (Debugger.IsAttached) { args = "--platform=essentials --output-path=test.txt".Split(' '); } await new Parser(parserSettings => parserSettings.CaseInsensitiveEnumValues = true).ParseArguments <CommandLineOptions>(args).MapResult( async options => { try { if (!string.IsNullOrWhiteSpace(options.Template)) { _mustacheTemplate = options.Template; Log.Debug("Using {template} instead of the default template.", _mustacheTemplate); } if (!string.IsNullOrWhiteSpace(options.ReferenceAssemblies)) { _referenceAssembliesLocation = options.ReferenceAssemblies; Log.Debug($"Using {_referenceAssembliesLocation} instead of the default reference assemblies location."); } IPlatform platform = null; switch (options.Platform) { case AutoPlatform.None: if (options.Assemblies.Any() == false) { throw new Exception("Assemblies to be used for manual generation were not specified."); } platform = new Bespoke(); platform.Assemblies.AddRange(options.Assemblies); if (PlatformHelper.IsRunningOnMono()) { platform.CecilSearchDirectories.AddRange(platform.Assemblies.Select(Path.GetDirectoryName).Distinct().ToList()); } else { platform.CecilSearchDirectories.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"); } break; case AutoPlatform.Android: platform = new Android(_referenceAssembliesLocation); break; case AutoPlatform.iOS: platform = new iOS(_referenceAssembliesLocation); break; case AutoPlatform.Mac: platform = new Mac(_referenceAssembliesLocation); break; case AutoPlatform.TVOS: platform = new TVOS(_referenceAssembliesLocation); break; case AutoPlatform.WPF: platform = new WPF(); break; case AutoPlatform.XamForms: platform = new XamForms(); break; case AutoPlatform.Tizen4: platform = new Tizen(); break; case AutoPlatform.UWP: platform = new UWP(); break; case AutoPlatform.Winforms: platform = new Winforms(); break; case AutoPlatform.Essentials: platform = new Essentials(); _mustacheTemplate = "XamarinEssentialsTemplate.mustache"; break; default: throw new ArgumentException($"Platform not {options.Platform} supported"); } await ExtractEventsFromAssemblies(options.OutputPath, platform).ConfigureAwait(false); Environment.Exit((int)ExitCode.Success); } catch (Exception ex) { Log.Fatal(ex.ToString()); if (Debugger.IsAttached) { Debugger.Break(); } } Environment.Exit((int)ExitCode.Error); }, _ => Task.CompletedTask).ConfigureAwait(false); }
public static void IndexPrograms() { _win32s = Win32.All(_settings); _uwps = UWP.All(); }
//---------------------------------------------------------------------------// // generate a single critter, by type //---------------------------------------------------------------------------// protected void GenerateCritter(int dnum, string ctype, UWP uwp, int typeDM, int sizeDM, int special) { // other attributes of a critter int size = 0; int weapon = 0; int armour = 0; int attrib = 0; // flyer etc int att_roll = Roll(6) + Roll(6); int attack; int flee; int speed; // choose a specific type within the overall class int type = Roll(6) + Roll(6); // apply DMs type += typeDM; if (type < 0) { type = 0; } if (type > 13) { type = 13; } // add offset for overall class // no offset for herbivores if (ctype[0] == 'O') { type += 14; } if (ctype[0] == 'C') { type += 28; } if (ctype[0] == 'S') { type += 42; } if (ctype[0] == 'E') { type += 56; } // check for other attributes // adjust roll for planet-type if (uwp.Size.Value > 8) { att_roll -= 1; } if (uwp.Size.Value < 6) { att_roll += 1; } if (uwp.Size.Value > 4) { att_roll += 1; // cumulative with the above for +2 } if (uwp.Atmosphere.Value > 7) { att_roll += 1; } if (uwp.Atmosphere.Value < 6) { att_roll -= 1; } if (att_roll < 2) { att_roll = 2; } if (att_roll > 12) { att_roll = 12; } if (special == 0) { // general terrain if (att_roll == 10) { attrib = 2; sizeDM = -6; } if (att_roll == 11) { attrib = 2; sizeDM = -5; } if (att_roll == 12) { attrib = 2; sizeDM = -3; } } if (special == 1) { // beach if (att_roll == 2) { attrib = 3; sizeDM += 1; } if (att_roll == 3) { attrib = 1; sizeDM += 2; } if (att_roll == 4) { attrib = 1; sizeDM += 2; } if (att_roll == 11) { attrib = 2; sizeDM = -6; } if (att_roll == 12) { attrib = 2; sizeDM = -5; } } if (special == 2) { // marsh if (att_roll == 2) { attrib = 3; sizeDM -= 6; } if (att_roll == 3) { attrib = 1; sizeDM += 2; } if (att_roll == 4) { attrib = 1; sizeDM += 1; } if (att_roll == 11) { attrib = 2; sizeDM = -6; } if (att_roll == 12) { attrib = 2; sizeDM = -5; } } if (special == 3) { // river if (att_roll == 2) { attrib = 3; sizeDM += 1; } if (att_roll == 3) { attrib = 1; sizeDM += 1; } if (att_roll == 11) { attrib = 2; sizeDM = -6; } if (att_roll == 12) { attrib = 2; sizeDM = -5; } } if (special == 4) { // sea if (att_roll == 2) { attrib = 3; sizeDM += 2; } if (att_roll == 3) { attrib = 3; sizeDM += 2; } if (att_roll == 4) { attrib = 3; sizeDM += 2; } if (att_roll == 5) { attrib = 1; sizeDM += 2; } if (att_roll == 6) { attrib = 1; sizeDM += 0; } if (att_roll == 7) { attrib = 3; sizeDM += 1; } if (att_roll == 8) { attrib = 3; sizeDM -= 1; } if (att_roll == 9) { attrib = 4; sizeDM -= 7; } if (att_roll == 10) { attrib = 4; sizeDM -= 6; } if (att_roll == 11) { attrib = 2; sizeDM = -6; } if (att_roll == 12) { attrib = 2; sizeDM = -5; } } if (special == 5) { // swamp if (att_roll == 2) { attrib = 3; sizeDM -= 3; } if (att_roll == 3) { attrib = 1; sizeDM += 1; } if (att_roll == 4) { attrib = 1; sizeDM += 1; } if (att_roll == 11) { attrib = 2; sizeDM = -6; } if (att_roll == 12) { attrib = 2; sizeDM = -5; } } // adjust size for planet if (uwp.Size.Value > 7) { sizeDM -= 1; } if (uwp.Size.Value < 5) { sizeDM += 1; } // derive a size size = Roll(6) + Roll(6) + sizeDM; if (size < 1) { size = 1; } if (size > 20) { size = 20; } while (TableData.weights[size][0] == '*') { size = Roll(6) + Roll(6) + sizeDM + 6; if (size < 1) { size = 1; } if (size > 20) { size = 20; } } if (ctype[0] == 'E') { size = 0; } // derive armour armour = Roll(6) + Roll(6); if (ctype[0] == 'C') { armour -= 1; } if (ctype[0] == 'S') { armour += 1; } if (ctype[0] == 'H') { armour += 2; } if (armour < 1) { armour = 1; } if (armour > 20) { armour = 20; } while (TableData.armours[armour][0] == '*') { armour = Roll(6) + Roll(6) + 6; if (ctype[0] == 'C') { armour -= 1; } if (ctype[0] == 'S') { armour += 1; } if (ctype[0] == 'H') { armour += 2; } if (armour < 1) { armour = 1; } if (armour > 20) { armour = 20; } } if (ctype[0] == 'E') { armour = 0; } // derive weapons weapon = Roll(6) + Roll(6); if (ctype[0] == 'O') { weapon += 4; } if (ctype[0] == 'C') { weapon += 8; } if (ctype[0] == 'H') { weapon -= 3; } if (weapon < 1) { weapon = 1; } if (weapon > 20) { weapon = 20; } if (ctype[0] == 'E') { weapon = 0; } // derive behaviours attack = Roll(6); flee = Roll(6); speed = Roll(6); // defaults if ((TableData.ctypes[type])[0] == 'F') { // filter attack = 0; flee += 2; speed -= 5; } if ((TableData.ctypes[type])[0] == 'I' && ctype[0] == 'H') { // intermittent attack += 3; flee += 3; speed -= 4; } if ((TableData.ctypes[type])[0] == 'G' && ctype[0] == 'H') { // grazer attack += 2; flee += 0; speed -= 2; } if ((TableData.ctypes[type])[0] == 'G' && ctype[0] == 'O') { // gatherer attack += 3; flee += 2; speed -= 3; } if ((TableData.ctypes[type])[0] == 'H' && ctype[0] == 'O') { // hunter attack += 0; flee += 2; speed -= 4; } if ((TableData.ctypes[type])[0] == 'E') { // eater attack += 0; flee += 3; speed -= 3; } if ((TableData.ctypes[type])[0] == 'P') { // pouncer attack = 0; flee = 0; speed -= 4; } if ((TableData.ctypes[type])[0] == 'C' && ctype[0] == 'C') { // chaser attack = 0; flee += 3; speed -= 2; } if ((TableData.ctypes[type])[0] == 'T') { // trapper attack = 0; flee += 2; speed -= 5; } if ((TableData.ctypes[type])[0] == 'S') { // siren attack = 0; flee += 3; speed -= 4; } if ((TableData.ctypes[type])[0] == 'K') { // killer attack += 0; flee += 3; speed -= 3; } if ((TableData.ctypes[type])[0] == 'H' && ctype[0] == 'S') { // hijacker attack += 1; flee += 2; speed -= 4; } if ((TableData.ctypes[type])[0] == 'I' && ctype[0] == 'S') { // intimidater attack += 2; flee += 1; speed -= 4; } if ((TableData.ctypes[type])[0] == 'C' && ctype[0] == 'S') { // carrion-eater attack += 3; flee += 2; speed -= 3; } if ((TableData.ctypes[type])[0] == 'R' && ctype[0] == 'S') { // reducer attack += 3; flee += 2; speed -= 4; } if (speed < 0) { speed = 0; } // output the critter to the table cr_size[cr_count] = size; cr_type[cr_count] = type; cr_weapon[cr_count] = weapon + TableData.weapon_dups[weapon]; // normalise repeated weapons to a single index cr_armour[cr_count] = armour; cr_attrib[cr_count] = attrib; cr_attack[cr_count] = attack; cr_flee[cr_count] = flee; cr_speed[cr_count] = speed; cr_family[cr_count] = 0; if (cr_count < MAX_CRIT) { cr_count += 1; // increment counter (if possible) } }