Esempio n. 1
0
        public static T GetEnum <T>(this IniKeyCollection keys, string key)
            where T : struct
        {
            var value = keys.GetString(key);

            return((T)Enum.Parse(typeof(T), value, true));
        }
Esempio n. 2
0
 protected override CodeLayer Load(IniKeyCollection iniData, LayerHandlerContext context)
 {
     return(new CodeLayer
     {
         Name = iniData.GetString("name"),
         ByteCode = context.LoadExternalFile(ClassFileKey)
     });
 }
Esempio n. 3
0
        protected override ActionLayer Load(IniKeyCollection iniData, LayerHandlerContext context)
        {
            var data = new ActionLayer();

            data.Name   = iniData.GetString("name");
            data.Hotkey = iniData.GetChar("hotkey");
            var parent = iniData.GetString("parent", "");

            if (!string.IsNullOrEmpty(parent))
            {
                var parts = parent.Split(':');
                data.Parent = new ResourceRef(parts[0], ushort.Parse(parts[1]));
            }
            data.Prerequisite = iniData.GetString("prereq", string.Empty);
            data.Verbs        = iniData.GetString("verbs", "")?.Split(',');

            return(data);
        }
Esempio n. 4
0
 protected override AudioLayer Load(IniKeyCollection iniData, LayerHandlerContext context)
 {
     return(new AudioLayer
     {
         Id = iniData.GetString("id"),
         BaseVolume = iniData.GetDouble("volume", 1.0),
         Data = context.LoadExternalFile(AudioFileKey)
     });
 }
Esempio n. 5
0
        public static T GetEnum <T>(this IniKeyCollection keys, string key, T defaultValue)
            where T : struct
        {
            var value = keys.GetString(key, "");

            try
            {
                return((T)Enum.Parse(typeof(T), value));
            }
            catch (Exception)
            {
                return(defaultValue);
            }
        }