private void btnCreate_Click(object sender, EventArgs e) { foreach (Control c in Controls) { c.Enabled = false; } label2.Text = "Creating new library file..."; // Checks for empty content selection and library file location if (lbFiles.Items.Count == 0) { MessageBox.Show("No files have been submitted for library fle creation. Please submit at least one PDF file, or select a .plrd file to read its contents to the new file.", "No files selected", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (string.IsNullOrEmpty(saveLocation)) { MessageBox.Show("No save location was specified. Please click the \"Save to...\" button to specify a location for the file library.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); label2.Text = string.Empty; foreach (Control c in Controls) { c.Enabled = true; } } else { PDFList.Files = new List <string>(); foreach (object file in lbFiles.Items) { PDFList.Files.Add(file.ToString()); } PDFList.SaveListTo(saveLocation, editing); Program.read = true; Program.library = saveLocation; Close(); } }
private void btnOpen_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() != DialogResult.Cancel && !string.IsNullOrEmpty(ofd.FileName)) { if (ofd.FileName.EndsWith(".plrd")) { PDFList.Files = new List <string>(); using (XmlReader reader = XmlReader.Create(ofd.FileName)) while (reader.Read()) { if (reader.Name == "path") { PDFList.Files.Add(reader.ReadElementContentAsString()); } } string pdfs = ""; foreach (string pdf in PDFList.GetFiles()) { pdfs += pdf + Environment.NewLine; } Program.read = true; Close(); } else { MessageBox.Show("The provided file's extension is not supported by this application. Please provide a file with the .plrd extension.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
IEnumerator GetRequest(string uri) { Debug.Log("Coroutine Started"); using (UnityWebRequest webRequest = UnityWebRequest.Get(uri)) { // Request and wait for the desired page. yield return(webRequest.SendWebRequest()); PDFList data = JsonUtility.FromJson <PDFList>(webRequest.downloadHandler.text); foreach (PDF test in data.pdf) { print("PDF Name: " + test.pdfName + "PDF FullName: " + test.pdfFullName); if (pdfNames.Contains(test.pdfName)) { Debug.Log("PDF Already Created"); } else { pdfList.pdf.Add(test); } } createBooks = true; } }
public PDFReader(string fileLocation, bool isLibrary) { if (!PDFList.ReadFrom(fileLocation)) { MessageBox.Show("No valid library file was passed, or file doesn't exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } current = PDFList.Files[index]; pdfViewer1.Document = PdfDocument.Load(current); pdfViewer1.Update(); }
private void LoadFiles() { PDFList.Clear(); try { FileInfo[] pdfs = Model.PDFContainer.GetDirectoryContent(FilePath, "*.pdf"); foreach (FileInfo file in pdfs) { Model.PDFContainer currentPdf = Model.PDFContainer.CreatePDFContainer(file.FullName); if (currentPdf.SheetName != null) { PDFList.Add(currentPdf); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }