コード例 #1
0
        /// <summary>
        /// Parses the .dat file contents from inStream.
        /// </summary>
        /// <param name="inStream">Unicode binary reader containing ONLY the contents of a single .dat file and nothing more</param>
        /// <param name="fileName">Name of the dat file (with extension)</param>
        public DatContainer(Stream inStream, string fileName)
        {
            datName = Path.GetFileNameWithoutExtension(fileName);
            DatType = DatFactory.GetTypeName(datName);

            using (BinaryReader br = new BinaryReader(inStream, Encoding.Unicode))
            {
                Read(br);
            }
        }
コード例 #2
0
        /// <summary>
        /// Parses the .dat file found at path 'fileName'
        /// </summary>
        /// <param name="fileName">Path of .dat file to parse</param>
        public DatContainer(string fileName)
        {
            this.datName = Path.GetFileNameWithoutExtension(fileName);
            DatType      = DatFactory.GetTypeName(datName);

            byte[] fileBytes = File.ReadAllBytes(fileName);

            using (MemoryStream ms = new MemoryStream(fileBytes))
            {
                using (BinaryReader br = new BinaryReader(ms, System.Text.Encoding.Unicode))
                {
                    Read(br);
                }
            }
        }