ReadHeader() private method

private ReadHeader ( FileStream fs ) : bool
fs System.IO.FileStream
return bool
Example #1
0
        public static Level Load(string fileName)
        {
            FileStream fs    = null;
            Level      level = null;

            if (!File.Exists(fileName))
            {
                Logger.LogError("Level.Load: Specified file does not exist: " + fileName);
                return(null);
            }

            try {
                fs = File.OpenRead(fileName);
                if (level.ReadHeader(fs))
                {
                    level.ReadLevel(fs);
                    return(level);
                }
                else
                {
                    return(null);
                }
            } catch (Exception) {
                Logger.LogError("Level.Load: Error trying to read from file: " + fileName);
                return(null);
            } finally {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }