/// <summary> /// Creates fused string /// </summary> /// <param name="s">String</param> public FString(string s) { StringKey _sk = StringKey.FindCreate(s); StringKey.AddString(_sk); // Adds globally _globalKey = _sk.Key; }
/// <summary> /// Creates fused string /// </summary> /// <param name="key">Key</param> public FString(long key) { StringKey _sk = StringKey.FindCreate(key); StringKey.AddString(_sk); // Adds globally _globalKey = _sk.Key; }
protected override void ImportData(AwesomeReader ar) { BaseDirectory = ar.ReadInt64(); // songs.Halestorm.LoveBites TableLanguage = (Language)ar.ReadInt64(); ar.BaseStream.Position += 8; // Skips zeros Dictionary <long, string> dic = new Dictionary <long, string>(); int count = ar.ReadInt32(); ar.BaseStream.Position += 12; // Skips to entries long difference = ar.BaseStream.Position + (count * 16); long[] key = new long[count]; long[] offset = new long[count]; for (int i = 0; i < count; i++) { key[i] = ar.ReadInt64(); offset[i] = ar.ReadInt32(); ar.ReadInt32(); // Should be zero } for (int i = 0; i < count; i++) { ar.BaseStream.Position = offset[i] + difference; string text = ar.ReadNullString(); if (!dic.ContainsKey(key[i])) { dic.Add(key[i], text); continue; } // Evidently the same string with different casings will have the same key (only for directory paths?) if (string.Compare(dic[key[i]], text, true) == 0) { dic.Remove(key[i]); dic.Add(key[i], text); } else { Console.WriteLine("STRING ERROR: {0} != {1}", dic[key[i]], text); //subDictionary.Add(key[i], text); } } Strings = new List <FString>(); foreach (var d in dic) { // Finds/adds key string globally StringKey sk = StringKey.FindCreate(d.Key); sk.SetValue(d.Value, TableLanguage); // Adds string to string table collection (And adds globally) StringKey.AddString(sk); Strings.Add(sk.Key); } }