private string GetJobSampleData() { var metric = _usageMetricFactory.CreateMetric <PdfCreatorUsageStatisticsMetric>(); metric.OperatingSystem = OsHelper.GetWindowsVersion(); metric.Duration = TimeSpan.Zero.Milliseconds; metric.OutputFormat = OutputFormat.Pdf.ToString(); metric.Mode = Mode.Interactive; metric.QuickActions = true; metric.OpenViewer = true; metric.OpenWithPdfArchitect = true; metric.Status = "Success"; metric.Attachment = true; metric.Background = true; metric.Dropbox = true; metric.Cover = true; metric.NumberOfCopies = 1; metric.Script = true; metric.CustomScript = true; metric.TotalPages = 1; metric.Mailclient = true; metric.Print = true; metric.Signature = true; metric.Encryption = true; metric.UserToken = true; metric.Ftp = true; metric.Http = true; metric.Smtp = true; metric.Stamp = true; return(ConvertToJson(metric)); }
private string GetServiceSampleData() { var metric = _usageMetricFactory.CreateMetric <ServiceUsageStatisticsMetric>(); metric.ServiceUptime = TimeSpan.TicksPerMillisecond; metric.TotalUsers = 1; metric.TotalDocuments = 1; metric.OperatingSystem = OsHelper.GetWindowsVersion(); return(ConvertToJson(metric)); }
public void AddTestPage() { var osHelper = new OsHelper(); var rm = new ResourceManager(typeof(Resources)); var sb = new StringBuilder(rm.GetString("TestPage")); // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion -> ProductName sb.Replace("[INFOTITLE]", "PDFCreator " + UpdateAssistant.CurrentVersion); sb.Replace("[INFODATE]", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString()); sb.Replace("[INFOAUTHORS]", "pdfforge"); sb.Replace("[INFOHOMEPAGE]", Urls.PdfforgeWebsiteUrl); sb.Replace("[INFOPDFCREATOR]", "PDFCreator " + UpdateAssistant.CurrentVersion); sb.Replace("[INFOCOMPUTER]", Environment.MachineName); sb.Replace("[INFOWINDOWS]", osHelper.GetWindowsVersion()); sb.Replace("[INFO64BIT]", osHelper.Is64BitOperatingSystem.ToString()); string tempPath = Path.Combine(SpoolFolder, Guid.NewGuid().ToString()); Directory.CreateDirectory(tempPath); File.WriteAllText(Path.Combine(tempPath, "testpage.ps"), sb.ToString()); sb = new StringBuilder(); sb.AppendLine("[0]"); sb.AppendLine("SessionId=" + Process.GetCurrentProcess().SessionId); sb.AppendLine("WinStation=Console"); sb.AppendLine("UserName="******"ClientComputer=" + Environment.MachineName); sb.AppendLine("SpoolFileName=testpage.ps"); sb.AppendLine("PrinterName=PDFCreator"); sb.AppendLine("JobId=1"); sb.AppendLine("TotalPages=1"); sb.AppendLine("Copies=1"); sb.AppendLine("DocumentTitle=PDFCreator Testpage"); sb.AppendLine(""); string infFile = Path.Combine(tempPath, "testpage.inf"); File.WriteAllText(infFile, sb.ToString(), Encoding.Unicode); var jobInfo = new JobInfo(infFile, SettingsHelper.Settings.ApplicationSettings.TitleReplacement); Add(jobInfo); }