//Static Member Function /// <summary> /// Find meta pref of a pref. /// </summary> /// <param name="pref"></param> /// <returns></returns> public static PP FindSerializablePP(PP pref) { foreach (KeyValuePair <PP, List <PP> > pair in serializableDictPrefs) { if (pair.Value.Contains(pref)) { return(pair.Key); } } throw new NullReferenceException("There is no such value named as " + pref.ToString() + " in serializableDictPrefs dictionary."); }
public void Save(int moveNum) { if (!Directory.Exists(Paths.DataPath + "Move")) { Directory.CreateDirectory(Paths.DataPath + "Move"); } using (XmlWriter writer = XmlWriter.Create(Paths.DataPath + "Move\\" + moveNum + ".xml", Logger.XmlWriterSettings)) { writer.WriteStartDocument(); writer.WriteStartElement("MoveEntry"); #region Basic data writer.WriteStartElement("General"); writer.WriteElementString("Name", Name); writer.WriteElementString("Description", Desc); writer.WriteElementString("PP", PP.ToString()); writer.WriteElementString("Type", Type.ToString()); writer.WriteElementString("Category", Category.ToString()); writer.WriteElementString("Contact", Contact.ToString()); writer.WriteElementString("SoundBased", SoundBased.ToString()); writer.WriteElementString("FistBased", FistBased.ToString()); writer.WriteElementString("PulseBased", PulseBased.ToString()); writer.WriteElementString("BulletBased", BulletBased.ToString()); writer.WriteElementString("JawBased", BulletBased.ToString()); writer.WriteElementString("Power", Power.ToString()); writer.WriteElementString("Accuracy", Accuracy.ToString()); writer.WriteElementString("Effect", Effect.ToString()); writer.WriteElementString("Effect1", Effect1.ToString()); writer.WriteElementString("Effect2", Effect2.ToString()); writer.WriteElementString("Effect3", Effect3.ToString()); writer.WriteElementString("HitsSelf", Range.HitsSelf.ToString()); writer.WriteElementString("HitsFriend", Range.HitsFriend.ToString()); writer.WriteElementString("HitsFoe", Range.HitsFoe.ToString()); writer.WriteElementString("Range", Range.RangeType.ToString()); writer.WriteElementString("Mobility", Range.Mobility.ToString()); writer.WriteElementString("CutsCorners", Range.CutsCorners.ToString()); writer.WriteElementString("Distance", Range.Distance.ToString()); writer.WriteStartElement("StartAnim"); StartAnim.Save(writer); writer.WriteEndElement(); writer.WriteStartElement("StartUserAnim"); StartUserAnim.Save(writer); writer.WriteEndElement(); writer.WriteElementString("StartSound", StartSound.ToString()); writer.WriteStartElement("MidAnim"); MidAnim.Save(writer); writer.WriteEndElement(); writer.WriteStartElement("MidUserAnim"); MidUserAnim.Save(writer); writer.WriteEndElement(); writer.WriteStartElement("MidTargetAnim"); MidTargetAnim.Save(writer); writer.WriteEndElement(); writer.WriteElementString("MidSound", MidSound.ToString()); writer.WriteStartElement("EndAnim"); EndAnim.Save(writer); writer.WriteEndElement(); writer.WriteStartElement("EndUserAnim"); EndUserAnim.Save(writer); writer.WriteEndElement(); writer.WriteStartElement("EndTargetAnim"); EndTargetAnim.Save(writer); writer.WriteEndElement(); writer.WriteElementString("EndSound", EndSound.ToString()); writer.WriteEndElement(); #endregion writer.WriteEndElement(); writer.WriteEndDocument(); } }