Beispiel #1
0
        public void Initialize()
        {
            //Set title and print version
            Console.Title = string.Format("RockSniffer {0}", version);
            Logger.Log("RockSniffer {0} ({1}bits)", version, CustomAPI.Is64Bits() ? "64" : "32");

            //Initialize and load configuration
            config = new Config();
            try
            {
                config.Load();
            }
            catch (Exception e)
            {
                Logger.LogError("Could not load configuration: {0}\r\n{1}", e.Message, e.StackTrace);
                throw e;
            }

            //Run version check
            if (!config.debugSettings.disableVersionCheck)
            {
                VersionCheck();
            }

            //Transfer logging options
            Logger.logStateMachine      = config.debugSettings.debugStateMachine;
            Logger.logCache             = config.debugSettings.debugCache;
            Logger.logFileDetailQuery   = config.debugSettings.debugFileDetailQuery;
            Logger.logMemoryReadout     = config.debugSettings.debugMemoryReadout;
            Logger.logSongDetails       = config.debugSettings.debugSongDetails;
            Logger.logSystemHandleQuery = config.debugSettings.debugSystemHandleQuery;

            //Initialize cache
            cache = new SQLiteCache();

            //Create directories
            Directory.CreateDirectory("output");

            //Enable addon service if configured
            if (config.addonSettings.enableAddons)
            {
                try
                {
                    addonService = new AddonService(config.addonSettings.ipAddress, config.addonSettings.port, new SQLiteStorage());
                }
                catch (SocketException e)
                {
                    Logger.LogError("Please verify that the IP address is valid and the port is not already in use");
                    Logger.LogError("Could not start addon service: {0}\r\n{1}", e.Message, e.StackTrace);
                }
                catch (Exception e)
                {
                    Logger.LogError("Could not start addon service: {0}\r\n{1}", e.Message, e.StackTrace);
                }
            }
        }
Beispiel #2
0
        public void Initialize()
        {
            //Set title and print version
            Console.Title = string.Format("RockSniffer {0}", version);
            Console.WriteLine("RockSniffer {0} ({1}bits)", version, CustomAPI.Is64Bits() ? "64" : "32");

            //Initialize and load configuration
            config = new Config();
            config.Load();

            //Transfer logging options
            Logger.logStateMachine      = config.debugSettings.debugStateMachine;
            Logger.logCache             = config.debugSettings.debugCache;
            Logger.logFileDetailQuery   = config.debugSettings.debugFileDetailQuery;
            Logger.logHIRCScan          = config.debugSettings.debugHIRCScan;
            Logger.logMemoryReadout     = config.debugSettings.debugMemoryReadout;
            Logger.logSongDetails       = config.debugSettings.debugSongDetails;
            Logger.logSystemHandleQuery = config.debugSettings.debugSystemHandleQuery;

            //Initialize cache
            cache = new FileCache(cachedir);

            //Create directories
            Directory.CreateDirectory("output");

            //Enable addon service if configured
            if (config.addonSettings.enableAddons)
            {
                try
                {
                    addonService = new AddonService(config.addonSettings.ipAddress, config.addonSettings.port);
                }
                catch (SocketException e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Please verify that the IP address is valid and the port is not already in use");
                    Console.WriteLine("Could not start addon service: {0}", e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.ResetColor();
                }
                catch (Exception e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Could not start addon service: {0}", e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.ResetColor();
                }
            }
        }