Пример #1
0
        public virtual string DelByModuleForm(string xml, string form, string ids)
        {
            xml = Xml(xml);
            if (form.IsEmpty())
            {
                //----------
                ModuleConfig config = xml.SingletonByPage <ModuleConfig>();
                var          _form  = config.Forms.First();
                if (_form is FormConfig)
                {
                    form = ((FormConfig)_form).TableName;
                }
                else
                {
                    form = _form.Name;
                }
            }
            string[] _idList = JsonConvert.DeserializeObject <string[]>(ids);
            DataSet  ds      = DataSetUtil.SetDelDataSet(form, _idList);
            string   res     = JsonConvert.SerializeObject(ds);

            string mres = ModuleMerge(res, xml, "Update");

            return(mres);
        }
Пример #2
0
        static void Main()
        {
            Type t = Type.GetType("Cn.Youdundianzi.Share.Util.Motor.MotorSignalSettings");

            CSettings settings = (CSettings)ModuleConfig.GetSettings(t, "Test.config");

            signLen             = new SignLength();
            signLen.GAN_LENGTH  = settings.SignConfig.GanLength;
            signLen.XIAN_LENGTH = settings.SignConfig.XianLength;
            signLen.CHE_LENGTH  = settings.SignConfig.CheLength;

            SimForm simForm = new Cn.Youdundianzi.Share.Util.Sim6G6X4C.SimForm();

            ISignalMonitor monitor = SignalMonitorFactory.CreateSignalMonitor("Motor.exe", "Cn.Youdundianzi.Share.Signal.Motor.MotorMonitor", settings);

            oldData = monitor.CreateMonDate(signLen);
            monitor.HotKeyHandle = simForm.Handle;
            monitor.RegMonitor(simForm);
            Program p = new Program();

            monitor.RegMonitor(p);

            ITranslator translator = TranslatorFactory.CreateTranslater("Motor.exe", "Cn.Youdundianzi.Exam.MotorSignalTranslator", monitor);
            //IStateManager sm = StateManagerFactory.CreateStateManager("Motor.exe", "Cn.Youdundianzi.Exam.State.MotorState.MotorStateManager", translator, settings);
            //IStateManager sm = StateManagerFactory.CreateStateManager("Motor.exe", "Cn.Youdundianzi.Exam.State.XA2WMotorState.MotorStateManager", translator, settings);
            IStateManager sm = StateManagerFactory.CreateStateManager("Motor.exe", "Cn.Youdundianzi.Exam.State.XA3WMotorState.MotorStateManager", translator, settings);

            sm.CurrentState = sm.EntryState;

            monitor.Start();
            Application.Run(simForm);
        }
Пример #3
0
        /// <summary>
        /// Binds the template.
        /// </summary>
        /// <param name="grid">The grid.</param>
        /// <param name="module">The module.</param>
        /// <param name="column">The column.</param>
        private void BindTemplate(Grid grid, ModuleConfig module, ViewColumn column)
        {
            if (column.Template == null)
            {
                return;
            }

            // Remove any template with the same name
            //foreach (GridServerTemplate existingTemplate in grid.ServerTemplates)
            for (int index = 0; index < grid.ServerTemplates.Count; index++)
            {
                if (String.Compare(grid.ServerTemplates[index].ID, column.Template.TemplateId, true) == 0)
                {
                    grid.ServerTemplates.RemoveAt(index);
                }
            }

            string    url      = String.Empty;
            ITemplate template = new SimpleTemplate((UserControl)grid.Parent, module.Name, column.Template);

            // Add server template to grid
            ComponentArt.Web.UI.GridServerTemplate gst = new ComponentArt.Web.UI.GridServerTemplate();
            gst.Template = (ITemplate)template;

            gst.ID = column.Template.TemplateId;

            BindColumnTemplateProperties(gst.Template, column.Template);
            grid.ServerTemplates.Add(gst);
            grid.Controls.Add(gst);
        }
