コード例 #1
0
ファイル: Parser.cs プロジェクト: rohanor/evecacheparser
        /// <summary>
        /// Gets the object of a cached object.
        /// </summary>
        /// <param name="value">The object.</param>
        /// <returns></returns>
        public static object GetObject(object value)
        {
            SCachedObjectType cachedObject = value as SCachedObjectType;

            if (cachedObject == null)
            {
                return(null);
            }

            if (cachedObject.Object != null)
            {
                return(cachedObject.Object);
            }

            if (cachedObject.RawData == null)
            {
                throw new InvalidDataException("No object?!");
            }

            byte[] rawData = Encoding.Default.GetBytes((string)cachedObject.RawData);
            byte[] data    = cachedObject.IsCompressed ? SCachedObjectType.Decompress(rawData) : rawData;

            cachedObject.Object  = CachedFileParser.Parse(data);
            cachedObject.RawData = null;

            return(cachedObject.Object);
        }
コード例 #2
0
        /// <summary>
        /// Parses the specified data.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <returns></returns>
        internal static object Parse(byte[] data)
        {
            var reader = new CachedFileReader(data);
            var parser = new CachedFileParser(reader);

            parser.Parse();

            return(parser.m_stream.Members.Select(member => member.ToObject()).ToList());
        }
コード例 #3
0
        /// <summary>
        /// Parses the specified file.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <returns></returns>
        internal static KeyValuePair <object, object> Parse(FileInfo file)
        {
            Console.WriteLine("Parsing...");

            SType.Reset();
            var cachedFile = new CachedFileReader(file);
            var parser     = new CachedFileParser(cachedFile);

            parser.Parse();

            return(!s_dumpStructure?parser.ToObjects() : new KeyValuePair <object, object>());
        }
コード例 #4
0
        /// <summary>
        /// Parses a sub stream.
        /// </summary>
        /// <returns></returns>
        SType ParseSubStream()
        {
            SType subStream = new SStreamType(StreamType.SubStream);
            var   length    = m_reader.ReadLength();

            if (s_dumpStructure)
            {
                var subReader = new CachedFileReader(m_reader, length);
                var subParser = new CachedFileParser(subReader);
                subParser.Parse();
                subStream.AddMember(subParser.m_stream.Clone());
            }

            if (s_cachedObject)
            {
                return(new SStringType(m_reader.ReadString(length)));
            }

            m_reader.Seek(length);

            return(subStream);
        }
コード例 #5
0
ファイル: Parser.cs プロジェクト: rohanor/evecacheparser
 /// <summary>
 /// Parses the specified file.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <returns></returns>
 public static KeyValuePair <object, object> Parse(FileInfo file)
 {
     return(CachedFileParser.Parse(file));
 }
コード例 #6
0
ファイル: Parser.cs プロジェクト: rohanor/evecacheparser
 /// <summary>
 /// Reads the specified file and shows it in an ASCII format.
 /// </summary>
 /// <param name="file">The file.</param>
 public static void ShowAsAscii(FileInfo file)
 {
     CachedFileParser.ShowAsAscii(file);
 }
コード例 #7
0
ファイル: Parser.cs プロジェクト: rohanor/evecacheparser
 /// <summary>
 /// Dumps the structure of the file to a file.
 /// </summary>
 /// <param name="file">The file.</param>
 public static void DumpStructure(FileInfo file)
 {
     CachedFileParser.DumpStructure(file);
 }