예제 #1
0
        private static void Initialize()
        {
            StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            if (StartupPath == null)
            {
                throw new InvalidOperationException();
            }

            AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;

            PacketWaitEntries = new PacketWaitEntries();

            _incomingQueue = new ThreadQueue <Packet>(ProcessIncomingQueue);
            _outgoingQueue = new ThreadQueue <Packet>(ProcessOutgoingQueue);

            IncomingPacketHandlers.Initialize();
            OutgoingPacketHandlers.Initialize();

            IncomingPacketFilters.Initialize();
            OutgoingPacketFilters.Initialize();

            CommandsManager.Initialize();

            AssistantOptions.Load();
        }
예제 #2
0
        private static void Initialize()
        {
            StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            if (StartupPath == null)
            {
                throw new InvalidOperationException();
            }

            AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;

            PacketWaitEntries = new PacketWaitEntries();

            _incomingQueue = new ThreadQueue <Packet>(ProcessIncomingQueue);
            _outgoingQueue = new ThreadQueue <Packet>(ProcessOutgoingQueue);

            IncomingPacketHandlers.Initialize();
            OutgoingPacketHandlers.Initialize();

            OutgoingPacketFilters.Initialize();

            CommandsManager.Initialize();

            string langOverridePath = Path.Combine(StartupPath, "Data", "languageOverride.json");

            if (!File.Exists(langOverridePath))
            {
                return;
            }

            string fileText = File.ReadAllText(langOverridePath);

            JObject jsonObject = JObject.Parse(fileText);

            if (jsonObject?["Language"] == null)
            {
                return;
            }

            Language lang = (Language)jsonObject["Language"]?.ToObject <Language>();

            if (lang != Language.Default)
            {
                Options.SetLanguage(lang);
            }

            Options.LanguageOverride = lang;
        }