Пример #1
0
        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));
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        /// <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;
        }