Exemple #1
0
        public Exporter(ExportFileType exportFileType)
        {
            switch (exportFileType)
            {
            case ExportFileType.PlainText:
                _exporter = new PlainTextExporter();
                break;

            case ExportFileType.Markdown:
                _exporter = new MarkdownExporter();
                break;

            case ExportFileType.BbCode:
                _exporter = new BbCodeExporter();
                break;

            case ExportFileType.Csv:
                _exporter = new DelimeterSeparatedValueExporter(DelimeterSeparatedValueExporter.Delimeter.Comma);
                break;

            case ExportFileType.Tsv:
                _exporter = new DelimeterSeparatedValueExporter(DelimeterSeparatedValueExporter.Delimeter.Tab);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #2
0
 public void add_exporter(IExporter exp)
 {
     if (!exporters.Contains(exp))
     {
         exporters.Add(exp);
     }
 }
Exemple #3
0
 public ExportStep(SharpDoxConfig sharpDoxConfig, SDBuildStrings sdBuildStrings, BuildMessenger buildMessenger, IExporter[] allExporters)
 {
     _sharpDoxConfig = sharpDoxConfig;
     _sdBuildStrings = sdBuildStrings;
     _buildMessenger = buildMessenger;
     _allExporters = allExporters;
 }
 public void Add(IExporter exporter)
 {
     if (exporter == null)
         throw new ArgumentNullException("exporter");
     
     base.Add(exporter);
 }
Exemple #5
0
        /// <summary>
        /// Crawl Play Store based on keywords given and export the result to CSV
        /// </summary>
        /// <param name="keywords">Array of keywords</param>
        /// <param name="exporter">Exporter class for exporting. If not null, the IExporter.Export() will be called.</param>
        /// <param name="maxAppUrls">Maximum Scraped App Urls for each keyword. To scrape without limit, set the value to 0</param>
        /// <param name="downloadDelay">Download Delay in milliseconds</param>
        /// <param name="writeCallback">Callback method for writing the App Data</param>
        public static void Crawl(string[] keywords, IExporter exporter = null, int maxAppUrls = 0, int downloadDelay = 0,
                                 Action <AppModel> writeCallback       = null)
        {
            if (exporter != null)
            {
                exporter.Open();
            }

            // Collect App Urls from keywords
            foreach (string keyword in keywords)
            {
                ISet <string> urls = CollectAppUrls(keyword, maxAppUrls);

                // Apply download delay
                if (downloadDelay > 0)
                {
                    Thread.Sleep(downloadDelay);
                }

                // Parse each of App Urls found
                ParseAppUrls(urls, downloadDelay, exporter, writeCallback);
            }

            if (exporter != null)
            {
                exporter.Close();
            }
        }
        public void ExportEventsToFile(EExportFormat exportType, List <CEventInfo> items, string path)
        {
            try
            {
                IExporter exporter = null;
                switch (exportType)
                {
                case EExportFormat.Csv:
                    exporter = new CCsvExport <CEventInfo>(items);
                    break;

                default:
                    s_logger.Warn("Unknown export format");
                    break;
                }

                if (exporter == null)
                {
                    throw new NullReferenceException();
                }

                exporter.ExportToFile(path);
            }
            catch (Exception ex)
            {
                s_logger.Error(ex);
                throw;
            }
        }
Exemple #7
0
        public void Run(string[] args)
        {
            if (args == null || args.Length < 2)
            {
                ShowHelp();
                Environment.Exit(-1);
            }
            //parse out command line
            // warmup web newprojName
            string templateName = args[0];
            string name         = args[1];
            string target       = null;

            if (args.Length > 2)
            {
                target = args[2];
            }

            var       td       = new TargetDir(name);
            IExporter exporter = GetExporter(templateName);

            exporter.Export(WarmupConfiguration.settings.SourceControlWarmupLocation, templateName, td);
            Console.WriteLine("Replacing tokens");
            td.ReplaceTokens(name);
            td.MoveToDestination(target);
        }
Exemple #8
0
        internal static void ExportTable(ExportContext context, DataTable table, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(table != null);
            Debug.Assert(writer != null);

            DataView view = table.DefaultView;

            //
            // If there is an exporter (perhaps an override) for the
            // DataView in effect then use it. Otherwise our
            // DataViewExporter.
            //

            IExporter exporter = context.FindExporter(view.GetType());

            if (exporter != null)
            {
                exporter.Export(context, view, writer);
            }
            else
            {
                DataViewExporter.ExportView(context, view, writer);
            }
        }
Exemple #9
0
        public virtual void Register(IExporter exporter)
        {
            if (exporter == null)
                throw new ArgumentNullException("exporter");

            Exporters.Put(exporter);
        }
 public WorldPopulationBO(ILogger logger, IApiClient api, IExporter exporter)
 {
     Logger   = logger;
     Api      = api;
     Exporter = exporter;
     Api.GetInstance();
 }
        public async Task ExportAsync(string name, Document document, IExporter exporter, IRenderer renderer)
        {
            if (await dialogService.ConfirmAsync(LocalizationManager.GetString("Export_EmailConfirm")))
            {
                var extension = exporter.Extensions.FirstOrDefault();

                if (extension == null)
                {
                    throw new InvalidOperationException("The exporter needs to specify at least one file extension.");
                }

                var buffer = await SerializeAsync(document, exporter, renderer);

                var downloadUri = await UploadAsync(name, extension, buffer);

                var subj = LocalizationManager.GetFormattedString("Export_EmailSubject");
                var body = LocalizationManager.GetFormattedString("Export_EmailBody", downloadUri);

                var message = new EmailMessage {
                    Subject = subj, Body = body
                };

                await EmailManager.ShowComposeNewEmailAsync(message);
            }
        }
Exemple #12
0
        /// <summary>
        /// Generates an email with the <paramref name="topMessage">topMessage</paramref> if the launch count = <paramref name="noLaunches">noLaunches</paramref>.
        /// </summary>
        /// <param name="emailAddress">email address to send report to</param>
        /// <param name="topMessage">Message for report</param>
        /// <param name="noLaunches">number of launches at which report should be generated.</param>
        public static void UsageReport(string emailAddress, string topMessage, int noLaunches)
        {
            int launchCount = int.Parse(Utils.UsageEmailDialog.RegistryAccess.GetStringRegistryValue(utilityLabel, "0"));

            if (launchCount == noLaunches)
            {
                // Set the Application label to the name of the app
                Assembly  assembly = Assembly.GetExecutingAssembly();
                IExporter exporter = DynamicLoader.CreateObject("PsExport.dll", "SIL.PublishingSolution.PsExport") as IExporter;
                if (exporter != null)
                {
                    assembly = exporter.GetType().Assembly;
                }
                string version = Application.ProductVersion;

                if (assembly != null)
                {
                    object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
                    version = (attributes != null && attributes.Length > 0) ?
                              ((AssemblyFileVersionAttribute)attributes[0]).Version : Application.ProductVersion;
                }

                string emailSubject = string.Format("{0} {1} Report {2} Launches", utilityLabel, version, launchCount);
                string emailBody    = string.Format("<report app='{0}' version='{1}'><stat type='launches' value='{2}'/></report>", utilityLabel, version, launchCount);
                string body         = emailBody.Replace(Environment.NewLine, "%0A").Replace("\"", "%22").Replace("&", "%26");

                Process p = new Process();
                p.StartInfo.FileName = String.Format("mailto:{0}?subject={1}&body={2}", emailAddress, emailSubject, body);
                p.Start();
            }
        }
Exemple #13
0
        /// <summary>
        /// Initializes a new TestScenario instance with a specified name and exporter.
        /// </summary>
        /// <param name="name">The name of the scenario and, when used, the persisted file</param>
        /// <param name="exporter">The exporter used when persisting scenarios</param>
        public TestScenario(string name, IExporter exporter)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("name");
            }

            _name = name;
            _rdg  = new RandomDataGenerator();

            _exporter = exporter;

            if (_exporter != null)
            {
                _exporter.Setup(string.Concat(
                                    Directory.GetCurrentDirectory(),
                                    Path.DirectorySeparatorChar,
                                    "test-scenario-data",
                                    Path.DirectorySeparatorChar,
                                    _name,
                                    ".json"));

                if (!_exporter.IsNew)
                {
                    _exporter.Load();
                }
            }
        }
        /// <summary>
        /// Basic export function to generate PDF from one element
        /// </summary>
        /// <param name="toExport">element to export</param>
        /// <returns>A PDF Document</returns>
        public PdfDocument Export(DomainDAL.Module toExport)
        {
            Document prePdf = new Document();

            //Document markup
            DefineStyles(prePdf);
            BuildCover(prePdf, toExport.Naam + "\n" + toExport.CursusCode);

            //Here starts the real exporting
            Section sect = prePdf.AddSection();

            ModuleExportArguments opt = new ModuleExportArguments()
            {
                ExportAll = true
            };

            ModuleExporterFactory mef = new ModuleExporterFactory();

            moduleExporterStrategy = mef.GetStrategy(opt);

            try
            {
                sect = moduleExporterStrategy.Export(toExport, sect);
            }
            catch (Exception e)
            {
                sect.AddParagraph("An error has occured while invoking an export-function on Module: " + toExport.Naam + "\n" + e.Message, "error");
            }

            PdfDocumentRenderer rend = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);

            rend.Document = prePdf;
            rend.RenderDocument();
            return(rend.PdfDocument);
        }
        public virtual void Export(object value, JsonWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            if (JsonNull.LogicallyEquals(value))
            {
                writer.WriteNull();
            }
            else
            {
                IExporter exporter = FindExporter(value.GetType());

                if (exporter != null)
                {
                    exporter.Export(this, value, writer);
                }
                else
                {
                    writer.WriteString(value.ToString());
                }
            }
        }
