private void editToolStripMenuItem_Click(object sender, EventArgs e) { ObjectParameters op = new ObjectParameters("ScenarioArchiveName"); WarpEdit we = new WarpEdit(); we.tableName = Tables[listBox1.SelectedIndex].Description; we.tableList = levels[listBox1.SelectedIndex]; if (we.ShowDialog() != DialogResult.OK) { return; } levels[listBox1.SelectedIndex] = we.tableList; Tables[listBox1.SelectedIndex].Description = we.tableName; Tables[listBox1.SelectedIndex].DescHash = GCN.CreateHash(we.tableName); Tables[listBox1.SelectedIndex].Grouped.Clear(); for (int i = 0; i < we.tableList.Length; i++) { GameObject go = new GameObject("ScenarioArchiveName", we.tableName + " " + i, 2); op.Adjust(go); op.SetParamValue(0, go, we.tableList[i]); Tables[listBox1.SelectedIndex].Grouped.Add(go); go.Parent = Tables[listBox1.SelectedIndex]; } stageArc.Save(arc); }
public GameObject(string name, string refname, int length) { Name = name; Hash = GCN.CreateHash(Name); Description = refname; DescHash = GCN.CreateHash(Description); Values = new byte[length]; Parent = null; Grouped = new List <GameObject>(); }
/// <summary> /// Constructor /// </summary> /// <returns></returns> public GameObject() { Name = "(null)"; Hash = GCN.CreateHash("(null)"); Description = "(null)1"; DescHash = GCN.CreateHash("(null)1"); Values = new byte[0]; Parent = null; Grouped = new List <GameObject>(); }
public static bool IsGroup(string name) { UInt16 hash = GCN.CreateHash(name); if (hash == 16824 || hash == 15406 || hash == 28318 || hash == 18246 || hash == 43971 || hash == 9858 || hash == 25289 || //Levels hash == 33769 || hash == 49941 || hash == 13756 || hash == 65459 || hash == 38017 || hash == 47488 || //Tables hash == 8719 || hash == 22637) { return(true); } return(false); }
/// <summary> /// Verifies the integrity of the file /// using hashes /// </summary> /// <returns>Return of true means the file passed the test</returns> public bool VerifyIntegrity() { foreach (GameObject g in AllObjects) { if (g.Hash != GCN.CreateHash(g.Name)) { return(false); } if (g.DescHash != GCN.CreateHash(g.Description)) { return(false); } } return(true); }
/// <summary> /// Verifies the integrity of the file /// using hashes /// </summary> /// <returns>id of the next broken object.</returns> public int VerifyIntegrity(int start) { for (int i = start; i < AllObjects.Count; i++) { GameObject g = AllObjects[i]; if (g.Hash != GCN.CreateHash(g.Name)) { return(i); } if (g.DescHash != GCN.CreateHash(g.Description)) { return(i); } } return(AllObjects.Count); }
/// <summary> /// Repairs disrepencies between names, descriptions, and their hashes /// </summary> public int RepairHashes() { int c = 0; foreach (GameObject g in AllObjects) { ushort nhash = GCN.CreateHash(g.Name); ushort dhash = GCN.CreateHash(g.Description); if (g.Hash != nhash || g.DescHash != dhash) { g.Hash = nhash; g.DescHash = dhash; c++; } } return(c); }
/* * Saves prm file type */ public void Save() { if (file == null) { return; } file.SetLength(GetSize()); file.Seek(0, SeekOrigin.Begin); Data.WriteInt32(file, paramList.Count); foreach (KeyValuePair <string, PrmData> kvp in paramList) { Data.WriteUInt16(file, GCN.CreateHash(kvp.Key)); Data.WriteUInt16(file, (UInt16)Encoding.GetEncoding("shift-jis").GetByteCount(kvp.Key)); Data.WriteString(file, kvp.Key, Encoding.GetEncoding("shift-jis"), false); kvp.Value.Write(file); } file.Flush(); }
public void SetActorType(string type) { Name = type; Hash = GCN.CreateHash(type); }
public void SetObjectKey(string key) { Description = key; DescHash = GCN.CreateHash(key); }