Aspose.Pdf.Examples.CSharp.AsposePDF.DocumentConversion.PDFToHTMLFormat.PrefixToImportDirectives.Strategy_10_CSS_WriteCssToResourceFolder C# (CSharp) Метод

Strategy_10_CSS_WriteCssToResourceFolder() приватный статический Метод

private static Strategy_10_CSS_WriteCssToResourceFolder ( HtmlSaveOptions resourceInfo ) : void
resourceInfo HtmlSaveOptions
Результат void
        private static void Strategy_10_CSS_WriteCssToResourceFolder(HtmlSaveOptions.CssSavingInfo resourceInfo)
        {
            // -------------------------------------------------------
            // This is only one of possible implementation of saving
            // You can write and use Your own implementation if You will
            // -------------------------------------------------------

            // Get CSS file name from requested file.
            // Some trick required cause we get in parameters of this method
            // Not pure file name but full URL that
            // Created with usage of our template returned in Strategy_9_CSS_ReturnResultPathInPredefinedTestFolder()
            // So, knowing of that template we must extract from it CSS file name itself
            string guid = System.Guid.NewGuid().ToString();
            string fullPathWithGuid = Strategy_10_CSS_ReturnResultPathInPredefinedTestFolder(new HtmlSaveOptions.CssUrlRequestInfo());
            fullPathWithGuid = string.Format(fullPathWithGuid, guid);
            int prefixLength = fullPathWithGuid.IndexOf(guid);
            int suffixLength = fullPathWithGuid.Length - (fullPathWithGuid.IndexOf(guid) + guid.Length);
            string fullPath = resourceInfo.SupposedURL;
            fullPath = fullPath.Substring(prefixLength);
            string cssFileNameCore = fullPath.Substring(0, fullPath.Length - suffixLength);

            // Get final file name for saving
            string cssFileName = "style" + cssFileNameCore + ".css";
            string path = _folderForReferencedResources_36435 + cssFileName;

            // Saving itself
            System.IO.BinaryReader reader = new BinaryReader(resourceInfo.ContentStream);
            System.IO.File.WriteAllBytes(path, reader.ReadBytes((int)resourceInfo.ContentStream.Length));
        }
        private static string Strategy_10_CSS_ReturnResultPathInPredefinedTestFolder(HtmlSaveOptions.CssUrlRequestInfo requestInfo)