Ejemplo n.º 1
0
        private static object LoadProperty(ConfigPropertyAttribute attrib, ServiceBussiness sb)
        {
            string         key            = attrib.Key;
            ServerProperty serverProperty = sb.GetServerPropertyByKey(key);

            if (serverProperty == null)
            {
                serverProperty       = new ServerProperty();
                serverProperty.Key   = key;
                serverProperty.Value = attrib.DefaultValue.ToString();
                GameProperties.log.Error("Cannot find server property " + key + ",keep it default value!");
            }
            object result;

            try
            {
                result = Convert.ChangeType(serverProperty.Value, attrib.DefaultValue.GetType());
            }
            catch (Exception exception)
            {
                GameProperties.log.Error("Exception in GameProperties Load: ", exception);
                result = null;
            }
            return(result);
        }
Ejemplo n.º 2
0
        private static object LoadProperty(ConfigPropertyAttribute attrib, ServiceBussiness sb)
        {
            String         key      = attrib.Key;
            ServerProperty property = sb.GetServerPropertyByKey(key);

            if (property == null)
            {
                property       = new ServerProperty();
                property.Key   = key;
                property.Value = attrib.DefaultValue.ToString();
                log.Error("Cannot find server property " + key + ",keep it default value!");
            }
            log.Debug("Loading " + key + " Value is " + property.Value);
            try
            {
                return(Convert.ChangeType(property.Value, attrib.DefaultValue.GetType()));
            }
            catch (Exception e)
            {
                log.Error("Exception in GameProperties Load: ", e);
                return(null);
            }
        }
Ejemplo n.º 3
0
 private static object LoadProperty(ConfigPropertyAttribute attrib, ServiceBussiness sb)
 {
     String key = attrib.Key;
     ServerProperty property = sb.GetServerPropertyByKey(key);
     if (property == null)
     {
         property = new ServerProperty();
         property.Key = key;
         property.Value = attrib.DefaultValue.ToString();
         log.Error("Cannot find server property " + key + ",keep it default value!");
     }
     log.Debug("Loading " + key + " Value is " + property.Value);
     try
     {
         return Convert.ChangeType(property.Value, attrib.DefaultValue.GetType());
     }
     catch (Exception e)
     {
         log.Error("Exception in GameProperties Load: ", e);
         return null;
     }
 }