Esempio n. 1
0
    public static void SetValue(Form form)
    {
        Control ctrl = null;

        while ((ctrl = form.GetNextControl(ctrl, true)) != null)
        {
            SettingLoader.SetValue(ctrl);
        }
    }
Esempio n. 2
0
        private static async Task Main(string[] args)
        {
            Settings = SettingLoader.Load <SettingModel>();

            // TODO: プラットフォーム依存 (しかし Windows 以外がわからん)
            SessionManager = new SessionManager();

            Connect();

            await ConsoleHost.WaitAsync();
        }
Esempio n. 3
0
        public void ShouldDumpVideo()
        {
            var logMock  = new Mock <ILogger>();
            var settings = SettingLoader.Load();
            var sut      = new VideoDumper(logMock.Object, settings, settings.Cameras[0], TestresultDir, "4");

            sut.AlarmActivated();
            var finfo = new DirectoryInfo(TestresultDir);
            var file  = finfo.GetFiles("*").First();

            file.Length.Should().BeGreaterThan(0);
        }
Esempio n. 4
0
    /// <summary>
    /// UIサイズセット
    /// </summary>
    private void PcUiSizeSet()
    {
        // PC向けビルドだったらサイズ変更
        if (Application.platform == RuntimePlatform.WindowsPlayer ||
            Application.platform == RuntimePlatform.OSXPlayer ||
            Application.platform == RuntimePlatform.LinuxPlayer)
        {
            //設定のロード
            LiplisMoonlightSetting setting = SettingLoader.LoadSetting();

            Vector2 size = setting.GetSize();

            Screen.SetResolution((int)size.x, (int)size.y, false);
            //Screen.SetResolution(1080, 1920, false);
        }
    }
Esempio n. 5
0
    // construct encoding from registry.
    public static Encoding GetTextEncoding()
    {
        Encoding code;

        if (SettingLoader.GetValue("Use windows default code page", true) == true)
        {
            code = Encoding.Default;
        }
        else
        {
            string strCodePage = SettingLoader.GetValue("Settings code page");
            Regex  reg         = new Regex(@"\([0-9]*\)");
            strCodePage = reg.Match(strCodePage).Value;
            code        = Encoding.GetEncoding(int.Parse(strCodePage.Trim('(', ')')));
        }
        return(code);
    }
Esempio n. 6
0
        private static async Task Main(string[] args)
        {
            // キャッシュ
            WeatherModel.CacheWeatherIcons(General.WeatherIconsPath);
            // 設定読み込み
            Settings = SettingLoader.Load <SettingModel>();

            if (string.IsNullOrWhiteSpace(Settings?.OpenWeatherMap.ApiKey))
            {
                Log.WriteLogLine("OpenWeatherMap へ接続するための API Key が見つかりません", Log.LogType.Error);
                await ConsoleHost.WaitAsync();

                return;
            }

            SetTimer();

            Connect();

            await ConsoleHost.WaitAsync();

            Disconnect();
        }
		public void ShouldLoadSettingsFromConfigFileCorrectly()
		{
			const string settingInString = @"
<healthMonitoring>	
	<client	name=""local.api"" enable=""true"">		
		<ping endpoint=""http://v1.api.egi.local.rbidev.ds/a/entry/for/reporting/status"" 
			  interval=""5000""
			  timeout=""5000"">				
		</ping>
		
		<Checker type=""Rbi.Property.HealthMonitoring.BasicHttpStatsChecker, Rbi.Property.HealthMonitoring"" />
		
		<outputs>		
			<file format=""json""
				  path=""c:\local.api.log"" 
				  maximumFileSize=""10MB"" 
				  when=""all"" /> 			
			<database 
				 connectionString="""" 
				 when=""all""/>				
			<email from=""no-reply@healthmonitoring""
				   to=""[email protected],[email protected]""
				   when=""timeout,failure""/>			
			<console when=""all""/>
		</outputs>		
	</client>	
</healthMonitoring>";

			XElement setting = XElement.Parse(settingInString);

			SettingLoader loader = new SettingLoader(null);

			HealthMonitoringSetting hmSetting = loader.Parse("");

			Assert.AreEqual(1, hmSetting.Clients.Length);
		}
Esempio n. 8
0
        public static void RegisterSettings(this TinyIoCContainer current)
        {
            var settings = SettingLoader.Load();

            current.Register(settings);
        }
Esempio n. 9
0
    public static void SetValue(Control ctrl)
    {
        string Name = ctrl.FindForm().Name + '-' + ctrl.Name;

        if (ctrl.Tag != null && ctrl.Tag.ToString().Trim().Length > 0)
        {
            switch (ctrl.GetType().Name)
            {
            case "TextBox":
                SettingLoader.SetValue((string)ctrl.Tag, ctrl.Text);
                break;

            case "CheckBox":
                CheckBox check = (CheckBox)ctrl;
                SettingLoader.SetValue((string)ctrl.Tag, check.Checked);
                break;

            case "RadioButton":
                RadioButton radio = (RadioButton)ctrl;
                SettingLoader.SetValue((string)ctrl.Tag, radio.Checked);
                break;

            case "NumericUpDown":
                NumericUpDown numeric = (NumericUpDown)ctrl;
                SettingLoader.SetValue((string)ctrl.Tag, numeric.Value.ToString());
                break;

            case "TabControl":
                TabControl tab = (TabControl)ctrl;
                SettingLoader.SetValue((string)ctrl.Tag, tab.SelectedIndex.ToString());
                break;

            case "ComboBox":
                ComboBox combo = (ComboBox)ctrl;
                try
                {
                    string      fileName = null;
                    XmlDocument doc      = null;
                    XmlNode     element  = GetCtrlNode(ctrl, ref fileName, ref doc);
                    element.RemoveAll();
                    foreach (string item in combo.Items)
                    {
                        XmlNode node = doc.CreateNode(XmlNodeType.Element, "Item", "");
                        node.InnerText = item;
                        element.AppendChild(node);
                    }
                    doc.Save(fileName);
                }
                catch (XmlException)
                {
                }
                SettingLoader.SetValue(Name, combo.Text);
                break;

            case "ListView":
                ListView list = (ListView)ctrl;
                try
                {
                    string      fileName = null;
                    XmlDocument doc      = null;
                    XmlNode     element  = GetCtrlNode(ctrl, ref fileName, ref doc);
                    element.RemoveAll();
                    foreach (ListViewItem viewItem in list.Items)
                    {
                        XmlNode node = doc.CreateNode(XmlNodeType.Element, "Item", "");
                        if (list.CheckBoxes == true)
                        {
                            XmlAttribute attribute = doc.CreateAttribute("Checked");
                            attribute.Value = viewItem.Checked.ToString();
                            node.Attributes.Append(attribute);
                        }
                        string InnerText = "";
                        foreach (ListViewItem.ListViewSubItem subItem in viewItem.SubItems)
                        {
                            InnerText += subItem.Text + '\t';
                        }
                        node.InnerText = InnerText.TrimEnd('\t');
                        element.AppendChild(node);
                    }
                    doc.Save(fileName);
                }
                catch (XmlException)
                {
                }
                break;
            }
        }
    }
Esempio n. 10
0
 public void GetDictionary(SettingLoader loader)
 {
 }