Пример #4
0
        /// <summary>
        /// Returns config for the specified App.
        /// </summary>
        /// <param name="name">The name.</param>
        private void InitializeConfig(string name)
        {
            if (HttpContext.Current != null)
            {
                string filePath = HttpContext.Current.Server.MapPath(String.Concat(BaseAppsPath, name, "/", name, ".config"));

                if (File.Exists(filePath))
                {
                    lock (_syncObject)
                    {
                        // get ModuleConfig object for the current fileName
                        ModuleConfig config = InternalGetConfig(filePath, name);

                        // if config loaded, add it to the collection
                        if (config != null)
                        {
                            _Configs[name] = config;
                            if (!_IsInitialized.ContainsKey(name))
                            {
                                _IsInitialized.Add(name, true);
                            }
                            else
                            {
                                _IsInitialized[name] = true;
                            }
                        }
                    }
                }
            }
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmConnManager(string configDir)
     : this()
 {
     configFileName = Path.Combine(configDir, ModuleConfig.DefaultFileName);
     moduleConfig   = new ModuleConfig();
     sortRequired   = false;
 }
Пример #6
0
        private List <ModuleConfig> FindModules(string path)
        {
            var configs = new List <ModuleConfig>();

            foreach (string moduleFile in Directory.GetFiles(path, "*.module"))
            {
                ModuleConfig moduleConfig = IOUtility.jsonDeserializer.deserialize <ModuleConfig>(moduleFile);
                if (moduleConfig != null)
                {
                    moduleConfig.DirectoryPath    = path;
                    moduleConfig.FilePath         = moduleFile;
                    moduleConfig.Version_Internal = Parser.getUInt32FromIP(moduleConfig.Version);
                    for (var i = moduleConfig.Dependencies.Count - 1; i >= 0; i--)
                    {
                        ModuleDependency moduleDependency = moduleConfig.Dependencies[i];
                        if (moduleDependency.Name == "Framework" || moduleDependency.Name == "Unturned")
                        {
                            moduleConfig.Dependencies.RemoveAtFast(i);
                        }
                        else
                        {
                            moduleDependency.Version_Internal = Parser.getUInt32FromIP(moduleDependency.Version);
                        }
                    }
                    configs.Add(moduleConfig);
                }
            }

            foreach (string subDirectory in Directory.GetDirectories(path))
            {
                configs.AddRange(FindModules(subDirectory));
            }

            return(configs);
        }
Пример #7
0
 // В конструкторе принимаем конфиг, а не индекс
 public Module(ModuleConfig config)
 {
     Type          = config.Type;
     Config        = config;
     Constructible = new Progression(config.ConstructionTime);
     Cycle         = new Progression(config.CycleTime);
 }
Пример #8
0
        /// <summary>
        /// Initializes the ModuleClient and sets up the callback to receive
        /// messages containing temperature information
        /// </summary>
        static async Task Init(TransportType transportType)
        {
            var mqttSetting = new MqttTransportSettings(transportType);

            ITransportSettings[] settings = { mqttSetting };

            // Open a connection to the Edge runtime
            ModuleClient moduleClient = await ModuleClient.CreateFromEnvironmentAsync(settings).ConfigureAwait(false);

            await moduleClient.OpenAsync().ConfigureAwait(false);

            Console.WriteLine("TemperatureFilter - Opened module client connection");

            ModuleConfig moduleConfig = await GetConfiguration(moduleClient).ConfigureAwait(false);

            Console.WriteLine($"Using TemperatureThreshold value of {moduleConfig.TemperatureThreshold}");

            var userContext = new Tuple <ModuleClient, ModuleConfig>(moduleClient, moduleConfig);

            // Register callback to be called when a message is sent to "input1"
            await moduleClient.SetInputMessageHandlerAsync(
                "input1",
                PrintAndFilterMessages,
                userContext).ConfigureAwait(false);
        }
Пример #9
0
        private void frmLptDetailEmployee_Load(object sender, EventArgs e)
        {
            crvDetail.ReportSource = reportDocument;

            //kiem tra tuy chon ExportRepost
            if (ExportReport)
            {
                settings = ModuleConfig.GetSettings();
                string   reportPart = settings.ReportPath;
                string   Targetfile = reportPart + "\\" + reportName + "_" + reportDate.Month + "_" + reportDate.Year + ".rpt";
                FileInfo fil        = new FileInfo(Targetfile);
                if (fil.Exists)
                {
                    if (
                        MessageBox.Show("Đã tồn tại báo cáo này, có ghi đè không?", "Thông báo", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        fil.Delete();
                    }
                    else
                    {
                        return;
                    }
                }
                //reportDocument.SaveAs(Targetfile, true);
                //Application.DoEvents();
                reportDocument.ExportToDisk(ExportFormatType.CrystalReport, Targetfile);
            }
        }
        public void when_the_input_is_correct_then_it_should_return_a_successfull_response()
        {
            String shapeName = ApplicationConstants.ShapeName.SQUARE;

            OutputDto expectedOutput = new OutputDto(
                shapeName,
                ApplicationConstants.Operation.AREA,
                4,
                ApplicationConstants.Status.SUCCESS,
                "Operation ran successfully");

            List <Double> values = new List <Double>();

            values.Add(2);

            Shape           shape = ModuleConfig.createShape(shapeName, values);
            InputAdapterDto input = new InputAdapterDto(shape, "area", values);

            Interactor shapeInteractor = new ShapeInteractor();

            OutputDto response = shapeInteractor.execute(input);

            Assert.IsNotNull(response);
            Assert.AreEqual(expectedOutput.Shape, response.Shape);
            Assert.AreEqual(expectedOutput.Operation, response.Operation);
            Assert.AreEqual(expectedOutput.ResponseStatus, response.ResponseStatus);
            Assert.AreEqual(expectedOutput.ValueResponse, response.ValueResponse);
            Assert.AreEqual(expectedOutput.Message, response.Message);
        }
Пример #11
0
        /// <summary>
        /// 构建配置
        /// </summary>
        /// <param name="filePath">路径</param>
        /// <returns></returns>
        public async Task <ModuleConfig> BuildConfig(string filePath)
        {
            FilePath     = filePath;
            moduleConfig = await BuildConfigByFile();

            return(moduleConfig);
        }
Пример #12
0
        private async Task <ModuleConfig> BuildConfigByFile()
        {
            string filePath = ResolveFilePath();

            if (!File.Exists(filePath))
            {
                log.LogError("unable to build navigation tree, could not find the file " + filePath);

                return(null);
            }

            string json;

            using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                using (StreamReader streamReader = new StreamReader(fileStream))
                {
                    json = await streamReader.ReadToEndAsync();
                }
            }

            ModuleConfig result = BuildTreeFromJson(json);

            return(result);
        }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmArcDir(AppDirs appDirs)
     : this()
 {
     this.appDirs   = appDirs ?? throw new ArgumentNullException(nameof(appDirs));
     configFileName = Path.Combine(appDirs.ConfigDir, ModuleConfig.DefaultFileName);
     moduleConfig   = new ModuleConfig();
 }
Пример #14
0
 // Token: 0x06001E03 RID: 7683 RVA: 0x000A32B0 File Offset: 0x000A16B0
 protected override void execute(CSteamID executorID, string parameter)
 {
     if (ModuleHook.modules.Count == 0)
     {
         CommandWindow.LogError(this.localization.format("NoModulesErrorText"));
         return;
     }
     CommandWindow.Log(this.localization.format("ModulesText"));
     CommandWindow.Log(this.localization.format("SeparatorText"));
     for (int i = 0; i < ModuleHook.modules.Count; i++)
     {
         Module module = ModuleHook.modules[i];
         if (module != null)
         {
             ModuleConfig config = module.config;
             if (config != null)
             {
                 Local local = Localization.tryRead(config.DirectoryPath, false);
                 CommandWindow.Log(local.format("Name"));
                 CommandWindow.Log(this.localization.format("Version", new object[]
                 {
                     config.Version
                 }));
                 CommandWindow.Log(local.format("Description"));
                 CommandWindow.Log(this.localization.format("SeparatorText"));
             }
         }
     }
 }
Пример #15
0
        static async Task <Tuple <ModuleClient, ModuleConfig> > InitModuleClient(TransportType transportType)
        {
            ITransportSettings[] GetTransportSettings()
            {
                switch (transportType)
                {
                case TransportType.Mqtt:
                case TransportType.Mqtt_Tcp_Only:
                case TransportType.Mqtt_WebSocket_Only:
                    return(new ITransportSettings[] { new MqttTransportSettings(transportType) });

                default:
                    return(new ITransportSettings[] { new AmqpTransportSettings(transportType) });
                }
            }

            ITransportSettings[] settings = GetTransportSettings();

            ModuleClient moduleClient = await ModuleClient.CreateFromEnvironmentAsync(settings).ConfigureAwait(false);

            await moduleClient.OpenAsync().ConfigureAwait(false);

            Console.WriteLine("TemperatureFilter - Opened module client connection");

            ModuleConfig moduleConfig = await GetConfiguration(moduleClient).ConfigureAwait(false);

            Console.WriteLine($"Using TemperatureThreshold value of {moduleConfig.TemperatureThreshold}");

            Console.WriteLine("Successfully initialized module client.");
            return(new Tuple <ModuleClient, ModuleConfig>(moduleClient, moduleConfig));
        }
Пример #16
0
        public override void UpdateSettings()
        {
            Config = new ModuleConfig(Settings, ModuleId, TabModuleId);

            Config.SharedKey = txtZendeskSharedKey.Text;
            Config.SubDomain = txtZendeskSubDomain.Text;
        }
Пример #17
0
        static async Task <int> MainAsync()
        {
            Logger.LogInformation("TemperatureFilter Main() started.");

            IConfiguration configuration = new ConfigurationBuilder()
                                           .SetBasePath(Directory.GetCurrentDirectory())
                                           .AddJsonFile("config/appsettings.json", optional: true)
                                           .AddEnvironmentVariables()
                                           .Build();

            TransportType transportType = configuration.GetValue("ClientTransportType", TransportType.Amqp_Tcp_Only);

            ModuleClient moduleClient = await ModuleUtil.CreateModuleClientAsync(
                transportType,
                ModuleUtil.DefaultTimeoutErrorDetectionStrategy,
                ModuleUtil.DefaultTransientRetryStrategy,
                Logger);

            (CancellationTokenSource cts, ManualResetEventSlim completed, Option <object> handler) = ShutdownHandler.Init(TimeSpan.FromSeconds(5), Logger);

            ModuleConfig moduleConfig = await GetConfigurationAsync(moduleClient);

            Logger.LogInformation($"Using TemperatureThreshold value of {moduleConfig.TemperatureThreshold}");

            var userContext = Tuple.Create(moduleClient, moduleConfig);
            await moduleClient.SetInputMessageHandlerAsync("input1", PrintAndFilterMessages, userContext);

            await cts.Token.WhenCanceled();

            completed.Set();
            handler.ForEach(h => GC.KeepAlive(h));
            Logger.LogInformation("TemperatureFilter Main() finished.");
            return(0);
        }
Пример #18
0
        public static void RunAssembly(string resname, string type, string[] args, IAgentInstance agent)
        {
            if (agent != null)
            {
                ModuleConfig modconfig = new ModuleConfig
                {
                    Assembly    = ReadResourceFile(resname),
                    Method      = "Execute",
                    Moduleclass = type,
                    Parameters  = args.ToArray <string>()
                };

                TaskMsg task = new TaskMsg
                {
                    TaskType   = "module",
                    Instanceid = RandomAString(10, new Random()),
                    ModuleTask = modconfig,
                    Agentid    = agent.AgentId
                };

                if (agent.Pivoter != null)
                {
                    task.AgentPivot = agent.Pivoter.AgentId;
                }
                agent.SendCommand(task);
            }
        }
Пример #19
0
        public override void LoadSettings()
        {
            Config = new ModuleConfig(Settings, ModuleId, TabModuleId);

            txtZendeskSharedKey.Text = Config.SharedKey;
            txtZendeskSubDomain.Text = Config.SubDomain;
        }
Пример #20
0
 public void Initialize(ModuleConfig moduleConfig, FormConfig formConfig, PageConfigView basePageView)
 {
     ModuleConfig = moduleConfig;
     FormConfig   = formConfig;
     BasePageView = basePageView;
     FormViews    = new List <FormConfigView>();
 }
Пример #21
0
        protected virtual Boolean LoadModules(ModuleConfig parent, int depth)
        {
            ModuleConfigCollection collection = parent.ModuleConfigCollection;
            Boolean result = false;

            if (collection != null)
            {
                IEnumerator moduleEnum = collection.GetEnumerator();
                if (moduleEnum != null)
                {
                    result = CreateInstances(moduleEnum, depth, parent);
                    if (depth == 0)
                    {
                        modules = collection;
                        result  = result && ConnectPropertyReferences();
                        result  = result && ConfigureInstances();
                        result  = result && ConnectReferences();
                        result  = result && FillAttributes();
                        result  = result && FillProperties();
                        result  = result && FillPipes();
                    }
                }
            }
            return(result);
        }
Пример #22
0
//		private void RestoreSettings()
//		{
//			Setting newSetting;
//
//			try
//			{
//				newSetting = ((Setting) WorkingContext.Setting.Restore());
//
//			}
//			catch (UserSettingsException ex)
//			{
//				// in case of failure, keep current WorkingContext.Settings
//				MessageBox.Show(ex.ToString());
//				newSetting = WorkingContext.Setting;
//
//			}
//
//			WorkingContext.Setting = newSetting;
//
//			UpdateDisplay();
//
//		}

        /// <summary>
        /// Hiển thị thông tin cấu hình
        /// </summary>
//		private void UpdateDisplay()
//		{
//			txtServer.Text = WorkingContext.Setting.Server;
//			txtDatabase.Text = WorkingContext.Setting.Database;
//			txtUserName.Text = WorkingContext.Setting.UserID;
//			txtPassWord.Text = WorkingContext.Setting.Password;
//
//			txtPicturePath.Text = WorkingContext.Setting.PicturePath;
//		}
        /// <summary>
        ///
        /// </summary>
        private void getSettings()
        {
            LoadServerCbo();
            settings            = ModuleConfig.GetSettings();
            txtDatabase.Text    = settings.Database;
            txtUserName.Text    = settings.UserName;
            txtPassWord.Text    = settings.Password;
            txtServer.Text      = settings.Server;
            txtPicturePath.Text = settings.PicturePath;
            txtReportPath.Text  = settings.ReportPath;
            switch (settings.Language)
            {
            case "en-US":
                rdoEnglish.Checked = true;
                break;

            case "vi-VN":
                rdoVietnamese.Checked = true;
                break;

            case "ja-JP":
                rdoJapanese.Checked = true;
                break;
            }
        }
Пример #23
0
        private Dictionary <int, CnlData> updatedCnlData; // holds recently updated channel data


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public PostgreHAL(IArchiveContext archiveContext, ArchiveConfig archiveConfig, int[] cnlNums,
                          ModuleConfig moduleConfig) : base(archiveContext, archiveConfig, cnlNums)
        {
            this.moduleConfig = moduleConfig ?? throw new ArgumentNullException(nameof(moduleConfig));
            archiveOptions    = new PostgreHAO(archiveConfig.CustomOptions);
            appLog            = archiveContext.Log;
            arcLog            = archiveOptions.LogEnabled ? CreateLog(ModuleUtils.ModuleCode) : null;
            stopwatch         = new Stopwatch();
            queryBuilder      = new QueryBuilder(Code);
            pointQueue        = new PointQueue(FixQueueSize(), queryBuilder.InsertHistoricalDataQuery)
            {
                ReturnOnError = true,
                ArchiveCode   = Code,
                AppLog        = appLog,
                ArcLog        = arcLog
            };
            writingPeriod = GetPeriodInSec(archiveOptions.WritingPeriod, archiveOptions.WritingUnit);

            hasError       = false;
            conn           = null;
            thread         = null;
            terminated     = false;
            nextWriteTime  = DateTime.MinValue;
            cnlIndexes     = null;
            prevCnlData    = null;
            updateTime     = DateTime.MinValue;
            updatedCnlData = null;
        }
Пример #24
0
    public IModule CreateModule(ModuleConfig config)
    {
        string nname = config.ModuleName;

        if (mModuleMap.ContainsKey(nname))
        {
            IModule m = mModuleMap[nname];
            //更换顺序
            mModuleList.Remove(m);
            mModuleList.Add(m);
            return(m);
        }
        else
        {
            if (!RegModuleList.ContainsKey(nname))
            {
                return(null);
            }
            Type type = RegModuleList[nname];
            //ModuleBase module = new NetModule();
            ModuleBase module = (ModuleBase)Activator.CreateInstance(type);
            if (module != null)
            {
                module.SetModuleName(mGameMain, nname);
                module.RegisterModuleEvent();
                //module.Setup ();
                mModuleMap[nname] = module;
                mModuleList.Add(module);
            }
            return(module);
        }
    }
Пример #25
0
        private void btnSaveSettings_Click(object sender, EventArgs e)
        {
            if (WorkingContext.CheckConnection(txtServer.Text, txtDatabase.Text, txtUserName.Text, txtPassWord.Text))
            {
                ModuleSettings newSettings = new ModuleSettings();
                newSettings.Database    = txtDatabase.Text.Trim();
                newSettings.Password    = txtPassWord.Text.Trim();
                newSettings.UserName    = txtUserName.Text.Trim();
                newSettings.Server      = txtServer.Text.Trim();
                newSettings.PicturePath = txtPicturePath.Text.Trim();
                newSettings.ReportPath  = txtReportPath.Text.Trim();
                if (rdoEnglish.Checked)
                {
                    newSettings.Language = "en-US";
                }
                else if (rdoVietnamese.Checked)
                {
                    newSettings.Language = "vi-VN";
                }
                else if (rdoJapanese.Checked)
                {
                    newSettings.Language = "ja-JP";
                }


//				WorkingContext.Setting.Server = txtServer.Text;
//				WorkingContext.Setting.Database = txtDatabase.Text;
//				WorkingContext.Setting.UserID = txtUserID.Text;
//				WorkingContext.Setting.Password = txtPassword.Text;
//
//				WorkingContext.Setting.PicturePath = txtPicturePath.Text;
                try
                {
//					WorkingContext.Setting.Save();
                    ModuleConfig.SaveSettings(newSettings);
                }

                catch
                {
                    string str1 = WorkingContext.LangManager.GetString("frmSetting_Error1");
                    string str3 = WorkingContext.LangManager.GetString("frmSetting_Error1_Title");
                    //MessageBox.Show("Không thể tạo file cấu hình hệ thống", "Lỗi", MessageBoxButtons.OK,  MessageBoxIcon.Error);
                    MessageBox.Show(str1, str3, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                string str  = WorkingContext.LangManager.GetString("frmSetting_ThongBao_Messa");
                string str2 = WorkingContext.LangManager.GetString("frmSetting_ThongBao_Title");
                MessageBox.Show(str, str2, MessageBoxButtons.OK, MessageBoxIcon.Information);
                WorkingContext.InitWorkingContext();
                this.Close();
            }
            else
            {
                string str4 = WorkingContext.LangManager.GetString("frmSetting_Error1_Title");
                string str5 = WorkingContext.LangManager.GetString("frmSetting_Error2");
                //MessageBox.Show("Không thể kết nối được cơ sở dữ liệu. Hãy nhập lại thông số cấu hình hệ thống", "Lỗi", MessageBoxButtons.OK,  MessageBoxIcon.Error);
                MessageBox.Show(str5, str4, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #26
0
        // started to make this async since there are async methods of deserializeobject
        // but found this thread which says not to use them as there is no benefit
        //https://github.com/JamesNK/Newtonsoft.Json/issues/66
        public ModuleConfig BuildTreeFromJson(string jsonString)
        {
            ModuleConfig moduleConfig =
                JsonConvert.DeserializeObject <ModuleConfig>(jsonString, new ModuleJsonConverter());


            return(moduleConfig);
        }
Пример #27
0
 /// <summary>
 /// Loads the test case configurations.
 /// </summary>
 /// <param name="module">The module.</param>
 private void LoadTestCaseConfigurations(ModuleConfig module)
 {
     chkIncludeNegativeTestCase.Checked   = module.IncludeNegativeTestCase;
     chkIncludeSecurityTestCase.Checked   = module.IncludeSecurityTestCase;
     chkIncludeEditModeValidation.Checked = module.IncludeEditModeValidation;
     chkIncludeViewModeValidation.Checked = module.IncludeViewModeValidation;
     chkIncludeDbValidation.Checked       = module.IncludeDBValidation;
 }
Пример #28
0
        public ModuleTcpChannel(ModuleConfig config, ILogger logger = null)
        {
            this.config            = config;
            this.logger            = logger;
            this.config.OnChanged += Config_OnChanged;

            slaveChannels = new Dictionary <byte, SlaveChannel>();
        }
Пример #29
0
        private void button2_Click(object sender, EventArgs e)
        {
            CSettings csetting = (CSettings)_currentSetup.Settings;

            csetting.PrintConfig = _currentSetupPanel.GetValues();

            ModuleConfig.SaveSettings(_currentSetup.Settings, _currentSetup.ConfigFilePath);
        }
Пример #30
0
 protected virtual Boolean LoadModule(ModuleConfig config)
 {
     if ((config != null) && config.IsInstance())
     {
         return(CreateInstance(config));
     }
     return(false);
 }
Пример #31
0
 internal static void Configure(MetricsDataProvider dataProvider, Func<HealthStatus> healthStatus, Action<INancyModule> moduleConfig, string metricsPath)
 {
     MetricsModule.Config = new ModuleConfig(dataProvider, healthStatus, moduleConfig, metricsPath);
 }
Пример #32
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private static void ValidateFeature(ModuleConfig module, FeatureConfig feature)
        {
            if ( string.IsNullOrWhiteSpace(feature.Name) && string.IsNullOrWhiteSpace(feature.LoaderClass) )
            {
                throw new NodeHostConfigException("At least one of Name or LoaderClass must be specified in Feature element.");
            }

            if ( string.IsNullOrWhiteSpace(feature.LoaderClass) )
            {
                feature.LoaderClass = string.Format("{0}.{1}FeatureLoader", Path.GetFileNameWithoutExtension(module.Assembly), feature.Name);
            }

            if ( string.IsNullOrWhiteSpace(feature.Name) )
            {
                feature.Name = feature.LoaderClass.TrimPrefix(Path.GetFileNameWithoutExtension(module.Assembly) + ".").TrimSuffix("FeatureLoader");
            }
        }
Пример #33
0
 public void Activate(HtzMgHelper helper, ModuleConfig config)
 {
     this._helper = helper;
     this._config = config;
     this._activated = true;
 }
Пример #34
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private static void ValidateModule(ModuleConfig module)
        {
            if ( string.IsNullOrEmpty(module.Assembly) )
            {
                throw new NodeHostConfigException("Each module must have Assembly specified.");
            }

            if ( string.IsNullOrEmpty(module.Name) )
            {
                module.Name = Path.GetFileNameWithoutExtension(module.Assembly);
            }

            if ( string.IsNullOrEmpty(module.LoaderClass) )
            {
                module.LoaderClass = string.Format("{0}.ModuleLoader", Path.GetFileNameWithoutExtension(module.Assembly));
            }

            if ( module.Features == null )
            {
                module.Features = new List<FeatureConfig>();
            }
            else
            {
                module.Features.ForEach(feature => ValidateFeature(module, feature));
            }
        }
Пример #35
0
 public static void Configure(MetricsRegistry registry, Func<HealthStatus> healthStatus, Action<INancyModule> moduleConfig, string metricsPath)
 {
     MetricsModule.Config = new ModuleConfig(registry, healthStatus, moduleConfig, metricsPath);
 }