Esempio n. 1
0
        private static void Main(string[] args)
        {
            CatalogManager m;

            if (args.Length != 0)
            {
                m = new CatalogManager(Loader.loaderFromFolder(args[0]), args[0]);
                m.Run();
            }
            else
            {
                PC.WriteLine("Files should be named correctly in input folder");
                PC.WriteLine(
                    "Few warnings are given in program. Ensure all codes are correct (01 is incorrect, 1 is correct)");
                PC.WriteLine("Do not have brackets in file names");
                PC.WriteLine("Ensure you have LONG PATHS enabled : https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters");
                string s;
                int    dec;
                do
                {
                    PC.WriteLine("0 - New Card System\n1 - Load Card System\n2 - Close");
                    s = Console.ReadLine();
                } while (!int.TryParse(s, out dec));

                if (dec == 0 || dec == 1)
                {
                    string fileContent = string.Empty;
                    string filePath    = string.Empty;

                    string path = MorePaths.getFolderPath();
                    if (path == null)
                    {
                        return;
                    }

                    m = dec == 0 ? CatalogManager.Setup(path) : new CatalogManager(Loader.loaderFromFolder(path), path);

                    Console.Clear();
                    m.Run();
                }
            }
        }
Esempio n. 2
0
        private void PromptShift()
        {
            PC.WriteLine("Please insert the range to shift along:");
            CodeRange orig = new CodeRange(ReadAnswer());

            if (orig.fromCode.Equals(CatalogCode.current))
            {
                throw new CatalogError("Cannot shift the root");
            }
            PC.WriteLine("Please insert by how much?");
            int dist = int.Parse(ReadAnswer());

            if (dist == 0)
            {
                return;
            }
            CodeRange shifted = orig + dist;

            if (catalog.Contains(shifted - orig, orig,
                                 (shifted - orig).fromCode.Youngest() - shifted.fromCode.Youngest()))
            {
                throw new CatalogError($"Cannot shift {orig} by {dist}");
            }
            MoveAndSave(orig, shifted);
        }