// protected DevExpress.XtraGrid.Views.BandedGrid.BandedGridView gridViewDetail;
 public FrmTNSRptRevTimebandBase()
 {
     InitializeComponent();
     Init();
     SheetName = "Sheet1";
     _exportData = new ExportData();
 }
 // protected DevExpress.XtraGrid.Views.BandedGrid.BandedGridView gridViewDetail;
 public FrmTNSRptRevByDanhMucTreeViewBase()
 {
     InitializeComponent();
     Init();
     SheetName = "Sheet1";
     _exportData = new ExportData();
 }
 void ExportSounds(TaxonDesc desc, ExportData _data)
 {
     _data.ProgressItem.Update(_data.ProgressItem.Current + 1);
     if (desc.HasSound)
     {
         CopyFile(TaxonUtils.GetSoundFullPath(desc), true, _data);
     }
 }
 // protected DevExpress.XtraGrid.Views.BandedGrid.BandedGridView gridViewDetail;
 public FrmTNSRptRevPivot()
 {
     InitializeComponent();
     InitGrid();
     Init();
     _exportData = new ExportData();
     pivotGridControl1.FieldsCustomization(dockPanelCustom);
 }
        public void ExportToExcel()
        {
            //Calling the bridge pattern and assigning the excel export class.
            IExporter        exporter         = new ExcelExporter();
            DataForIntervals dataForIntervals = new ExportData(Response); //Injecting Response object for processing

            dataForIntervals.Exporter = exporter;                         //Injecting the Excel class object
            dataForIntervals.Export();                                    //Calling the excel export method
        }
        public static void ImportGameLevels()
        {
            string path = EditorUtility.OpenFilePanel("Import Game Levels", "", "xls");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            using (Stream reader = File.OpenRead(path))
            {
                IDictionary <string, PropertyInfo> customPossibleProperties =
                    ExportData.GetCustomPossibleProperties(
                        TypeHelper.GetAllTypes(AllTypeCategory.Game)
                        .Where(type => typeof(GameLevelInfo).IsAssignableFrom(type))
                        .ToArray());
                Dictionary <string, Type> parameters = new Dictionary <string, Type>();
                parameters["Id"] = typeof(string);
                //parameters["Scene"] = typeof(string);
                //parameters["DisplayName"] = typeof(string);
                parameters["Name"] = typeof(string);
                foreach (KeyValuePair <string, PropertyInfo> pair in customPossibleProperties)
                {
                    parameters[pair.Key] = pair.Value.PropertyType;
                }
                HSSFWorkbook workbook   = new HSSFWorkbook(reader);
                ExportData   exportData = ExportData.DeserializeFromSheet(parameters, workbook.GetSheetAt(0));
                foreach (ExportRow exportRow in exportData.ExportRows)
                {
                    if (!exportRow.ContainsParameter("Id"))
                    {
                        continue;
                    }
                    string id = (string)exportRow.GetValue("Id").Value;
                    if (!InfoResolver.Resolve <FortInfo>().GameLevel.GameLevelInfos.ContainsKey(id))
                    {
                        continue;
                    }
                    GameLevelInfo gameLevelInfo = InfoResolver.Resolve <FortInfo>().GameLevel.GameLevelInfos[id];
                    if (exportRow.ContainsParameter("Scene"))
                    {
/*                        gameLevelInfo.Scene = new FortScene();
 *                      gameLevelInfo.Scene.SceneName = (string)exportRow.GetValue("Scene").Value;*/
                    }

/*                    if (exportRow.ContainsParameter("DisplayName"))
 *                  {
 *                      gameLevelInfo.DisplayName = (string)exportRow.GetValue("DisplayName").Value;
 *                  }*/
                    if (exportRow.ContainsParameter("Name"))
                    {
                        gameLevelInfo.Name = (string)exportRow.GetValue("Name").Value;
                    }
                    exportRow.FillCustomExportParameter(gameLevelInfo);
                }
            }
            InfoResolver.Resolve <FortInfo>().Save();
        }
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            FileInfo fi = new FileInfo(ExportPathTextBox.Text);

            if (!fi.Directory.Exists)
            {
                using (TaskDialog dialog = new TaskDialog()) {
                    dialog.WindowTitle     = "Error";
                    dialog.MainIcon        = TaskDialogIcon.Error;
                    dialog.MainInstruction = "Could not find specified directory.";
                    TaskDialogButton okButton = new TaskDialogButton(ButtonType.Ok);
                    dialog.Buttons.Add(okButton);
                    TaskDialogButton button = dialog.ShowDialog(this);
                }
            }
            else
            {
                try {
                    Mouse.SetCursor(Cursors.Wait);
                    ExportData ed = ExportData.None;
                    if (JapaneseTextSwitch.IsOn)
                    {
                        ed = ed | ExportData.Japanese;
                    }
                    if (NotesSwitch.IsOn)
                    {
                        ed = ed | ExportData.Notes;
                    }
                    if (TranslationSwitch.IsOn)
                    {
                        ed = ed | ExportData.Translation;
                    }
                    if (IndexPagesSwitch.IsOn)
                    {
                        ed = ed | ExportData.Filename;
                    }

                    _chapterManager.ExportCustomScript(ExportPathTextBox.Text, ed);
                    Mouse.SetCursor(Cursors.Arrow);
                }
                catch (Exception ex) {
                    Mouse.SetCursor(Cursors.Arrow);

                    using (TaskDialog dialog = new TaskDialog()) {
                        dialog.WindowTitle     = "Error";
                        dialog.MainIcon        = TaskDialogIcon.Error;
                        dialog.MainInstruction = "There was an error exporting the script.";
                        dialog.Content         = ex.Message;
                        TaskDialogButton okButton = new TaskDialogButton(ButtonType.Ok);
                        dialog.Buttons.Add(okButton);
                        TaskDialogButton button = dialog.ShowDialog(this);
                    }
                    return;
                }
                Close();
            }
        }
