Ejemplo n.º 1
0
    virtual public void Load()
    {
        Type t = this.GetType();

        arrtr = t.GetCustomAttributes(typeof(ConfigCsvAttribute), false)[0] as ConfigCsvAttribute;
        ConfigSetting.Load(arrtr.assetName, ParseAsset);
    }
Ejemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Program.Config = ConfigSetting.Load(ConfigSetting.WeiyaConfigPath);
            Application.Run(new WeiyaCalcForm());
        }
Ejemplo n.º 3
0
        protected ConfigBase Instantiate(ConfigBaseMetadata metadata, PluginRuntime pluginRuntime)
        {
            ServiceRegistration.Get <ILogger>().Debug("ConfigurationNode: Loading configuration item '{0}'", metadata.Location);
            ConfigBase result;

            if (metadata.GetType() == typeof(ConfigGroupMetadata))
            {
                result = new ConfigGroup();
            }
            else if (metadata.GetType() == typeof(ConfigSectionMetadata))
            {
                result = new ConfigSection();
            }
            else if (metadata.GetType() == typeof(ConfigSettingMetadata))
            {
                ConfigSettingMetadata csm = (ConfigSettingMetadata)metadata;
                try
                {
                    ConfigSetting cs = (ConfigSetting)pluginRuntime.InstantiatePluginObject(csm.ClassName);
                    if (cs == null)
                    {
                        throw new ArgumentException(string.Format("Configuration class '{0}' not found", csm.ClassName));
                    }
                    cs.Load();
                    if (csm.ListenTo != null)
                    {
                        foreach (string listenToLocation in csm.ListenTo)
                        {
                            IConfigurationNode node;
                            if (FindNode(listenToLocation, out node))
                            {
                                if (node.ConfigObj is ConfigSetting)
                                {
                                    cs.ListenTo((ConfigSetting)node.ConfigObj);
                                }
                                else
                                {
                                    ServiceRegistration.Get <ILogger>().Warn("ConfigurationNode '{0}': Trying to listen to setting, but location '{1}' references a {2}",
                                                                             Location, listenToLocation, node.ConfigObj.GetType().Name);
                                }
                            }
                        }
                    }
                    result = cs;
                }
                catch (Exception ex)
                {
                    ServiceRegistration.Get <ILogger>().Error("Error loading configuration class '{0}'", ex, csm.ClassName);
                    return(null);
                }
            }
            else
            {
                throw new NotImplementedException(string.Format("Unknown child class '{0}' of '{1}'", metadata.GetType().FullName, typeof(ConfigBaseMetadata).FullName));
            }
            result.SetMetadata(metadata);
            return(result);
        }
Ejemplo n.º 4
0
        private void btnWeiya_Click(object sender, EventArgs e)
        {
            this.Hide();

            Program.Config = ConfigSetting.Load(ConfigSetting.WeiyaConfigPath);
            WeiyaCalcForm dialog = new WeiyaCalcForm();

            dialog.ShowDialog();
            this.Close();
        }
 public void Initialize(ConfigSetting setting)
 {
     if (_setting != null)
     {
         _setting.Changed -= OnSettingChanged;
     }
     _setting = setting;
     if (_setting != null)
     {
         _setting.Changed += OnSettingChanged;
         _setting.Load();
     }
     SettingChanged();
 }
Ejemplo n.º 6
0
        protected ConfigBase Instantiate(ConfigBaseMetadata metadata, PluginRuntime pluginRuntime)
        {
            ServiceRegistration.Get <ILogger>().Debug("ConfigurationNode: Loading configuration item '{0}'", metadata.Location);
            ConfigBase result;

            if (metadata.GetType() == typeof(ConfigGroupMetadata))
            {
                result = new ConfigGroup();
            }
            else if (metadata.GetType() == typeof(ConfigSectionMetadata))
            {
                result = new ConfigSection();
            }
            else if (metadata.GetType() == typeof(ConfigSettingMetadata))
            {
                ConfigSettingMetadata csm = (ConfigSettingMetadata)metadata;
                try
                {
                    ConfigSetting cs = (ConfigSetting)pluginRuntime.InstantiatePluginObject(csm.ClassName);
                    if (cs == null)
                    {
                        throw new ArgumentException(string.Format("Configuration class '{0}' not found", csm.ClassName));
                    }
                    cs.Load();
                    result = cs;
                }
                catch (Exception ex)
                {
                    ServiceRegistration.Get <ILogger>().Error("Error loading configuration class '{0}'", ex, csm.ClassName);
                    return(null);
                }
            }
            else
            {
                throw new NotImplementedException(string.Format("Unknown child class '{0}' of '{1}'", metadata.GetType().FullName, typeof(ConfigBaseMetadata).FullName));
            }
            result.SetMetadata(metadata);
            return(result);
        }
Ejemplo n.º 7
0
        public CalcProcHad(bool isBaseStationConvertFinish)
        {
            this.isBaseStationConvertFinish = isBaseStationConvertFinish;

            config = ConfigSetting.Load(ConfigSetting.HadConfigPath);
        }
Ejemplo n.º 8
0
 public WeiyaCalcProcess()
 {
     config = ConfigSetting.Load(ConfigSetting.WeiyaConfigPath);
 }