public DetourNativeMonoPlatform(IDetourNativePlatform inner, string libmono)
        {
            Inner = inner;

            Dictionary <string, List <DynDllMapping> > mappings = new Dictionary <string, List <DynDllMapping> >();

            if (!string.IsNullOrEmpty(libmono))
            {
                mappings.Add("mono", new List <DynDllMapping>()
                {
                    libmono
                });
            }
            DynDll.ResolveDynDllImports(this, mappings);

            _Pagesize = mono_pagesize();
        }
        public DetourNativeMonoPlatform(IDetourNativePlatform inner, string libmono)
        {
            Inner = inner;

#if MONOMOD_RUNTIMEDETOUR
            Dictionary <string, DynDllMapping> mappings = new Dictionary <string, DynDllMapping>();
            if (!string.IsNullOrEmpty(libmono))
            {
                mappings.Add("mono", new DynDllMapping {
                    ResolveAs = libmono
                });
            }
            DynDll.ResolveDynDllImports(this, mappings);
#endif

            _Pagesize = mono_pagesize();
        }
Пример #3
0
        static void Main(string[] args)
        {
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            Args = args;

            if (!Directory.Exists(InstallDir))
            {
                Directory.CreateDirectory(InstallDir);
            }
            if (!Directory.Exists(ConfigDir))
            {
                Directory.CreateDirectory(ConfigDir);
            }

            Environment.SetEnvironmentVariable("LOCAL_LUA_DEBUGGER_VSCODE", "0");
            Environment.CurrentDirectory = InstallDir;

            if (File.Exists(LogPath))
            {
                File.Delete(LogPath);
            }

            using (Stream fileStream = new FileStream(LogPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete))
                using (StreamWriter fileWriter = new StreamWriter(fileStream, Console.OutputEncoding))
                    using (LogWriter logWriter = new LogWriter {
                        STDOUT = Console.Out,
                        File = fileWriter
                    }) {
                        try {
                            Console.SetOut(logWriter);

                            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;

                            Console.WriteLine($"Olympus Launcher {typeof(Program).Assembly.GetName().Version}");

                            if (StartMain())
                            {
                                Console.WriteLine("Quitting early");
                                return;
                            }

                            Console.WriteLine("Starting up form");

                            // Application.SetHighDpiMode(HighDpiMode.SystemAware);
                            DynDll.ResolveDynDllImports(typeof(DpiUtils));
                            if (DpiUtils.SetProcessDpiAwarenessContext != null)
                            {
                                DpiUtils.SetProcessDpiAwarenessContext(DpiUtils.DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
                            }
                            else if (DpiUtils.SetProcessDpiAwareness != null)
                            {
                                DpiUtils.SetProcessDpiAwareness(DpiUtils.PROCESS_DPI_AWARENESS.Process_Per_Monitor_DPI_Aware);
                            }
                            else if (DpiUtils.SetProcessDPIAware != null)
                            {
                                DpiUtils.SetProcessDPIAware();
                            }

                            Application.EnableVisualStyles();
                            Application.SetCompatibleTextRenderingDefault(false);
                            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                            Application.Run(new OlympusForm());
                        } finally {
                            if (logWriter.STDOUT != null)
                            {
                                Console.SetOut(logWriter.STDOUT);
                                logWriter.STDOUT = null;
                            }
                        }
                    }
        }