Beispiel #1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
            {
                Logger.Fatal(eventArgs.ExceptionObject as Exception);
            };

            Config config = JsonConvert.DeserializeObject <Config>(File.ReadAllText(ConfigFilePath));

            var date  = DateTime.Now;
            var month = new DateTime(date.Year, date.Month, 1);

            //TODO first hide all tabs in the HR sheet report

            var rawUserDataReporter      = new RawUserDataReporter(new RawUserDataSheet(config.RawUsersSheetSettings));
            var freshestUserDataReporter = new FreshestUserDataReporter(rawUserDataReporter);

            var currentUsersReporter = new CurrentUsersReporter(freshestUserDataReporter);

            ReportWriter <List <UserData> > userDataWriter = new ReportWriter <List <UserData> >(currentUsersReporter, new CurrentUsersSheet(config.CurrentUsersSheetSettings));

            userDataWriter.Write();
            var publicHolidayReporter = new PublicHolidayReporter(config.PublicHolidayApiKey, Enumerable.Range(HolidayYearStart, month.Year - HolidayYearStart + 2).ToList());

            CalculateMonthlyReports(freshestUserDataReporter, publicHolidayReporter, month, config);

            SendAlerts(freshestUserDataReporter, publicHolidayReporter, date, config);
        }
Beispiel #2
0
        public void writeSummaryReport(string report)
        {
            string fileName = String.Format("SummaryReport_{0:MM-dd-yyyy}", DateTime.Now);
            string filePath = System.Web.HttpContext.Current.Server.MapPath("~/Reports/" + fileName);

            ReportWriter.CreateFile(report, filePath + ".html");
        }
Beispiel #3
0
        public void writeWeeklyStatment(Person person, String statment)
        {
            string fileName = String.Format("WeeklyStatment_{0}_{1:MM-dd-yyyy}", person.Name.Replace(" ", "-"), DateTime.Now);
            string filePath = System.Web.HttpContext.Current.Server.MapPath("~/Reports/" + fileName);

            ReportWriter.CreateFile(statment, filePath + ".html");
        }
        private void bcopy_Click(object sender, EventArgs e)
        {
            // Copy
            if (subreportedit.SelectedItems.Count == 0)
            {
                MessageBox.Show("No items selected");
                return;
            }
            if (!(subreportedit.SelectedItems.Values[0] is PrintPosItem))
            {
                MessageBox.Show("No items selected");
                return;
            }
            List <PrintPosItem> nlist = new List <PrintPosItem>();

            foreach (BandInfo nband in subreportedit.SelectedItemsBands.Values)
            {
                Section nsec = nband.Section;
                if (nsec != null)
                {
                    foreach (PrintPosItem nitem in nsec.Components)
                    {
                        int index = subreportedit.SelectedItems.IndexOfKey(nitem.SelectionIndex);
                        if (index >= 0)
                        {
                            nlist.Add(nitem);
                        }
                    }
                }
            }
            string nresult = ReportWriter.WriteComponents(nlist);

            Clipboard.SetText(nresult);
        }
        private static async Task Handler(int iterations, int duration, int concurrency, int rampUp, string reportFile,
                                          string target)
        {
            var reportWriter = new ReportWriter(reportFile);

            var userStepTime = rampUp / concurrency;
            var testTasks    = new List <Task>();
            var startTime    = DateTime.UtcNow;

            var testAssembly = System.Reflection.Assembly.LoadFrom(target);

            for (var i = 1; i <= concurrency; ++i)
            {
                var threadName    = $"worker_{i}";
                var eventListener = new XUnitTestEventListener(reportWriter, threadName);

                var runner = AssemblyRunner.WithoutAppDomain(target);
                runner.OnDiscoveryComplete = XUnitTestEventListener.OnDiscoveryComplete;

                runner.OnTestFailed   = eventListener.OnTestFailed;
                runner.OnTestSkipped  = eventListener.OnTestSkipped;
                runner.OnTestFinished = eventListener.OnTestFinished;

                testTasks.Add(Task.Run(() => StartWorker(runner, startTime, iterations, duration)));
                Thread.Sleep(userStepTime * 1000);
            }

            await Task.WhenAll(testTasks);

            await reportWriter.StopWritingAsync();
        }
