예제 #1
0
            public MinLaunchReport(LaunchResult result, LaunchOptions options)
            {
                #region KMCCC信息

                LauncherType    = "ERROR";
                LauncherVersion = Version;

                #endregion

                #region 系统信息

                RuntimeVersion = Environment.Version.ToString();
                SystemVersion  = Environment.OSVersion.VersionString;
                Memory         = ((uint)(SystemTools.GetTotalMemory() >> 20));
                Arch           = SystemTools.GetArch();

                #endregion

                #region 启动信息

                LaunchErrorType    = result.ErrorType.ToString();
                AuthenticationType = options.Authenticator.Type;

                #endregion
            }
예제 #2
0
 public FullLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options) : base(core, result, options)
 {
     LaunchedVersionId = options.Version.Id;
     AutoConnectServer = (options.Server != null) ? options.Server.ToString() : "";
     LauncherDirectory = Environment.CurrentDirectory;
     GameDirectory     = core.GameRootPath;
     if (result.Handle != null)
     {
         PlayerName = result.Handle.Arguments.Authentication.DisplayName;
     }
 }
예제 #3
0
            public BasicLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options) : base(result, options)
            {
                #region 系统信息

                VideoCardInfo = GetVideoCardInfo();
                ProcessorInfo = GetProcessorInfo();

                #endregion

                #region 启动信息

                JavaPath = core.JavaPath;

                #endregion
            }
예제 #4
0
        /// <summary>
        ///     报告一次启动结果
        /// </summary>
        /// <param name="core">启动器核心</param>
        /// <param name="result">启动结果</param>
        /// <param name="options">启动选项</param>
        public static LaunchResult Report(this LauncherCore core, LaunchResult result, LaunchOptions options)
        {
            if (_reportLevel == ReportLevel.None)
            {
                return(result);
            }
            if (result.ErrorType == ErrorType.NoJAVA)
            {
                if (NoJavaReported)
                {
                    return(result);
                }
                NoJavaReported = true;
            }
            Task.Factory.StartNew(() =>
            {
                try
                {
                    var wc = new WebClient();
                    wc.Headers.Add("user-agent", _clientName);
                    wc.UploadString(LAUNCH_REPORT,
                                    JsonMapper.ToJson((_reportLevel == ReportLevel.Full)
                                                        ? new FullLaunchReport(core, result, options)
                                                        : (_reportLevel == ReportLevel.Basic)
                                                                ? new BasicLaunchReport(core, result, options)
                                                                : new MinLaunchReport(result, options))
#if DEBUG
                                    .Print()
#endif
                                    );
                }
                catch
                {
                    Console.WriteLine("[KMCCC] report failed");
                }
            });
            return(result);
        }