Exemple #16
0
        private IExporter FindCompatibleExporter(Type type)
        {
            Debug.Assert(type != null);

            if (typeof(IJsonExportable).IsAssignableFrom(type))
                return new ExportAwareExporter(type);

            if (type.IsClass && type != typeof(object))
            {
                IExporter exporter = FindBaseExporter(type.BaseType, type);
                if (exporter != null)
                    return exporter;
            }

            if (typeof(IDictionary).IsAssignableFrom(type))
                return new DictionaryExporter(type);

            if (typeof(IEnumerable).IsAssignableFrom(type))
                return new EnumerableExporter(type);
            
            if ((type.IsPublic || type.IsNestedPublic) &&
                !type.IsPrimitive && type.GetConstructor(Type.EmptyTypes) != null)
            {
                return new ComponentExporter(type);
            }

            return new StringExporter(type);
        }
        /// <summary>
        /// Kiválasztott exportálóhoz megjelniti a megfelelő Options Panelt.
        /// </summary>
        private void ComboBoxExportFormat_SelectedIndexChanged(object sender, EventArgs e)
        {
            _exporter = (IExporter)comboBoxExportFormat.SelectedItem;

            if (_exporter is ToCsv)
            {
                if (!PanelOptions.Controls.Contains((Control)_csvOptionsView))
                {
                    PanelOptions.Controls.Clear();
                    PanelOptions.Controls.Add((Control)_csvOptionsView);
                }
            }
            else if (_exporter is ToXlsx)
            {
                if (!PanelOptions.Controls.Contains((Control)_xlsxOptionsView))
                {
                    PanelOptions.Controls.Clear();
                    PanelOptions.Controls.Add((Control)_xlsxOptionsView);
                }
            }
            else if (_exporter is ToXml)
            {
                if (!PanelOptions.Controls.Contains((Control)_xmlOptionsView))
                {
                    PanelOptions.Controls.Clear();
                    PanelOptions.Controls.Add((Control)_xmlOptionsView);
                }
            }

            /*kiterjeszés változása miatt itt is frissíteni kell.*/
            textBoxPath.Text = Environment.CurrentDirectory + "\\" + _directory + "\\" + _fileName + _exporter.FileExtension;
            _saveFileDialog.InitialDirectory = Environment.CurrentDirectory;
            _saveFileDialog.Filter           = _exporter.FileFilter;
            _saveFileDialog.FileName         = _fileName;
        }
