// Token: 0x06000F6E RID: 3950 RVA: 0x00068420 File Offset: 0x00066820 public void write(IFormattedFileWriter writer) { if (string.IsNullOrEmpty(this.key)) { return; } if (this.leaf != null) { string text = this.leaf.text; if (text == null) { text = string.Empty; } writer.beginObject(this.key); text = text.Replace("\"", "\\\""); text = text.Replace("'", "\\'"); writer.writeValue("Text", text); writer.writeValue <int>("Version", this.leaf.version); writer.endObject(); } else if (this.branches != null) { writer.beginObject(this.key); foreach (KeyValuePair <string, TranslationBranch> keyValuePair in this.branches) { TranslationBranch value = keyValuePair.Value; value.write(writer); } writer.endObject(); } }
// Token: 0x06000F6D RID: 3949 RVA: 0x00068338 File Offset: 0x00066738 public void read(IFormattedFileReader reader) { reader = reader.readObject(this.key); if (reader == null) { return; } if (reader.containsKey("Text") && reader.containsKey("Version")) { this.addLeaf(); reader.readKey("Text"); this.leaf.text = reader.readValue <string>(); reader.readKey("Version"); this.leaf.version = reader.readValue <int>(); } else { this.addBranches(); foreach (string key in reader.getKeys()) { TranslationBranch translationBranch = this.addBranch(key); reader.readKey(key); translationBranch.read(reader); } } }
// Token: 0x06000F6A RID: 3946 RVA: 0x000682EC File Offset: 0x000666EC public virtual TranslationBranch addBranch(string key) { TranslationBranch translationBranch = new TranslationBranch(this.translation, this, key); this.branches.Add(key, translationBranch); return(translationBranch); }
// Token: 0x06000F51 RID: 3921 RVA: 0x00067F94 File Offset: 0x00066394 public virtual void load() { this.tree = new TranslationBranch(this, null, "Translation"); using (StreamReader streamReader = new StreamReader(this.path)) { IFormattedFileReader reader = new KeyValueTableReader(streamReader); this.read(reader); } }
// Token: 0x06000F6F RID: 3951 RVA: 0x00068530 File Offset: 0x00066930 protected virtual void recursiveTriggerKeyChanged(string oldKey, string newKey) { this.triggerKeyChanged(oldKey, newKey); if (this.branches != null) { foreach (KeyValuePair <string, TranslationBranch> keyValuePair in this.branches) { TranslationBranch value = keyValuePair.Value; value.triggerKeyChanged(oldKey, newKey); } } }
// Token: 0x06000F4F RID: 3919 RVA: 0x00067EFC File Offset: 0x000662FC public virtual TranslationLeaf getLeaf(string token) { TranslationBranch tree = this.tree; string[] array = token.Split(Translation.DELIMITERS); for (int i = 0; i < array.Length; i++) { if (tree == null || tree.branches == null) { break; } tree.branches.TryGetValue(array[i], out tree); } if (tree != null && tree.leaf != null) { return(tree.leaf); } return(null); }
// Token: 0x06000F4E RID: 3918 RVA: 0x00067E4C File Offset: 0x0006624C public virtual TranslationLeaf addLeaf(string token) { TranslationBranch translationBranch = this.tree; string[] array = token.Split(Translation.DELIMITERS); for (int i = 0; i < array.Length; i++) { TranslationBranch translationBranch2; if (!translationBranch.branches.TryGetValue(array[i], out translationBranch2)) { translationBranch2 = translationBranch.addBranch(array[i]); } translationBranch = translationBranch2; if (i == array.Length - 1) { if (translationBranch.leaf == null) { translationBranch.addLeaf(); } } else { if (translationBranch.leaf != null) { return(null); } if (translationBranch.branches == null) { translationBranch.addBranches(); } } } if (translationBranch != null && translationBranch.leaf != null) { return(translationBranch.leaf); } return(null); }
// Token: 0x06000F52 RID: 3922 RVA: 0x00067FF0 File Offset: 0x000663F0 public virtual void unload() { this.tree = null; }
// Token: 0x06000F5B RID: 3931 RVA: 0x000680D3 File Offset: 0x000664D3 public TranslationBranch(Translation newTranslation, TranslationBranch newParentBranch, string newKey) { this.translation = newTranslation; this.parentBranch = newParentBranch; this._key = newKey; }
public TranslationLeaf(Translation newTranslation, TranslationBranch newBranch) { this.translation = newTranslation; this.branch = newBranch; }