namespace KMCCC.Launcher
{
#region
using System;
#endregion
///
/// 启动模式
///
public abstract class LaunchMode
{
public static readonly BmclLaunchMode BmclMode = new BmclLaunchMode();
public static readonly MCLauncherMode MCLauncher = new MCLauncherMode();
///
/// 启动模式
///
/// 模式是否应用成功
public abstract bool Operate(LauncherCore core, MinecraftLaunchArguments args);
}
///
/// 模仿BMCL的启动模式
///
public class BmclLaunchMode : LaunchMode
{
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;
}
}
///
/// 模仿MCLauncher的启动模式
///
public class MCLauncherMode : LaunchMode
{
public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
{
args.Tokens["game_directory"] = String.Format(@".\versions\{0}\", args.Version.Id);
return true;
}
}
///
/// 简单的映射启动模式
///
public class SimpleWarpedMode : LaunchMode
{
private readonly Func _operatorMethod;
public SimpleWarpedMode(Func operatorMethod)
{
_operatorMethod = operatorMethod;
}
public override bool Operate(LauncherCore core, MinecraftLaunchArguments args)
{
return _operatorMethod.Invoke(core, args);
}
}
}