Пример #1
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            //LogInfo(Application.ExecutablePath);
            Text = Application.ProductName;

            // refresh the screen before we run tasks that may make it look frozen
            Refresh();

            // open the last log file
            var path = config.Read("filename");

            if (File.Exists(path))
            {
                textLogPath.Text = path;
                WatchFile(path);
            }
            else if (String.IsNullOrEmpty(path))
            {
                var dir = new DirectoryInfo(@"C:/Users/Public/Daybreak Game Company/Installed Games/Everquest/Logs");
                if (dir.Exists)
                {
                    openLogDialog.InitialDirectory = dir.FullName;
                }

                dir = new DirectoryInfo(@"C:/Users/Public/Sony Online Entertainment/Installed Games/Everquest/Logs");
                if (dir.Exists)
                {
                    openLogDialog.InitialDirectory = dir.FullName;
                }
            }

            _ = uploader.Hello(config);
        }
Пример #2
0
        /// <summary>
        /// Initialize the privateKey and perform a version compatibility check using the User-Agent header.
        /// </summary>
        public async Task <bool> Hello(IConfigAdapter config)
        {
            privateKey = config.Read("privateKey");
            if (String.IsNullOrEmpty(privateKey))
            {
                privateKey = Guid.NewGuid().ToString();
                config.Write("privateKey", privateKey);
            }

            logger("Checking if your version is still compatible with " + uploadUrl);
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", privateKey);
            try
            {
                var result = await httpClient.GetAsync(uploadUrl + "/logs/hello");

                logger(await result.Content.ReadAsStringAsync());
                IsReady = result.IsSuccessStatusCode;
                return(IsReady);
            }
            catch (Exception ex)
            {
                logger("Login failed: " + ex.Message);
                return(false);
            }
        }