private void SerializeGameRule(string _fileName, DestroyMonsterScript _DestroyMonsterScript) { try { XmlSerializer serializer = new XmlSerializer(typeof(DestroyMonsterScript)); using (StreamWriter writer = new StreamWriter(_fileName)) { serializer.Serialize(writer, _DestroyMonsterScript); } } catch { } }
private void DeSerializeGameRule(string _fileName) { try { if (File.Exists(_fileName)) { XmlSerializer Deserializer = new XmlSerializer(typeof(DestroyMonsterScript)); using (StreamReader reader = new StreamReader(_fileName)) { _DestroyMonsterScriptList = (DestroyMonsterScript)Deserializer.Deserialize(reader); } } } catch { } }