BlueCollar.Dashboard.StaticFile.GetContents C# (CSharp) Метод

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

Loads the contents of an embedded static file into a buffer and returns it.
private static GetContents ( string name ) : byte[]
name string The name of the file to load.
Результат byte[]
        private static byte[] GetContents(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name", "name must contain a value.");
            }

            byte[] buffer;

            using (Stream stream = typeof(StaticFileHandler).Assembly.GetManifestResourceStream(name))
            {
                if (stream == null)
                {
                    throw new FileNotFoundException("The specified file is not a valid embedded static file resource.", name);
                }

                buffer = new byte[stream.Length];
                int count = 0;

                while (count < buffer.Length)
                {
                    count = stream.Read(buffer, count, buffer.Length);
                }
            }

            return buffer;
        }