Ejemplo n.º 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 4
0
            public BasicLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options) : base(result, options)
            {
                #region 系统信息

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

                #endregion

                #region 启动信息

                JavaPath = core.JavaPath;

                #endregion
            }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 8
0
 public static string GetVersionJsonPath(this LauncherCore core, string versionId)
 {
     return(String.Format(@"{0}\versions\{1}\{1}.json", core.GameRootPath, versionId));
 }
Ejemplo n.º 9
0
 public static string GetVersionJsonPath(this LauncherCore core, Version version)
 {
     return(GetVersionJsonPath(core, version.Id));
 }
Ejemplo n.º 10
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     return(_operatorMethod.Invoke(core, args));
 }
Ejemplo n.º 11
0
 public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
 {
     args.Tokens["game_directory"] = String.Format(@".\versions\{0}\", args.Version.Id);
     return(true);
 }
Ejemplo n.º 12
0
 /// <summary>
 ///     启动模式
 /// </summary>
 /// <returns>模式是否应用成功</returns>
 public abstract bool Operate(LauncherCore core, MinecraftLaunchArguments args);