} // Combo public void OnLoadEvent() { AssemblyExtensions.InitAssembly("TODO", "0"); Print.LogMessage.Error("This hero not Supported!"); }
public override async Task Execute(string[] commandLineArguments) { var remainingArguments = Options.Parse(commandLineArguments); if (printHelp) { GetHelp(Console.Out, commandLineArguments); return; } if (remainingArguments.Count > 0) { throw new CommandException("Unrecognized command arguments: " + string.Join(", ", remainingArguments)); } if (string.IsNullOrWhiteSpace(ServerBaseUrl)) { throw new CommandException("Please specify the Octopus Server URL using --server=http://your-server/. " + $"The Octopus Server URL can also be set in the {ServerUrlEnvVar} environment variable."); } if (!string.IsNullOrWhiteSpace(ApiKey) && !string.IsNullOrWhiteSpace(Username)) { throw new CommandException("Please provide an API Key OR a username and password, not both. " + "These values may have been passed in as command line arguments, or may have been set in the " + $"{ApiKeyEnvVar} and {UsernameEnvVar} environment variables."); } if (string.IsNullOrWhiteSpace(ApiKey) && string.IsNullOrWhiteSpace(Username)) { throw new CommandException("Please specify your API key using --apiKey=ABCDEF123456789 OR a username and password. " + $"The API key can also be set in the {ApiKeyEnvVar} environment variable, " + $"while the username and password can be set in the {UsernameEnvVar} and {PasswordEnvVar} " + "environment variables respectively. Learn more at: https://github.com/OctopusDeploy/Octopus-Tools"); } var endpoint = string.IsNullOrWhiteSpace(ApiKey) ? new OctopusServerEndpoint(ServerBaseUrl) : new OctopusServerEndpoint(ServerBaseUrl, ApiKey); #if NETFRAMEWORK /* * There may be a delay between the completion of a large file upload and when Octopus responds * to finish the HTTP connection. This delay can be several minutes. During this time, no traffic is * sent, and some networking infrastructure will close the connection. For example, Azure VMs will * close idle connections after 4 minutes, and AWS VMs will close them after 350 seconds. The * TCP keepalive option will ensure that the connection is not idle at the end of the file upload. * * This is the bug that explains why this doesn't work with .NET Core: * https://github.com/dotnet/corefx/issues/26013 */ if (keepAlive > 0) { ServicePointManager.FindServicePoint(new Uri(ServerBaseUrl)).SetTcpKeepAlive(true, keepAlive, keepAlive); } #endif #if HTTP_CLIENT_SUPPORTS_SSL_OPTIONS clientOptions.IgnoreSslErrors = ignoreSslErrors; #else ServicePointManager.ServerCertificateValidationCallback = ServerCertificateValidationCallback; #endif commandOutputProvider.PrintMessages = OutputFormat == OutputFormat.Default || enableDebugging; CliSerilogLogProvider.PrintMessages = commandOutputProvider.PrintMessages; commandOutputProvider.PrintHeader(); var client = await clientFactory.CreateAsyncClient(endpoint, clientOptions).ConfigureAwait(false); if (!string.IsNullOrWhiteSpace(Username)) { await client.Repository.Users.SignIn(Username, Password).ConfigureAwait(false); } var serverHasSpaces = await client.ForSystem().HasLink("Spaces").ConfigureAwait(false); if (!string.IsNullOrEmpty(spaceNameOrId)) { if (!serverHasSpaces) { throw new CommandException($"The server {endpoint.OctopusServer} has no spaces. Try invoking {AssemblyExtensions.GetExecutableName()} without specifying the space name as an argument"); } var space = await client.ForSystem().Spaces.FindByNameOrIdOrFail(spaceNameOrId).ConfigureAwait(false); Repository = repositoryFactory.CreateRepository(client, RepositoryScope.ForSpace(space)); commandOutputProvider.Debug("Space name specified, process is now running in the context of space: {space:l}", space.Name); } else { Repository = repositoryFactory.CreateRepository(client); if (!serverHasSpaces) { commandOutputProvider.Debug("Process will run in backwards compatible mode for older versions of Octopus Server"); } else { var defaultSpace = await client.ForSystem() .Spaces.FindOne(space => space.IsDefault) .ConfigureAwait(false); if (defaultSpace == null) { throw new CommandException("Octopus Server does not have a default space enabled, hence you need to specify the space name as an argument"); } commandOutputProvider.Debug("Space name unspecified, process will run in the default space context"); } } RepositoryCommonQueries = new OctopusRepositoryCommonQueries(Repository, commandOutputProvider); if (enableDebugging) { Repository.Client.SendingOctopusRequest += request => commandOutputProvider.Debug("{Method:l} {Uri:l}", request.Method, request.Uri); } commandOutputProvider.Debug("Handshaking with Octopus Server: {Url:l}", ServerBaseUrl); var root = await Repository.LoadRootDocument().ConfigureAwait(false); commandOutputProvider.Debug("Handshake successful. Octopus version: {Version:l}; API version: {ApiVersion:l}", root.Version, root.ApiVersion); var user = await Repository.Users.GetCurrent().ConfigureAwait(false); if (user != null) { if (string.IsNullOrEmpty(user.EmailAddress)) { commandOutputProvider.Debug("Authenticated as: {Name:l} {IsService:l}", user.DisplayName, user.IsService ? "(a service account)" : ""); } else { commandOutputProvider.Debug("Authenticated as: {Name:l} <{EmailAddress:l}> {IsService:l}", user.DisplayName, user.EmailAddress, user.IsService ? "(a service account)" : ""); } } await ValidateParameters().ConfigureAwait(false); await Execute().ConfigureAwait(false); }
public void OnLoadEvent() { AssemblyExtensions.InitAssembly("VickTheRock", "0.1"); Print.LogMessage.Success("Into the shadows."); menu.AddItem(new MenuItem("enabled", "Enabled").SetValue(true)); menu.AddItem(new MenuItem("keyBind", "Combo key").SetValue(new KeyBind('D', KeyBindType.Press))); menu.AddItem( new MenuItem("Skills", "Skills").SetValue(new AbilityToggler(new Dictionary <string, bool> { { "riki_smoke_screen", true }, { "riki_blink_strike", true }, { "riki_tricks_of_the_trade", true } }))); menu.AddItem( new MenuItem("Items", "Items:").SetValue(new AbilityToggler(new Dictionary <string, bool> { { "item_blink", true }, { "item_diffusal_blade", true }, { "item_diffusal_blade_2", true }, { "item_heavens_halberd", true }, { "item_orchid", true }, { "item_bloodthorn", true }, { "item_urn_of_shadows", true }, { "item_veil_of_discord", true }, { "item_abyssal_blade", true }, { "item_shivas_guard", true }, { "item_blade_mail", true }, { "item_black_king_bar", true }, { "item_satanic", true }, { "item_medallion_of_courage", true }, { "item_solar_crest", true } }))); menu.AddItem(new MenuItem("Heel", "Min targets to BKB").SetValue(new Slider(2, 1, 5))); menu.AddItem(new MenuItem("Ult", "Min targets to Ultimate").SetValue(new Slider(3, 1, 5))); menu.AddItem(new MenuItem("Heelm", "Min targets to BladeMail").SetValue(new Slider(2, 1, 5))); txt = new Font( Drawing.Direct3DDevice9, new FontDescription { FaceName = "Tahoma", Height = 12, OutputPrecision = FontPrecision.Default, Quality = FontQuality.Default }); not = new Font( Drawing.Direct3DDevice9, new FontDescription { FaceName = "Tahoma", Height = 170, OutputPrecision = FontPrecision.Default, Quality = FontQuality.Default }); Drawing.OnPreReset += Drawing_OnPreReset; Drawing.OnPostReset += Drawing_OnPostReset; Drawing.OnEndScene += Drawing_OnEndScene; AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload; }
static void Main(string[] args) { Console.Title = "Marathon Command Line"; Console.WriteLine ( $"Marathon - Version {AssemblyExtensions.GetInformationalVersion()}\n\n" + "" + "All your '06 formats are belong to us.\n" ); #if !DEBUG // Log to file if an unhandled exception occurs. AppDomain.CurrentDomain.UnhandledException += (sender, e) => { File.WriteAllText($"{AssemblyExtensions.GetAssemblyName()}.log", ((Exception)e.ExceptionObject).CreateLog()); }; #endif // Force culture info 'en-GB' to prevent errors with values altered by culture-specific differences. CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-GB"); if (args.Length > 0) { foreach (string arg in args) { // Set compression level. switch (arg) { case "--no-compression": _compressionLevel = CompressionLevel.NoCompression; continue; case "--fast-compression": _compressionLevel = CompressionLevel.Fastest; continue; case "--optimal-compression": _compressionLevel = CompressionLevel.Optimal; continue; } if (Directory.Exists(arg)) { U8Archive arc = new(arg, true, _compressionLevel); arc.Save(StringHelper.ReplaceFilename(arg, Path.GetFileName(arg) + arc.Extension)); } if (File.Exists(arg)) { Console.WriteLine($"File: {arg}\n"); // Get last extension for overwritable formats. switch (Path.GetExtension(arg)) { case ".arc": U8Archive arc = new(arg, IO.ReadMode.IndexOnly); arc.Extract(Path.Combine(Path.GetDirectoryName(arg), Path.GetFileNameWithoutExtension(arg))); break; case ".lub": LuaBinary lub = new(arg, true); break; } // Get full extension for serialisable formats. switch (StringHelper.GetFullExtension(arg)) { case ".bin": case ".bin.json": { Console.WriteLine ( "This file is of a generic type, please specify what format it is;\n" + "1. Collision (collision.bin)\n" + "2. Common Package (Common.bin)\n" + "3. Explosion Package (Explosion.bin)\n" + "4. Path Package (PathObj.bin)\n" + "5. Save Data (SonicNextSaveData.bin)\n" + "6. Script Package (ScriptParameter.bin)\n" + "7. Shot Package (ShotParameter.bin)" ); switch (Console.ReadKey().KeyChar) { case '1': Collision collision = new(arg, true); break; case '2': CommonPackage common = new(arg, true); break; case '3': ExplosionPackage explosion = new(arg, true); break; case '4': PathPackage pathObj = new(arg, true); break; case '5': SonicNextSaveData saveData = new(arg, true); break; case '6': ScriptPackage scriptParameter = new(arg, true); break; case '7': ShotPackage shotParameter = new(arg, true); break; } // Pad with two line breaks. Console.WriteLine('\n'); break; } case ".bin.obj": Collision collisionOBJ = new(arg, true); break; case ".sbk": case ".sbk.json": SoundBank sbk = new(arg, true); break; case ".epb": case ".epb.json": EventPlaybook epb = new(arg, true); break; case ".tev": case ".tev.json": TimeEvent tev = new(arg, true); break; case ".pkg": case ".pkg.json": AssetPackage pkg = new(arg, true); break; case ".plc": case ".plc.json": ParticleContainer plc = new(arg, true); break; case ".peb": case ".peb.json": ParticleEffectBank peb = new(arg, true); break; case ".pgs": case ".pgs.json": ParticleGenerationSystem pgs = new(arg, true); break; case ".ptb": case ".ptb.json": ParticleTextureBank ptb = new(arg, true); break; case ".rab": case ".rab.json": ReflectionZone rab = new(arg, true); break; case ".set": case ".set.json": ObjectPlacement set = new(arg, true, !args.Contains("--no-index")); break; case ".prop": case ".prop.json": ObjectPropertyDatabase prop = new(arg, true); break; case string mstEx when mstEx.EndsWith(".mst"): case string mstJsonEx when mstJsonEx.EndsWith(".mst.json"): MessageTable mst = new(arg, true); break; case ".pft": case ".pft.json": PictureFont pft = new(arg, true); break; } } } } else { Console.WriteLine("Arguments:"); Console.WriteLine("--no-index - disables index display for serialised Object Placement data."); Console.WriteLine("--no-compression - writes U8 Archive files uncompressed."); Console.WriteLine("--fast-compression - writes U8 Archive files using fast Zlib compression."); Console.WriteLine("--optimal-compression - writes U8 Archive files using optimal Zlib compression.\n"); Console.WriteLine("Archive:"); Console.WriteLine("- U8 Archive (*.arc)\n"); Console.WriteLine("Audio:"); Console.WriteLine("- Sound Bank (*.sbk)\n"); Console.WriteLine("Event:"); Console.WriteLine("- Event Playbook (*.epb)"); Console.WriteLine("- Time Event (*.tev)\n"); Console.WriteLine("Mesh:"); Console.WriteLine("- Collision (*.bin)"); Console.WriteLine("- Reflection Zone (*.rab)\n"); Console.WriteLine("Package:"); Console.WriteLine("- Asset Package (*.pkg)"); Console.WriteLine("- Common Package (Common.bin)"); Console.WriteLine("- Explosion Package (Explosion.bin)"); Console.WriteLine("- Path Package (PathObj.bin)"); Console.WriteLine("- Script Package (ScriptParameter.bin)"); Console.WriteLine("- Shot Package (ShotParameter.bin)\n"); Console.WriteLine("Particle:"); Console.WriteLine("- Particle Container (*.plc)"); Console.WriteLine("- Particle Effect Bank (*.peb)"); Console.WriteLine("- Particle Generation System (*.pgs)"); Console.WriteLine("- Particle Texture Bank (*.ptb)\n"); Console.WriteLine("Placement:"); Console.WriteLine("- Object Placement (*.set)"); Console.WriteLine("- Object Property Database (*.prop)\n"); Console.WriteLine("Save:"); Console.WriteLine("- Save Data (SonicNextSaveData.bin)\n"); Console.WriteLine("Script:"); Console.WriteLine("- Lua Bytecode (*.lub)\n"); Console.WriteLine("Text:"); Console.WriteLine("- Message Table (*.mst)"); Console.WriteLine("- Picture Font (*.pft)\n"); Console.WriteLine ( "Usage:\n" + "Marathon.CLI.exe \"some_supported_file_format.pkg\" ...\n" + "Marathon.CLI.exe \"some_supported_serialised_format.pkg.json\" ...\n" ); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); } }
/// <summary> /// Performs the customization. /// </summary> protected override void ExecuteTask() { if (-1 == _buildNumber) { Log(Level.Info, "No customization performed."); return; } #region transform Log(Level.Verbose, "Loading stylesheet..."); var transform = new XslCompiledTransform(); using (var stream = AssemblyExtensions.OpenScopedResourceStream <CustomizeAssemblyTask>("CustomInfo_cs.xsl")) { using (var reader = XmlReader.Create(stream)) { transform.Load(reader); } } #endregion #region Version if (null == Version) { if (null == VersionFile) { VersionFile = new FileInfo(Path.Combine(BaseDirectory.FullName, "Version.xml")); } Log(Level.Verbose, "Loading VersionFile = {0}...", VersionFile.FullName); using (var stream = VersionFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) { var doc = new XmlDocument(); doc.Load(stream); Version = doc; } } #endregion #region arguments var arguments = new XsltArgumentList(); Action <string, object> addParam = (name, value) => { if (value != null) { Log(Level.Verbose, "Adding param {0} = {1}", name, value); arguments.AddParam(name, String.Empty, value); } }; addParam("buildNumber", _buildNumber); addParam("registeredUserDisplayName", _registeredUserDisplayName); addParam("registeredUserEmailAddress", _registeredUserEmailAddress); #endregion foreach (string project in EnumerateProjectNames()) { Log(Level.Info, "Customizing {0}...", project); var projectDir = Path.Combine(BaseDirectory.FullName, project); var outputFile = Path.Combine(projectDir, "Properties/CustomInfo.cs"); if (File.Exists(outputFile)) { Log(Level.Verbose, "Deleting {0}...", outputFile); File.Delete(outputFile); } Log(Level.Verbose, "Generating {0}...", outputFile); using (var stream = File.Open(outputFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read)) { transform.Transform(Version, arguments, stream); } } }