Exemple #1
0
        private void cd(String filename, Subreddit dir)
        {
            var file = RedditFSUtils.lookupFile(filename, dir);

            if (file != null)
            {
                if (RedditFSUtils.isDirectory(file))
                {
                    var newDir = RedditFSUtils.openDirSymlink(reddit, file);
                    if (newDir != null)
                    {
                        dir = newDir;
                    }
                    else
                    {
                        Console.WriteLine("Failed to open dir.");
                    }
                }
                else
                {
                    Console.WriteLine("Operand to cd was not a dir.");
                }
            }
            else
            {
                Console.WriteLine("No such file/dir exists.");
            }
        }
Exemple #2
0
        private void ls(Subreddit dir)
        {
            var posts = sub.New.GetEnumerator(100);

            while (posts.MoveNext())
            {
                if (!RedditFSUtils.isDirectory(posts.Current))
                {
                    Console.WriteLine("\t" + posts.Current.Title);
                }
                else
                {
                    Console.BackgroundColor = ConsoleColor.Blue;
                    Console.WriteLine("\t" + posts.Current.Title);
                    Console.ResetColor();
                }
            }
        }