private WebResource GetWebResource(Uri uri, string fileName)
        {
            byte[] headBuff;
            byte[] footBuff;

            var buff = File.ReadAllBytes(fileName);

            // webResourceLength = buff.Length;
            webResourceMimeType = MimeHelper.GetMimeType(System.IO.Path.GetExtension(fileName));
            // webResourceData = new byte[buff.Length]; ;

            if (ChromiumStartup.EnableMaster && uri.ToString().Contains(ChromiumStartup.SubViewPathName))
            {
                var headFile = GetResourceFileName(new Uri(ChromiumStartup.MasterHeaderFile));
                headBuff = File.ReadAllBytes(headFile);

                var footFile = GetResourceFileName(new Uri(ChromiumStartup.MasterFooterFile));
                footBuff = File.ReadAllBytes(footFile);

                webResourceLength = buff.Length + headBuff.Length + footBuff.Length;
                webResourceData   = new byte[webResourceLength];

                Buffer.BlockCopy(headBuff, 0, webResourceData, 0, headBuff.Length);
                Buffer.BlockCopy(buff, 0, webResourceData, headBuff.Length, buff.Length);
                Buffer.BlockCopy(footBuff, 0, webResourceData, headBuff.Length + buff.Length, footBuff.Length);
            }
            else
            {
                webResourceLength = buff.Length;
                webResourceData   = new byte[buff.Length];;
                Buffer.BlockCopy(buff, 0, webResourceData, 0, buff.Length);
            }

            return(new WebResource(webResourceData, webResourceMimeType));
        }
        private WebResource GetNonFoundWebResource(Uri uri, string fileName)
        {
            webResourceMimeType = MimeHelper.GetMimeType(System.IO.Path.GetExtension(fileName));
            byte[] headBuff;
            byte[] footBuff;
            var    nonFoundData = Encoding.UTF8.GetBytes($"Content {uri.ToString()} Not Found!");

            if (ChromiumStartup.EnableMaster && uri.ToString().Contains(ChromiumStartup.SubViewPathName))
            {
                var headFile = GetResourceFileName(new Uri(ChromiumStartup.MasterHeaderFile));
                headBuff = File.ReadAllBytes(headFile);

                var footFile = GetResourceFileName(new Uri(ChromiumStartup.MasterFooterFile));
                footBuff = File.ReadAllBytes(footFile);

                webResourceLength = nonFoundData.Length + headBuff.Length + footBuff.Length;
                webResourceData   = new byte[webResourceLength];

                Buffer.BlockCopy(headBuff, 0, webResourceData, 0, headBuff.Length);
                Buffer.BlockCopy(nonFoundData, 0, webResourceData, headBuff.Length, nonFoundData.Length);
                Buffer.BlockCopy(footBuff, 0, webResourceData, headBuff.Length + nonFoundData.Length, footBuff.Length);
            }
            else
            {
                webResourceLength = nonFoundData.Length;
                webResourceData   = new byte[nonFoundData.Length];
                ;
                Buffer.BlockCopy(nonFoundData, 0, webResourceData, 0, nonFoundData.Length);
            }

            return(new WebResource(webResourceData, webResourceMimeType));
        }
        private Assembly GetResourceInfo(Uri uri, out string resourceMimeType, out string resourceName)
        {
            var fileName = string.IsNullOrEmpty(domain)
                    ? string.Format("{0}{1}", uri.Authority, uri.AbsolutePath)
                    : uri.AbsolutePath;

            //requestFile = uri.LocalPath;
            if (fileName.StartsWith("/") && fileName.Length > 1)
            {
                fileName = fileName.Substring(1);
            }

            var ass          = resourceAssembly;
            var endTrimIndex = fileName.LastIndexOf('/');

            if (endTrimIndex > -1)
            {
                var tmp = fileName.Substring(0, endTrimIndex);
                tmp = tmp.Replace("-", "_");

                fileName = string.Format("{0}{1}", tmp, fileName.Substring(endTrimIndex));
            }

            var resourcePath = string.Format("{0}.{1}", ass.GetName().Name, fileName.Replace('/', '.'));

            resourceMimeType = MimeHelper.GetMimeType(System.IO.Path.GetExtension(fileName));

            resourceName = ass.GetManifestResourceNames()
                           .SingleOrDefault(p => p.Equals(resourcePath, StringComparison.CurrentCultureIgnoreCase));
            return(ass);
        }