Beispiel #6
0
        public void writeEFTData(Provider provider, string content)
        {
            string fileName = String.Format("EFT_{0}_{1:MM-dd-yyyy}", provider.Name.Replace(" ", "-"), DateTime.Now);
            string filePath = System.Web.HttpContext.Current.Server.MapPath("~/Reports/" + fileName);

            ReportWriter.CreateFile(content, filePath + ".txt");
        }
    public void GenerateReportFromLatestEmbeddings()
    {
        var embeddingsFile = new DirectoryInfo($@"{Directory.GetCurrentDirectory()}/{ResultsDirectory}").EnumerateFiles()
                             .Where(f => Regex.IsMatch(f.Name, "^wordEmbeddings-.*$"))
                             .OrderBy(f => f.CreationTime)
                             .Last();
        var reportFileLoc = $@"{Directory.GetCurrentDirectory()}/{ResultsDirectory}/report-{DateTime.Now.Ticks}.csv";

        var wordEmbeddings = new List <WordEmbedding>();

        using var fileStream = new FileStream(embeddingsFile.FullName, FileMode.OpenOrCreate, FileAccess.Read);
        using var reader     = new StreamReader(fileStream, Encoding.UTF8);
        wordEmbeddings.PopulateWordEmbeddingsFromStream(reader);
        wordEmbeddings.NormaliseEmbeddings();

        var articleEmbeddings = new List <ArticleEmbedding>();

        foreach (var line in File.ReadLines(InputFileLoc))
        {
            var splitLine = line.Split(',');
            articleEmbeddings.Add(new ArticleEmbedding(splitLine[0], string.Join(' ', splitLine.Skip(1)), maxContentsLength: 500));
        }
        articleEmbeddings.AssignVectorsFromWeightedWordEmbeddings(wordEmbeddings);

        var kMeans = new KMeans(articleEmbeddings);

        kMeans.CalculateLabelClusterMap(
            numberOfClusters: 25
            );

        var reportHandler = new ReportWriter(reportFileLoc);

        reportHandler.WriteLabelsWithClusterIndex(kMeans.LabelClusterMap);
    }
        public async void PrintPDF(Memo memo)
        {
            Reports = new Reports(memo);
            //var stream = new InMemoryRandomAccessStream();
            //FileSavePicker fileSavePicker = new FileSavePicker();
            WriterFormat format = WriterFormat.PDF;

            //fileSavePicker.SuggestedFileName = "ExportReport";
            //var savedItem = await fileSavePicker.PickSaveFileAsync();

            //if (savedItem != null)
            //

            Windows.Storage.StorageFolder storageFolder =
                Windows.Storage.ApplicationData.Current.LocalFolder;

            Windows.Storage.StorageFile savedItem =
                await storageFolder.CreateFileAsync("sample.pdf",
                                                    Windows.Storage.CreationCollisionOption.ReplaceExisting);

            //var savedItem = await FileSavePicker.PickSaveFileAsync();
            MemoryStream exportFileStream = new MemoryStream();

            Assembly assembly = typeof(HomePage).GetTypeInfo().Assembly;
            // Ensure the report loaction and application name.
            Stream reportStream = assembly.GetManifestResourceStream("UwpApp.Report.Inv.rdlc");

            BoldReports.UI.Xaml.ReportDataSourceCollection datas = new BoldReports.UI.Xaml.ReportDataSourceCollection();
            datas.Add(new BoldReports.UI.Xaml.ReportDataSource {
                Name = "PatientInfo", Value = Reports.LoadReport()
            });
            datas.Add(new BoldReports.UI.Xaml.ReportDataSource {
                Name = "MemoDetails", Value = Reports.loadmemodetail()
            });



            ReportWriter writer = new ReportWriter(reportStream, datas);

            writer.ExportMode = ExportMode.Local;
            await writer.SaveASync(exportFileStream, format);



            try
            {
                using (IRandomAccessStream stream = await savedItem.OpenAsync(FileAccessMode.ReadWrite))
                {
                    // Write compressed data from memory to file
                    using (Stream outstream = stream.AsStreamForWrite())
                    {
                        byte[] buffer = exportFileStream.ToArray();
                        outstream.Write(buffer, 0, buffer.Length);
                        outstream.Flush();
                    }
                }
                exportFileStream.Dispose();
            }
            catch { }
        }
Beispiel #9
0
        public void ExecuteTest()
        {
            var mergeOptions = new MergeOptions
            {
                InputFiles = new[]
                {
                    @"TestFiles\TestFile1.xml",
                    @"TestFiles\TestFile2.xml"
                },
                OutputFile      = "merged.xml",
                LogLevel        = LogLevel.Trace,
                DisableSanitize = false
            };

            var fileLoader       = new FileLoader(new NullLogger <FileLoader>());
            var reportSanitizer  = new ReportSanitizer(new NullLogger <ReportSanitizer>());
            var reportMerger     = new ReportMerger(new NullLogger <ReportMerger>());
            var reportCalculator = new ReportCalculator(new NullLogger <ReportCalculator>());
            var reportWriter     = new ReportWriter(new NullLogger <ReportWriter>());

            var logger = new MessageLogger <Runner>();
            var runner = new Runner(logger, fileLoader, reportSanitizer, reportMerger, reportCalculator, reportWriter);

            Assert.True(runner.Execute(mergeOptions.InputFiles, mergeOptions.OutputFile, mergeOptions.DisableSanitize));

            Assert.Empty(logger.Messages);
        }
Beispiel #10
0
 protected override void Process()
 {
     if (Options.ReportFileName != null)
     {
         ReportWriter.Write(Options.ReportFileName, Options.OptimizerReport);
     }
 }
Beispiel #11
0
        public void Msbuild_ReportWriter(string coverletMultiTargetFrameworksCurrentTFM, string coverletOutput, string reportFormat, string expectedFileName)
        {
            Mock <IFileSystem> fileSystem = new Mock <IFileSystem>();

            fileSystem.Setup(f => f.WriteAllText(It.IsAny <string>(), It.IsAny <string>()))
            .Callback((string path, string contents) =>
            {
                // Path.Combine depends on OS so we can change only win side to avoid duplication
                Assert.Equal(path.Replace('/', Path.DirectorySeparatorChar), expectedFileName.Replace('/', Path.DirectorySeparatorChar));
            });

            Mock <IConsole> console = new Mock <IConsole>();

            ReportWriter reportWriter = new ReportWriter(
                coverletMultiTargetFrameworksCurrentTFM,
                // mimic code inside CoverageResultTask.cs
                Path.GetDirectoryName(coverletOutput),
                coverletOutput,
                new ReporterFactory(reportFormat).CreateReporter(),
                fileSystem.Object,
                console.Object,
                new CoverageResult()
            {
                Modules = new Modules()
            });

            reportWriter.WriteReport();
        }
Beispiel #12
0
 private void btnImport_Click(object sender, EventArgs e)
 {
     if (int.TryParse(txtPeriod.Text, out pastelPeriod) && pastelPeriod >= 1 && pastelPeriod <= 12 && !String.IsNullOrEmpty(txtFileName.Text))
     {
         ReportWriter rw     = new ReportWriter();
         String       errors = "";
         List <Dictionary <String, String> > contents = rw.ExtractData(txtFileName.Text, out errors);
         lines = contents.Count;
         if (errors != "")
         {
             txtProgress.Text += errors + Environment.NewLine;
         }
         txtProgress.Text = "Starting processing" + Environment.NewLine;
         Application.DoEvents();
         txtProgress.Text += lines.ToString() + " in Excel file" + Environment.NewLine;
         MessageBox.Show("Extract Completed");
         Application.DoEvents();
         ProcessContents(contents);
         txtProgress.Text += processedLines.ToString() + " processed" + Environment.NewLine;
         Application.DoEvents();
         txtProgress.Text += "Completed" + Environment.NewLine;
         Application.DoEvents();
     }
     else if (!int.TryParse(txtPeriod.Text, out pastelPeriod) || pastelPeriod < 1 || pastelPeriod > 12)
     {
         MessageBox.Show("Please enter a valid period");
     }
     else
     {
         MessageBox.Show("Please select an Excel file!", "Imports");
     }
 }
