Ejemplo n.º 1
0
        private void DisplayProject(KnitupProject iProject)
        {
            txtInput.Text = iProject.MarkdownSource;

            //Input
            cKPtProject = iProject;

            //Design
            picCompanyLogo.Image = iProject.Info.CompanyLogo;
            picBackgroundImage.Image = iProject.Info.BackgroundImage;

            //Options
            txtCopyrightMessage.Text = cKPtProject.Options.CopyrightMessage;
            chkGenerateTableOfContents.Checked = cKPtProject.Options.GenerateTableOfContents;

            //Images
            lbxImages.Items.Clear();
            foreach(ProjectImage curImage in cKPtProject.Images.Images.Values)
            {
                lbxImages.Items.Add(curImage);
            }

            UpdateSaveState();
            cKPtProject.PropertyChanged += CKPtProject_PropertyChanged;
        }
Ejemplo n.º 2
0
        public static async Task <KnitupProject> Load(String iFullPath)
        {
            using (FileStream pFSmArchive = File.Open(iFullPath, FileMode.Open, FileAccess.Read, FileShare.None))
            {
                using (ZipArchive pZAeArchive = new ZipArchive(pFSmArchive, ZipArchiveMode.Read, true))
                {
                    KnitupProject pKPtProject = new KnitupProject();

                    pKPtProject.cStrFullPath = iFullPath;

                    ZipArchiveEntry pZAESource = pZAeArchive.GetEntry("input.md");
                    using (Stream pStmSource = pZAESource.Open())
                    {
                        using (MemoryStream pMSmSource = new MemoryStream())
                        {
                            await pStmSource.CopyToAsync(pMSmSource);

                            pKPtProject.cStrMarkdownSource = System.Text.Encoding.UTF8.GetString(pMSmSource.ToArray());
                        }
                    }

                    pKPtProject.Info.Load(pZAeArchive);
                    pKPtProject.Options.Load(pZAeArchive);
                    pKPtProject.Images.Load(pZAeArchive);

                    return(pKPtProject);
                }
            }
        }
Ejemplo n.º 3
0
 public Generator(KnitupProject iProject)
 {
     cKPtProject = iProject;
 }
Ejemplo n.º 4
0
        public static async Task<KnitupProject> Load(String iFullPath)
        {
            using (FileStream pFSmArchive = File.Open(iFullPath, FileMode.Open, FileAccess.Read, FileShare.None))
            {
                using (ZipArchive pZAeArchive = new ZipArchive(pFSmArchive, ZipArchiveMode.Read, true))
                {
                    KnitupProject pKPtProject = new KnitupProject();

                    pKPtProject.cStrFullPath = iFullPath;

                    ZipArchiveEntry pZAESource = pZAeArchive.GetEntry("input.md");
                    using (Stream pStmSource = pZAESource.Open())
                    {
                        using (MemoryStream pMSmSource = new MemoryStream())
                        {
                            await pStmSource.CopyToAsync(pMSmSource);
                            pKPtProject.cStrMarkdownSource = System.Text.Encoding.UTF8.GetString(pMSmSource.ToArray());
                        }
                    }

                    pKPtProject.Info.Load(pZAeArchive);
                    pKPtProject.Options.Load(pZAeArchive);
                    pKPtProject.Images.Load(pZAeArchive);

                    return (pKPtProject);
                }
            }
        }
Ejemplo n.º 5
0
 private void markdownToolStripMenuItem_Click(object sender, EventArgs e)
 {
     List<String> pLisImages = null;
     if (FileExtensionUtility.GetImageFileNameFromDialog(FileExtensionCollection.EXTENSION_COLLECTION_IMPORT_DOCUMENT,
         "Browse For Document To Import...",
         out pLisImages,
         false))
     {
         KnitupProject pKPtProject = new KnitupProject();
         pKPtProject.MarkdownSource = File.ReadAllText(pLisImages[0]);
         DisplayProject(pKPtProject);
     }
 }