Пример #1
0
        static void Main(string[] args)
        {
#if DEBUG
            // Log unhandled exceptions
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CLogger.ExceptionHandleEvent);
#endif
            CLogger.Configure(Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0]) + ".log"); // Create a log file
            CLogger.LogInfo("{0} version {1}",
                            Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyTitleAttribute>().Title,
                            Assembly.GetEntryAssembly().GetName().Version.ToString());
            CLogger.LogInfo("*************************");

            if (args.Length == 0)
            {
                CInputOutput.Log("No arguments provided");
                CInputOutput.ShowHelp();
                return;
            }
            CConverter.ConvertMode mode = CInputOutput.DetermineMode(args[0]);
            if (mode == CConverter.ConvertMode.cModeUnknown)
            {
                return;
            }
            CConverter converter = new(mode);
            converter.ConvertData();
        }
Пример #2
0
        /// <summary>
        /// Initialise log file
        /// </summary>
        public static void InitLogger()
        {
            if (LoggerInit)
            {
                return;
            }
#if DEBUG
            // Log unhandled exceptions
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CLogger.ExceptionHandleEvent);
#endif
            CLogger.Configure(Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0]) + ".log"); // Create a log file
            CLogger.LogInfo("*************************");
            LoggerInit = true;
        }
Пример #3
0
        [STAThread]         // Requirement for Shell32.Shell [and Microsoft.Web.WebView2] COM objects
        public static void Main(string[] args)
        {
#if DEBUG
            // Log unhandled exceptions
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CLogger.ExceptionHandleEvent);
#endif
            Application.EnableVisualStyles();

            string currentPath = Path.GetDirectoryName(AppContext.BaseDirectory);
            string imgFolder   = Path.Combine(currentPath, IMAGE_FOLDER_NAME);
            string gameFolder  = Path.Combine(currentPath, GAME_FOLDER_NAME);

            CLogger.Configure(Path.Combine(currentPath,
                                           Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0]) + ".log")); // Create a log file
            if (!Directory.Exists(imgFolder))
            {
                Directory.CreateDirectory(imgFolder);
            }
            if (!Directory.Exists(gameFolder))
            {
                Directory.CreateDirectory(gameFolder);
            }

            CLogger.LogInfo("{0} version {1}",
                            Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyTitleAttribute>().Title,
                            Assembly.GetEntryAssembly().GetName().Version.ToString());
            CLogger.LogInfo("*************************");

            if (Console.IsOutputRedirected)
            {
                Console.WriteLine("redir");
            }

            // Allow for unicode characters, such as trademark symbol
            Console.OutputEncoding = System.Text.Encoding.UTF8;              // 'The handle is invalid.'

            CDock gameDock = new();
            gameDock.MainLoop(args);
        }