Example #1
0
        public void Start()
        {
            /*TODO: I want these Console calls to be done via some ILogger interface. In this class it's useless, but since I don't want
             *  Console to be used in other namespaces - I want them to receive the ILogger and just write stuff to Debug, Error etc log.
             *  So for Console app I'd be able to use simple class that would write to Console as an ILogger implementation.*/


            var backupsFolder = LoadGoogleBackupsFolder();
            var localDataRoot = LocalManager.GetTree(@"G:\Coding\GoogleDriveClient\Data");

            PrintTree(backupsFolder, localDataRoot);

            var navigator = new TreeNavigator(backupsFolder, localDataRoot, GoogleManager, LocalManager, FileCacheManager);

            /*TODO: Here's one big todo. I have an issue with INodes children because sometimes I have only IDs there, and sometimes - full data.
             * Another thing is that I use GetTree to get children names.
             * So my assumption is - Children should _always_ have objects. Maybe I'd better hide list of IDs in some private property of a Node and Children collection would be empty until I'll fill it
             * It's also worth to check if it's faster to ask Google for object info by ID - without getting any children info - I mean it could be useful for getting children names*/

            while (true)
            {
                Console.WriteLine("Enter a name of a folder to open or press enter to go up");
                var folderToOpen = Console.ReadLine();
                if (String.IsNullOrEmpty(folderToOpen))
                {
                    navigator.NavigateBothTreesUp();
                }
                else
                {
                    navigator.NavigateBothTreesDown(folderToOpen);
                }

                PrintTree(navigator.GetCurrentGoogleNode(), navigator.GetCurrentLocalNode());
            }
        }