protected override void ProcessRecord()
        {
            var Data = DataXml;

            if (Data == null && DataCsv != null)
            {
                try
                {
                    WriteVerbose("Xmlifying CSV data");
                    Data = ShuffleHelper.StringToXmlSerialized(DataCsv);
                }
                catch (Exception ex)
                {
                    WriteError(new ErrorRecord(ex, "StringToXmlSerialized", ErrorCategory.ReadError, Definition));
                }
            }
            try
            {
                WriteDebug("Importing");
                var result = Shuffler.QuickImport(Definition, Data, ShuffleListener, Container, Folder, true);
                var output = new ShuffleImportResult
                {
                    Created = result.Item1,
                    Updated = result.Item2,
                    Skipped = result.Item3,
                    Deleted = result.Item4,
                    Failed  = result.Item5
                };
                WriteObject(output);
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "QuickImport", ErrorCategory.ReadError, Definition));
            }
        }
Beispiel #2
0
        protected override void ProcessRecord()
        {
            var Data = DataXml;

            if (Data == null && DataCsv != null)
            {
                try
                {
                    WriteVerbose("Xmlifying CSV data");
                    Data = ShuffleHelper.StringToXmlSerialized(DataCsv);
                }
                catch (Exception ex)
                {
                    WriteError(new ErrorRecord(ex, "StringToXmlSerialized", ErrorCategory.ReadError, Definition));
                }
            }
            try
            {
                WriteDebug("Importing");
                var dataList = new Dictionary <string, XmlDocument>
                {
                    { string.Empty, Data }
                };

                var result = Shuffler.QuickImport(new ShuffleContainer(this), Definition, dataList, ShuffleListener, Folder, true);
                var output = new ShuffleImportResult
                {
                    Created = result.created,
                    Updated = result.updated,
                    Skipped = result.skipped,
                    Deleted = result.deleted,
                    Failed  = result.failed
                };
                WriteObject(output);
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "QuickImport", ErrorCategory.ReadError, Definition));
            }
        }