Example #8
0
        public XElement ConvertToXml(ExportData data)
        {
            var customer     = (Customer)data;
            var customerNode = new XElement("Customer", new XAttribute("CustomerID", customer.CustomerID));

            customerNode.SetAttributeValue("ExternalCustomerID", customer.MembershipID);
            customerNode.SetAttributeValue("CustomerRewardsNo", customer.LoyaltyNumber);
            customerNode.SetAttributeValue("CustomerType", customer.CustomerType);
            customerNode.SetAttributeValue("Operation", customer.Operation);
            customerNode.SetAttributeValue("OrganizationCode", customer.OrganizationCode);
            customerNode.SetAttributeValue("RegisteredDate", customer.CreatedOn);
            customerNode.SetAttributeValue("Status", customer.Status);

            if (customer.Consumer != null)
            {
                var consumerNode = new XElement("Consumer");
                var billingNode  = CreateAddressNode("BillingPersonInfo", customer.Consumer.BillingPersonInfo);
                consumerNode.Add(billingNode);
                customerNode.Add(consumerNode);
            }
            var contactListNode = new XElement("CustomerContactList");
            var contactNode     = CreateAddressNode("CustomerContact", customer.CustomerContactList.CustomerContact,
                                                    new Dictionary <string, string> {
                { "CustomerContactID", customer.CustomerContactList.CustomerContact.CustomerContactID }
            }, true);

            contactListNode.Add(contactNode);
            customerNode.Add(contactListNode);

            var additionalAddressListNode = new XElement("CustomerAdditionalAddressList");

            additionalAddressListNode.SetAttributeValue("Reset", customer.CustomerContactList.CustomerContact.CustomerAdditionalAddressList.Reset);
            if (customer.CustomerContactList.CustomerContact.CustomerAdditionalAddressList.Addresses != null)
            {
                foreach (var address in customer.CustomerContactList.CustomerContact.CustomerAdditionalAddressList.Addresses)
                {
                    var additionalAddressNode = new XElement("CustomerAdditionalAddress");
                    additionalAddressListNode.Add(additionalAddressNode);
                    additionalAddressNode.SetAttributeValue("CustomerAdditionalAddressID", address.AddressID);
                    var personInfoNode = CreateAddressNode("PersonInfo", address.PersonInfo);
                    additionalAddressNode.Add(personInfoNode);
                }
            }
            contactNode.Add(additionalAddressListNode);

            var currencyListNode = new XElement("CustomerCurrencyList");

            currencyListNode.SetAttributeValue("Reset", customer.CustomerCurrencyList.Reset);
            var currencyNode = new XElement("CustomerCurrency");

            currencyNode.SetAttributeValue("Currency", customer.CustomerCurrencyList.CustomerCurrency.Currency);
            currencyNode.SetAttributeValue("IsDefaultCurrency", customer.CustomerCurrencyList.CustomerCurrency.IsDefaultCurrency);
            currencyListNode.Add(currencyNode);
            customerNode.Add(currencyListNode);

            return(customerNode);
        }
 // protected DevExpress.XtraGrid.Views.BandedGrid.BandedGridView gridViewDetail;
 public FrmTNSRptCppBase()
 {
     InitializeComponent();
     btnPrint = new SimpleButton();
     InitGrid();
     Init();
     SheetName = "Sheet1";
     _exportData = new ExportData();
 }