Beispiel #13
0
 public FxdacSyntaxRewriter(ReportWriter reportWriter, SemanticModel model, string assembly)
 {
     _model                 = model;
     _assembly              = assembly;
     _reportWriter          = reportWriter;
     _undesiredDependencies = s_AssemblyToTypeDependenciesToRemove.Where(dep => dep.From == _assembly).Select(dep => dep.To).ToList();
 }
        private void btnExcel_Click(object sender, EventArgs e)
        {
            ReportWriter reporter = new ReportWriter();
            String       msg      = "";

            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.Filter = "Excel Files | *.xls";
                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (sfd.FileName != "" && sfd.FileName.EndsWith(".xls"))
                    {
                        reporter.CreateSummaryReport(summaries, sfd.FileName, out msg);
                        if (msg != "Excel Report Saved")
                        {
                            MessageBox.Show(msg, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            MessageBox.Show(msg, "Report", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
        }
Beispiel #15
0
 /// <summary>
 /// Метод непосредственного создания отчета.
 /// </summary>
 public void MakeReport()
 {
     try
     {
         byte[] result = null;
         BuildTimer.Elapsed += (object source, ElapsedEventArgs e) =>
         {
             if (!Canceled)
             {
                 StopWorker(() => ReportWriter.ReportTimeout(Id));
             }
         };
         BuildTimer.Start();
         result = ReportBuilder.Build();
         if (!Canceled)
         {
             StopWorker(() => ReportWriter.ReportSuccess(result, Id));
         }
     }
     catch (Exception ex) when(ex.Message == "Report failed")
     {
         if (!Canceled)
         {
             StopWorker(() => ReportWriter.ReportError(Id));
         }
     }
 }
Beispiel #16
0
    private static bool RefactorAssemblies(ReportWriter reportWriter, out FxRedist redist)
    {
        // prepare the right folders
        PrepareOutputFolder(s_OutputSources);
        PrepareOutputFolder(s_OutputDlls);

        // load files describing the desired factoring. verify consistency of these files.
        redist = new FxRedist();
        if (!ProcessSpecifications(redist, reportWriter))
        {
            Console.WriteLine("\nPress ENTER to exit ...");
            Console.ReadLine();
            return(false);
        }

        // compile master file
        reportWriter.WriteListStart("REMOVED");

        AddSourcesToRedist(reportWriter, redist, s_MasterAPIFile);
        AddSourcesToRedist(reportWriter, redist, s_CoreFxAPIFile);

        reportWriter.WriteListEnd();

        // generate and compile factored assemblies
        GenerateSources(redist);
        var successfulBuild = CompileAssemblies(redist);

        // warn about types that are not in any of the factored assemblies
        if (redist.Leftover.CountOfTypes > 0)
        {
            WriteMessage(ConsoleColor.Yellow, "\n{0} type[s] not assigned to an assembly", redist.Leftover.CountOfTypes);
        }

        return(successfulBuild);
    }
 void ReportReader.WriteReports(ReportWriter reporter)
 {
     using (var builder = new BigEndianDataBuilder())
     {
         var res = _client.SendRequestWithResponse(new Request(FUNCTION_READER_WRITE_REPORTS, builder.Add(reporter.ObjectId).Build(), _objectId));
     }
 }
        public XmlSerializer()
        {
            Configuration = new XmlSerializerConfiguration();
            var xmlAttributeInterpreter = new XmlAttributeInterpreter();

            reportReader = new ReportReader(new ContentReaderCollection(xmlAttributeInterpreter, Configuration.OnDeserialize));
            reportWriter = new ReportWriter(new ContentWriterCollection(xmlAttributeInterpreter));
        }
 public void WriteReports(ReportWriter reporter)
 {
     if (!(reporter is RemoteObject ro))
     {
         throw new ArgumentException("Can only use with remote objects.");
     }
     _client.SendRequestWithResponse(new Request(FUNCTION_READER_WRITE_REPORTS, BigEndianBitConverter.GetBytes(ro.ObjectId), _objectId));
 }
Beispiel #20
0
        public void writeServiceDirectory(Provider provider, List <ServiceReportItem> services)
        {
            string    fileName = String.Format("ServiceDirectory_{0}_{1:MM-dd-yyyy}", provider.Name.Replace(" ", "-"), DateTime.Now);
            string    filePath = System.Web.HttpContext.Current.Server.MapPath("~/Reports/" + fileName);
            DataTable dt       = DataConversion.ToDataTable(services);

            //you can activate next line to do CSV file
            // ReportWriter.CreateCSVFile(dt, filePath + ".txt");
            ReportWriter.CreateHtmlFile(dt, filePath + ".html");
        }
Beispiel #21
0
    static void Main(string[] args)
    {
        //RemoveSerialization();

        if (args.Length > 0)
        {
            s_ExistingContracts = args[0];
        }

        //s_ExistingContracts = @"C:\Users\Krzysztof\Desktop\ExistingContracts";

        if (!Directory.Exists(s_ExistingContracts))
        {
            WriteMessage(ConsoleColor.Red, "Existing contract folder {0} does not exist", s_ExistingContracts);
        }
        else
        {
            FxRedist redist;
            using (var reportWriter = new ReportWriter(s_ReportPath)) {
                if (RefactorAssemblies(reportWriter, out redist))
                {
                    if (s_ExistingContracts != null)
                    {
                        LocationAnalysis.CompareFactorings(s_ExistingContracts, s_OutputDlls, reportWriter);
                    }
                }

                // Orphaned types are types in the specifications that don't exist in master source.
                PrintOrphanedTypes(redist, reportWriter);

                if (redist.Leftover.Count > 0)
                {
                    reportWriter.WriteListStart("TYPES_NOT_IN_ANY_ASSEMBLY", "total", redist.Leftover.CountOfTypes, "description", "types that are not in specification files");

                    foreach (var ns in redist.Leftover)
                    {
                        var nsName = ns.Key;
                        foreach (var type in ns.Value)
                        {
                            reportWriter.WriteListItem(type.Symbol.GetDocumentationCommentId().Substring(2));
                        }
                    }
                    reportWriter.WriteListEnd();
                }

                AnalyzeLayers(redist, reportWriter);
            }
        }

        if (args.Length == 0)
        {
            Console.WriteLine("\nPress ENTER to exit ...");
            Console.ReadLine();
        }
    }
Beispiel #22
0
        public void PrintOrder(MainViewModel model)
        {
            var reportStream =
                Assembly.GetExecutingAssembly().GetManifestResourceStream("HillStationPOS.Reports.Order.rdlc");

            var writer = new ReportWriter { ReportProcessingMode = ProcessingMode.Local };
            writer.DataSources.Clear();
            writer.DataSources.Add(new ReportDataSource { Name = "OrderItems", Value = model.OrderItems });
            writer.LoadReport(reportStream);

            var parameters = new List<ReportParameter>();
            foreach (var parameter in writer.GetParameters())
            {
                var param = new ReportParameter
                {
                    Prompt = parameter.Prompt,
                    Name = parameter.Name
                };
                switch (param.Name)
                {
                    case "OrderNumber":
                        param.Values.Add(model.OrderNumber);
                        break;

                    case "Address":
                        param.Values.Add(model.Address);
                        break;

                    default:
                        throw new InvalidEnumArgumentException(@"Invalid parameter name: " + param.Name);
                }
                parameters.Add(param);
            }

            writer.SetParameters(parameters);

            var stream = new MemoryStream();
            writer.Save(@"D:\Documents\xxx.pdf", WriterFormat.PDF);
            writer.Save(stream, WriterFormat.PDF);

            var pdf = new PdfDocument(stream);

            var size = pdf.Pages[0].Size;
            var paper = new PaperSize("Custom", (int)size.Width, (int)size.Height)
            {
                RawKind = (int)PaperKind.Custom
            };
            pdf.PageScaling = PdfPrintPageScaling.ActualSize;
            var printDocument = pdf.PrintDocument;
            //            printDocument.PrinterSettings.Copies = 2;
            printDocument.DefaultPageSettings.PaperSize = paper;

            //            printDocument.Print();
        }
Beispiel #23
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CommandExecutor  commandExecutor  = new CommandExecutor(Program.getClientUrlResponse(), EMAIL_ADRESS, TOKEN);
            ArcStateReceiver arcStateReceiver = new ArcStateReceiver(Program.getClientUrlRequest());
            ReportWriter     reportWriter     = new ReportWriter(EMAIL_ADRESS, TOKEN);

            Application.Run(new MainView(commandExecutor, arcStateReceiver, reportWriter));
        }
Beispiel #24
0
        /** ****************************************************************************************
         * Sets a new writer. The actual writer is implemented as a stack. It is important to
         * keep the right order when pushing and popping writers, as there lifetime is externally
         * managed. (In standard use-cases, only one, app-specific writer should be pushed anyhow).
         * To give a little assurance, method #PopWriter takes the same parameter as this method
         * does, to verify if if the one to be removed is really the topmost.
         *
         * @param newWriter   The writer to use.
         ******************************************************************************************/
        public void PushWriter(ReportWriter newWriter)
        {
            try { Lock.Acquire();

                  if (writers.Count > 0)
                  {
                      writers.Peek().NotifyActivation(Phase.End);
                  }

                  writers.Push(newWriter);
                  newWriter.NotifyActivation(Phase.Begin); } finally { Lock.Release(); }
        }
        public StrictXmlSerializer()
        {
            var xmlAttributeInterpreter = new XmlAttributeInterpreter();

            var onDeserializeConfiguration = new OnDeserializeConfiguration();

            onDeserializeConfiguration.OnUnexpectedElement   += OnUnexpectedElement;
            onDeserializeConfiguration.OnUnexpectedAttribute += OnUnexpectedAttribute;

            reportReader = new ReportReader(new ContentReaderCollection(xmlAttributeInterpreter, onDeserializeConfiguration));
            reportWriter = new ReportWriter(new ContentWriterCollection(xmlAttributeInterpreter));
        }
Beispiel #26
0
        public MainView(CommandExecutor commandExecutor, ArcStateReceiver arcStateReceiver, ReportWriter reporter)
        {
            InitializeComponent();

            this.commandExecutor  = commandExecutor;
            this.arcStateReceiver = arcStateReceiver;
            this.reporter         = reporter;

            resetSimulation();
            currentState = arcStateReceiver.GetState();
            updateViewArcState(currentState);
        }
Beispiel #27
0
 // Autogenerated method
 //  public static org.xdef.XDOutput createXDOutput(org.xdef.sys.ReportWriter);
 /// <summary>Creates XDOutput from reporter.</summary>
 /// <param name="value">the reporter.</param>
 /// <returns>the XDOutput object.</returns>
 public XDOutput CreateXDOutput(ReportWriter value)
 {
     using (var builder = new BigEndianDataBuilder())
     {
         builder.Add(value.ObjectId);
         var res = SendRequestWithResponse(new Request(FUNCTION_CREATEXDOUTPUT_1, builder.Build(), ObjectId));
         using (var reader = res.Reader)
         {
             return(new XDOutput(reader.ReadInt32(), _client));
         }
     }
 }
        public GenealogyOMatic(ILogger <GenealogyOMatic> logger, IConfiguration configuration, GEDLoader gedLoader, ReportWriter reportWriter)
        {
            _logger        = logger;
            _configuration = configuration;
            _gedLoader     = gedLoader;
            _reportWriter  = reportWriter;

            InputFilename             = configuration["GenealogyHelper:InputFilename"];
            IndividualsOutputFilename = configuration["GenealogyHelper:IndividualsOutputFilename"];
            EventsOutputFilename      = configuration["GenealogyHelper:EventsOutputFilename"];
            KeyIndividual             = configuration["GenealogyHelper:KeyIndividual"];
        }
Beispiel #29
0
        // ---------------------------------------------------------------------------------------------------------------

        public bool CheckEntity(ProcessingFlags pProcessingFlags, string pNamePrinted = null)
        {
            string report;
            bool   checkOk = CheckEntity(pProcessingFlags, out report);

            if (checkOk && pProcessingFlags.HasFlag(ProcessingFlags.JustReportIssues))
            {
                return(false);
            }

            ReportWriter.WriteReportLineFeed($"{Name} : {report}");
            return(checkOk);
        }
Beispiel #30
0
 // Autogenerated method
 //  public static org.xdef.XDDocument xparse(java.lang.String, org.xdef.sys.ReportWriter) throws org.xdef.sys.SRuntimeException;
 /// <summary>Parse XML with X-definition declared in source.</summary>
 /// <param name="source">URL, pathname direct to XML or direct XML.</param>
 /// <param name="reporter">used for error messages or <tt>null</tt>.</param>
 /// <returns>created XDDocument object.</returns>
 /// <exception cref="RemoteCallException">if an error occurs.</exception>
 public XDDocument Xparse(string source, ReportWriter reporter)
 {
     using (var builder = new BigEndianDataBuilder())
     {
         builder.Add(source);
         builder.Add(reporter.ObjectId);
         var res = SendRequestWithResponse(new Request(FUNCTION_XPARSE_2, builder.Build(), ObjectId));
         using (var reader = res.Reader)
         {
             return(new XDDocument(reader.ReadInt32(), _client));
         }
     }
 }
Beispiel #31
0
 // Autogenerated method
 //  public static org.xdef.XDBuilder getXDBuilder(org.xdef.sys.ReportWriter, java.util.Properties);
 /// <summary>Creates instance of XDBuilder with properties.</summary>
 /// <param name="reporter">the ReportWriter to be used for error reporting.</param>
 /// <param name="props">
 /// Properties or <tt>null</tt> -
 /// see
 /// <see cref="XDConstants"/>
 /// .
 /// </param>
 /// <returns>created XDBuilder.</returns>
 public XDBuilder GetXDBuilder(ReportWriter reporter, Utils.Properties props)
 {
     using (var builder = new BigEndianDataBuilder())
     {
         builder.Add(reporter.ObjectId);
         builder.Add(props);
         var res = SendRequestWithResponse(new Request(FUNCTION_GETXDBUILDER_2, builder.Build(), ObjectId));
         using (var reader = res.Reader)
         {
             return(new XDBuilder(reader.ReadInt32(), _client));
         }
     }
 }
Beispiel #32
0
        private string toPDF2(string auth1,string reportPath, string month)
        {
            
                //string reportPath = templatetxt.Text; ;
                WriterFormat format;
                string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string fileName = @path + "\\Telephone Bill"+" "+auth1+".pdf";

                format = WriterFormat.PDF;
                ReportWriter wrp = new ReportWriter(reportPath);

                wrp.SetParameters(this.GetParameter(auth1, month));
                wrp.Save(fileName, format);

                return fileName;
            
           
        }
        private string CommentFor(MethodDefinition m, ReportWriter format, List<Regex> reviewedMethods)
        {
            if (!MethodPrivilegeDetector.IsMethodSignatureSafe(m))
                return "#methodsignature_notsafe";

            string unavailablereason = null;
            bool criticaltype = false;
            if (_criticalTypes.Contains(m.DeclaringType))
            {
                criticaltype = true;
                unavailablereason = format.PropagationGraphStringFor(new[] { new PropagationReasonIsInCriticalType(m) });
            }
            else if (_canBeSscManual.Contains(m))
            {
                return "#available_manualSSC";
            }
            else if (_resultingSecurityCriticalMethods.Contains(m))
            {
                if (_methodRequiringPrivilegesThemselves.Contains(m))
                    unavailablereason= "method itself requires privileges";
                else
                    unavailablereason = format.PropagationGraphStringFor(PropagationStackFor(m));
            }
            if (unavailablereason!=null)
            {
                string prefix = "#unavailable_notreviewed ";
                if (criticaltype || reviewedMethods.Any(r => r.Match(m.ToString()).Success))
                    prefix = "#unavailable_butreviewed ";

                return prefix + " (ML: " + Moonlight.GetSecurityStatusFor(m) + ") " + unavailablereason;
            }
            return "#available";
        }
Beispiel #34
0
        /** ****************************************************************************************
         * Restores the previous writer after setting a new one using #PushWriter.
         * It is important to keep the right order when pushing and popping writers, as there
         * lifetime is externally managed.
         * (In standard use-cases, only one, app-specific writer should be pushed anyhow).
         * To give a little assurance, this method #PopWriter takes the same parameter as
         * #PushWriter does, to verify if the one to be removed is really the topmost.
         *
         * @param checkWriter  The previously pushed writer (for checking of call order).
         ******************************************************************************************/
        public void PopWriter( ReportWriter checkWriter )
        {
            try { Lock.Acquire();
                if ( writers.Count  == 0 )             { ALIB.ERROR( "No Writer to remove" );          return; }
                if ( writers.Peek() != checkWriter )   { ALIB.ERROR( "Report Writer is not actual" );  return; }

                writers.Peek().NotifyActivation( Phase.End );
                writers.Pop();
                if ( writers.Count > 0 )
                    writers.Peek().NotifyActivation( Phase.Begin );

            } finally { Lock.Release(); }
        }
Beispiel #35
0
        /** ****************************************************************************************
         * Sets a new writer. The actual writer is implemented as a stack. It is important to
         * keep the right order when pushing and popping writers, as there lifetime is externally
         * managed. (In standard use-cases, only one, app-specific writer should be pushed anyhow).
         * To give a little assurance, method #PopWriter takes the same parameter as this method
         * does, to verify if if the one to be removed is really the topmost.
         *
         * @param newWriter   The writer to use.
         ******************************************************************************************/
        public void PushWriter( ReportWriter newWriter )
        {
            try { Lock.Acquire();

                if ( writers.Count > 0 )
                    writers.Peek().NotifyActivation( Phase.End );

                writers.Push( newWriter );
                newWriter.NotifyActivation( Phase.Begin );
            } finally { Lock.Release(); }
        }
Beispiel #36
0
 public void Arrange()
 {
     _visitor = new Visitor("SomeSessionId");
     _repository = new VisitorsByDateRepository();
     _reporter = new ReportWriter(_repository);
 }
        public string BuildPublicApisReport(IEnumerable<MethodDefinition> candidates, List<Regex> reviewedMethods, ReportWriter format)
        {
            var report = SelectVisibleEntryPoints(candidates)
                .Select(m => new
                             	{
                             		Method = m,
                             		Comment = CommentFor(m, format, reviewedMethods)
                             	}).GroupBy(row => row.Comment)
                .OrderByDescending(g => g.Key)
                .SelectMany(g => g.OrderBy(row => row.Method.DeclaringType.FullName + row.Method.Name));

            var writer = new StringWriter();
            format.BeginReport(writer);
            foreach (var row in report)
                format.PublicMethod(writer, row.Method, row.Comment);
            format.EndReport(writer);

            return writer.ToString();
        }
Beispiel #38
0
        private void createReportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListView.SelectedIndexCollection indexes = this.listViewHeap.SelectedIndices;
            if (indexes.Count == 0)
            {
                return;
            }
            else
            {

                Image3D Result = new Image3D(((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).Width,
                    ((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).Height,
                    ((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).Depth,
                    ((Image3D)(this.listViewHeap.Items[indexes[0]].Tag)).NumBands);

                ReportWriter rw = new ReportWriter();
                rw.create("tellme.xml");
                rw.setInfo("First Report", "Don't know name", "Description", 5, 100);

                int indexesCount = indexes.Count;
                for (int i = 0; i < indexesCount; i++)
                {
                    Image3D TmpIm = ((Image3D)(this.listViewHeap.Items[indexes[i]].Tag));
                    rw.addThumbnailImage(TmpIm, "Test" + i, "", "essai");
                    //rw.addThumbnailImage(TmpIm, "Test"+i, TmpIm.Name, "essai");
                }
                rw.close();

            }
        }
Beispiel #39
0
        private void createReportToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            ListView.SelectedIndexCollection indexes = this.listViewHeap.SelectedIndices;

            int indexesCount = indexes.Count;

            if (indexesCount == 0) return;

            request RQuest = new request();
            Control[] ButtonControl = RQuest.Controls.Find("buttonCreateGrid", false);
            ButtonControl[0].Text = "Create Report";

            Control[] ButtonControl1 = RQuest.Controls.Find("label1", false);
            ButtonControl1[0].Text = "Zoom (%)";

            ButtonControl = RQuest.Controls.Find("numericUpDownGridSize", false);
            NumericUpDown TmpNum = (NumericUpDown)ButtonControl[0];
            TmpNum.Maximum = 100;
            TmpNum.Value = 100;

            ButtonControl = RQuest.Controls.Find("numericUpDownImPerLine", false);
            TmpNum = (NumericUpDown)ButtonControl[0];
            TmpNum.Visible = true;
            TmpNum.Maximum = TmpNum.Value = indexesCount;

            ButtonControl = RQuest.Controls.Find("label2", false);
            System.Windows.Forms.Label Tmplabel = (System.Windows.Forms.Label)ButtonControl[0];
            Tmplabel.Visible = true;

            if (RQuest.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string sTime = DateTime.Now.ToString("yyyy-MM-dd mm-ss");
            ReportWriter rw = new ReportWriter(sTime);

            rw.create("HeapReport" + sTime + ".xml");
            rw.setInfo("Image Heap Report", "Report" + sTime, "", (int)TmpNum.Value, (int)RQuest.numericUpDownGridSizeValue);

            for (int i = 0; i < indexesCount; i++)
            {
                Image3D TmpIm = ((Image3D)(this.listViewHeap.Items[indexes[i]].Tag));

                rw.addThumbnailImage(TmpIm, "Index" + i, "Image " + i, UpdateInfoPicture(TmpIm));
            }

            rw.close();
            rw.openReport();
        }