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); }
/// <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); }
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; } }
public BasicLaunchReport(LauncherCore core, LaunchResult result, LaunchOptions options) : base(result, options) { #region 系统信息 VideoCardInfo = GetVideoCardInfo(); ProcessorInfo = GetProcessorInfo(); #endregion #region 启动信息 JavaPath = core.JavaPath; #endregion }
/// <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); }
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)); }
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)); }
public static string GetVersionJsonPath(this LauncherCore core, string versionId) { return(String.Format(@"{0}\versions\{1}\{1}.json", core.GameRootPath, versionId)); }
public static string GetVersionJsonPath(this LauncherCore core, Version version) { return(GetVersionJsonPath(core, version.Id)); }
public override bool Operate(LauncherCore core, MinecraftLaunchArguments args) { return(_operatorMethod.Invoke(core, args)); }
public override bool Operate(LauncherCore core, MinecraftLaunchArguments args) { args.Tokens["game_directory"] = String.Format(@".\versions\{0}\", args.Version.Id); return(true); }
/// <summary> /// 启动模式 /// </summary> /// <returns>模式是否应用成功</returns> public abstract bool Operate(LauncherCore core, MinecraftLaunchArguments args);