Exemple #18
0
        /// <summary>
        /// Puts current player in score board. Determines position comparing player's scores with other entries in score board.
        /// </summary>
        /// <param name="player">Current players that plays the game.</param>
        public void PlacePlayerInScoreBoard(IPlayer player)
        {
            this.LoadTopPlayers(Globals.BestScoresPath);
            int emptyPosition = this.GetFirstFreePosition();

            if (this.scoreBoardTable.TopPlayers[emptyPosition] == null || player.Score >= this.scoreBoardTable.TopPlayers[emptyPosition].Score)
            {
                this.scoreBoardTable.TopPlayers[emptyPosition] = player;

                for (int i = 0; i < emptyPosition; i++)
                {
                    IPlayer firstPlayer  = this.scoreBoardTable.TopPlayers[i];
                    IPlayer secondPlayer = this.scoreBoardTable.TopPlayers[i + 1];

                    if (firstPlayer.Score < secondPlayer.Score)
                    {
                        this.scoreBoardTable.TopPlayers[i]     = secondPlayer;
                        this.scoreBoardTable.TopPlayers[i + 1] = firstPlayer;
                    }
                }
            }

            this.export = new FileExporter(this.scoreBoardTable);
            this.export.Save(Globals.BestScoresPath);
        }
        public ExporterSelection(SDGuiStrings strings, ICoreConfigSection sharpdoxConfig, IExporter[] allExporters)
        {
            Strings = strings;

            DataContext = new ExporterViewModel(sharpdoxConfig, allExporters);
            InitializeComponent();
        }
        public virtual IExporter FindExporter(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            IExporter exporter = Exporters[type];

            if (exporter != null)
            {
                return(exporter);
            }

            exporter = StockExporters[type];

            if (exporter == null)
            {
                exporter = FindCompatibleExporter(type);
            }

            if (exporter != null)
            {
                Register(exporter);
                return(exporter);
            }

            return(null);
        }
Exemple #21
0
 public BuildController(SDBuildStrings sdBuildStrings, IConfigController configController, IBuildMessenger buildMessenger, IExporter[] allExporters)
 {
     _configController = configController;
     _sdBuildStrings = sdBuildStrings;
     _buildMessenger = (BuildMessenger)buildMessenger;
     _allExporters = allExporters;
 }
Exemple #22
0
        /// <summary>
        /// </summary>
        /// <param name="scheme"></param>
        /// <returns></returns>
        internal string Export(Scheme scheme, IExporter exporter)
        {
            var builder = new StringBuilder();

            exporter.WriteHeader(builder, scheme);

            if (exporter.Group)
            {
                var maximum = scheme.Colors.Length / 2;

                for (var index = 0; index < maximum; index++)
                {
                    exporter.WriteColor(builder, scheme, index, index + maximum);
                }
            }
            else
            {
                for (var index = 0; index < scheme.Colors.Length; index++)
                {
                    exporter.WriteColor(builder, scheme, index, -1);
                }
            }

            exporter.WriteEpilogue(builder, scheme);

            return(builder.ToString());
        }
Exemple #23
0
        private static void ExportDataSet(ExportContext context, DataSet dataSet, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(dataSet != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();

            foreach (DataTable table in dataSet.Tables)
            {
                writer.WriteMember(table.TableName);

                //
                // If there is an exporter (perhaps an override) for the
                // DataTable in effect then use it. Otherwise our
                // DataTableExporter.
                //

                IExporter tableExporter = context.FindExporter(table.GetType());

                if (tableExporter != null)
                {
                    tableExporter.Export(context, table, writer);
                }
                else
                {
                    DataTableExporter.ExportTable(context, table, writer);
                }
            }

            writer.WriteEndObject();
        }
Exemple #24
0
 /// <summary>
 /// Exports indicator results to file.
 /// </summary>
 /// <param name="fileName">File name.</param>
 /// <param name="exporter">Exporter</param>
 public void Export(string fileName, IExporter <TInput, TResult> exporter)
 {
     using (var stream = new FileStream(fileName, FileMode.Create))
     {
         this.Export(stream, exporter);
     }
 }
        /// <summary>
        /// Exports the model in a STA.
        /// </summary>
        /// <param name="e">The exporter.</param>
        /// <param name="stream">The output stream.</param>
        /// <param name="visual">The visual to export.</param>
        protected void ExportModel(IExporter e, Stream stream, Func <Visual3D> visual)
        {
            Exception exception = null;

            CrossThreadTestRunner.RunInSTA(
                () =>
            {
                var vp = new Viewport3D {
                    Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720
                };
                vp.Children.Add(new DefaultLights());
                vp.Children.Add(visual());
                try
                {
                    e.Export(vp, stream);
                }
                catch (Exception ex)
                {
                    exception = ex;
                }
            });

            if (exception != null)
            {
                throw exception;
            }
        }
        /// <summary>
        /// Exports a simple model in a STA.
        /// </summary>
        /// <param name="e">The exporter.</param>
        /// <param name="stream">The stream.</param>
        protected void ExportSimpleModel(IExporter e, Stream stream)
        {
            Exception exception = null;
            CrossThreadTestRunner.RunInSTA(
                () =>
                {
                    var vp = new Viewport3D { Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720 };
                    vp.Children.Add(new DefaultLights());
                    var box = new BoxVisual3D();
                    box.UpdateModel();
                    vp.Children.Add(box);
                    try
                    {
                        e.Export(vp, stream);
                    }
                    catch (Exception ex)
                    {
                        exception = ex;
                    }
                });

            if (exception != null)
            {
                throw exception;
            }
        }
Exemple #27
0
        private void cmdExport_Click(object sender, System.EventArgs e)
        {
            CFile export;

            ExportRow.ExportRowList rows = new ExportRow.ExportRowList();

            int   courseID = GetCourseID();
            Users userda   = new Users(Globals.CurrentIdentity);

            User.UserList users = GetUserSet(GetSectionID(), GetCourseID());

            //Add rows
            rows.Add(userda.GetCourseExportHeading(courseID));
            foreach (User user in users)
            {
                rows.Add(userda.GetCourseExport(user.UserName, courseID));
            }

            //Do export
            try {
                IExporter exporter =
                    (IExporter)ExporterFactory.GetInstance().CreateItem(ddlExportFormat.SelectedItem.Value);
                export = exporter.Export(new FileSystem(Globals.CurrentIdentity), rows);
            } catch (CustomException er) {
                PageExportError(er.Message);
                return;
            }

            //Setup d/l link
            lnkExport.Attributes.Clear();
            lnkExport.Attributes.Add("onClick",
                                     @"window.open('Controls/Filesys/dlfile.aspx?FileID=" + export.ID +
                                     @"', '" + export.ID + @"', 'width=770, height=580')");
            lnkExport.Visible = true;
        }
 private void ShowProgress(object sender, EventArgs e)
 {
     if (_exporter != null)
     {
         int    progress        = _exporter.Progress;
         int    lastError       = _exporter.LastError;
         string lastErrorString = _exporter.LastErrorString;
         if (progress >= 0)
         {
             progressBar.Value = progress;
             if (progress == 100)
             {
                 _timer.Stop();
                 labelError.Text = "Done";
                 _exporter.EndExport();
                 _exporter            = null;
                 buttonCancel.Enabled = false;
             }
         }
         if (lastError > 0)
         {
             progressBar.Value = 0;
             labelError.Text   = lastErrorString + "  ( " + lastError + " )";
             if (_exporter != null)
             {
                 _exporter.EndExport();
                 _exporter            = null;
                 buttonCancel.Enabled = false;
             }
         }
     }
 }
Exemple #29
0
 /// <summary>
 /// Exports the specified <see cref="PlotModel" /> to a file.
 /// </summary>
 /// <param name="exporter">The exporter.</param>
 /// <param name="model">The model to export.</param>
 /// <param name="path">The path to the file.</param>
 public static void ExportToFile(this IExporter exporter, IPlotModel model, string path)
 {
     using (var stream = File.OpenWrite(path))
     {
         exporter.Export(model, stream);
     }
 }
Exemple #30
0
 public JSONExportEmployees(IDbContext db, ISerializer serializer, IExporter exporter, IWriter writer)
 {
     this.db         = db ?? throw new ArgumentNullException(nameof(db));
     this.serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
     this.exporter   = exporter ?? throw new ArgumentNullException(nameof(exporter));
     this.writer     = writer ?? throw new ArgumentNullException(nameof(writer));
 }
Exemple #31
0
        public string Run(IExporter <Peak> exporter)
        {
            SessionPath =
                "session_" + DateTime.Now.ToString("yyyyMMdd_HHmmssfff_", CultureInfo.InvariantCulture) +
                new Random().Next(100000, 999999).ToString();

            CreateTempSamples();
            var template = string.Format("-i {0} -i {1} -r bio -w 1E-2 -s 1E-8", TmpSamples[0], TmpSamples[1]);

            string output;

            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);
                var o = new Orchestrator(exporter);
                o.Orchestrate(template.Split(' '));
                output = sw.ToString();
            }

            var standardOutput = new StreamWriter(Console.OpenStandardOutput())
            {
                AutoFlush = true
            };

            Console.SetOut(standardOutput);
            return(output);
        }
