예제 #1
0
        /// <summary>
        /// Factory method to create C2da objects from streams.
        /// </summary>
        /// <param name="stream">The stream to create the 2da object from</param>
        /// <returns>A 2da object for the stream.</returns>
        public static _2DA Load2da(Stream stream)
        {
            _2DA file = new _2DA();
            using (StreamReader reader = new StreamReader(stream, Encoding.ASCII))
            {
                file.Read(reader);
            }

            return file;
        }
예제 #2
0
        /// <summary>
        /// Factory method to create C2da objects from 2da files.
        /// </summary>
        /// <param name="fileName">The name of the 2da file</param>
        /// <returns>A 2da object for the 2da file.</returns>
        public static _2DA Load2da(string fileName)
        {
            // Open the 2da file.
            _2DA file = new _2DA(fileName);
            using(StreamReader reader = new StreamReader(fileName))
            {
                file.Read(reader);
            }

            return file;
        }