public bool IsPresentationPasswordProtected(string filename) { try { var license = new License(); license.SetLicense(GetLicence()); var presentation = new Presentation(filename); } catch (Exception) { return true; } return false; }
protected static void CheckLicense(LicenseProvider provider) { try { switch (provider) { case LicenseProvider.Cells: var license1 = new Aspose.Cells.License(); license1.SetLicense(LICENSEPATH); break; case LicenseProvider.Diagram: var license2 = new Aspose.Diagram.License(); license2.SetLicense(LICENSEPATH); break; case LicenseProvider.Pdf: var license3 = new Aspose.Pdf.License(); license3.SetLicense(LICENSEPATH); break; case LicenseProvider.Slides: var license4 = new Aspose.Slides.License(); license4.SetLicense(LICENSEPATH); break; case LicenseProvider.Words: var license5 = new Aspose.Words.License(); license5.SetLicense(LICENSEPATH); break; case LicenseProvider.Tasks: var license6 = new Aspose.Tasks.License(); license6.SetLicense(LICENSEPATH); break; case LicenseProvider.Imaging: var license7 = new Aspose.Imaging.License(); license7.SetLicense(LICENSEPATH); break; } } catch (Exception ex) { WriteLicenseException(ex); } }
/// <summary> /// Initializes static members of the <see cref="FileManager"/> class. /// </summary> static FileManager() { var byteArray = Encoding.ASCII.GetBytes(AsposeLicense); using (var licenseStream = new MemoryStream(byteArray)) { var pdfLicense = new Aspose.Pdf.License(); pdfLicense.SetLicense(licenseStream); licenseStream.Position = 0; var cellLicense = new Aspose.Cells.License(); cellLicense.SetLicense(licenseStream); licenseStream.Position = 0; var wordsLicense = new Aspose.Words.License(); wordsLicense.SetLicense(licenseStream); licenseStream.Position = 0; var slidesLicense = new Aspose.Slides.License(); slidesLicense.SetLicense(licenseStream); licenseStream.Position = 0; var tasksLicense = new Aspose.Tasks.License(); tasksLicense.SetLicense(licenseStream); licenseStream.Position = 0; var diagramLicense = new Aspose.Diagram.License(); diagramLicense.SetLicense(licenseStream); } }