public frmConfig2(int dataSourceId, string dataSourceName, DataFormatTypes dataFormatType, IWindowsFormsEditorService windowsFormsEditorService = null) { _WindowsFormsEditorService = windowsFormsEditorService; if (_WindowsFormsEditorService != null) { TopLevel = false; } InitializeComponent(); ; headerFooterConfiguration1.DataFormatType = dataFormatType; headerFooterConfiguration1.DataSourceId = dataSourceId; switch (dataFormatType) { case DataFormatTypes.Delimited: this.Text = "Delimited Configuration"; break; case DataFormatTypes.FixedLength: this.Text = "FixedLength Configuration"; break; } }
public ConfigCSharpInputGenerator(int dataSourceId, DataFormatTypes dataformatType = DataFormatTypes.CSharpCode, IWindowsFormsEditorService windowsFormsEditorService = null) { InitializeComponent(); ; _WindowsFormsEditorService = windowsFormsEditorService; if (_WindowsFormsEditorService != null) { TopLevel = false; } DataSourceId = dataSourceId; DataformatType = dataformatType; if (DataformatType == DataFormatTypes.CSharpCode) { pnlTop.Visible = true; this.Text = "C# Code Configuration"; } else { pnlTop.Visible = false; this.Text = "Multi Record Configuration"; cbGenerateDataTableFrom.SelectedIndex = 1; } BindData(); }
/// <summary> /// Parses a literal message out of the given array of packets. /// In this special case, the first packet in packets MUST be /// a literal data packet. /// </summary> /// <returns>Returns the number of packets used by the function. /// If everything works fine, it will always return 1.</returns> /// <param name="packets">Array of packets. The first packet in /// the array MUST be a literal data packet. Otherwise an exception /// is thrown.</param> /// <remarks>No remarks</remarks> public override int ParseMessage(Packet[] packets) { if (packets[0] is LiteralDataPacket) { this.pPackets = new Packet[1]; pPackets[0] = packets[0]; LiteralDataPacket ldpPacket = (LiteralDataPacket)packets[0]; dftDataFormat = ldpPacket.DataFormat; Binary = ldpPacket.LiteralData; strFilename = ldpPacket.Filename; dtTimeCreated = ldpPacket.TimeCreated; } else { throw new System.ArgumentException("Expected a literal data packet as first packet in the array, but did not find it. Looks like something went terribly wrong."); } return(1); }
public frmFixedLengthConfig(int applicationId, string applicationName, DataFormatTypes formatType) { _ApplicationId = applicationId; _ApplicationName = applicationName; _formatType = formatType; InitializeComponent(); switch (formatType) { case DataFormatTypes.Sql: this.Text = "Paste SQL Query"; grpHeader.Visible = false; grpFooter.Visible = false; break; case DataFormatTypes.FixedLength: this.Text = "Paste Fixed Length Schema"; grpHeader.Visible = true; grpFooter.Visible = true; break; default: this.Text = ""; btnSave.Enabled = false; grpHeader.Visible = false; grpFooter.Visible = false; break; } _Attributes = new Data.UtilDataManager().GetAttributes(_ApplicationId); cmbAttributeFooter.DataSource = _Attributes; cmbAttributeFooter.DisplayMember = "Name"; Data.Attribute[] aa2 = new Data.Attribute[_Attributes.Count]; _Attributes.CopyTo(aa2, 0); cmbAttributeHeader.DataSource = aa2; cmbAttributeHeader.DisplayMember = "Name"; this.fixedLengthSchemaGenerator1.Attributes = _Attributes.Where(aa => aa.IsAcceptable == true).Select(a => a.Name).ToArray(); }
/// <summary> /// Parses the packet given as byte array into the current /// class and returns this with the populated parameters. /// </summary> /// <param name="bData">A byte array containing an OpenPGP /// representation of the packet.</param> /// <returns>Returns an LiteralDataPacket that containes /// the parsed properties.</returns> /// <remarks>No remarks</remarks> public override Packet ParsePacket(byte[] bData) { int iPos = 0; dftDataFormat = (DataFormatTypes)bData[iPos++]; // next comes the filename int iFilenameLength = bData[iPos++]; if (iFilenameLength > bData.Length - 2) { throw new System.ApplicationException("Not a valid LiteralDataPacket!"); } byte[] bFilename = new byte[iFilenameLength]; Array.Copy(bFilename, 0, bData, iPos, iFilenameLength); iPos += iFilenameLength; if (bFilename.Length > 0) { strFilename = System.Text.Encoding.UTF8.GetString(bFilename); } // now 4 bytes of data indicating the modification time of the // file int iTime = bData[iPos++] << 24; iTime ^= bData[iPos++] << 16; iTime ^= bData[iPos++] << 8; iTime ^= bData[iPos++]; dtTimeCreated = new DateTime(iTime * 10000000 + new DateTime(1970, 1, 1).Ticks); bLiteralData = new byte[bData.Length - iPos]; Array.Copy(bData, iPos, bLiteralData, 0, bData.Length - iPos); this.bIsUpdated = false; return(this); }
public frmConfig(bool clickedFromDataFeeder, int applicationId, DataFeederTypes dataFeederType, DataFormatTypes dataFormatType) { _clickedFromDataFeeder = clickedFromDataFeeder; _DataSourceId = applicationId; _dataFeederType = dataFeederType; _dataFormatType = dataFormatType; InitializeComponent(); grpLocalFileSystem.Location = grpFTPFileSystem.Location; grpCustom.Location = grpFTPFileSystem.Location; if (_clickedFromDataFeeder) { switch (_dataFeederType) { case DataFeederTypes.PullFtp: btnSave.Enabled = true; this.Text = "Configure FTP"; grpFTPFileSystem.Visible = true; grpLocalFileSystem.Visible = false; grpCustom.Visible = false; this.Height = grpFTPFileSystem.Height + btnSave.Height + toolStripStatusLabel1.Height + 40; this.Width = grpFTPFileSystem.Width + 18; this.btnSave.Top = grpFTPFileSystem.Top + grpFTPFileSystem.Height + 5; this.btnCancel.Top = grpFTPFileSystem.Top + grpFTPFileSystem.Height + 5; break; case DataFeederTypes.PullLocalFileSystem: btnSave.Enabled = true; this.Text = "Configure Local File System"; grpFTPFileSystem.Visible = false; grpLocalFileSystem.Visible = true; grpCustom.Visible = false; this.Height = grpLocalFileSystem.Height + btnSave.Height + toolStripStatusLabel1.Height + 40; this.Width = grpLocalFileSystem.Width + 18; this.btnSave.Top = grpLocalFileSystem.Top + grpLocalFileSystem.Height + 5; this.btnCancel.Top = grpLocalFileSystem.Top + grpLocalFileSystem.Height + 5; break; default: grpFTPFileSystem.Visible = false; grpLocalFileSystem.Visible = false; btnSave.Enabled = false; break; } } else { SetDataFormatUI(); } cbFilter1.Items.Add("All(No Filter)"); cbFilter1.Items.Add(".txt"); cbFilter1.Items.Add(".csv"); cbFilter1.Items.Add(".txt|.csv"); cbFilter1.Items.Add(".dat"); cbFilter1.Items.Add(".zip"); cbFilter1.Items.Add(".rar"); cbFilter1.Items.Add(".tar"); cbFilter1.Items.Add(".zip|.rar|.tar"); cbFilter2.Items.Add("All(No Filter)"); cbFilter2.Items.Add(".txt"); cbFilter2.Items.Add(".csv"); cbFilter2.Items.Add(".txt|.csv"); cbFilter2.Items.Add(".dat"); cbFilter2.Items.Add(".zip"); cbFilter2.Items.Add(".rar"); cbFilter1.Items.Add(".tar"); cbFilter2.Items.Add(".zip|.rar|.tar"); filterTypeErrorProvider.SetIconAlignment(this.cbFilter1, ErrorIconAlignment.TopLeft); filterTypeErrorProvider.SetIconAlignment(this.cbFilter2, ErrorIconAlignment.TopLeft); BindingList <Eyedia.IDPE.Interface.Data.Attribute> allAttributes = new Data.UtilDataManager().GetAttributes(this._DataSourceId); if (allAttributes != null) { List <string> attributeNames = allAttributes.Select(a => a.Name).ToList(); AcceptableAttributeNames = string.Join(",", attributeNames.ToArray()); } }
private void BindData() { IdpeKey key = DataSource.Keys.GetKey(IdpeKeyTypes.ZipFilesSortType.ToString()); if (key != null) { if (key.Value == "-1") { chkZipSort.Checked = false; } else if (key.Value == "0") { chkZipSort.Checked = true; cmbZipSortType.SelectedIndex = 0; } else if (key.Value == "1") { chkZipSort.Checked = true; cmbZipSortType.SelectedIndex = 1; } else { chkZipSort.Checked = true; radZipSortCstm.Checked = true; txtSortCustom.Text = key.Value; } } key = DataSource.Keys.GetKey(IdpeKeyTypes.ZipDoNotCreateAcknoledgementInOutputFolder.ToString()); if (key != null) { chkZipDoNotCreateAcknoledgementInOutputFolder.Checked = key.Value.ParseBool(); } key = DataSource.Keys.GetKey(IdpeKeyTypes.ZipInterfaceName.ToString()); if (key != null) { txtInterfaceNameZip.Text = key.Value; radZipHandlerCustom.Checked = true; } else { radZipHandlerDefault.Checked = true; } key = DataSource.Keys.GetKey(IdpeKeyTypes.ZipIgnoreFileList.ToString()); if (key != null) { txtZipIgnoreFileList.Text = key.Value; if (!string.IsNullOrEmpty(txtZipIgnoreFileList.Text)) { chkZipIgnoreFiles.Checked = true; } } key = DataSource.Keys.GetKey(IdpeKeyTypes.ZipIgnoreFileListButCopyToOutputFolder.ToString()); if (key != null) { txtZipIgnoreFileListButCopy.Text = key.Value; if (!string.IsNullOrEmpty(txtZipIgnoreFileListButCopy.Text)) { chkZipIgnoreFilesButCopy.Checked = true; } } key = DataSource.Keys.GetKey(IdpeKeyTypes.ZipDataFileDataFormatType.ToString()); DataFormatTypes formatType = DataFormatTypes.Delimited; if (key != null) { int intDataFormat = (int)key.Value.ParseInt(); formatType = (DataFormatTypes)intDataFormat; } cmbDataFormatTypes.Text = formatType.ToString(); cmbDelmiter.Text = DataSource.Delimiter == "\t" ? "Tab" : DataSource.Delimiter; key = DataSource.Keys.GetKey(IdpeKeyTypes.IsFirstRowHeader.ToString()); if (key != null) { chkFileHasHeader.Checked = key.Value.ParseBool(); } key = DataSource.Keys.GetKey(IdpeKeyTypes.RenameColumnHeader.ToString()); if (key != null) { chkRenameHeaders.Checked = key.Value.ParseBool(); } key = DataSource.Keys.GetKey(IdpeKeyTypes.FileInterfaceName.ToString()); if (key != null) { txtFileInterfaceName.Text = key.Value; } }
/// <summary> /// Creates a new literal data message with the given dataformat. /// </summary> /// <param name="dataFormat">The dataformat of the literal Message</param> /// <remarks>No remarks</remarks> public LiteralMessage(DataFormatTypes dataFormat) { dftDataFormat = dataFormat; pPackets = new Packet[0]; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService wfes = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; SreDataSourceProperty dsProperty = context.Instance as SreDataSourceProperty; if (wfes != null) { switch (dsProperty.DataFeederType) { case DataFeederTypes.PullSql: frmConfigSql configPullSql = new frmConfigSql(dsProperty.Id); wfes.ShowDialog(configPullSql); break; default: DataFormatTypes selType = dsProperty.DataFormatType; if ((selType == DataFormatTypes.Xml) || (selType == DataFormatTypes.Zipped)) { selType = DataFormatTypes.Delimited; //to prevent showing xml/zip UI when clicked from this button. } frmConfig configUI = new frmConfig(true, dsProperty.Id, dsProperty.DataFeederType, selType); IdpeKey key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpRemoteLocation.ToString()); configUI.FtpRemoteLocation = key != null ? key.Value : string.Empty; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalLocation.ToString()); key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpUserName.ToString()); configUI.FtpUserName = key != null ? key.Value : string.Empty; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpPassword.ToString()); configUI.FtpPassword = key != null ? key.Value : string.Empty; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FtpWatchInterval.ToString()); configUI.Interval = int.Parse(key != null ? key.Value : "2"); key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.WatchFilter.ToString()); configUI.WatchFilter = key != null ? key.Value : "All(No Filter)"; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.FileInterfaceName.ToString()); if (key != null) { configUI.InterfaceName = key.Value; } key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.IsFirstRowHeader.ToString()); if (key != null) { configUI.IsFirstRowIsHeader = key.Value.ParseBool(); } key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFoldersOverriden.ToString()); configUI.LocalFileSystemFoldersOverriden = key != null?key.Value.ParseBool() : false; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderArchiveAuto.ToString()); configUI.LocalFileSystemFolderArchiveAuto = key != null?key.Value.ParseBool() : false; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderPull.ToString()); configUI.LocalFileSystemFolderPullFolder = key != null ? key.Value : string.Empty; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderArchive.ToString()); configUI.LocalFileSystemFolderArchiveFolder = key != null ? key.Value : string.Empty; key = dsProperty.DataSourceKeys.GetKey(IdpeKeyTypes.LocalFileSystemFolderOutput.ToString()); configUI.LocalFileSystemFolderOutputFolder = key != null ? key.Value : string.Empty; wfes.ShowDialog(configUI); //this.DataSourceKeys = _Manager.GetKeys(DataSource.Id); break; } } return(value); }
/// <summary> /// Parses the packet given as byte array into the current /// class and returns this with the populated parameters. /// </summary> /// <param name="bData">A byte array containing an OpenPGP /// representation of the packet.</param> /// <returns>Returns an LiteralDataPacket that containes /// the parsed properties.</returns> /// <remarks>No remarks</remarks> public override Packet ParsePacket(byte[] bData) { int iPos = 0; dftDataFormat = (DataFormatTypes)bData[iPos++]; // next comes the filename int iFilenameLength = bData[iPos++]; if (iFilenameLength > bData.Length - 2) throw new System.ApplicationException("Not a valid LiteralDataPacket!"); byte[] bFilename = new byte[iFilenameLength]; Array.Copy(bFilename, 0, bData, iPos, iFilenameLength); iPos += iFilenameLength; if (bFilename.Length > 0) strFilename = System.Text.Encoding.UTF8.GetString(bFilename); // now 4 bytes of data indicating the modification time of the // file int iTime = bData[iPos++] << 24; iTime ^= bData[iPos++] << 16; iTime ^= bData[iPos++] << 8; iTime ^= bData[iPos++]; dtTimeCreated = new DateTime(iTime*10000000 + new DateTime(1970, 1, 1).Ticks); bLiteralData = new byte[bData.Length - iPos]; Array.Copy(bData, iPos, bLiteralData, 0, bData.Length - iPos); this.bIsUpdated = false; return this; }
/// <summary> /// Parses a literal message out of the given array of packets. /// In this special case, the first packet in packets MUST be /// a literal data packet. /// </summary> /// <returns>Returns the number of packets used by the function. /// If everything works fine, it will always return 1.</returns> /// <param name="packets">Array of packets. The first packet in /// the array MUST be a literal data packet. Otherwise an exception /// is thrown.</param> /// <remarks>No remarks</remarks> public override int ParseMessage(Packet[] packets) { if (packets[0] is LiteralDataPacket) { this.pPackets = new Packet[1]; pPackets[0] = packets[0]; LiteralDataPacket ldpPacket = (LiteralDataPacket)packets[0]; dftDataFormat = ldpPacket.DataFormat; Binary = ldpPacket.LiteralData; strFilename = ldpPacket.Filename; dtTimeCreated = ldpPacket.TimeCreated; } else throw new System.ArgumentException("Expected a literal data packet as first packet in the array, but did not find it. Looks like something went terribly wrong."); return 1; }