Beispiel #1
0
        void Install(IReadOnlyList <string> args)
        {
            if (args.Count < 2)
            {
                Console.Error.WriteLine("install command requires a name and path");
            }

            var(name, path) = (args[0], args[1]);
            var installPath = $"{path}/ReShade/Repositories/{name}";

            if (FSUtils.GetItem(installPath, out var kind))
            {
                if (InteractUtils.RequestInput(
                        $"Installation path {installPath} already exists, remove?",
                        allowDefault: false,
                        (ConsoleKey.Y, "Yes"),
                        (ConsoleKey.N, "No")) == ConsoleKey.Y)
                {
                    switch (kind)
                    {
                    case FSItemKind.File:
                    case FSItemKind.Link:
                        File.Delete(path);
                        break;

                    case FSItemKind.Directory:
                        Directory.Delete(path, true);
                        break;
                    }
                }
            }

            FSUtils.CreateSymbolicLink(
                installPath,
                Path.GetFullPath($"{Runtime.RepositoriesPath}/{name}"));

            Console.WriteLine("Repository installed.");
        }