Exemple #32
0
        private void miOutput_Click(object sender, EventArgs e)
        {
            SaveFileDialog pSaveDialog = new SaveFileDialog();

            pSaveDialog.FileName = "";
            pSaveDialog.Filter   = "JPEG图片(*.JPG)|*.jpg|TIFF图片(*.TIF)|*.tif|PDF文档(*.PDF)|*.pdf)";
            if (pSaveDialog.ShowDialog() == DialogResult.OK)
            {
                double    iScreenDisplayResolution = axPageLayoutControl1.ActiveView.ScreenDisplay.DisplayTransformation.Resolution;
                IExporter pExporter = null;
                if (pSaveDialog.FilterIndex == 1)
                {
                    pExporter = new JpegExporterClass();
                }
                else if (pSaveDialog.FilterIndex == 2)
                {
                    pExporter = new TiffExporterClass();
                }
                else if (pSaveDialog.FilterIndex == 3)
                {
                    pExporter = new PDFExporterClass();
                }
                pExporter.ExportFileName = pSaveDialog.FileName;
                pExporter.Resolution     = (short)iScreenDisplayResolution;
                tagRECT   deviceRect      = axPageLayoutControl1.ActiveView.ScreenDisplay.DisplayTransformation.get_DeviceFrame();
                IEnvelope pDeviceEnvelope = new EnvelopeClass();
                pDeviceEnvelope.PutCoords(deviceRect.left, deviceRect.bottom, deviceRect.right, deviceRect.top);
                pExporter.PixelBounds = pDeviceEnvelope;
                ITrackCancel pCancel = new CancelTrackerClass();
                axPageLayoutControl1.ActiveView.Output(pExporter.StartExporting(), pExporter.Resolution, ref deviceRect, axPageLayoutControl1.ActiveView.Extent, pCancel);
                Application.DoEvents();
                pExporter.FinishExporting();
            }
        }
Exemple #33
0
        public RouteApp(
            AppConfig config,
            IHostApplicationLifetime lifetime,
            IIndex <string, IConfigurationUpdater> configUpdaters,
            IIndex <ImportType, IImporter> importers,
            IIndex <ExportType, IExporter> exporters,
            IIndex <ProcessorType, IRouteProcessor> snapProcessors,
            IJ4JLogger logger
            )
        {
            _config    = config;
            _lifetime  = lifetime;
            _importers = importers;

            _exporter = exporters[config.ExportType];

            _distProc = snapProcessors[ProcessorType.Distance];
            _distProc.PointsProcessed += PointsProcessedHandler;

            _logger = logger;
            _logger.SetLoggedType(GetType());

            if (configUpdaters.TryGetValue(AutofacKey, out var updater) &&
                updater.Update(_config))
            {
                _routeProc = snapProcessors[config.ProcessorType];
                _routeProc.PointsProcessed += PointsProcessedHandler;

                return;
            }

            _logger.Fatal("Incomplete configuration, aborting");
            _lifetime.StopApplication();
        }
