Пример #1
0
        static async Task MainAsync(string baseDirectory, string connectionString, string dbName)
        {
            var creoleDir = Path.Combine(baseDirectory, "Creole");
            var htmlDir   = Path.Combine(baseDirectory, "Html");

            PrepareDirectories(baseDirectory, creoleDir, htmlDir);

            var client                 = new MongoClient(connectionString);
            var database               = client.GetDatabase(dbName);
            var pagesCollection        = database.GetCollection <BsonDocument>("Page");
            var pagesContentCollection = database.GetCollection <BsonDocument>("PageContent");

            AbstractBar bar = new SwayBar();

            var documents = await pagesCollection.Find(new BsonDocument()).ToListAsync();

            foreach (var document in documents)
            {
                var title  = document.GetValue("Title").AsString;
                var filter = Builders <BsonDocument> .Filter.Eq("Page", document);

                await pagesContentCollection.Find(filter).ForEachAsync(d => CreateFile(creoleDir, htmlDir, title, d));

                bar.Step();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Bar bar;

            bar = new AnimatedBar();
            int wait = 100;
            int end  = 50;

            Test(bar, wait, end);

            bar = new SwayBar();
            Test(bar, wait, end);

            Console.ReadKey();
        }