public static void Main()
        {
            DemolitionFalconsDbContext context = new DemolitionFalconsDbContext();

            SetUpDatabase.CreateDataBase(context);

            Engine engine = new Engine(context);

            JsonExport jsonExporter = new JsonExport();

            jsonExporter.Export(context);

            engine.Run();
        }
Esempio n. 2
0
        /// <summary>
        /// <para type="synopsis">Write out resulting export set object.</para>
        /// </summary>
        protected async override Task EndProcessingAsync()
        {
            string json = await export.Export(Indent.IsPresent);

            string output = json;

            if (Output == OutputType.HTML)
            {
                if (string.IsNullOrWhiteSpace(Template))
                {
                    // Load default template
                    var _assembly = typeof(psCheckPoint.Extra.Export.ExportCheckPointObjects).GetTypeInfo().Assembly;
                    using (var _html = new StreamReader(_assembly.GetManifestResourceStream("psCheckPoint.Extra.Export.ExportTemplate.html")))
                    {
                        output = await _html.ReadToEndAsync();
                    }
                }
                else
                {
                    output = File.ReadAllText(Template);
                }

                if (string.IsNullOrWhiteSpace(output))
                {
                    throw new CmdletInvocationException("Unable to load HTML template.");
                }

                output = output.Replace("{JSON}", json);
            }

            if (Path != null)
            {
                File.WriteAllText(Path, output);
            }
            else
            {
                WriteObject(output);
            }

            WriteVerbose($"Exported {export.Count} objects");
        }