コード例 #1
0
        private string GetFileName(string Language, string[] Rows, out string Title)
        {
            StringBuilder sb = new StringBuilder();

            foreach (string Row in Rows)
            {
                sb.AppendLine(Row);
            }

            string Xml = sb.ToString();
            int    i   = Language.IndexOf(':');

            if (i > 0)
            {
                Title    = Language.Substring(i + 1).Trim();
                Language = Language.Substring(0, i).TrimEnd();
            }
            else
            {
                Title = string.Empty;
            }

            sb.Append(Language);

            string Hash = Hashes.ComputeSHA256HashString(Encoding.UTF8.GetBytes(sb.ToString()));

            string LayoutFolder = Path.Combine(contentRootFolder, "Layout");
            string FileName     = Path.Combine(LayoutFolder, Hash);
            string PngFileName  = FileName + ".png";

            if (!File.Exists(PngFileName))
            {
                try
                {
                    XmlDocument Doc = new XmlDocument();
                    Doc.LoadXml(Xml);

                    Layout2DDocument LayoutDoc = new Layout2DDocument(Doc);
                    RenderSettings   Settings  = new RenderSettings()
                    {
                        ImageSize = RenderedImageSize.ResizeImage                           // TODO: Theme colors, font, etc.
                    };

                    using (SKImage Img = LayoutDoc.Render(Settings, out Map[] _))                       // TODO: Maps
コード例 #2
0
        protected override void Test(string FileName, params KeyValuePair <string, object>[] ContentAttachments)
        {
            Layout2DDocument Doc      = Layout2DDocument.FromFile("Xml\\" + FileName + ".xml", ContentAttachments);
            RenderSettings   Settings = new RenderSettings();

            using (SKImage Image = Doc.Render(Settings, out Map[] _))
コード例 #3
0
        protected override void Test(string FileName)
        {
            Layout2DDocument Doc = Layout2DDocument.FromFile("Xml\\" + FileName);

            using (SKImage Image = Doc.Render(800, 600, 1, 0, 0, out Map[] _))