Exemple #34
0
        //////////////////////////输出当前视图
        public static void ExportWindow(AxMapControl MapCtrl)
        {
            SaveFileDialog pSaveDialog = new SaveFileDialog();

            pSaveDialog.FileName = "";
            pSaveDialog.Filter   = "JPG图片(*.JPG)|*.jpg|tif图片(*.tif)|*.tif";
            if (pSaveDialog.ShowDialog() == DialogResult.OK)
            {
                double    iScreenDispalyResolution = MapCtrl.ActiveView.ScreenDisplay.DisplayTransformation.Resolution;
                IExporter pExporter = null;
                if (pSaveDialog.FilterIndex == 1)
                {
                    pExporter = new JpegExporterClass();
                }
                else if (pSaveDialog.FilterIndex == 2)
                {
                    pExporter = new TiffExporterClass();
                }
                pExporter.ExportFileName = pSaveDialog.FileName;
                pExporter.Resolution     = (short)iScreenDispalyResolution;
                tagRECT   deviceRect      = MapCtrl.ActiveView.ScreenDisplay.DisplayTransformation.get_DeviceFrame();
                IEnvelope pDeviceEnvelope = new EnvelopeClass();
                pDeviceEnvelope.PutCoords(deviceRect.left, deviceRect.bottom, deviceRect.right, deviceRect.top);
                pExporter.PixelBounds = pDeviceEnvelope;
                ITrackCancel pCancle = new CancelTrackerClass();
                MapCtrl.ActiveView.Output(pExporter.StartExporting(), pExporter.Resolution, ref deviceRect, MapCtrl.ActiveView.Extent, pCancle);
                pExporter.FinishExporting();
            }
        }
Exemple #35
0
        /// <summary>
        /// Puts current player in score board. Determines position comparing player's scores with other entries in score board.
        /// </summary>
        /// <param name="player">Current players that plays the game.</param>
        public void PlacePlayerInScoreBoard(IPlayer player)
        {
            this.LoadTopPlayers(Globals.BestScoresPath);
            int emptyPosition = this.GetFirstFreePosition();

            if (this.scoreBoardTable.TopPlayers[emptyPosition] == null || player.Score >= this.scoreBoardTable.TopPlayers[emptyPosition].Score)
            {
                this.scoreBoardTable.TopPlayers[emptyPosition] = player;
                        
                for (int i = 0; i < emptyPosition; i++)
                {
                    IPlayer firstPlayer = this.scoreBoardTable.TopPlayers[i];
                    IPlayer secondPlayer = this.scoreBoardTable.TopPlayers[i + 1];

                    if (firstPlayer.Score < secondPlayer.Score)
                    {
                        this.scoreBoardTable.TopPlayers[i] = secondPlayer;
                        this.scoreBoardTable.TopPlayers[i + 1] = firstPlayer;
                    }
                }
            }

            this.export = new FileExporter(this.scoreBoardTable);
            this.export.Save(Globals.BestScoresPath);
        }
Exemple #36
0
        /// <summary>
        /// Basic export function to generate PDF from one element
        /// </summary>
        /// <param name="toExport">element to export</param>
        /// <returns>A PDF Document</returns>
        public PdfDocument Export(FaseType toExport)
        {
            Document prePdf = new Document();

            //Document markup
            DefineStyles(prePdf);
            BuildCover(prePdf, toExport.Type);

            //Here starts the real exporting
            Section sect = prePdf.AddSection();

            LessenTabelExportArguments opt = new LessenTabelExportArguments()
            {
                ExportAll = true
            };

            LessenTabelExporterFactory ltef = new LessenTabelExporterFactory();

            lessenTabelExporterStrategy = ltef.GetStrategy(opt);

            try
            {
                sect = lessenTabelExporterStrategy.Export(toExport, sect);
            }
            catch (Exception e)
            {
                sect.AddParagraph("An error has occured while invoking an export-function on FaseType: " + toExport.Type + "\n" + e.Message, "error");
            }

            PdfDocumentRenderer rend = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);

            rend.Document = prePdf;
            rend.RenderDocument();
            return(rend.PdfDocument);
        }
Exemple #37
0
        public virtual void Register(IExporter exporter)
        {
            if (exporter == null)
                throw new ArgumentNullException("exporter");

            Exporters.Put(exporter);
        }
Exemple #38
0
        public ExporterViewModel(ICoreConfigSection sharpDoxConfig, IExporter[] allExporters)
        {
            _sharpDoxConfig = sharpDoxConfig;
            _allExporter = allExporters;

            RunRefresh();
            sharpDoxConfig.PropertyChanged += (s, a) => RunRefresh();
        }
Exemple #39
0
 public void ExportToFile(IExporter exporter, string resultsPath)
 {
     var path = new DirectoryInfo(resultsPath);
     if (!path.Exists)
         path.Create();
     var text = Export(exporter);
     File.WriteAllText(Path.Combine(path.FullName, GenerateFileName(exporter)), text);
 }
Exemple #40
0
        public BuildContext(SharpDoxConfig sharpDoxConfig, SDBuildStrings sdBuildStrings, IConfigController configController, BuildMessenger buildMessenger, IExporter[] allExporters)
        {
            _sharpDoxConfig = sharpDoxConfig;
            _sdBuildStrings = sdBuildStrings;
            _buildMessenger = buildMessenger;

            _steps = new Steps(sharpDoxConfig, sdBuildStrings, configController, buildMessenger, allExporters);
        }
Exemple #41
0
 public BuildController(BuildMessenger buildMessenger, IConfigController configController, Func<ICodeParser> codeParser, IExporter[] allExporters, SDBuildStrings sdBuildStrings)
 {
     BuildMessenger = buildMessenger;
     _configController = configController;
     _codeParser = codeParser;
     _allExporters = allExporters;
     _sdBuildStrings = sdBuildStrings;
 }
 public static IOResult<FileLocation> ExportPoiService(PoiService data, IExporter<PoiService, string> exporter, FileLocation destination = null, bool includeGuid = false)
 {
     if (destination == null)
     {
         destination = GetOutputFileLocation(data, exporter.DataFormatExtension, includeGuid);                
     }
     return ConvertFile(null, data, exporter, destination, includeGuid);
 }
Exemple #43
0
 public StepInput(IConfigController configController, ICodeParser codeParser, SDBuildStrings sdBuildStrings, IExporter[] allExporters)
 {
     ConfigController = configController;            
     CoreConfigSection = configController.GetConfigSection<ICoreConfigSection>();
     CodeParser = codeParser;
     SDBuildStrings = sdBuildStrings;
     AllExporters = allExporters;
 }
 public void Put(IExporter exporter)
 {
     if (exporter == null)
         throw new ArgumentNullException("exporter");
     
     Remove(exporter.InputType);
     Add(exporter);
 }
Exemple #45
0
 public Plugin(IXmlReader xmlReader, IImporter importer, IExporter exporter)
 {
     _xmlReader = xmlReader;
     _importer = importer;
     _exporter = exporter;
     Name = "ISO Plugin";
     Version = "0.1.1";
     Owner = "AgGateway & Contributors";
 }
Exemple #46
0
 public void ResetDbProvider()
 {
     SetUiText();
     this.DbProvider = GlobalConfigVars.GetDbProvider();
     this.DbExporter = GlobalConfigVars.GetExporter();
     this.lbSelectedSampleId.Items.Clear();
     SetBoldDates();
     RefreshSampleIdList(datePicker1.Value);
 }
Exemple #47
0
 public Steps(SharpDoxConfig sharpDoxConfig, SDBuildStrings sdBuildStrings, IConfigController configController, BuildMessenger buildMessenger, IExporter[] allExporters = null)
 {
     PreBuildStep = new PreBuildStep(sharpDoxConfig, sdBuildStrings);
     LoadStep = new LoadStep(sharpDoxConfig, sdBuildStrings, buildMessenger);
     ParseStep = new ParseStep(sdBuildStrings, sharpDoxConfig, buildMessenger);
     StructureParseStep = new StructureParseStep(sdBuildStrings, buildMessenger);
     ExportStep = new ExportStep(sharpDoxConfig, sdBuildStrings, buildMessenger, allExporters);
     EndStep = new EndStep(configController, sharpDoxConfig);
 }
        public ConfigSectionControl(ILocalController localController, ICoreConfigSection coreConfigSection, IExporter[] allExporters, BuildController buildController)
        {
            _localController = localController;
            _coreConfigSection = coreConfigSection;
            _allExporters = allExporters;
            _buildController = buildController;

            DataContext = this;
            InitializeComponent();
        }
        public ConfigGridControl(IConfigController configController, IExporter[] allExporters, ILocalController localController, BuildController buildController)
        {
            _allExporters = allExporters;
            _localController = localController;
            _configController = configController;
            _buildController = buildController;

            InitializeComponent();
            InitializeGrid();
        }
        public DocumentEditorViewModel(IDocumentEditor documentEditor, IExporter exporter)
        {
            Ensure.ArgumentNotNull(documentEditor, "documentEditor");
            Ensure.ArgumentNotNull(exporter, "exporter");

            _documentEditor = documentEditor;
            _fontSize = DefaultFontSize;
            _documentEditor.New();
            _document = new TextDocument();
            _exporter = exporter;
        }
 /// <summary>
 /// Exports the model in a STA.
 /// </summary>
 /// <param name="e">The exporter.</param>
 /// <param name="stream">The output stream.</param>
 /// <param name="visual">The visual to export.</param>
 protected void ExportModel(IExporter e, Stream stream, Func<Visual3D> visual)
 {
     CrossThreadTestRunner.RunInSTA(
         () =>
         {
             var vp = new Viewport3D { Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720 };
             vp.Children.Add(new DefaultLights());
             vp.Children.Add(visual());
             e.Export(vp, stream);
         });
 }
        public void Setup()
        {
            m_Mockery = new Mockery();

            m_FileSystem = m_Mockery.NewMock<IFileSystem>();
            m_ClipBoardHelper = m_Mockery.NewMock<IClipBoardHelper>();
            m_ResultViewHelper = m_Mockery.NewMock<IResultViewHelper>();
            m_DetailsTextViewHelper = m_Mockery.NewMock<ITextViewHelper>();
            m_ExportHelper = m_Mockery.NewMock<IExporter>();
            Expect.Once.On(m_ResultViewHelper).EventAdd("SelectionChanged", Is.Anything);
            m_GeneratorController = new GeneratorController(m_FileSystem, m_ResultViewHelper, m_ClipBoardHelper, m_DetailsTextViewHelper);
        }
