private void CopyToClipboard() { // регистрация формата данных либо получаем его, если он уже зарегистрирован var format = DataFormats.GetFormat(typeof(Document[]).FullName); if (documentationListView.SelectedItems == null || documentationListView.SelectedItems.Count == 0) { return; } var pds = new List <Document>(); foreach (var document in documentationListView.SelectedItems) { pds.Add(document.GetCopyUnsaved()); } if (pds.Count <= 0) { return; } //todo:(EvgeniiBabak) Нужен другой способ проверки сереализуемости объекта using (var mem = new System.IO.MemoryStream()) { var bin = new BinaryFormatter(); try { bin.Serialize(mem, pds); } catch (Exception ex) { MessageBox.Show("Объект не может быть сериализован. \n" + ex); return; } } // копирование в буфер обмена IDataObject dataObj = new DataObject(); dataObj.SetData(format.Name, false, pds.ToArray()); Clipboard.SetDataObject(dataObj, false); pds.Clear(); }
/// <summary>Pastes rawSamples from the clipboard. If there are any.</summary> /// <param name="posX">The position to paste the samples in the rawSamples array.</param> private void pasteRawSamples(int posX) { DataFormats.Format myFormat = DataFormats.GetFormat("cutData"); IDataObject myRetrievedObject = Clipboard.GetDataObject(); ClipboardData csData = (ClipboardData)myRetrievedObject.GetData(myFormat.Name); if (csData != null) { if (csData.Cs == null || csData.Cs.Length <= 0 || csData.Sr <= 0) { return; } int length = csData.Cs.Length; double[] newCutSamples = csData.Cs; if (csData.Sr > this.sampleRate) { //downSample newCutSamples = downSample(csData); int factor = (int)(csData.Sr / this.sampleRate); length = csData.Cs.Length / factor; } if (csData.Sr < this.sampleRate) { //upSample newCutSamples = upSample(csData); int factor = (int)(this.sampleRate / csData.Sr); length = csData.Cs.Length * factor; } double[] newRawSamples = new double[rawSamples.Length + length]; //paste left side of cut into new arr Array.Copy(rawSamples, 0, newRawSamples, 0, posX); //paste cutout section Array.Copy(newCutSamples, 0, newRawSamples, posX + 1, newCutSamples.Length); //paste right side of cut int arr Array.Copy(rawSamples, posX, newRawSamples, (posX + length), rawSamples.Length - posX); //reinitialize rawsamples rawSamples = new double[newRawSamples.Length]; //copy new raw samples into old raw samples variable Array.Copy(newRawSamples, 0, rawSamples, 0, newRawSamples.Length); dataSize = rawSamples.Length / numChannels; refreshChart(); } }
protected HTTPResponse HandleRequest(HTTPRequest request) { var url = StringUtils.FixUrl(request.path); if (url.Equals("/favicon.ico")) { return(null); } DataNode result; var query = request.args; RouteEntry route = null;// router.Find(url, query); if (route != null) { var handler = route.Handlers.First().Handler; // TODO fixme try { result = (DataNode)handler(request); } catch (Exception ex) { result = OperationResult(ex.Message); } } else { result = DataNode.CreateObject("result"); result.AddField("error", "invalid route"); } var response = new HTTPResponse(); var content = DataFormats.SaveToString(format, result); response.bytes = System.Text.Encoding.UTF8.GetBytes(content); response.headers["Content-Type"] = mimeType; return(response); }
/// <summary> /// Copies an object in the specified format to the windows Clipboard. /// </summary> /// <param name="format">The <see cref="System.Windows.Forms.DataFormats"/></param> /// <param name="item">The object to place on the Clipboard buffer.</param> /// <exception cref="ProdOperationException">Examine inner exception</exception> public static void CopyToClipboard(DataFormats format, object item) { try { Clipboard.SetData(format.ToString(), item); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }
private void toolStripButton_1079_8_Click(object sender, EventArgs e) { openFileDialog_1079_1.Title = "Choose Image"; openFileDialog_1079_1.Filter = "Image files|*.bmp;*.jpg;*.gif;*.png;*.tif"; if (openFileDialog_1079_1.ShowDialog() == DialogResult.OK) { string fileName = openFileDialog_1079_1.FileName; Bitmap bitmap = new Bitmap(fileName); Clipboard.SetDataObject(bitmap); DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Bitmap); if (richTextBox_1079_1.CanPaste(myFormat)) { richTextBox_1079_1.Paste(myFormat); } } }
public void PasteAcceptable() { try { if (!m_bSimpleTextOnly) { Paste(); } else if (ClipboardUtil.ContainsData(DataFormats.UnicodeText)) { Paste(DataFormats.GetFormat(DataFormats.UnicodeText)); } else if (ClipboardUtil.ContainsData(DataFormats.Text)) { Paste(DataFormats.GetFormat(DataFormats.Text)); } } catch (Exception) { Debug.Assert(false); } }
/// <summary> /// Overridden for searching on key strokes /// </summary> protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); if (e.Control) { if (e.KeyCode == Keys.F) { if (SetSearchString()) { FindNextMatch(); } else if (e.KeyCode == Keys.F3) { FindPrevMatch(); } else if (e.KeyCode == Keys.L) { CutLine(); } else if (e.KeyCode == Keys.V) { this.Paste(DataFormats.GetFormat(DataFormats.Text)); e.Handled = true; } } //else if( e.Ke } else if (e.Shift) { if (e.KeyCode == Keys.F3) { FindPrevMatch(); } } else if (e.KeyCode == Keys.F3) { FindNextMatch(); } else if (e.KeyCode == Keys.F2) { FindPrevMatch(); } }
private void 貼り付け_Click(object sender, EventArgs e) { if ((console == null) || (console.IsInProcess) || !貼り付け.Enabled) { return; } if (Clipboard.GetDataObject() != null && Clipboard.ContainsText()) { if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) { //Clipboard.SetText(Clipboard.GetText(TextDataFormat.UnicodeText)); richTextBox1.Paste(DataFormats.GetFormat(DataFormats.UnicodeText)); } //richTextBox1.Paste(); //if (richTextBox1.SelectedText.Length > 0) // richTextBox1.SelectedText = ""; //richTextBox1.AppendText(Clipboard.GetText()); } }
public bool PasteSpecial(IDataObject dataObject) { bool pasted = false; try { if (dataObject != null) { foreach (string format in dataObject.GetFormats()) { if (this.CanPaste(DataFormats.GetFormat(format))) { // NOTE: Calling method OnDragDrop() was a nice try but without any success. // Either a recursion has occurred or the data were not pasted. Therefore, // there is no other way (at moment) to teach the RichTextBox to accept // an IDataObject without using the Windows Clipboard! // Save current Clipboard data. var oldDataObject = Clipboard.GetDataObject(); // Try pasting new data from Clipboard. Clipboard.SetDataObject(dataObject); base.Paste(DataFormats.GetFormat(format)); // Try restoring of previous Clipboard data. if (oldDataObject != null) { Clipboard.SetDataObject(oldDataObject); } pasted = true; break; } } } } catch (Exception exception) { Debug.WriteLine(exception); } return(pasted); }
private static Stream ReadFromDataObject(DataObject dataObject, int fileIndex) { var formatetc = new FORMATETC { cfFormat = (short)DataFormats.GetDataFormat(NativeMethods.CFSTR_FILECONTENTS).Id, dwAspect = DVASPECT.DVASPECT_CONTENT, lindex = fileIndex, ptd = new IntPtr(0), tymed = TYMED.TYMED_ISTREAM }; STGMEDIUM medium; System.Runtime.InteropServices.ComTypes.IDataObject obj2 = dataObject; obj2.GetData(ref formatetc, out medium); try { if (medium.tymed == TYMED.TYMED_ISTREAM) { var mediumStream = (IStream)Marshal.GetTypedObjectForIUnknown(medium.unionmember, typeof(IStream)); Marshal.Release(medium.unionmember); var streaWrapper = new ComStreamWrapper(mediumStream, FileAccess.Read, ComRelease.None); streaWrapper.Closed += delegate(object sender, EventArgs e) { NativeMethods.ReleaseStgMedium(ref medium); Marshal.FinalReleaseComObject(mediumStream); }; return(streaWrapper); } throw new NotSupportedException(string.Format("Unsupported STGMEDIUM.tymed ({0})", medium.tymed)); } catch { NativeMethods.ReleaseStgMedium(ref medium); throw; } }
private void btn_InsertImage_Click(object sender, EventArgs e) { OpenFileDialog P_OpenFileDialog = //创建打开文件对话框对象 new OpenFileDialog(); P_OpenFileDialog.Filter = "*.jpg|*.jpg|*.bmp|*.bmp"; DialogResult P_DialogResult = //弹出打开文件对话框 P_OpenFileDialog.ShowDialog(); if (P_DialogResult == DialogResult.OK) //判断是否选中文件 { Clipboard.SetDataObject( //将图像放入剪切板 Image.FromFile(P_OpenFileDialog.FileName), false); if (rtbox_Display.CanPaste( //判断剪切板内是否是图像 DataFormats.GetFormat(DataFormats.Bitmap))) { rtbox_Display.Paste();//粘贴剪切板的内容到控件中 } } }
/// <summary> /// Import SDMX Data Files /// </summary> /// <param name="schemaType"></param> /// <param name="format"></param> /// <param name="agencyId"></param> /// <param name="SDMXFileNameWithPath"></param> /// <param name="dbConnection"></param> /// <param name="dbQueries"></param> /// <returns></returns> public static bool Import_SDMXML_Data(SDMXSchemaType schemaType, DataFormats format, string agencyId, string SDMXFileNameWithPath, DIConnection dbConnection, DIQueries dbQueries) { bool RetVal = false; BaseSDMXHelper BaseSDMXHelpeObj = null; try { BaseSDMXHelpeObj = new BaseSDMXHelper(dbConnection, dbQueries); RetVal = BaseSDMXHelpeObj.Import_SDMXML_Data(SDMXFileNameWithPath); } catch (Exception) { } return(RetVal); }
// ======================================== // method // ======================================== // === IRole ========== public override bool CanUnderstand(IRequest request) { if (request.Id != RequestIds.Paste) { return(false); } var data = Clipboard.GetDataObject(); foreach (var provider in _FormatAndPasters) { var format = DataFormats.GetFormat(provider.Item1); if (data.GetDataPresent(format.Name)) { return(true); } } return(EditorFactory.CanRestoreDataObject(data, _Host)); }
internal static object Retrieve(NSPasteboard pboard, int id) { var name = DataFormats.GetFormat(id)?.Name ?? String.Empty; if (name == Clipboard.IDataObjectFormat) { var native = null == pboard.GetStringForType(Clipboard.IDataObjectFormat); if (native) { return(new DataObjectPasteboard(pboard)); } if (managed.TryGetValue(name, out object value)) { return(value is IDataObject idata ? new DataObjectWrapper(idata) : value); } } return(null); }
/// <summary> /// 实现文本框的全选 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txt_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.A && !e.Alt && !e.Shift) { ((TextBoxBase)sender).SelectAll(); e.Handled = true; //e.SuppressKeyPress = true; } if (e.Control && e.KeyCode == Keys.V) { RichTextBox txt = sender as RichTextBox; if (txt != null) { e.Handled = true; //e.SuppressKeyPress = true; txt.Paste(DataFormats.GetFormat(DataFormats.Text)); } } }
private void TradesGridContextMenuCopyTagsBtn_Click(object sender, RoutedEventArgs e) { //Copies a list of tags from the selected trade to the clipboard DataFormat dataFormat = DataFormats.GetDataFormat(typeof(List <int>).FullName); IDataObject dataObject = new DataObject(); var selectedTrade = (Trade)TradesGrid.SelectedItem; if (selectedTrade.Tags == null) { return; } List <int> dataToCopy = selectedTrade.Tags.Select(x => x.ID).ToList(); dataObject.SetData(dataFormat.Name, dataToCopy, false); Clipboard.SetDataObject(dataObject, false); }
private void transPanel_DragDrop(object sender, DragEventArgs de) { if (m_draggingItem) { DataFormats.Format format = DataFormats.GetFormat("ChameleonSnippet"); string snippetName = (string)de.Data.GetData(format.Name); Point clientPoint = CurrentEditor.PointToClient(new Point(de.X, de.Y)); int pos = CurrentEditor.PositionFromPoint(clientPoint.X, clientPoint.Y); DropMarker dm = CurrentEditor.DropMarkers.MarkerStack.Peek(); dm.Collect(); m_transPanel.SendToBack(); CurrentEditor.Focus(); CurrentEditor.Snippets.InsertSnippet(snippetName); } }
private void insertImageToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Bitmap File| *.jpg"; if (dlg.ShowDialog() == DialogResult.OK) { Image img = Image.FromFile(dlg.FileName); Clipboard.SetDataObject(img); DataFormats.Format df; df = DataFormats.GetFormat(DataFormats.Bitmap); if (this.richText_Note.CanPaste(df)) { richText_Note.Paste(df); } imgflag = img; } this._listImage.Add(imgflag); }
/// <summary> /// Pastes a project item from clipboard /// </summary> /// <param name="dest">Destination</param> public void ProjectItemPasteClipboard(Reference dest) { var dataFormat = DataFormats.GetDataFormat(typeof(ClipboardData).FullName); if (Clipboard.ContainsData(dataFormat.Name)) { ClipboardData data = (ClipboardData)Clipboard.GetData(dataFormat.Name); var reference = ActiveProject.Root.GetReference(data.QualifiedName); if (data.Cut) { ProjectItemMove(reference, dest); Clipboard.Clear(); } else { ProjectItemCopy(reference, dest); } } }
public void InsertPicture() { OpenFileDialog P_OpenFileDialog = new OpenFileDialog(); P_OpenFileDialog.Filter = "*.jpg|*.jpg|*.bmp|*.bmp"; DialogResult P_DialogResult = P_OpenFileDialog.ShowDialog(); if (P_DialogResult == DialogResult.OK)//判断是否选中文件 { Image temp = Image.FromFile(P_OpenFileDialog.FileName); Bitmap im = new Bitmap(temp, richTextBox1.Size.Width, temp.Height * richTextBox1.Size.Width / temp.Width); Clipboard.SetDataObject(im, false); if (richTextBox1.CanPaste(DataFormats.GetFormat(DataFormats.Bitmap))) { richTextBox1.Paste();//粘贴剪切板的内容到控件中 } } }
public TypeData(string s) { var list = s.Split(','); try { Type = DataFormats.GetFormat(list[0]); var tmp = ""; for (var i = 1; i < list.Length; i++) { tmp += list[i]; } if (tmp.Length > 0) { var info = new FileInfo(tmp); Path = info?.FullName ?? ""; } } catch { } }
private void btn_InsertImage_Click(object sender, EventArgs e) { OpenFileDialog P_OpenFileDialog = //建立打開文件對話框物件 new OpenFileDialog(); P_OpenFileDialog.Filter = "*.jpg|*.jpg|*.bmp|*.bmp"; DialogResult P_DialogResult = //彈出打開文件對話框 P_OpenFileDialog.ShowDialog(); if (P_DialogResult == DialogResult.OK) //判斷是否選中文件 { Clipboard.SetDataObject( //將圖像放入剪貼簿 Image.FromFile(P_OpenFileDialog.FileName), false); if (rtbox_Display.CanPaste( //判斷剪貼簿內是否是圖像 DataFormats.GetFormat(DataFormats.Bitmap))) { rtbox_Display.Paste();//貼上剪貼簿的內容到控制元件中 } } }
//ToolStrip Icon Chèn Hình. private void tsbchonhinh_Click(object sender, EventArgs e) { open = new OpenFileDialog(); DialogResult Result = open.ShowDialog(); //khai báo biến kết quả cho việc mở tập tin if (Result == DialogResult.Cancel) //nếu chọn Cancel { return; //rời khỏi sự kiện } else //hoặc chọn Open { try //thử { string ImagePath = open.FileName; //lấy đường dẫn //của tập tin Bitmap myBitmap = new Bitmap(ImagePath); //tạo một Bitmap Clipboard.SetDataObject(myBitmap); //đặt đối tượng dử liệu vào Clipboard DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Bitmap); //lấy định dạng của hình if (rtbinfo.CanPaste(myFormat)) //nếu có thể chèn vào RTBox { rtbinfo.Paste(myFormat); //chèn hình vào } else //nếu không thể chèn { MessageBox.Show("Không thể chèn !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); //hiển thị thông báo } } catch (Exception ex) //nếu có ngoại lệ (mở tập tin không phải hình) { MessageBox.Show(ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; //thông báo và rời khỏi sự kiện } } }
private void pureTextBox_KeyDown(object sender, KeyEventArgs e) { if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Space)) { CheckWebPreview(); } if (e.Control && e.KeyCode == Keys.V) { if (pureTextBox.CanPaste(DataFormats.GetFormat(DataFormats.Bitmap))) { e.SuppressKeyPress = true; } else if (pureTextBox.CanPaste(DataFormats.GetFormat(DataFormats.Text))) { pureTextBox.Paste(DataFormats.GetFormat(DataFormats.Text)); CheckWebPreview(); e.SuppressKeyPress = true; } } }
private void widgetBox_PreviewMouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed && !_isDragging) { _isDragging = true; Point current = e.GetPosition(null); if (Math.Abs(current.X - _startPosition.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(current.Y - _startPosition.Y) > SystemParameters.MinimumVerticalDragDistance) { if (widgetBox.SelectedItem != null) { DataObject obj = new DataObject( DataFormats.GetDataFormat(WidgetDataFormat).Name, widgetBox.SelectedItem); DragDrop.DoDragDrop(this, obj, DragDropEffects.Move); } } _isDragging = false; } }
internal void ValidateCodeIdentifierIsLegal(ValidationContext context) { try { if (!DataFormats.IsValidCSharpIdentifier(this.CodeIdentifier)) { context.LogError( string.Format(CultureInfo.CurrentCulture, Properties.Resources.Validate_NamedElementCodeIdentifierNotValid, this.Name), Properties.Resources.Validate_NamedElementCodeIdentifierNotValidCode, this); } } catch (Exception ex) { tracer.Error( ex, Properties.Resources.ValidationMethodFailed_Error, Reflector <NamedElementSchema> .GetMethod(n => n.ValidateCodeIdentifierIsLegal(context)).Name); throw; } }
private void mnuInsertPicture_Click(object sender, EventArgs e) { string _imgPath = GetImagePath(); if (_imgPath == "") { return; } Image img = Image.FromFile(_imgPath); Image tempImage = Clipboard.GetImage(); Clipboard.Clear(); Clipboard.SetImage(img); this.TextEditor.Paste(DataFormats.GetFormat(DataFormats.Bitmap)); if (tempImage != null) { Clipboard.SetImage(tempImage); } tempImage.Dispose(); }
public void FormDataObject(ListViewItem item) { var formatmumber=(Int16)DataFormats.GetFormat(NativeMethods.CFSTR_FILECONTENTS).Id; //формируем структуру для shell formatetc = new FORMATETC(); formatetc.cfFormat = formatmumber; formatetc.ptd = IntPtr.Zero; formatetc.dwAspect = DVASPECT.DVASPECT_CONTENT; formatetc.lindex = -1; formatetc.tymed = TYMED.TYMED_ISTREAM; //формируем структуру для передачи данных в shell medium = new STGMEDIUM(); medium.tymed = TYMED.TYMED_ISTREAM; MemoryStream = GetFileContents(item); //IStream ob1; medium.unionmember = Marshal.GetComInterfaceForObject(iStream, typeof(MemoryStream)); //medium.unionmember = iStream; ((System.Runtime.InteropServices.ComTypes.IDataObject)ob).SetData(ref formatetc, ref medium, true); }
private static Nullable <DateTime> GetRegistryTimestamp(string CacheId) { if (!File.Exists(FilePath)) { return(null); } var root = DataFormats.LoadFromFile(FilePath); var caches = root.GetNode("caches"); if (caches == null) { Log.Write("caches == null"); return(null); } var cacheNode = caches.GetNode(CacheId); if (cacheNode == null) { return(null); } string timestamp = cacheNode.GetString("timestamp"); if (String.IsNullOrEmpty(timestamp)) { return(null); } if (DateTime.TryParse(timestamp, out var ts)) { return(ts); } else { return(null); } }
public HCEdit() { HCUnitConversion.Initialization(); //this.DoubleBuffered = true; //Create(); // 便于子类在构造函数前执行 FHCExtFormat = DataFormats.GetFormat(HC.HC_EXT); SetStyle(ControlStyles.Selectable, true); // 可接收焦点 FStyle = new HCStyle(true, true); FUndoList = new HCUndoList(); FUndoList.OnUndo = DoUndo; FUndoList.OnRedo = DoRedo; FUndoList.OnUndoNew = DoUndoNew; FUndoList.OnUndoGroupStart = DoUndoGroupBegin; FUndoList.OnUndoGroupEnd = DoUndoGroupEnd; FData = new HCViewData(FStyle); FData.Width = 200; FData.OnGetUndoList = DoGetUndoList; FData.OnCreateItemByStyle = DoDataCreateStyleItem; FData.OnDrawItemPaintBefor = DoDrawItemPaintBefor; FData.OnInsertItem = DoDataInsertItem; FData.OnRemoveItem = DoDataRemoveItem; // 垂直滚动条,范围在Resize中设置 FVScrollBar = new HCScrollBar(); FVScrollBar.Orientation = Orientation.oriVertical; FVScrollBar.OnScroll = DoVScrollChange; // 水平滚动条,范围在Resize中设置 FHScrollBar = new HCScrollBar(); FHScrollBar.Orientation = Orientation.oriHorizontal; FHScrollBar.OnScroll = DoVScrollChange; this.Controls.Add(FHScrollBar); this.Controls.Add(FVScrollBar); FChanged = false; this.ResumeLayout(); }
/// <summary> /// Import SDMX Data Files /// </summary> /// <param name="schemaType"></param> /// <param name="format"></param> /// <param name="agencyId"></param> /// <param name="SDMXFileNameWithPath"></param> /// <param name="dbConnection"></param> /// <param name="dbQueries"></param> /// <returns></returns> public static bool Import_SDMXML_Data(SDMXSchemaType schemaType, DataFormats format, string agencyId, string SDMXFileNameWithPath, DIConnection dbConnection, DIQueries dbQueries) { bool RetVal = false; BaseSDMXHelper BaseSDMXHelpeObj = null; try { BaseSDMXHelpeObj = new BaseSDMXHelper(dbConnection, dbQueries); RetVal = BaseSDMXHelpeObj.Import_SDMXML_Data(SDMXFileNameWithPath); } catch (Exception) { } return RetVal; }
/// <summary> /// Import DSD from Webservice to template/database /// </summary> /// <param name="schemaType"></param> /// <param name="dsdfileNameWPath"></param> /// <param name="format"></param> /// <param name="agencyId"></param> /// <param name="dbConnection"></param> /// <param name="dbQueries"></param> /// <param name="includeSource"></param> /// <returns></returns> public static bool Import_DSD(SDMXSchemaType schemaType, string dsdfileNameWPath, DataFormats format, string agencyId, DIConnection dbConnection, DIQueries dbQueries, bool includeSource) { bool RetVal = false; BaseSDMXHelper BaseSDMXHelpeObj = null; try { BaseSDMXHelpeObj = new BaseSDMXHelper(dbConnection, dbQueries); RetVal = BaseSDMXHelpeObj.Import_DSD(schemaType, dsdfileNameWPath, includeSource); } catch (Exception ex) { throw ex; } return RetVal; }
/// <summary> /// Import DSD from Webservice to template/database /// </summary> /// <param name="schemaType"></param> /// <param name="dsdfileNameWPath"></param> /// <param name="format"></param> /// <param name="agencyId"></param> /// <param name="dbConnection"></param> /// <param name="dbQueries"></param> /// <returns></returns> public static bool Import_DSD(SDMXSchemaType schemaType, string dsdfileNameWPath, DataFormats format, string agencyId, DIConnection dbConnection, DIQueries dbQueries) { bool RetVal = false; RetVal = SDMXHelper.Import_DSD(schemaType, dsdfileNameWPath, format, agencyId, dbConnection, dbQueries, false); return RetVal; }
public static bool Generate_Data(SDMXSchemaType schemaType, XmlDocument query, DataFormats format, DIConnection DIConnection, DIQueries DIQueries, string outputFolder) { bool RetVal; BaseDataUtility BaseDataUtility; RetVal = false; BaseDataUtility = null; try { switch (format) { case DataFormats.Generic: BaseDataUtility = new GenericDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.GenericTS: BaseDataUtility = new GenericTimeSeriesDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.StructureSpecific: BaseDataUtility = new StructureSpecificDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.StructureSpecificTS: BaseDataUtility = new StructureSpecificTimeSeriesDataUtility(DIConnection, DIQueries, string.Empty); break; default: break; } RetVal = BaseDataUtility.Generate_Data(query, outputFolder); } catch (Exception ex) { RetVal = false; throw ex; } finally { } return RetVal; }
public static XmlDocument Get_Data(SDMXSchemaType schemaType, XmlDocument query, DataFormats format, DIConnection DIConnection, DIQueries DIQueries) { XmlDocument RetVal; BaseDataUtility BaseDataUtility; RetVal = null; BaseDataUtility = null; try { switch (format) { case DataFormats.Generic: BaseDataUtility = new GenericDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.GenericTS: BaseDataUtility = new GenericTimeSeriesDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.StructureSpecific: BaseDataUtility = new StructureSpecificDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.StructureSpecificTS: BaseDataUtility = new StructureSpecificTimeSeriesDataUtility(DIConnection, DIQueries, string.Empty); break; default: break; } RetVal = BaseDataUtility.Get_Data(query); } catch (Exception ex) { if (!ex.Message.Contains(Constants.SDMXWebServices.Exceptions.InvalidSyntax.Message) && !ex.Message.Contains(Constants.SDMXWebServices.Exceptions.NoResults.Message) && !ex.Message.Contains(Constants.SDMXWebServices.Exceptions.NotImplemented.Message)) { throw new Exception(Constants.SDMXWebServices.Exceptions.ServerError.Message); } else { throw ex; } } finally { } return RetVal; }
/// <summary> /// Generate_DES /// </summary> /// <param name="schemaType"></param> /// <param name="format"></param> /// <param name="agencyId"></param> /// <param name="DESOutputFileNameWPath"></param> /// <param name="dataFileNameWithPath"></param> /// <param name="DSDFileNameWPath"></param> /// <returns></returns> public static bool Generate_DES(SDMXSchemaType schemaType, DataFormats format, string agencyId, string DESOutputFileNameWPath, string SDMXFileNameWithPath, string DSDFileNameWPath, string languageCode) { bool RetVal = false; BaseSDMXHelper BaseSDMXHelpeObj = null; try { BaseSDMXHelpeObj = new BaseSDMXHelper();//(dbConnection, dbQueries); RetVal = BaseSDMXHelpeObj.Generate_DES(schemaType, DESOutputFileNameWPath, SDMXFileNameWithPath, DSDFileNameWPath, languageCode); } catch (Exception) { } return RetVal; }
public static bool Generate_Data(SDMXSchemaType schemaType, XmlDocument query, DataFormats format, DIConnection DIConnection, DIQueries DIQueries, string outputFolder, out int fileCount,out List<string> GeneratedFiles,SDMXObjectModel.Message.StructureHeaderType Header) { bool RetVal; BaseDataUtility BaseDataUtility; RetVal = false; BaseDataUtility = null; fileCount = 0; GeneratedFiles = new List<string>(); try { switch (format) { case DataFormats.Generic: BaseDataUtility = new GenericDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.GenericTS: BaseDataUtility = new GenericTimeSeriesDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.StructureSpecific: BaseDataUtility = new StructureSpecificDataUtility(DIConnection, DIQueries, string.Empty); break; case DataFormats.StructureSpecificTS: BaseDataUtility = new StructureSpecificTimeSeriesDataUtility(DIConnection, DIQueries, string.Empty); break; default: break; } RetVal = BaseDataUtility.Generate_Data(query, outputFolder,out fileCount,out GeneratedFiles,Header); } catch (Exception ex) { RetVal = false; throw ex; } finally { } return RetVal; }