Stumps.Server.Data.DataAccess.ServerReadResource C# (CSharp) Method

ServerReadResource() public method

Loads the contents of a resource for a Stumps server.
A null value is returned if the resource cannot be found.
/// is null. ///
public ServerReadResource ( string serverId, string resourceName ) : byte[]
serverId string The unique identifier for the Stumps server.
resourceName string Name of the file.
return byte[]
        public byte[] ServerReadResource(string serverId, string resourceName)
        {
            if (string.IsNullOrWhiteSpace(serverId))
            {
                throw new ArgumentNullException("serverId");
            }

            resourceName = resourceName ?? string.Empty;

            byte[] fileBytes = null;

            var path = Path.Combine(_storagePath, serverId, DataAccess.StumpsPathName, resourceName);
            if (File.Exists(path))
            {
                fileBytes = File.ReadAllBytes(path);
            }

            return fileBytes;
        }