Internal structure that contains format information about a file resource. Used internally to figure out how to write a resource into the database
        /// <summary>
        /// Internal routine that looks at a file and based on its
        /// extension determines how that file needs to be stored in the
        /// database. Returns FileInfoFormat structure
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static FileInfoFormat GetFileInfo(string fileName, bool noPhysicalFile = false)
        {
            FileInfoFormat fileInfo = new FileInfoFormat();

            FileInfo fi = new FileInfo(fileName);
            if (!noPhysicalFile && !fi.Exists)
                throw new InvalidOperationException("Invalid Filename");

            string Extension = fi.Extension.ToLower().TrimStart('.');
            fileInfo.FileName = fi.Name;

            if (Extension == "txt" || Extension == "css" || Extension == "js" || Extension.StartsWith("htm") || Extension == "xml")
            {
                fileInfo.FileFormatType = FileFormatTypes.Text;
                fileInfo.Type = "FileResource";

                if (!noPhysicalFile)
                {
                    using (StreamReader sr = new StreamReader(fileName, Encoding.Default, true))
                    {
                        fileInfo.TextContent = sr.ReadToEnd();
                    }
                }
                fileInfo.ValueString = fileInfo.FileName + ";" + typeof(string).AssemblyQualifiedName + ";" + Encoding.Default.HeaderName;
            }
            else if (Extension == "gif" || Extension == "jpg" || Extension == "jpeg" || Extension == "bmp" || Extension == "png")
            {
                fileInfo.FileFormatType = FileFormatTypes.Image;
                fileInfo.Type = "FileResource";
                if(!noPhysicalFile)
                    fileInfo.BinContent = File.ReadAllBytes(fileName);
                fileInfo.ValueString = fileInfo.FileName + ";" + typeof(Bitmap).AssemblyQualifiedName;
            }
            else if (Extension == "ico")
            {
                fileInfo.FileFormatType = FileFormatTypes.Image;
                fileInfo.Type = "System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
                if (!noPhysicalFile)
                    fileInfo.BinContent = File.ReadAllBytes(fileName);
                fileInfo.ValueString = fileInfo.FileName + ";" + typeof(Icon).AssemblyQualifiedName;
            }
            else
            {
                fileInfo.FileFormatType = FileFormatTypes.Binary;
                fileInfo.Type = "FileResource"; 
                if (!noPhysicalFile)
                    fileInfo.BinContent = File.ReadAllBytes(fileName);                
                fileInfo.ValueString = fileInfo.FileName + ";" + typeof(Byte[]).AssemblyQualifiedName;
            }

            return fileInfo;
        }
        /// <summary>
        /// Internal routine that looks at a file and based on its
        /// extension determines how that file needs to be stored in the
        /// database. Returns FileInfoFormat structure
        /// </summary>
        /// <param name="FileName"></param>
        /// <returns></returns>
        private FileInfoFormat GetFileInfo(string FileName)
        {
            FileInfoFormat Details = new FileInfoFormat();

            FileInfo fi = new FileInfo(FileName);
            if (!fi.Exists)
                throw new InvalidOperationException("Invalid Filename");

            string Extension = fi.Extension.ToLower().TrimStart('.');
            Details.FileName = fi.Name;

            if (Extension == "txt" || Extension == "css" || Extension == "js")
            {
                Details.FileFormatType = FileFormatTypes.Text;
                using (StreamReader sr = new StreamReader(FileName, Encoding.Default, true))
                {
                    Details.TextContent = sr.ReadToEnd();
                }
                Details.ValueString = Details.FileName + ";" + typeof(string).AssemblyQualifiedName + ";" + Encoding.Default.HeaderName;
            }
            else if (Extension == "gif" || Extension == "jpg" || Extension == "bmp" || Extension == "png")
            {
                Details.FileFormatType = FileFormatTypes.Image;
                Details.BinContent = File.ReadAllBytes(FileName);
                Details.ValueString = Details.FileName + ";" + typeof(Bitmap).AssemblyQualifiedName;
            }
            else
            {
                Details.BinContent = File.ReadAllBytes(FileName);
                Details.ValueString = Details.FileName + ";" + typeof(Byte[]).AssemblyQualifiedName;
            }

            return Details;
        }