static License GetLicense(string call) { WebClient client = new WebClient(); client.Headers.Add(HttpRequestHeader.Referer, "http://wireless2.fcc.gov/UlsApp/UlsSearch/searchAmateur.jsp"); client.Headers.Add(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); string linkPage = client.UploadString("http://wireless2.fcc.gov/UlsApp/UlsSearch/results.jsp", string.Format("fiUlsExactMatchInd=Y&fiulsTrusteeName=&fiOwnerName=&fiUlsFRN=&fiCity=&ulsState=&fiUlsZipcode=&ulsCallSign={0}&statusAll=Y&ulsDateType=&dateSearchType=+&ulsFromDate=&ulsToDate=3%2F8%2F2014&fiRowsPerPage=10&ulsSortBy=uls_l_callsign++++++++++++++++&ulsOrderBy=ASC&x=34&y=11&hiddenForm=hiddenForm&jsValidated=true", call)); var match = Regex.Match(linkPage, "license.jsp(;JSESSIONID_ULSSEARCH=[a-zA-Z0-9!]+)?\\?licKey=(\\d+)", RegexOptions.IgnoreCase); if (!match.Success) return null; string url = "http://wireless2.fcc.gov/UlsApp/UlsSearch/license.jsp?licKey=" + match.Groups[2].Value; var page = client.DownloadString(url); var blockStart = page.IndexOf("<!--Addresses are displayed on successive lines:"); var blockEnd = page.IndexOf("</td>", blockStart); var block = page.Substring(blockStart, blockEnd - blockStart); // match = Regex.Match(block, @"^ +([a-zA-Z ,\\-]+)\<br\>"); match = Regex.Match(page, @"<title>ULS License \- Amateur License \- [A-Z0-9 ]+ \- ([^<]+)</title>"); if (!match.Success) return null; License lic = new License { Name = match.Groups[1].Value }; match = Regex.Match(page, @"Grant</td>\s+<td[^>]+>\s+([\d/]{10})", RegexOptions.Multiline); lic.Issued = DateTime.Parse(match.Groups[1].Value); match = Regex.Match(page, @"Expiration</td>\s+<td[^>]+>\s+([\d/]{10})", RegexOptions.Multiline); lic.Expires = DateTime.Parse(match.Groups[1].Value); lic.Url = url; return lic; }
public static void Run() { try { var lic = new License(); lic.SetLicense(@"E:\Aspose\License\Aspose.Tasks.lic"); // ExStart:WriteFormulasInExtendedAttributesToMPP // Create project instance string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); Project project = new Project(dataDir + "Project1.mpp"); project.Set(Prj.NewTasksAreManual, false); // Create new custom field (Task Text1) with formula which will double task cost ExtendedAttributeDefinition attr = new ExtendedAttributeDefinition(); attr.FieldId = ExtendedAttributeTask.Text1.ToString("D"); attr.Alias = "Double Costs"; attr.Formula = "[Cost]*2"; project.ExtendedAttributes.Add(attr); // Add a task Task task = project.RootTask.Children.Add("Task"); // Set task cost task.Set(Tsk.Cost, 100); // Save project project.Save(dataDir + "WriteFormulasInExtendedAttributesToMPP_out.mpp", SaveFileFormat.MPP); // ExEnd:WriteFormulasInExtendedAttributesToMPP } catch(Exception ex) { Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx."); } }
protected void ImportButton_Click(object sender, EventArgs e) { Control destinationControl = Globals.FindControlRecursiveDown(Page, PanesDropDownList.SelectedValue.Replace("dnn_", string.Empty)); if (ImportFileUpload.HasFile) { // Check for license and apply if exists string licenseFile = Server.MapPath("~/App_Data/Aspose.Total.lic"); if (File.Exists(licenseFile)) { License license = new License(); license.SetLicense(licenseFile); } Stream stream = ImportFileUpload.FileContent; Document doc = new Document(stream); string filePath = Server.MapPath("~/temp/"); if (!Directory.Exists(filePath)) Directory.CreateDirectory(filePath); filePath += "\\" + System.Guid.NewGuid().ToString(); doc.Save(filePath, SaveFormat.Html); string outputText = File.ReadAllText(filePath); if (destinationControl != null) destinationControl.Controls.Add(new LiteralControl(outputText)); else OutputLiteral.Text = outputText; } }
public RenewLicenseCommand(License license) { if (license == null) throw new ArgumentNullException("license"); License = license; }
public void aaaFakeLicenseDatabase() { Assert.Throws<NoValidVelocityDBLicenseFoundException>(() => { using (SessionNoServer session = new SessionNoServer(systemDir)) { session.BeginUpdate(); Database database; License license = new License("Mats", 1, null, null, null, 99999, DateTime.MaxValue, 9999, 99, 9999); Placement placer = new Placement(License.PlaceInDatabase, 1, 1, 1); license.Persist(placer, session); for (uint i = 10; i < 20; i++) { database = session.NewDatabase(i); Assert.NotNull(database); } session.Commit(); File.Copy(Path.Combine(systemDir, "20.odb"), Path.Combine(systemDir, "4.odb")); session.BeginUpdate(); for (uint i = 21; i < 30; i++) { database = session.NewDatabase(i); Assert.NotNull(database); } session.RegisterClass(typeof(VelocityDbSchema.Samples.Sample1.Person)); Graph g = new Graph(session); session.Persist(g); session.Commit(); } }); }
protected void ImportButton_Click(object sender, EventArgs e) { Control destinationControl = Globals.FindControlRecursiveDown(Page, PanesDropDownList.SelectedValue.Replace("dnn_", string.Empty)); if (ImportFileUpload.HasFile) { // Check for license and apply if exists string licenseFile = Server.MapPath("~/App_Data/Aspose.Total.lic"); if (File.Exists(licenseFile)) { License license = new License(); license.SetLicense(licenseFile); } // Initialize the stream to read the uploaded file. Stream myStream = ImportFileUpload.FileContent; //open document Document pdfDocument = new Document(myStream); string path = Server.MapPath(".") + "//" + ImportFileUpload.FileName.Replace(".pdf", ".html"); pdfDocument.Save(path, SaveFormat.Html); string extractedText = File.ReadAllText(path); if (destinationControl != null) destinationControl.Controls.Add(new LiteralControl(extractedText)); else OutputLiteral.Text = extractedText; } else { OutputLiteral.Text = "Please Upload File"; } }
protected void AddButton_OnClick( object sender, EventArgs e ) { ParsedLicense parsedLicense = ParsedLicense.Deserialize( this.licenseKeyTextBox.Text ); if ( parsedLicense == null ) { this.errorLabel.Text = "Invalid license key."; this.errorLabel.Visible = true; return; } if ( !parsedLicense.IsLicenseServerElligible() ) { this.errorLabel.Text = string.Format( "Cannot add a {0} of {1} to the server.", parsedLicense.GetLicenseTypeName() ?? "(unknown license type)", parsedLicense.GetProductName( ) ); this.errorLabel.Visible = true; return; } License license = new License { LicenseId = parsedLicense.LicenseId, LicenseKey = ParsedLicense.CleanLicenseString( this.licenseKeyTextBox.Text ), CreatedOn = VirtualDateTime.UtcNow, ProductCode = parsedLicense.Product.ToString(), }; Database db = new Database(); db.Licenses.InsertOnSubmit( license ); db.SubmitChanges(); this.Response.Redirect( ".." ); }
public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); try { // Create a License object License license = new License(); // Set the license of Aspose.Cells to avoid the evaluation limitations license.SetLicense(dataDir + "Aspose.Cells.lic"); } catch (Exception ex) { Console.WriteLine(ex.Message); } // Instantiate a Workbook object that represents Excel file. Workbook wb = new Workbook(); // When you create a new workbook, a default "Sheet1" is added to the workbook. Worksheet sheet = wb.Worksheets[0]; // Access the "A1" cell in the sheet. Cell cell = sheet.Cells["A1"]; // Input the "Hello World!" text into the "A1" cell cell.PutValue("Hello World!"); // Save the Excel file. wb.Save(dataDir + "MyBook_out.xlsx", SaveFormat.Excel97To2003); // ExEnd:1 }
private void GeneratePreviewImages() { var previewFile = Path.Combine((string)asm.GetType("Workshare.Utilities.LocalCopyOfFileManager").GetProperty("ManagedFolder").GetValue(_lcfm), "0.jpg"); var license = new License(); license.SetLicense(GetLicence()); var document = new Document(FileName); var saveOptions = new ImageSaveOptions(SaveFormat.Jpeg) { UseHighQualityRendering = true, JpegQuality = 100 }; for (var i = 0; i < document.PageCount; i++) { saveOptions.PageIndex = i; var pageImageFileName = string.Format("{0}{1}.jpg", (string)asm.GetType("Workshare.Utilities.LocalCopyOfFileManager").GetProperty("ManagedFolder").GetValue(_lcfm) + "\\", i); document.Save(pageImageFileName, saveOptions); if (PreviewImage == null) { PreviewImage = new Bitmap(previewFile); Events.RaiseEvent(this, ThumbnailGenerated); } PreviewImages.Add(new Bitmap(pageImageFileName)); } }
public RemoveLicenseCommand(License license) { if (license == null) throw new ArgumentNullException(nameof(license)); License = license; }
// // GET: /AsposeExporter/ public void Index(string Format="pdf") { string baseURL = Request.Url.Authority; if (Request.ServerVariables["HTTPS"] == "on") { baseURL = "https://" + baseURL; } else { baseURL = "http://" + baseURL; } // Check for license and apply if exists string licenseFile = Server.MapPath("~/App_Data/Aspose.Words.lic"); if (System.IO.File.Exists(licenseFile)) { License license = new License(); license.SetLicense(licenseFile); } string refURL = Request.UrlReferrer.AbsoluteUri; string html = new WebClient().DownloadString(refURL); // To make the relative image paths work, base URL must be included in head section html = html.Replace("</head>", string.Format("<base href='{0}'></base></head>", baseURL)); MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(html)); Document doc = new Document(stream); string fileName = System.Guid.NewGuid().ToString() + "." + Format; doc.Save(System.Web.HttpContext.Current.Response, fileName, ContentDisposition.Inline, null); System.Web.HttpContext.Current.Response.End(); }
/// <summary> /// Sets the license stream. /// </summary> public override void SetLicense() { License license = new License(); license.SetLicense(AttachmentResources.LicenseFileName); Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License(); pdfLicense.SetLicense(AttachmentResources.LicenseFileName); }
public IPackage CreatePackage( string packageId, string packageVersion, string contentFilePath, License requiresLicenseAccept, params IPackage[] dependencies) { PackageBuilder builder = new PackageBuilder(); ManifestMetadata metadata = new ManifestMetadata() { Authors = "dummy author", Version = new SemanticVersion(packageVersion).ToString(), Id = packageId, Description = "dummy description", LicenseUrl = "http://choosealicense.com/", RequireLicenseAcceptance = (requiresLicenseAccept == License.Required) }; List<ManifestDependency> dependencyList = new List<ManifestDependency>(); foreach (IPackage dependencyNode in dependencies) { dependencyList.Add(new ManifestDependency() { Id = dependencyNode.Id, Version = dependencyNode.Version.ToString(), }); } List<ManifestDependencySet> dependencySetList = new List<ManifestDependencySet>() { new ManifestDependencySet() { Dependencies = dependencyList } }; metadata.DependencySets = dependencySetList; builder.Populate(metadata); PhysicalPackageFile file = new PhysicalPackageFile(); file.SourcePath = contentFilePath; file.TargetPath = Path.GetFileName(contentFilePath); builder.Files.Add(file); string fileName = packageId + "." + metadata.Version + ".nupkg"; string destinationName = Path.Combine(this.manager.LocalRepository.Source, fileName); using (Stream fileStream = File.Open(destinationName, FileMode.OpenOrCreate)) { builder.Save(fileStream); } // Retrieve and return the newly-created package IPackage package = this.fakeRemoteRepo.FindPackage(packageId, new SemanticVersion(packageVersion)); Assert.IsNotNull(package, "Test setup error: failed to create and retrieve a test package"); return package; }
/// <summary> /// Constroi um objeto recuperando e definindo a licença de uso /// </summary> public PDF2ImageAsposePDFConverter() { var assembly = Assembly.GetExecutingAssembly(); License license = new License(); using (Stream stream = assembly.GetManifestResourceStream("Carubbi.PDF.Assets.Aspose.Total.lic")) { license.SetLicense(stream); } }
static void Main(string[] args) { Aspose.Diagram.License lic = new License(); lic.SetLicense(@"Aspose.Diagram.lic"); Diagram diagram = new Diagram("./../../Samples/Basic Flowchart.vsd"); diagram.Save("./../../Output/Output.pdf", SaveFileFormat.PDF); Console.WriteLine("Done"); Console.ReadKey(); }
public static void Run() { // ExStart:ApplyLicenseByPath // Set path of the license file, i.e. c:\temp\ string dataDir = @"c:\temp\"; License license = new License(); license.SetLicense(dataDir + "Aspose.Diagram.lic"); // ExEnd:ApplyLicenseByPath }
public ActionResult Edit(License license) { if (ModelState.IsValid) { licenseRepository.InsertOrUpdate(license); licenseRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(License license) { if (license.ID == default(System.Guid)) { // New entity //license.ID = Guid.NewGuid(); context.Licenses.Add(license); } else { // Existing entity context.Entry(license).State = EntityState.Modified; } }
static void Main(string[] args) { Aspose.Diagram.License lic = new License(); lic.SetLicense(@"Aspose.Diagram.lic"); Diagram diagram = new Diagram("./../../Samples/Sample.vdx"); diagram.Save("./../../Output/Output.html", SaveFileFormat.HTML); Console.WriteLine("Done"); Console.ReadKey(); }
public LetterGenerator(IAdjustmentLettersConfiguration config, IAsposeWrapper aspose) { this.pdfTemplate = config.PdfLetterTemplate; var license = new License(); //// Instantiate license file license.SetLicense("Aspose.Pdf.lic"); //// Set the value to indicate that license will be embedded in the application license.Embedded = true; this.aspose = aspose; }
public static void Run() { // ExStart:ApplyLicenseUsingFileStream // Set path of the license file, i.e. c:\temp\ string dataDir = @"c:\temp\"; // Load an existing Visio file in the stream FileStream LicStream = new FileStream(dataDir + "Aspose.Diagram.lic", FileMode.Open); License license = new License(); license.SetLicense(LicStream); // ExEnd:ApplyLicenseUsingFileStream }
internal static void SetUnlimitedLicense() { if (File.Exists(TestLicenseFileName)) { // This shows how to use an Aspose.Words license when you have purchased one. // You don't have to specify full path as shown here. You can specify just the // file name if you copy the license file into the same folder as your application // binaries or you add the license to your project as an embedded resource. License license = new License(); license.SetLicense(TestLicenseFileName); } }
public OrderItem RecordOrderItem( License license, PurchaseRecord purchaseRecord, int itemNumber ) { OrderItem item = new OrderItem() { OrderItemNo = itemNumber, PurchaseRecordId = purchaseRecord.Id, ActivationKey = license.ActivationKey, LicenseId = license.LicenseId }; _orderItemRepository.Add( item ); return item; }
protected void Application_Start(object sender, EventArgs e) { // TODO 0 Do not ship source code of this demo project with Aspose.Words.lic embedded in the project. Delete Aspose.Words.lic and this comment before shipping. using (Stream licenseStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FirstFloor.Documents.Aspose.Web.Aspose.Words.lic")) { if (licenseStream != null) { License license = new License(); license.SetLicense(licenseStream); } } }
/// <summary> /// Creates a new GracePeriodNotification. /// </summary> /// <param name="license">The Licence that has expired.</param> /// <param name="configuration">The configuration to use.</param> public GracePeriodNotification(License license, ILicenseConfiguration configuration) { if (license == null) { throw new ArgumentNullException("license"); } if (configuration == null) { throw new ArgumentNullException("configuration"); } _license = license; _configuration = configuration; }
static void Main(string[] args) { Aspose.Diagram.License lic = new License(); lic.SetLicense(@"Aspose.Diagram.lic"); //Load adiagram Diagram diagram = new Diagram("./../../Samples/Drawing1.vsd"); //Get first page if (diagram.Pages.Count == 0) { return; } Page page0 = diagram.Pages[0]; //Get the rectangle master Master masterRectangle = null; foreach (Master master in diagram.Masters) if (master.Name == "Rectangle") { masterRectangle = master; break; } if (masterRectangle == null) { return; } //Get next shape ID long nextID = 100; //Set shape properties and add it in the shapes' collection Shape shape = new Shape(); shape.ID = nextID; shape.Master = masterRectangle; shape.MasterShape = masterRectangle.Shapes[0]; shape.Type = TypeValue.Shape; shape.XForm.Height.Value = 1; shape.XForm.Width.Value = 2; shape.XForm.PinX.Value = 2; shape.XForm.PinY.Value = 2; shape.XForm.LocPinX.Ufe.F = "Width*0.5"; shape.XForm.LocPinY.Ufe.F = "Height*0.5"; shape.Text.Value.Add(new Txt("Some Text")); page0.Shapes.Add(shape); diagram.Save("./../../Output/Output.vdx", SaveFileFormat.VDX); Console.WriteLine("Done"); Console.ReadKey(); }
/// <summary> /// Instantiate a comparison service /// </summary> public ComparisonService(ComparisonWidgetSettings settings) { //Set new context name _contextName = Guid.NewGuid().ToString(); //Set settings _settings = settings; //Set Viewer license if (!String.IsNullOrEmpty(settings.LicensePath)) { License lic = new License(); lic.SetLicense(settings.LicensePath); } }
static void Main(string[] args) { Aspose.Diagram.License lic = new License(); lic.SetLicense("Aspose.Diagram.lic"); Diagram diagram = new Diagram("./../../Samples/Sample.vdx"); SWFSaveOptions options = new SWFSaveOptions(); options.SaveFormat = SaveFileFormat.SWF; // Exclude the embedded viewer options.ViewerIncluded = false; diagram.Save("./../../Output/Output.swf", options); Console.WriteLine("Done"); Console.ReadKey(); }
//ExStart:ApplyLicense /// <summary> /// Applies product license /// </summary> public static void ApplyLicense() { try { // initialize License License lic = new License(); // apply license lic.SetLicense(System.Configuration.ConfigurationManager.AppSettings["LicensePath"].ToString()); } catch (Exception exp) { } }
//ExEnd:MapDestinationFilePath //ExStart:ApplyLicense /// <summary> /// Applies product license /// </summary> public static void ApplyLicense() { try { // initialize License License lic = new License(); // apply license lic.SetLicense(LicenseFilePath); } catch (Exception exp) { Console.WriteLine(exp.Message); } }