Beispiel #1
0
        private string findItem(string title)
        {
            int startIndex = FileBody.IndexOf("<" + title + ">");
            int endIndex   = FileBody.IndexOf("</" + title + ">");

            if (startIndex < 0 || endIndex < 0)
            {
                return("");
            }
            else
            {
                startIndex += +title.Length + 2;
                return(FileBody.Substring(startIndex, endIndex - startIndex));
            }
        }
        public byte[] ToByteArray()
        {
            if (!string.IsNullOrWhiteSpace(FileBody))
            {
                var pos = FileBody.IndexOf("base64", StringComparison.Ordinal);
                if (pos > 0)
                {
                    var fileBody = FileBody.Substring(pos + "base64,".Length);

                    try
                    {
                        var data = Convert.FromBase64String(fileBody);
                        return(data);
                    }
                    catch (Exception) { }
                }
            }
            return(null);
        }