Example #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <Item> result = Item.FindExpiredItem();

            ExportData exData = new ExportData(result);

            exData.WriteExpiredItemToExcel();
            this.Close();
        }
Example #11
0
        private void btnExport_ItemClick(object sender, ItemClickEventArgs e)
        {
            FolderBrowserDialog Dlg = new FolderBrowserDialog();

            if (DialogResult.OK == Dlg.ShowDialog())
            {
                string toFolder = Dlg.SelectedPath;
                XtraMessageBox.Show(ExportData.Export(toFolder));
            }
        }
Example #12
0
        private void Export_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog ExportDialog = new SaveFileDialog();

            if (ExportDialog.ShowDialog() == true)
            {
                ExportData Export = new ExportData();
                Export.ToBeebFiles(ExportDialog.FileName, tiles, levelwindow.levelEdView.screens);
            }
        }
Example #13
0
        public List <string> GetExportIncludedFilenames(string format)
        {
            if (_exportDatas.ContainsKey(format))
            {
                ExportData data = _exportDatas[format];
                return(data.ExportIncludedFilenames);
            }

            return(new List <string>());
        }
Example #14
0
        public string GetExportFolder(string format)
        {
            if (_exportDatas.ContainsKey(format))
            {
                ExportData data = _exportDatas[format];
                return(data.ExportFolder);
            }

            return(string.Empty);
        }
Example #15
0
        public bool ShouldBeExported(string format)
        {
            if (_exportDatas.ContainsKey(format))
            {
                ExportData data = _exportDatas[format];
                return(data.IsExported);
            }

            return(true);
        }
        public ImportExportDialog(ExportData data, bool importMode) : base("ImportExportDialog", null)
        {
            this.importMode = importMode;
            this.data       = data;

            BuildLists();


            SetupDataSource();
        }
Example #17
0
        public static void Export(IProgressMonitor monitor, Object data, String innerFileName, String exportFileName, Action <Exception> finishedAction)
        {
            Exporter   exporter   = new Exporter();
            ExportData exportData = new ExportData();

            exportData.Data           = data;
            exportData.InnerFileName  = innerFileName;
            exportData.ExportFileName = exportFileName;
            exporter.DoExport(monitor, exportData, finishedAction);
        }
        public void ExportGroups(string filePath)
        {
            var export = new ExportData
            {
                SolutionName = SolutionName,
                Groups       = Groups.ToList()
            };
            var json = JsonConvert.SerializeObject(export, Formatting.Indented);

            File.WriteAllText(filePath, json);
        }
 public void Execute(ExportData <Models.Employees.Employee> criteria)
 {
     try
     {
         _excelDataComponent.ConvertToCsv(_excelEmployeeMapper.Map(criteria.DataList), criteria.FilePath);
     }
     catch (IOException ex)
     {
         throw new FileNotAccessibleException(criteria.FileName, ex);
     }
 }
        bool CopyDirectory(string _folder, ExportData _data)
        {
            string newFolder = _data.Transform(_folder);

            if (newFolder == null)
            {
                return(false);
            }
            CopyDir.Copy(_folder, newFolder);
            return(true);
        }
Example #21
0
    public string Success(string strSuccess, List <DataTable> dtArray)
    {
        string     strResult = "";
        ExportData ajaxJson  = new ExportData();

        ajaxJson.arrTable = dtArray;
        ajaxJson.Status   = "1";
        ajaxJson.Msg      = "执行成功!";
        strResult         = JsonConvert.SerializeObject(ajaxJson);
        return(strResult);
    }
