Example #1
0
        private void ParseDatFile(Stream inStream)
        {
            try
            {
                _dat = new DatContainer(inStream, _datName);

                var containerData     = DataEntries.ToList();
                var userStringOffsets = _dat.GetUserStringOffsets();
                foreach (var keyValuePair in containerData)
                {
                    var data   = keyValuePair.Value;
                    var isUser = userStringOffsets.Contains(keyValuePair.Key);
                    Strings.Add(new DatString(data, isUser));
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format(Settings.Strings["DatWrapper_ParseDatFile_Failed"], ex.ToString()), ex);
            }
        }
Example #2
0
        private void ParseDatFile(Stream inStream)
        {
            Dat = new DatContainer(inStream, datName);

            try
            {
                var containerData = DataEntries.ToList();

                foreach (var keyValuePair in containerData)
                {
                    if (keyValuePair.Value is UnicodeString)
                    {
                        Strings.Add((UnicodeString)keyValuePair.Value);
                    }
                    else if (keyValuePair.Value is UInt64List)
                    {
                        UInt64List ul = (UInt64List)keyValuePair.Value;
                        Strings.Add((UnicodeString) new UnicodeString(ul.Offset, ul.dataTableOffset, ul.ToString()));
                    }
                    else if (keyValuePair.Value is UInt32List)
                    {
                        UInt32List ul = (UInt32List)keyValuePair.Value;
                        Strings.Add((UnicodeString) new UnicodeString(ul.Offset, ul.dataTableOffset, ul.ToString()));
                    }
                    else if (keyValuePair.Value is Int32List)
                    {
                        Int32List ul = (Int32List)keyValuePair.Value;
                        Strings.Add((UnicodeString) new UnicodeString(ul.Offset, ul.dataTableOffset, ul.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format(Settings.Strings["DatWrapper_ParseDatFile_Failed"], ex.Message), ex);
            }
        }