> For the complete documentation index, see [llms.txt](https://skillshop.gitbook.io/winbooster/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skillshop.gitbook.io/winbooster/examples/custom-game-optimize.md).

# Custom Game Optimize

```csharp
//dll WinBoosterDataBase.dll
//dll WinBoosterNative.dll

//using System.Runtime.InteropServices;
//using WinBooster.DataBase;
//using WinBooster.Native;

MCC.LoadScript(new CustomGameOptimizer());

//Script Extensions

public class CustomGameOptimizer: Script
{
	[DllImport("kernel32.dll", SetLastError = true)]
    	[return: MarshalAs(UnmanagedType.Bool)]
    	private static extern bool AllocConsole();
	
    	[DllImport("kernel32.dll", SetLastError = true)]
    	[return: MarshalAs(UnmanagedType.Bool)]
    	private static extern bool FreeConsole();
		
	public override void Initialize()
    	{
		if (AllocConsole()) 
		{
			Console.WriteLine(GameList.games.Count);
			GameList.games.Add(new CustomGameOptimize());
			Console.WriteLine(GameList.games.Count);
		}
    	}
	
	public override void OnGameOptimizeStart()
	{
		Console.WriteLine("Game Optimize Started");
	}
	
	public override void OnGameOptimizeDone()
	{
		Console.WriteLine("Game Optimize Done");
	}
	
	public class CustomGameOptimize : GameOptimizeI
	{
		public bool GameInstalled()
		{
			return true;
		}
		
		public string GameName()
        	{
           		return "My Game";
        	}
		
		public void Optimize()
		{
			Console.WriteLine("Типо оптимизация");
		}
		
		public void SetOptimizeData(params int[] data)
        	{
            		throw new NotImplementedException();
        	}
	}
}
```
