private static void Init()
 {
     RunReport.runReportsFolder = Application.dataPath + "/RunReports/";
     HGXml.Register <RunReport>(new HGXml.Serializer <RunReport>(RunReport.ToXml), new HGXml.Deserializer <RunReport>(RunReport.FromXml));
     HGXml.Register <RunReport.PlayerInfo>(new HGXml.Serializer <RunReport.PlayerInfo>(RunReport.PlayerInfo.ToXml), new HGXml.Deserializer <RunReport.PlayerInfo>(RunReport.PlayerInfo.FromXml));
     HGXml.Register <RunReport.PlayerInfo[]>(new HGXml.Serializer <RunReport.PlayerInfo[]>(RunReport.PlayerInfo.ArrayToXml), new HGXml.Deserializer <RunReport.PlayerInfo[]>(RunReport.PlayerInfo.ArrayFromXml));
 }
Esempio n. 2
0
 // Token: 0x06001869 RID: 6249 RVA: 0x000742D8 File Offset: 0x000724D8
 static ItemCatalog()
 {
     ItemCatalog.DefineItems();
     HGXml.Register <ItemIndex[]>(delegate(XElement element, ItemIndex[] obj)
     {
         element.Value = string.Join(" ", from v in obj
                                     select v.ToString());
     }, delegate(XElement element, ref ItemIndex[] output)
     {
         output = element.Value.Split(new char[]
         {
             ' '
         }).Select(delegate(string v)
         {
             ItemIndex result;
             if (!Enum.TryParse <ItemIndex>(v, false, out result))
             {
                 return(ItemIndex.None);
             }
             return(result);
         }).ToArray <ItemIndex>();
         return(true);
     });
 }
Esempio n. 3
0
 // Token: 0x06001893 RID: 6291 RVA: 0x00069E13 File Offset: 0x00068013
 public RuleBook()
 {
     HGXml.Register <RuleBook>(new HGXml.Serializer <RuleBook>(RuleBook.ToXml), new HGXml.Deserializer <RuleBook>(RuleBook.FromXml));
     this.SetToDefaults();
 }
Esempio n. 4
0
 // Token: 0x06001CF6 RID: 7414 RVA: 0x0007C051 File Offset: 0x0007A251
 static StatSheet()
 {
     HGXml.Register <StatSheet>(new HGXml.Serializer <StatSheet>(StatSheet.ToXml), new HGXml.Deserializer <StatSheet>(StatSheet.FromXml));
 }
    // Token: 0x0600018E RID: 398 RVA: 0x00008E80 File Offset: 0x00007080
    static HGXml()
    {
        HGXml.Register <int>(delegate(XElement element, int contents)
        {
            element.Value = TextSerialization.ToStringInvariant(contents);
        }, delegate(XElement element, ref int contents)
        {
            int num;
            if (TextSerialization.TryParseInvariant(element.Value, out num))
            {
                contents = num;
                return(true);
            }
            return(false);
        });
        HGXml.Register <uint>(delegate(XElement element, uint contents)
        {
            element.Value = TextSerialization.ToStringInvariant(contents);
        }, delegate(XElement element, ref uint contents)
        {
            uint num;
            if (TextSerialization.TryParseInvariant(element.Value, out num))
            {
                contents = num;
                return(true);
            }
            return(false);
        });
        HGXml.Register <ulong>(delegate(XElement element, ulong contents)
        {
            element.Value = TextSerialization.ToStringInvariant(contents);
        }, delegate(XElement element, ref ulong contents)
        {
            ulong num;
            if (TextSerialization.TryParseInvariant(element.Value, out num))
            {
                contents = num;
                return(true);
            }
            return(false);
        });
        HGXml.Register <bool>(delegate(XElement element, bool contents)
        {
            element.Value = (contents ? "1" : "0");
        }, delegate(XElement element, ref bool contents)
        {
            int num;
            if (TextSerialization.TryParseInvariant(element.Value, out num))
            {
                contents = (num != 0);
                return(true);
            }
            return(false);
        });
        HGXml.Register <float>(delegate(XElement element, float contents)
        {
            element.Value = TextSerialization.ToStringInvariant(contents);
        }, delegate(XElement element, ref float contents)
        {
            float num;
            if (TextSerialization.TryParseInvariant(element.Value, out num))
            {
                contents = num;
                return(true);
            }
            return(false);
        });
        HGXml.Register <double>(delegate(XElement element, double contents)
        {
            element.Value = TextSerialization.ToStringInvariant(contents);
        }, delegate(XElement element, ref double contents)
        {
            double num;
            if (TextSerialization.TryParseInvariant(element.Value, out num))
            {
                contents = num;
                return(true);
            }
            return(false);
        });
        HGXml.Register <string>(delegate(XElement element, string contents)
        {
            element.Value = contents;
        }, delegate(XElement element, ref string contents)
        {
            contents = element.Value;
            return(true);
        });
        MethodInfo method = typeof(HGXml).GetMethod("RegisterEnum");

        foreach (TypeInfo typeInfo in from t in typeof(HGXml).Assembly.DefinedTypes
                 where t.IsEnum
                 select t)
        {
            method.MakeGenericMethod(new Type[]
            {
                typeInfo
            }).Invoke(null, Array.Empty <object>());
        }
    }