예제 #1
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     core.CopyVersionDirectory("mods", args.Version.Id);
     core.CopyVersionDirectory("coremods", args.Version.Id);
     core.CopyVersionDirectories(core.GetVersionRootPath(args.Version));
     return(true);
 }
예제 #2
0
        /// <summary>
        ///     从CreationOption创建启动器核心
        /// </summary>
        /// <param name="option">启动器创建选项</param>
        /// <returns>创建的启动器核心</returns>
        public static LauncherCore Create(LauncherCoreCreationOption option)
        {
            var launcherCore = new LauncherCore
            {
                GameRootPath   = option.GameRootPath,
                JavaPath       = option.JavaPath,
                VersionLocator = option.VersionLocator
            };

            return(launcherCore);
        }
예제 #3
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;
     }
 }
예제 #4
0
            public BasicLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options) : base(result, options)
            {
                #region 系统信息

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

                #endregion

                #region 启动信息

                JavaPath = core.JavaPath;

                #endregion
            }
예제 #5
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);
        }
예제 #6
0
 public static string GetNativePath(this LauncherCore core, Native native)
 {
     return(String.Format(@"{0}\libraries\{1}\{2}\{3}\{2}-{3}-{4}.jar", core.GameRootPath, native.NS.Replace(".", "\\"), native.Name, native.Version,
                          native.NativeSuffix));
 }
예제 #7
0
 public static string GetLibPath(this LauncherCore core, Library lib)
 {
     return(String.Format(@"{0}\libraries\{1}\{2}\{3}\{2}-{3}.jar", core.GameRootPath, lib.NS.Replace(".", "\\"), lib.Name, lib.Version));
 }
예제 #8
0
 public static string GetVersionJsonPath(this LauncherCore core, string versionId)
 {
     return(String.Format(@"{0}\versions\{1}\{1}.json", core.GameRootPath, versionId));
 }
예제 #9
0
 public static string GetVersionJsonPath(this LauncherCore core, Version version)
 {
     return(GetVersionJsonPath(core, version.Id));
 }
예제 #10
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     return(_operatorMethod.Invoke(core, args));
 }
예제 #11
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     args.Tokens["game_directory"] = String.Format(@".\versions\{0}\", args.Version.Id);
     return(true);
 }
예제 #12
0
 /// <summary>
 ///     启动模式
 /// </summary>
 /// <returns>模式是否应用成功</returns>
 public abstract bool Operate(LauncherCore core, MinecraftLaunchArguments args);