public static ResultInfo MappingMode(string option, string link, string target) { ResultInfo result = DataDeal(ref option, ref link, ref target); if (!result.IsSuccess) { return(result); } try { if (File.Exists(target)) { File.Move(target, link); } else if (Directory.Exists(target)) { DirectoryExtension.Move(target, link); } else { return(new ResultInfo(false, "请确保文件或目录存在")); } Cmd cmd = new Cmd(); result = cmd.Start(MkLinkCommand, option, target, link); cmd.Close(); return(result); } catch (Exception e) { return(new ResultInfo(false, e.Message)); } }
public static ResultInfo LinkMode(string option, string link, string target) { ResultInfo result = DataDeal(ref option, ref link, ref target); if (result.IsSuccess) { Cmd cmd = new Cmd(); result = cmd.Start(MkLinkCommand, option, link, target); if (result.IsSuccess) { result.SetResult(true, "执行成功"); } cmd.Close(); } return(result); }
/// <summary> /// Unloads all mod data. /// </summary> public void Close() { if (init) { TryCloseMenu(); Config.Save(GetConfig()); } init = false; initStart = false; Binds?.Close(); Cmd?.Close(); Menu?.Close(); Config?.Close(); Log?.Close(); HudElements?.Close(); Settings?.Close(); Instance = null; }