public AnvilLevel(string worldname) { Difficulty = 0; LvlName = worldname; LevelType = LVLType.Default; Generator = new AnvilWorldProvider(worldname); ConsoleFunctions.WriteInfoLine("Level Type: Anvil"); }
public BetterLevel(string worldname) { Difficulty = 0; LvlName = worldname; LevelType = LVLType.Default; Generator = new BetterWorldProvider(worldname); ConsoleFunctions.WriteInfoLine("Level Type: Better (Experimental)"); DefaultGamemode = Gamemode.Creative; }
public static void AddPlugin(string filePath) { // todo: improve this when I learn more abt .NET reflection. var assembly = Assembly.LoadFrom(filePath); var attributes = assembly.GetCustomAttributes(typeof(PluginAttributes), false).Cast <PluginAttributes>(); foreach (var attribute in attributes) { try { var module = assembly.GetModule(attribute.ModuleName); if (module == null) { ConsoleFunctions.WriteWarningLine( $"No module found in \"{filePath}\" at \"{attribute.ModuleName}\"."); break; } var pluginType = assembly.GetType(attribute.PluginPath); if (pluginType == null) { ConsoleFunctions.WriteWarningLine( $"No module found in \"{filePath}\" at \"{attribute.ModuleName}\"."); break; } dynamic obj = Activator.CreateInstance(pluginType); if (obj == null) { ConsoleFunctions.WriteWarningLine($"{pluginType} is null when creating instance!"); break; } var plugin = obj as SharperPlugin; if (plugin == null) { ConsoleFunctions.WriteWarningLine($"{obj} is not SharperPlugin instance!"); break; } plugin.Name = attribute.Name; plugin.Description = attribute.Description; plugin.Author = attribute.Author; plugin.Version = attribute.Version; AddPlugin(plugin); } catch (Exception ex) { ConsoleFunctions.WriteWarningLine( $"Failed to load plugin {attribute.Name} {attribute.Version} at " + $"\"{attribute.PluginPath}\" at \"{attribute.ModuleName}\". {ex}"); } } }
public NetherLevel(string worldname) { Difficulty = 0; LvlName = worldname; LevelType = LvlType.Default; Generator = new NetherWorldProvider(worldname); ConsoleFunctions.WriteDebugLine("Level Type: Nether"); Dimension = -1; }
public override void Execute(ICommandSender sender, string label, string[] args, string origMessage) { foreach (Player allPlayer in Globals.LevelManager.GetAllPlayers()) { allPlayer.SavePlayer(); } Globals.LevelManager.SaveAllChunks(); ConsoleFunctions.WriteInfoLine("World & Player data saved."); }
public StandardLevel(string worldname) { Difficulty = 0; LvlName = worldname; LevelType = LvlType.Default; Generator = new StandardWorldProvider(worldname); ConsoleFunctions.WriteInfoLine("Level Type: Standard"); DefaultGamemode = Gamemode.Creative; }
public override void Enable() { ConsoleFunctions.WriteInfoLine("Enabling!!!!!!"); CommandManager.AddCommand(new ExampleCommand("/")); var exampleSystem = new CommandSystem(new [] { "\\" }); exampleSystem.AddCommand(new ExampleCommand("\\")); CommandManager.AddCommandSystem(exampleSystem); }
private void Erase(int x, int y, int Pieza) { for (int i = 0; i < 4; i++) { ConsoleFunctions.WriteConsole(x + Forma[Pieza, Rotacion, i].X, y + Forma[Pieza, Rotacion, i].Y, " "); } }
protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi) { if (CurrentContainedWindow != null) { ConsoleFunctions.SendDpiChangedMessage(CurrentContainedWindowHandle, (int)newDpi.PixelsPerInchX); CurrentContainedWindow.Dpi = (int)newDpi.PixelsPerInchX; } base.OnDpiChanged(oldDpi, newDpi); }
public void PrintConsole() { ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Cyan); Console.WriteLine("||||||||||| D3DTX Header |||||||||||"); ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.White); Console.WriteLine("D3DTX mVersion = {0}", mVersion); Console.WriteLine("D3DTX mSamplerState_BlockSize = {0}", mSamplerState_BlockSize); Console.WriteLine("D3DTX mSamplerState = {0}", mSamplerState); Console.WriteLine("D3DTX mPlatform_BlockSize = {0}", mPlatform_BlockSize); Console.WriteLine("D3DTX mPlatform = {0} ({1})", Enum.GetName(typeof(PlatformType), (int)mPlatform), mPlatform); Console.WriteLine("D3DTX mName Block Size = {0}", mName_BlockSize); Console.WriteLine("D3DTX mName = {0}", mName); Console.WriteLine("D3DTX mImportName Block Size = {0}", mImportName_BlockSize); Console.WriteLine("D3DTX mImportName = {0}", mImportName); Console.WriteLine("D3DTX mImportScale = {0}", mImportScale); Console.WriteLine("D3DTX mToolProps = {0}", mToolProps); Console.WriteLine("D3DTX mNumMipLevels = {0}", mNumMipLevels); Console.WriteLine("D3DTX mWidth = {0}", mWidth); Console.WriteLine("D3DTX mHeight = {0}", mHeight); Console.WriteLine("D3DTX mSurfaceFormat = {0} ({1})", Enum.GetName(typeof(T3SurfaceFormat), mSurfaceFormat), (int)mSurfaceFormat); Console.WriteLine("D3DTX mResourceUsage = {0} ({1})", Enum.GetName(typeof(T3ResourceUsage), mResourceUsage), (int)mResourceUsage); Console.WriteLine("D3DTX mNormalMapFormat = {0}", mNormalMapFormat); Console.WriteLine("D3DTX mHDRLightmapScale = {0}", mHDRLightmapScale); Console.WriteLine("D3DTX mToonGradientCutoff = {0}", mToonGradientCutoff); Console.WriteLine("D3DTX mAlphaMode = {0} ({1})", Enum.GetName(typeof(eTxAlpha), mAlphaMode), (int)mAlphaMode); Console.WriteLine("D3DTX mColorMode = {0} ({1})", Enum.GetName(typeof(eTxColor), mColorMode), (int)mColorMode); Console.WriteLine("D3DTX mUVOffset = {0}", mUVOffset); Console.WriteLine("D3DTX mUVScale = {0}", mUVScale); ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Cyan); Console.WriteLine("----------- mToonRegions -----------"); ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.White); Console.WriteLine("D3DTX mToonRegions_ArrayCapacity = {0}", mToonRegions_ArrayCapacity); Console.WriteLine("D3DTX mToonRegions_ArrayLength = {0}", mToonRegions_ArrayLength); for (int i = 0; i < mToonRegions_ArrayLength; i++) { Console.WriteLine("D3DTX mToonRegion {0} = {1}", i, mToonRegions[i]); } Console.WriteLine("D3DTX mRegionCount = {0}", mStreamHeader.mRegionCount); Console.WriteLine("D3DTX mAuxDataCount {0}", mStreamHeader.mAuxDataCount); Console.WriteLine("D3DTX mTotalDataSize {0}", mStreamHeader.mTotalDataSize); ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Cyan); Console.WriteLine("----------- mRegionHeaders -----------"); for (int i = 0; i < mStreamHeader.mRegionCount; i++) { ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Cyan); Console.WriteLine("[mRegionHeader {0}]", i); ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.White); Console.WriteLine("D3DTX mMipIndex = {0}", mRegionHeaders[i].mMipIndex); Console.WriteLine("D3DTX mMipCount = {0}", mRegionHeaders[i].mMipCount); Console.WriteLine("D3DTX mDataSize = {0}", mRegionHeaders[i].mDataSize); Console.WriteLine("D3DTX mPitch = {0}", mRegionHeaders[i].mPitch); } }
public static void UnPauseGame(Thread GamePlay, ConsoleFunctions.CHAR_INFO[] Buffer, ConsoleFunctions.CHAR_INFO[] BufferNext) { afliw.Clear(1, 24, 1, 11); Console.Title = Console.Title.Remove(14); ConsoleFunctions.WriteBufferToConsole(1, 1, 11, 24, Buffer); ConsoleFunctions.WriteBufferToConsole(15, 1, 4, 4, BufferNext); Playground.UnPause(); GamePlay.Resume(); ConsoleFunctions.FlushConsoleInputBuffer(); }
public Tuple <string, int, float, int, int, int> FindAtomBySymbol(string _symbol) { try { return(data[_symbol]); } catch (KeyNotFoundException) { ConsoleFunctions.ThrowError("The atom " + _symbol + " does not exist.", null); return(data.Values.FirstOrDefault()); } }
private static void DeSensibilizeCell() { ushort[,] SensColor = new ushort[1, 1]; for (int i = 0; i < LastSensibilizedNumber; i++) { SensColor[0, 0] = LastSensibilizedColors[0, i]; ConsoleFunctions.WriteConsoleAttribute(LastSensibilizedPosition[i].X, LastSensibilizedPosition[i].Y, SensColor); } }
private void GameTick(object source, ElapsedEventArgs e) { _sw.Start(); DayTick(); foreach (var blockEvent in BlockWithTicks.ToArray()) { if (blockEvent.Value <= CurrentWorldTime) { GetBlock(blockEvent.Key).OnTick(this); int value; BlockWithTicks.TryRemove(blockEvent.Key, out value); } } foreach (var player in OnlinePlayers.ToArray()) { player.OnTick(); } foreach (var entity in Entities.ToArray()) { entity.OnTick(); } if (_saveTick == 1500) { _saveTick = 0; ConsoleFunctions.WriteInfoLine("Saving chunks"); var sw = new Stopwatch(); sw.Start(); SaveChunks(); sw.Stop(); ConsoleFunctions.WriteInfoLine("Saving chunks took: " + sw.ElapsedMilliseconds + "MS"); ConsoleFunctions.WriteInfoLine("Clearing chunk cache..."); Generator.ClearCache(); //Clear chunk cache GC.Collect(); //Collect garbage } else { _saveTick++; } if (_saveTick == 750) { GC.Collect(); } _sw.Stop(); _lastCalc = _sw.ElapsedMilliseconds; _sw.Reset(); }
internal void LoadPlugins() { if (Config.GetProperty("PluginDisabled", false)) { return; } var pluginDirectory = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); pluginDirectory = Config.GetProperty("PluginDirectory", pluginDirectory); if (pluginDirectory != null) { pluginDirectory = Path.GetFullPath(pluginDirectory); foreach (var pluginPath in Directory.GetFiles(pluginDirectory, "*.dll", SearchOption.AllDirectories)) { var newAssembly = Assembly.LoadFile(pluginPath); var types = newAssembly.GetExportedTypes(); foreach (var type in types) { try { if (!type.IsDefined(typeof(PluginAttribute), true) && !typeof(IPlugin).IsAssignableFrom(type)) { continue; } if (type.IsDefined(typeof(PluginAttribute), true)) { var pluginAttribute = Attribute.GetCustomAttribute(type, typeof(PluginAttribute), true) as PluginAttribute; if (pluginAttribute != null) { if (!Config.GetProperty(pluginAttribute.PluginName + ".Enabled", true)) { continue; } } } var ctor = type.GetConstructor(Type.EmptyTypes); if (ctor != null) { var plugin = ctor.Invoke(null); _plugins.Add(plugin); LoadCommands(type); LoadOnPlayerJoin(type); } } catch (Exception ex) { ConsoleFunctions.WriteWarningLine("Failed loading plugin type " + type + " as a plugin."); ConsoleFunctions.WriteDebugLine("Plugin loader caught exception: " + ex); } } } } }
private void Draw(int x, int y, int Pieza) { for (int i = 0; i < 4; i++) { ConsoleFunctions.WriteConsole(x + Forma[Pieza, Rotacion, i].X, y + Forma[Pieza, Rotacion, i].Y, Colors[Pieza], "\x8"); } UpdatePieceDimentions(); Available = true; }
//Show this menu to the screen public void Show() { InitScreen(); //Remember current background/text color var currentBgColor = Console.BackgroundColor; var currentTxtColor = Console.ForegroundColor; //Keep in this menu until isFinished = true while (!isFinished) { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; ConsoleFunctions.writeToCenter($"({selectedOption}) {_MenuOptions[selectedOption-1].ToString()}", 4 + selectedOption - 1); Console.ForegroundColor = currentTxtColor; Console.BackgroundColor = currentBgColor; //Read user input var pressedKey = Console.ReadKey(); switch (pressedKey.Key) { //Options are printed from top to bottom case ConsoleKey.UpArrow: if (!(selectedOption == 1)) { selectedOption--; } break; case ConsoleKey.DownArrow: if (!(selectedOption == _MenuOptions.Length)) { selectedOption++; } break; //Raise OptionSelected event with SelectedOption case ConsoleKey.Enter: OptionSelected.Invoke(this, selectedOption); InitScreen(); //Reinit the screen after returning to this menu break; //Exit Menu case ConsoleKey.Backspace: isFinished = true; break; } //draw all Options again for (int i = 0; i < _MenuOptions.Length; i++) { ConsoleFunctions.writeToCenter($"({i+1}) {_MenuOptions[i].ToString()}", 4 + i); } } }
static void Main(string[] args) { bool run = true; while (run) { Items item = Items.None; int i = ConsoleFunctions.ShowMenuOptions <Items>(); if (i == 99) { item = Items.Sair; } else { item = (Items)Enum.Parse(typeof(Items), i.ToString()); } switch (item) { case Items.BoxingAndUnboxing: BoxingAndUnboxingExample(); break; case Items.TypeConversion: TypeConversionExample(); break; case Items.BadDynamicCode: BadDynamicCodeExample(); break; case Items.UsingDynamicVariables: UsingDynamicVariablesExample(); break; case Items.InteractingWithExcel: InteractingWithExcelExample(); break; case Items.Sair: run = false; break; } if (run) { Console.WriteLine("Finished processing. Press a key to end."); Console.ReadKey(); } } }
/// <summary> /// The main entry point for the application. /// </summary> /// <param name="args"></param> public static void Main(string[] args) { // Find Assemblies Manually if necessary (Deprecate app.config) AppDomain.CurrentDomain.AssemblyResolve += AssemblyFinder.CurrentDomain_AssemblyResolve; /* - Initialization - */ DoSquirrelStuff(); // Initialize the console. ConsoleFunctions.Initialize(); // Print startup information. Banner.PrintBanner(); // Get Controller Order Controllers.PrintControllerOrder(); // Unlock DLLs, Removes Zone Information which may prevent DLL injection if DLL was downloaded from e.g. Internet Explorer DllUnlocker.UnblockDlls(); // Setup Server LoaderServer.SetupServer(); // Setup libReloaded Debug Bindings SetuplibReloadedBindings(); /* - Option Parsing, Linking - */ // Parse Arguments ParseArguments(args); // Start game InjectByMethod(args); /* - Load and enter main close polling loop - */ // Add to exited event _gameProcess.GetProcessFromReloadedProcess().EnableRaisingEvents = true; _gameProcess.GetProcessFromReloadedProcess().Exited += (sender, eventArgs) => ProcessSelfReattach(args); // Load modifications for the current game. ModLoader.LoadMods(_gameConfig, _gameProcess); // Stay alive in the background AppDomain.CurrentDomain.ProcessExit += Shutdown; Console.CancelKeyPress += Shutdown; // Sleep infinitely as much as it is necessary. while (true) { Console.ReadLine(); } }
static void Main(string[] args) { bool run = true; while (run) { Items item = Items.None; int i = ConsoleFunctions.ShowMenuOptions <Items>(); if (i == 99) { item = Items.Sair; } else { item = (Items)Enum.Parse(typeof(Items), i.ToString()); } switch (item) { case Items.PublicDataMembers: PublicDataMembersExample(); break; case Items.UsingAProperty: UsingAPropertyExample(); break; case Items.CreatingAccessorMethods: CreatingAccessorMethodsExample(); break; case Items.ProtectedAccess: ProtectedAccessExample(); break; case Items.PrintingInterface: PrintingInterfaceExample(); break; case Items.Sair: run = false; break; } if (run) { Console.WriteLine("Finished processing. Press a key to end."); Console.ReadKey(); } } }
public Server(string[] args) { GuiApp.Setup(args); ConsoleFunctions.ClearConsole(); if (!args.Contains("--minimal")) { for (var i = 0; i < 10; i++) { ConsoleFunctions.Write( TextUtils.ToChatText( "\u00A74\u00A7l[ETHO]\u00A7r \u00A7l\u00A7nUSE\u00A77 --minimal\u00A7r \u00A7l\u00A7nIN PROGRAM ARGUMENTS TO FIX ASYNC WRITING OR DEAL W/ IT") ); } } ConsoleFunctions.WriteInfoLine("For some reason, writing async in non-minimal console doesn't work."); ConsoleFunctions.WriteInfoLine("For some reason, the server doesn't close all threads. Just kill it for now."); ConsoleFunctions.WriteInfoLine("Registering default events..."); EventManager.RegisterDefaultEvents(); ConsoleFunctions.WriteInfoLine("Loading plugins..."); PluginManager.RegisterPlugins(); ConsoleFunctions.WriteInfoLine("Initiating server on {0}", Globals.ProtocolName); CurrentDirectory = Directory.GetCurrentDirectory(); var currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += UnhandledException; ConsoleFunctions.Pause(); ConsoleFunctions.WriteInfoLine("Enabling global error handling... "); ConsoleFunctions.WriteLine("Enabled.", ConsoleColor.Green); ConsoleFunctions.Continue(); ConsoleFunctions.Pause(); ConsoleFunctions.WriteInfoLine("Checking if server properties exist... "); ConsoleFunctions.WriteLine(LoadSettings() ? "Loading." : "Created.", ConsoleColor.Green); ConsoleFunctions.Continue(); ConsoleFunctions.Pause(); ConsoleFunctions.WriteInfoLine("Loading server variables... "); ConsoleFunctions.WriteLine("Loaded.", ConsoleColor.Green); ConsoleFunctions.Continue(); ConsoleFunctions.Pause(); ConsoleFunctions.WriteInfoLine("Checking files and directories... "); CheckDirectoriesAndFiles(); ConsoleFunctions.WriteLine("Files are good hopefully.", ConsoleColor.Green); ConsoleFunctions.Continue(); Initiated = true; }
public void SendChat(ChatText message) { if (Wrapper.TcpClient == null) { ConsoleFunctions.WriteInfoLine(message); return; } new ChatMessage(Wrapper) { Message = message }.Write(); }
private void HandleClientCommNew(object client) { TcpClient tcpClient = (TcpClient)client; NetworkStream clientStream = tcpClient.GetStream(); ClientWrapper Client = new ClientWrapper(tcpClient); //Buffer size of 4096 Bytes, reason: I guess we don't need more? byte[] message = new byte[4096]; int bytesRead; while (true) { bytesRead = 0; try { //if (clientStream.DataAvailable) bytesRead = clientStream.Read(message, 0, 4096); if (bytesRead > 0) { ConsoleFunctions.WriteDebugLine("Packet received. Time: " + DateTime.Now.ToLocalTime()); ConsoleFunctions.WriteDebugLine("Packet ID: " + Globals.v2Int32(message, 1)[0]); PacketHandler.PacketHandler PH = new PacketHandler.PacketHandler(); Thread handler = new Thread(() => PH.HandlePacket(Client, message)); handler.Start(); } if (bytesRead == 0) { //Close connection with user. as he disconnected! break; } } catch (Exception ex) { ConsoleFunctions.WriteErrorLine("ERROR! \n" + ex.Message); break; } } ConsoleFunctions.WriteDebugLine("A client disconnected!"); if (Utils.PlayerHelper.isConnectedPlayer(Client)) { ConsoleFunctions.WriteInfoLine("Player '" + Utils.PlayerHelper.getPlayer(Client).Username + "' disconnected!"); Client._Player.SaveToFile(); Globals.Players.Remove(Utils.PlayerHelper.getPlayer(Client)); Globals.PlayerOnline--; Globals.updateTitle(); } tcpClient.Close(); Globals.ActiveConnections--; Globals.updateTitle(); }
public void Show(int?page = 1) //Display this Journal Page (Entry) { bool finished = false; //Temp while (!finished) { Console.Clear(); //Draw blocks ConsoleFunctions.writeToCenter($"= Journal Entry {journal.EntryId} =", 0); ConsoleFunctions.drawRectangle(8, (int)(Console.BufferWidth / 4), 0, 1); ConsoleFunctions.drawRectangle(8, (int)(Console.BufferWidth / 4), 0, 9); ConsoleFunctions.drawRectangle(16, (int)(Console.BufferWidth * 3 / 4), (int)(Console.BufferWidth / 4), 1); //draw content ConsoleFunctions.writeTO($"Author: {journal.Author}", 1, 3); ConsoleFunctions.writeTO($"Time: {journal.EntryTime.ToString()}", 1, 4); ConsoleFunctions.writeTO($"Location: {journal.Location}", 1, 5); //Write instructions ConsoleFunctions.writeTO($"Up key: Previous entry", 1, 10); ConsoleFunctions.writeTO($"Down key: Next entry", 1, 11); ConsoleFunctions.writeTO($"Left key: Previous page", 1, 12); ConsoleFunctions.writeTO($"Right key: Next page", 1, 13); ConsoleFunctions.writeTO($"Backspace: Return to menu", 1, 14); //Print report ConsoleFunctions.writeTO($"{journal.EntryTitle} ({page}/2)", (int)(Console.BufferWidth * 5 / 8) - (journal.EntryTitle.Length) / 2, 2); //I assume page starts with 1 and array starts with 0 right? (VB, get out.) var result = Regex.Matches(journal.Contents[(int)page - 1], @"(.{1," + ((Console.BufferWidth * 3 / 4) - 4) + @"})(?:\s|$)"); for (int i = 0; i < result.Count; i++) { ConsoleFunctions.writeTO(result[i].ToString(), (Console.BufferWidth / 4) + 2, i + 3); Thread.Sleep(30); } var pressedKey = Console.ReadKey(); switch (pressedKey.Key) { case ConsoleKey.LeftArrow: page = 1; break; case ConsoleKey.RightArrow: page = 2; break; case ConsoleKey.Backspace: finished = true; break; } } }
public static void PauseGame(Thread GamePlay, ref bool Quit, ref Piezas ObPieza) { ConsoleFunctions.CHAR_INFO[] Buffer = new ConsoleFunctions.CHAR_INFO[11 * 24]; ConsoleFunctions.CHAR_INFO[] BufferNext = new ConsoleFunctions.CHAR_INFO[4 * 4]; GamePlay.Suspend(); Playground.Pause(); Buffer = ConsoleFunctions.ReadConsoleOutput(1, 1, 11, 24); BufferNext = ConsoleFunctions.ReadConsoleOutput(15, 1, 4, 4); Console.Title = Console.Title + " (Paused)"; afliw.Clear(1, 24, 1, 11); afliw.Clear(1, 5, 15, 19); ConsoleFunctions.WriteConsole(3, 1, (ushort)ConsoleColor.DarkCyan, "Paused"); for (int i = 0; i < 11; i++) { Console.MoveBufferArea(3, 1 + i, 6, 1, 3, 2 + i); Thread.Sleep(300 / (5 * (i + 1))); } for (int i = 0; i < 3; i++) { Console.MoveBufferArea(3, 12 - i, 6, 1, 3, 11 - i); Thread.Sleep(30 * (i + 1)); } Thread.Sleep(20); for (int i = 0; i < 3; i++) { Console.MoveBufferArea(3, 9 + i, 6, 1, 3, 10 + i); Thread.Sleep(30 * (i + 1)); } int Option = 2; Menu PauseMenu = new Menu(2, 14, -1, "Gray"); PauseMenu.AddItem(true, "Continue", "Restart", "Config", "Quit"); ConsoleFunctions.FlushConsoleInputBuffer(); do { Option = PauseMenu.DrawMenu(0); switch (Option) { case 0: UnPauseGame(GamePlay, Buffer, BufferNext); break; case 1: UnPauseGame(GamePlay, Buffer, BufferNext); RestartGame(ref ObPieza); break; case 2: Options(); break; case 3: Quit = true; break; } }while(Option == 2); }
private bool CheckAuthenticity() { foreach (FieldInfo field in Server.ServerSettings.GetType().GetFields()) { if (File.ReadAllText(ConfigName).Contains(field.Name)) { continue; } ConsoleFunctions.WriteInfoLine(field.Name + " " + field.GetValue(Server.ServerSettings)); WriteDefault(); return(false); } return(true); }
public static void Disable(IPlugin plugin) { CheckPluginRegistration(plugin); try { plugin.Disable(); } catch (Exception ex) { ConsoleFunctions.WriteErrorLine( $"Failed to disable plugin: {plugin.GetName()} {plugin.GetVersion()} {ex}"); } Plugins[plugin] = PluginState.Disabled; }
/* * /// <summary> * /// The main function for reading and converting said .d3dtx into a .dds file * /// </summary> * /// <param name="sourceFile"></param> * /// <param name="destinationFile"></param> * public void ConvertTexture_FromD3DTX_ToDDS(string sourceFileName, string sourceFile, string destinationFile) * { * string file_dword = D3DTX_File.Read_D3DTX_File_MetaVersionOnly(sourceFile); * D3DTX_File d3dtx_file = new D3DTX_File(); * * if (file_dword.Equals("6VSM")) * { * //read D3DTX file * d3dtx_file.D3DTX_6VSM = new D3DTX_6VSM(sourceFile, false); * } * else if (file_dword.Equals("5VSM")) * { * //read D3DTX file * d3dtx_file.D3DTX_5VSM = new D3DTX_5VSM(sourceFile, false); * } * else if (file_dword.Equals("ERTM")) * { * //read D3DTX file * d3dtx_file.D3DTX_ERTM = new D3DTX_ERTM(sourceFile, false); * * return; * } * * //create a DDS file in memory based off the d3dtx * DDS_File ddsFile = new DDS_File(d3dtx_file); * * //write the dds file to disk * //ddsFile.Write_D3DTX_AsDDS(d3dtx_file, destinationFile); * * //write the d3dtx header to disk * //d3dtx_file.Write_D3DTX_Header(destinationFile); * * //GenericImageFormats.ConvertDDS_To_PSD(destinationFile); * } */ //-----------------------------------------------DDS TO D3DTX----------------------------------------------- //-----------------------------------------------DDS TO D3DTX----------------------------------------------- //-----------------------------------------------DDS TO D3DTX----------------------------------------------- /// <summary> /// Application function for converting DDS to D3DTX /// </summary> public void App_Convert_DDS_Mode() { //notify the user we are starting ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Green); Console.WriteLine("Conversion Starting..."); //we got our paths, so lets begin //Convert_DDS_Bulk(workingDirectory.workingDirectoryPath, workingDirectory.workingDirectoryPath); //once BeginProcess is finished, it will come back here and we will notify the user that we are done ConsoleFunctions.SetConsoleColor(ConsoleColor.Black, ConsoleColor.Green); Console.WriteLine("Conversion Finished."); Console.ResetColor(); }
public override void Read() { if (Buffer != null) { var message = Buffer.ReadString(); switch (message) { case "MC|Brand": ConsoleFunctions.WriteInfoLine(Client.Player.Username + "'s client: " + Buffer.ReadString()); break; } } }
public static void CheckEquation() { string was_balanced = Try(); if (was_balanced == "true") { ConsoleFunctions.WriteLine("\nYour equation is properaly balanced.", ConsoleColor.Green, false); } else if (was_balanced != "exit") { ConsoleFunctions.WriteLine("\nYour equation is NOT properaly balanced.", ConsoleColor.Yellow, false); ConsoleFunctions.WriteLine(was_balanced, ConsoleColor.Yellow, false); } }