public PlayTime() { uint value = SaveData.Instance().ReadNumber(0x10, 4); mHour = value / 216000; mMinute = value / 3600 % 60; mSecond = (value - mMinute * 3600) / 60 % 60; }
private void Write() { uint value = mHour * 216000; value += mMinute * 3600; value += mSecond * 60; SaveData.Instance().WriteNumber(0x10, 4, value); }
private void Load(String filename, bool force) { if (SaveData.Instance().Open(filename, force) == false) { MessageBox.Show("fail"); return; } DataContext = new ViewModel(); MessageBox.Show("success"); }
private void MenuItemFileExport_Click(object sender, RoutedEventArgs e) { var dlg = new SaveFileDialog(); if (dlg.ShowDialog() == false) { return; } SaveData.Instance().Export(dlg.FileName); }
public static void WriteNumber(uint address, uint size, uint value, uint min, uint max) { if (value < min) { value = min; } if (value > max) { value = max; } SaveData.Instance().WriteNumber(address, size, value); }
private void MenuItemFileSaveAs_Click(object sender, RoutedEventArgs e) { var dlg = new SaveFileDialog(); if (dlg.ShowDialog() == false) { return; } (DataContext as ViewModel)?.ItemCount(); SaveData.Instance().SaveAs(dlg.FileName); }
private void MenuItemFileImport_Click(object sender, RoutedEventArgs e) { var dlg = new OpenFileDialog(); if (dlg.ShowDialog() == false) { return; } if (SaveData.Instance().Import(dlg.FileName)) { DataContext = new ViewModel(); } }
private void MenuItemFileSave_Click(object sender, RoutedEventArgs e) { (DataContext as ViewModel)?.ItemCount(); SaveData.Instance().Save(); }
public (bool, int) Adaptation(String patch) { patch = patch.Replace("\t", " "); patch = patch.Replace("\r\n", "\n"); String[] lines = patch.Split('\n'); SaveData save = SaveData.Instance(); for (int i = 0; i < lines.Length; i++) { if (String.IsNullOrEmpty(lines[i])) { continue; } uint size = 0; uint address = 0; uint value = 0; uint loop = 1; uint move = 0; uint add = 0; String[] code = lines[i].Split(' '); if (code.Length != 2) { return(false, i); } address = Convert.ToUInt32(code[0].Substring(1), 16); value = Convert.ToUInt32(code[1], 16); switch (code[0][0]) { case '0': size = 1; break; case '1': size = 2; break; case '2': size = 4; break; case '4': if (i + 1 >= lines.Length) { return(false, i); } address = Convert.ToUInt32(code[0].Substring(2), 16); switch (code[0][1]) { case '0': size = 1; break; case '1': size = 2; break; case '2': size = 4; break; } i++; code = lines[i].Split(' '); if (code[0][0] != '4') { return(false, i); } loop = Convert.ToUInt32(code[0].Substring(1, 3), 16); move = Convert.ToUInt32(code[0].Substring(4), 16); add = Convert.ToUInt32(code[1], 16); break; default: return(false, i); } for (uint j = 0; j < loop; j++) { save.WriteNumber(address + move * j, size, value + add * j); } } return(true, 0); }
public void ItemCount() { uint count = 0; foreach (var item in Consumable) { if (item.ID != 0xFFFF) { count++; } } SaveData.Instance().WriteNumber(0xE9B8, 4, count); count = 0; foreach (var item in Weapon) { if (item.ID != 0xFFFF) { count++; } } SaveData.Instance().WriteNumber(0xE9BC, 4, count); count = 0; foreach (var item in Armor) { if (item.ID != 0xFFFF) { count++; } } SaveData.Instance().WriteNumber(0xE9C0, 4, count); count = 0; foreach (var item in Accessorie) { if (item.ID != 0xFFFF) { count++; } } SaveData.Instance().WriteNumber(0xE9C4, 4, count); count = 0; foreach (var item in Technique) { if (item.ID != 0xFFFF) { count++; } } SaveData.Instance().WriteNumber(0xE9D8, 4, count); count = 0; foreach (var item in Magic) { if (item.ID != 0xFFFF) { count++; } } SaveData.Instance().WriteNumber(0xE9DC, 4, count); }