Exemplo n.º 1
0
 /// <summary>
 /// load file extension and create output path
 /// </summary>
 private void LoadFileInfo()
 {
     //extension of input image
     inputFileExtension = System.IO.Path.GetExtension(InputImagePath).Substring(1).ToLower();
     //extension of output image
     OutputFileExtension = OutputFileExtension.ToLower();
     //path for created image
     outputImagePath = System.IO.Path.ChangeExtension(InputImagePath, $".{OutputFileExtension}");
 }
Exemplo n.º 2
0
        private void SaveOutputWriterKeys()
        {
            Manager dm  = new Manager();
            IdpeKey key = new IdpeKey();

            key.Name  = IdpeKeyTypes.OutputPartialRecordsAllowed.ToString();
            key.Value = AllowPartial.ToString();
            key.Type  = (int)IdpeKeyTypes.OutputPartialRecordsAllowed;
            dm.Save(key, DataSource.Id);

            key       = new IdpeKey();
            key.Name  = IdpeKeyTypes.OutputIsFirstRowHeader.ToString();
            key.Value = OutputHasHeader.ToString();
            key.Type  = (int)IdpeKeyTypes.OutputIsFirstRowHeader;
            dm.Save(key, DataSource.Id);


            switch (OutputDataFormatType)
            {
            case OutputTypes.Xml:
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputDelimiter.ToString(), true);
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputIsFirstRowHeader.ToString(), true);
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputDelimiterDoNotEncloseWithDoubleQuote.ToString(), true);
                break;

            case OutputTypes.Delimited:

                key      = new IdpeKey();
                key.Name = IdpeKeyTypes.OutputDelimiter.ToString();
                if (OutputDelimiter.ToLower() == "tab")
                {
                    key.Value = "\t";
                }
                else if (string.IsNullOrEmpty(OutputDelimiter))
                {
                    key.Value = ",";
                }
                else
                {
                    key.Value = OutputDelimiter;
                }
                key.Type = (int)IdpeKeyTypes.OutputDelimiter;
                dm.Save(key, DataSource.Id);


                key       = new IdpeKey();
                key.Name  = IdpeKeyTypes.OutputDelimiterDoNotEncloseWithDoubleQuote.ToString();
                key.Value = (!EncloseWithDoubleQuote).ToString();
                key.Type  = (int)IdpeKeyTypes.OutputDelimiterDoNotEncloseWithDoubleQuote;
                dm.Save(key, DataSource.Id);

                break;

            case OutputTypes.FixedLength:
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputDelimiter.ToString(), true);
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputIsFirstRowHeader.ToString(), true);
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputDelimiterDoNotEncloseWithDoubleQuote.ToString(), true);
                break;

            case OutputTypes.Database:
                OutputFileExtension = ".csv";
                break;

            case OutputTypes.Custom:
                break;
            }

            if (OutputFileNameFormat.ToLower() != "same as input")
            {
                key       = new IdpeKey();
                key.Name  = IdpeKeyTypes.OutputFileName.ToString();
                key.Value = OutputFileNameFormat;
                key.Type  = (int)IdpeKeyTypes.OutputFileName;
                dm.Save(key, DataSource.Id);
            }
            else
            {
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputFileName.ToString(), true);
            }

            if (OutputFileExtension.ToLower() != ".xml")
            {
                key       = new IdpeKey();
                key.Name  = IdpeKeyTypes.OutputFileExtension.ToString();
                key.Value = OutputFileExtension;
                key.Type  = (int)IdpeKeyTypes.OutputFileExtension;
                dm.Save(key, DataSource.Id);
            }
            else
            {
                dm.DeleteKeyFromApplication(this.DataSource.Id, IdpeKeyTypes.OutputFileExtension.ToString(), true);
            }
        }