예제 #1
0
        public BigBoiFolder(DirectoryInfo dir)
        {
            Console.Out.WriteLine("Beginning to Map " + dir.FullName);
            name       = dir.Name;
            attributes = dir.Attributes;

            FileInfo[]      subFiles = dir.GetFiles();
            DirectoryInfo[] subDirs  = dir.GetDirectories();

            files   = new BigBoiFile[subFiles.Length];
            folders = new BigBoiFolder[subDirs.Length];

            int count = 0;

            foreach (FileInfo file in subFiles)
            {
                files[count] = new BigBoiFile(file);
                count++;
            }
            count = 0;
            foreach (DirectoryInfo dirs in subDirs)
            {
                folders[count] = new BigBoiFolder(dirs);
                count++;
            }
            Console.Out.WriteLine(dir.FullName + " has been mapped");
        }
예제 #2
0
        public static BigBoiFolder LoadFile(DirectoryInfo dir)
        {
            Console.Out.WriteLine("Beginning to load " + dir.FullName);
            BigBoiFolder folder = new BigBoiFolder(dir);

            Console.Out.WriteLine(dir.FullName + " has been loaded successfully");
            return(folder);
        }
예제 #3
0
        static void Main(string[] args)
        {
            if (!configs.Exists)
            {
                configs.Create();
            }
            Console.Out.WriteLine("BigBoi " + version);
            Console.Out.WriteLine("Options");
            Console.Out.WriteLine("0 - Create new Backup");
            Console.Out.WriteLine("1 - Load Backup");
            ConsoleKeyInfo keyInput = Console.ReadKey();

            if (keyInput.Key.Equals(ConsoleKey.D0))
            {
                Console.Clear();
                container = new BigBoiFolder[] { LoadFile(new DirectoryInfo(wow.FullName + "\\WTF")), LoadFile(new DirectoryInfo(wow.FullName + "\\Interface")) };
                Console.Out.WriteLine(container[0].Name() + " has been loaded");
                Console.Out.WriteLine(container[1].Name() + " has been loaded");
                SerializeFolder(container, configs);
                Console.Out.WriteLine("Press any key to quit");
                Console.ReadKey();
            }
            if (keyInput.Key.Equals(ConsoleKey.D1))
            {
                Console.Clear();
                FileInfo[]      files   = configs.GetFiles();
                List <FileInfo> raw     = new List <FileInfo>();
                int             counter = 0;

                foreach (FileInfo file in files)
                {
                    if (file.Name.Contains(".bbs"))
                    {
                        raw.Add(file);
                        counter++;
                    }
                }
                Console.Out.WriteLine("Which Backup would you like to restore?");

                FileInfo[] backups = new FileInfo[counter];
                counter = 0;

                foreach (FileInfo backup in raw)
                {
                    Console.Out.WriteLine(counter + " - " + backup.Name);
                    backups[counter] = backup;
                    counter++;
                }

                bool alive = true;

                while (alive)
                {
                    String input0 = Console.In.ReadLine();
                    int    index;
                    if (int.TryParse(input0, out index))
                    {
                        if (!(index > counter))
                        {
                            container = DeSerializeFolder(backups[index]);
                            alive     = false;
                        }
                        else
                        {
                            Console.Out.WriteLine("Incorrect Selection. Please try again");
                        }
                    }
                    else
                    {
                        Console.Out.WriteLine("Please use a number from above");
                    }
                }

                foreach (BigBoiFolder folder in container)
                {
                    folder.Create(wow.FullName);
                }

                Console.Out.WriteLine("You have successfully restored your config");
                Console.Out.WriteLine("Press any key to Quit");
                Console.ReadKey();
            }
            if (keyInput.Key.Equals(ConsoleKey.J))
            {
                Console.Out.WriteLine("Enter the Dir Below you want to Serialize");
                String dir = Console.In.ReadLine();
                Console.Out.WriteLine("The Dir you want to output the File");
                String         file   = Console.In.ReadLine();
                BigBoiFolder[] folder = new BigBoiFolder[] { new BigBoiFolder(new DirectoryInfo(dir)) };
                SerializeFolder(folder, new DirectoryInfo(file));
            }
        }