コード例 #1
0
ファイル: Program.cs プロジェクト: trimbe/Sidekick
        static void Main()
        {
            // Only have one instance running.
            var mutex = new Mutex(true, APPLICATION_PROCESS_GUID, out bool instanceResult);

            if (!instanceResult)
            {
                return;
            }
            GC.KeepAlive(mutex);

            Logger.Log("Starting Sidekick.");

            // System tray icon.
            TrayIcon.Initialize();

            // Load POE Trade information.
            _ = TradeClient.Initialize();

            // Keyboard hooks.
            EventsHandler.Initialize();

            // Overlay.
            OverlayController.Initialize();

            // Run window.
            Application.ApplicationExit += OnApplicationExit;
            Application.Run();
        }
コード例 #2
0
        /// <summary>
        /// Every item should start with Rarity in the first line.
        /// This will force the TradeClient to refetch the Public API's data if needed.
        /// </summary>
        public static async Task <bool> FindAndSetLanguageProvider(string itemDescription)
        {
            foreach (var item in RarityToLanguageDictionary)
            {
                if (itemDescription.Contains(item.Key))
                {
                    if (CurrentLanguage != item.Value)
                    {
                        Logger.Log($"Changed language support to {item.Value}.");
                        CurrentLanguage = item.Value;
                        Provider        = GetLanguageProvider(item.Value);
                        TradeClient.Dispose();
                        return(await TradeClient.Initialize());
                    }

                    return(true);
                }
            }

            Logger.Log("This Path of Exile language is not yet supported.");
            return(false);
        }