Exemplo n.º 1
0
        void WriteFiles()
        {
            var writing = Stopwatch.StartNew();

            var dataUpdate = new UpdatePackage("data");
            var jsout = new JsOutput(dataUpdate);
            jsout.Write();

            // Has to be after everything else because partials are modified here.
            var searchUpdate = new UpdatePackage("search");
            var sqlout = new SearchOutput(jsout, searchUpdate);
            sqlout.Write();

            if (dataUpdate.RowCount > 0)
            {
                DatabaseBuilder.PrintLine($"Updating {dataUpdate.RowCount} data rows.");
                dataUpdate.Write();
            }

            if (searchUpdate.RowCount > 0)
            {
                DatabaseBuilder.PrintLine($"Updating {searchUpdate.RowCount} data rows.");
                searchUpdate.Write();
            }

            writing.Stop();
            DatabaseBuilder.PrintLine($"Writing elapsed: {writing.Elapsed}");
        }
Exemplo n.º 2
0
        void ExportFileZip()
        {
            var update = new UpdatePackage("archive") { IncludeAll = true };
            var jsout = new JsOutput(update);
            jsout.Write();

            var zip = new Ionic.Zip.ZipFile("export.zip");
            zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.Always;
            foreach (var row in update.OrderedRows().OfType<DataJsonRow>())
            {
                var path = $"{row.Lang}\\{row.Type}\\{row.Id}.json";
                zip.AddEntry(path, row.Json, Encoding.UTF8);
            }

            zip.Save();
        }