Exemple #53
0
        public static List<StepBase> StructureParseConfig(IConfigController configController, ICodeParser codeParser, SDBuildStrings sdBuildStrings, IExporter[] allExporters)
        {
            var stepInput = new StepInput(configController, codeParser, sdBuildStrings, allExporters);

            var config = new List<StepBase>();

            config.Add(new CheckConfigStep(stepInput, 0, 15));
            config.Add(new ParseProjectStep(stepInput, 15, 25));
            config.Add(new StructeParseCodeStep(stepInput, 25, 100));

            return config;
        }
Exemple #54
0
        public Shell(IConfigController configController, IExporter[] allExporters, ILocalController localController, BuildController buildController)
        {
            var guiStrings = localController.GetLocalStrings<SDGuiStrings>();
            DataContext = new ShellViewModel(guiStrings, configController, buildController, ExecuteOnClose);
            Strings = guiStrings;
            Style = (Style)FindResource("SharpDoxWindowStyle");

            Closing += (sender, args) => ExecuteOnClose();
            SourceInitialized += OnWindowSourceInitialized;

            InitializeComponent();
            svBody.Content = new ConfigGridControl(configController, allExporters, localController, buildController);
        }
        /// <summary>
        /// Exports a simple model in a STA.
        /// </summary>
        /// <param name="e">The exporter.</param>
        /// <param name="stream">The stream.</param>
        protected void ExportSimpleModel(IExporter e, Stream stream)
        {
            CrossThreadTestRunner.RunInSTA(
                () =>
                {
                    var vp = new Viewport3D { Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720 };
                    vp.Children.Add(new DefaultLights());
                    var box = new BoxVisual3D();
                    box.UpdateModel();
                    vp.Children.Add(box);

                    e.Export(vp, stream);
                });
        }
        public static IOResult<FileLocation> ConvertFile(FileLocation source, IExporter<PoiService, FileLocation> exporter, FileLocation destination = null)
        {
            // Import.
            IOResult<PoiService> import = PoiServiceImporters.Instance.Import(source);
            if (import == null)
            {
                return new IOResult<FileLocation>(new Exception("Cannot read file '" + source + "'."));
            }
            if (!import.Successful)
            {
                return new IOResult<FileLocation>(import.Exception);
            }

            // Export.
            return exporter.ExportData(import.Result, destination);
        }
        public static IOResult<FileLocation> ConvertFile(FileLocation source, IExporter<PoiService, string> exporter, FileLocation destination = null, bool includeGuid = false)
        {
            // Import the file.
            IOResult<PoiService> data = PoiServiceImporters.Instance.Import(source);
            if (data == null)
            {
                return new IOResult<FileLocation>(new Exception("Cannot read file '" + source + "'.")); 
            }
            if (!data.Successful)
            {
                return new IOResult<FileLocation>(data.Exception);
            }

            // Export the file.
            PoiService poiService = data.Result;
            return ConvertFile(source, poiService, exporter, destination, includeGuid);
        }
Exemple #58
0
		private async void Export (IExporter exporter)
		{
			if (string.IsNullOrEmpty (App.Settings.Common.ParticipantId)) {
				await App.Current.MainPage.DisplayAlert (Resources.Strings.Error, Resources.Strings.ExportErrorNoParticipantMessage, Resources.Strings.Ok);
				return;
			}

			//to block user for doing anything while uploading info
			await App.Navigation.PushModalAsync (new ExportWaitPage ());

			//from time 00:00:00 for From date to 23:59:59 time at To date
			var csv = App.EncounterUtils.ExportEventsToCsv (From, To.AddHours(23).AddMinutes(59).AddSeconds(59));

			var isSuccess = await exporter.SendAsync (csv, App.Settings.Common.ParticipantId);
			if (isSuccess)
				await App.Current.MainPage.DisplayAlert (Resources.Strings.Success, Resources.Strings.ExportSuccessMessage, Resources.Strings.Ok);
			else
				await App.Current.MainPage.DisplayAlert (Resources.Strings.Error, Resources.Strings.ExportErrorMessage, Resources.Strings.Ok);

			await App.Navigation.PopModalAsync ();
		}
Exemple #59
0
 public Exporter(ExportFileType exportFileType)
 {
     switch (exportFileType)
     {
         case ExportFileType.PlainText:
             _exporter = new PlainTextExporter();
             break;
         case ExportFileType.Markdown:
             _exporter = new MarkdownExporter();
             break;
         case ExportFileType.BbCode:
             _exporter = new BbCodeExporter();
             break;
         case ExportFileType.Csv:
             _exporter = new DelimeterSeperatedValueExporter(DelimeterSeperatedValueExporter.Delimter.Comma);
             break;
         case ExportFileType.Tsv:
             _exporter = new DelimeterSeperatedValueExporter(DelimeterSeperatedValueExporter.Delimter.Tab);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
		/// <summary>
		/// Save the document by using the passed IExporter
		/// with the passed file name.
		/// </summary>
		/// <param name="filename">The name of the new file.</param>
		/// <param name="iExporter"></param>
		public void SaveTo(string filename, IExporter iExporter)
		{
			this.CreateContentBody();
			iExporter.Export(this, filename);
		}