Example #22
0
        private void navExportHtml_Click(object sender, EventArgs e)
        {
            ExportData myExportData  = new ExportData();
            String     printTitle    = Properties.Settings.Default.Mdi_Title;
            String     printSubtitle = this.Text + " " + mySanctionNum + " held " + myTourRow["EventDates"].ToString();
            String     printFooter   = " Scored with " + Properties.Settings.Default.AppTitle + " Version " + Properties.Settings.Default.BuildVersion;

            printFooter.PadRight(15, '*');
            printFooter.PadLeft(15, '*');
            myExportData.exportDataAsHtml(scoreSummaryDataGridView, printTitle, printSubtitle, printFooter, "EventStats.htm");
        }
 public void Execute(ExportData <CustomData> criteria)
 {
     try
     {
         _excelDataComponent.ConvertToCsv(_customFieldMapper.Map(criteria.DataList), criteria.FilePath);
     }
     catch (IOException ex)
     {
         throw new FileNotAccessibleException(criteria.FileName, ex);
     }
 }
        public ExportData MergeData(ExportData previousRecord, ExportData data)
        {
            var merged = (PosTransaction)previousRecord;
            var curr   = (PosTransaction)data;

            foreach (Item item in curr.ItemList)
            {
                merged.ItemList.Add(item);
            }

            return(merged);
        }
        private void ExportSelected()
        {
            var selected = GetSelectedPointSet();

            if (selected != null)
            {
                var        Data     = BuildPointSetMatrix(selected);
                ExportData exporter = new ExportData(Data, selected.Name, null);
                exporter.Owner = PluginManager.Instance.ParentWindow;
                exporter.ShowDialog();
            }
        }
        private void EmployeeCustomDateStep(List <Employee> fullData, string fileName)
        {
            var employeeMapper      = new EmployeeMapper();
            var employeeCustomDates = employeeMapper.MapCustomDate(fullData);
            var employeeExportData  = new ExportData <CustomDate>
            {
                DataList = employeeCustomDates,
                FilePath = _outputDirectory.ExcelFilePath(fileName)
            };

            _commandExecutor.Execute(employeeExportData);
        }
 protected void ButtonShippingCsv_Click(object sender, System.EventArgs e)
 {
     try
     {
         string     table      = _csvShippingHiddenValue.Value;
         ExportData exportData = new ExportData();
         exportData.ExportToCsv(ref table, "MyReport_StoreShipping");
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Example #28
0
 private void btExport_Click_1(object sender, EventArgs e)
 {
     if (tbFromDate != null && tbFromDate.Text != null && tbToDate.Text != "" && tbToDate.Text != null)
     {
         DateTime temp;
         if (DateTime.TryParse(tbFromDate.Text, out temp) && DateTime.TryParse(tbFromDate.Text, out temp))
         {
             List <CheckLog> result  = CheckLog.GetData(tbFromDate.Text, tbToDate.Text);
             ExportData      expData = new ExportData(result);
             expData.WriteResultToExcel();
         }
     }
 }
Example #29
0
        private void navExport_Click(object sender, EventArgs e)
        {
            if (isDataModified)
            {
                navSaveItem_Click(null, null);
            }

            ExportData myExportData    = new ExportData();
            String     mySelectCommand = "Select * from TourBoatUse "
                                         + " Where SanctionId = '" + mySanctionNum + "'";

            myExportData.exportData("TourBoatUse", mySelectCommand);
        }
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         string     data      = HdnReviews.Value;
         ExportData excelData = new ExportData();
         excelData.ExportToExcel(ref data, "MyReport_CustomerReview");
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 protected void ButtonCustomerTags_Click(object sender, System.EventArgs e)
 {
     try
     {
         string     table      = _csvCustomerTagHdn.Value;
         ExportData exportData = new ExportData();
         exportData.ExportToCsv(ref table, "MyReport_StoreOrder");
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 protected void ButtonCustomerReviewDetail_Click(object sender, System.EventArgs e)
 {
     try
     {
         string     table      = _csvCustomerReviewDetailValue.Value;
         ExportData exportData = new ExportData();
         exportData.ExportToCsv(ref table, "MyReport_CustomerReview");
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         string     table     = HdnValue.Value;
         ExportData excelData = new ExportData();
         excelData.ExportToExcel(ref table, "MyReport_CustomerReviewAll");
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Example #34
0
 private void DoExport(IProgressMonitor monitor, ExportData exportData, Action <Exception> finishedAction)
 {
     m_FinishedAction = finishedAction;
     m_Worker         = new System.ComponentModel.BackgroundWorker();
     m_Worker.WorkerReportsProgress      = true;
     m_Worker.WorkerSupportsCancellation = true;
     m_Worker.DoWork             += new System.ComponentModel.DoWorkEventHandler(m_Worker_DoWork);
     m_Worker.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(m_Worker_ProgressChanged);
     m_Worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(m_Worker_RunWorkerCompleted);
     m_Monitor = monitor;
     m_Monitor.SetProgress(0, String.Empty);
     m_Worker.RunWorkerAsync(exportData);
 }
        public async Task<HttpResponseMessage> ExportDatabase(ExportData smugglerOptionsJson)
		{
            var requestString = smugglerOptionsJson.SmugglerOptions;
	        SmugglerOptions smugglerOptions;
      
            using (var jsonReader = new RavenJsonTextReader(new StringReader(requestString)))
			{
				var serializer = JsonExtensions.CreateDefaultJsonSerializer();
                smugglerOptions = (SmugglerOptions)serializer.Deserialize(jsonReader, typeof(SmugglerOptions));
			}


            var result = GetEmptyMessage();
            
            // create PushStreamContent object that will be called when the output stream will be ready.
			result.Content = new PushStreamContent(async (outputStream, content, arg3) =>
			{
			    try
			    {
			        await new DataDumper(Database).ExportData(new SmugglerExportOptions
			        {
			            ToStream = outputStream
			        }, smugglerOptions).ConfigureAwait(false);
			    }
                    // close the output stream, so the PushStremContent mechanism will know that the process is finished
			    finally
			    {
			        outputStream.Close();
			    }

				
			});

            result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = "Dump of " + this.DatabaseName + ", " + DateTime.Now.ToString("dd MMM yyyy HH-mm")
            };
			
			return result;


		}
Example #36
0
        private void button_start_Click(object sender, EventArgs e)
        {
            this.SetControlState(true);

            ExportData data = new ExportData();

            data.Bit = this.radioButton_16bit.Checked ? 2 : 1;
            data.SamplingRate = int.Parse(this.comboBox_samplingRate.Text.Substring(0, this.comboBox_samplingRate.Text.IndexOf(' ')));
            data.Oversampling = (int)Math.Pow(2, this.trackBar_oversampling.Value);

            data.FileSize = (this.radioButton_unlimit.Checked) ?
                (long)Int32.MaxValue :
                    (this.radioButton_time.Checked) ?
                    (long)((double)(this.numericUpDown_min.Value * 60m + this.numericUpDown_sec.Value) * data.SamplingRate * 2.0 * data.Bit) :
                    (long)(this.numericUpDown_filesize.Value * 1024.0m * 1024.0m);

            data.Connector = new SmfConnector(data.SamplingRate * data.Oversampling);
            {
                foreach (var presetFile in this.presetFiles)
                    data.Connector.AddPreset(presetFile);

                data.Connector.Load(this.inputFile);
                data.Connector.Sequencer.SequenceEnd += (s2, e2) => { data.SequenceEnded = true; data.Connector.Master.Release(); };

                this.masterControlDialog.ApplyToMaster(data.Connector.Master);
                this.masterControlDialog.ApplyToSequencer(data.Connector.Sequencer);
            }

            if (!this.CheckFileCreate(this.textBox_saveto.Text))
            {
                button_stop_Click(null, null);
                return;
            }

            this.reqEnd = false;

            Task.Factory.StartNew(() => this.ExportLoop(data), TaskCreationOptions.LongRunning);
            Task.Factory.StartNew(() => this.UpdateLabelText(data), TaskCreationOptions.LongRunning);
        }
Example #37
0
        private void UpdateLabelText(ExportData data)
        {
            TimeSpan ts;

            while (!this.reqEnd)
            {
                ts = TimeSpan.FromSeconds(data.Output / 2.0 / data.Bit / (double)data.SamplingRate);

                this.Invoke(new Action(() =>
                {
                    long position = data.Connector.Sequencer.Tick;
                    this.label_progress.Text = String.Format("{0:p0}", (double)data.Output / (double)data.FileSize);
                    this.progressBar.Value = (int)((double)data.Output / (double)data.FileSize * 100);
                    this.label_filesize.Text = String.Format("出力: {0:f0} KB", data.Output / 1024.0);
                    this.label_tick.Text = String.Format("位置: {0}", position < 0 ? 0 : position);
                    this.label_time.Text = String.Format("時間: {0}:{1:d2}", (int)ts.TotalMinutes, ts.Seconds);
                }));

                Thread.Sleep(30);
            }
        }
Example #38
0
        private void ExportLoop(ExportData data)
        {
            using (FileStream fs = new FileStream(this.textBox_saveto.Text, FileMode.Create))
            using (WaveFormatWriter wfw = new WaveFormatWriter(fs, data.SamplingRate, data.Bit * 8, 2))
            {
                const int bufferSize = 512;
                const int filterSize = 4096;

                float[] buffer = new float[bufferSize];
                double[] buffer_double = new double[filterSize];
                double[] bufferOut = new double[filterSize];

                SoundFilter filter = new SoundFilter(true, filterSize);
                var filterGenerator = new LowPassFilter()
                {
                    SamplingRate = data.SamplingRate * data.Oversampling,
                    CutoffFrequency = data.SamplingRate / 2 - ImpulseResponse.GetDelta(data.SamplingRate * data.Oversampling, filterSize)
                };
                double[] impulse = filterGenerator.Generate(filterSize / 2);

                Window.Hanning(impulse);
                filter.SetFilter(impulse);

                double bufferTime = (buffer.Length / 2.0) / (data.SamplingRate * data.Oversampling);

                var filterBuffer = new FilterBuffer<float>(filterSize, da =>
                {
                    if (data.Oversampling > 1)
                    {
                        for (int i = 0; i < filterSize; i++)
                            bufferOut[i] = da[i];

                        filter.Filtering(bufferOut);

                        for (int i = 0, j = 0; i < filterSize; i += data.Oversampling * 2)
                        {
                            buffer_double[j++] = bufferOut[i];
                            buffer_double[j++] = bufferOut[i + 1];
                        }

                        wfw.Write(buffer_double, 0, (int)Math.Min(filterSize / data.Oversampling, data.FileSize - data.Output));
                    }
                    else
                        wfw.Write(da, 0, filterSize);

                    data.Output = wfw.WrittenBytes;
                });

                while (!this.reqEnd && data.FileSize > data.Output)
                {
                    data.Connector.Sequencer.Progress(bufferTime);
                    data.Connector.Master.Read(buffer, 0, bufferSize);

                    filterBuffer.Push(buffer);

                    if (data.SequenceEnded && data.Connector.Master.ToneCount == 0)
                        this.reqEnd = true;
                }

                filterBuffer.Close();

                this.reqEnd = true;
                this.Invoke(new Action(() => button_stop_Click(null, null)));
            }
        }
        public Task<HttpResponseMessage> ExportDatabase(ExportData smugglerOptionsJson)
		{
            var requestString = smugglerOptionsJson.SmugglerOptions;
            SmugglerDatabaseOptions smugglerOptions;
      
            using (var jsonReader = new RavenJsonTextReader(new StringReader(requestString)))
			{
				var serializer = JsonExtensions.CreateDefaultJsonSerializer();
                smugglerOptions = (SmugglerDatabaseOptions)serializer.Deserialize(jsonReader, typeof(SmugglerDatabaseOptions));
			}


            var result = GetEmptyMessage();
            
            // create PushStreamContent object that will be called when the output stream will be ready.
			result.Content = new PushStreamContent(async (outputStream, content, arg3) =>
			{
			    try
			    {
				    var dataDumper = new DatabaseDataDumper(Database, smugglerOptions);
				    await dataDumper.ExportData(
                        new SmugglerExportOptions<RavenConnectionStringOptions>
					    {
						    ToStream = outputStream
					    }).ConfigureAwait(false);
			    }
			    finally
			    {
			        outputStream.Close();
			    }

				
			});
		    
            var fileName = String.IsNullOrEmpty(smugglerOptions.NoneDefualtFileName) || (smugglerOptions.NoneDefualtFileName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) ? 
		        string.Format("Dump of {0}, {1}", this.DatabaseName, DateTime.Now.ToString("yyyy-MM-dd HH-mm", CultureInfo.InvariantCulture)) :
		        smugglerOptions.NoneDefualtFileName;
            result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = fileName + ".ravendump"
            };
			
			return new CompletedTask<HttpResponseMessage>(result);
		}
Example #40
0
        public void SetExportInfo(string format, bool isExported, bool exportUnifiedFile, string folder = null, List<string> includedFilenames = null) {
            if (!_exportDatas.ContainsKey(format)) {
                _exportDatas[format] = new ExportData();
            }

            ExportData data = _exportDatas[format];
            data.IsExported = isExported;
            data.ExportUnifiedFile = exportUnifiedFile;

            if (folder != null)
                data.ExportFolder = folder;

            if (includedFilenames != null) {
                data.ExportIncludedFilenames.Clear();
                data.ExportIncludedFilenames.AddRange(includedFilenames);
            }
        }