Exemplo n.º 1
0
 public Main(string propertiesFilePath)
 {
     using (TextReader reader = File.OpenText(propertiesFilePath))
     {
         _Properties = PropertiesLoader.Load(reader);
     }
 }
Exemplo n.º 2
0
        protected override void Load(object obj, HtmlNode objNode)
        {
            var ac = obj as RawCode;

            ac.Code = objNode.InnerHtml;
            PropertiesLoader.Load(obj, objNode);
        }
Exemplo n.º 3
0
 public static void ReadCoreNlpProps(this JObject properties, string path)
 {
     using (var sr = new StreamReader(path))
     {
         var dictProp = PropertiesLoader.Load(sr);
         foreach (var prop in dictProp)
         {
             properties.Add(prop.Key, prop.Value);
         }
     }
 }
 public static IDictionary <string, string> LoadProperty(string propertiesURL)
 {
     try {
         IDictionary <string, string> prop = null;
         using (TextReader reader = new StreamReader(propertiesURL))
         {
             prop = PropertiesLoader.Load(reader);
         }
         return(prop);
     } catch (Exception e) {
         Console.WriteLine(e.ToString());
         return(null);
     }
 }
Exemplo n.º 5
0
        public ProjectPropertiesWindow()
        {
            DataContext = new AsyncLoadViewModel(Designer.Resources.ProjectPropertiesAsyncLoadMessage);

            InitializeComponent();

            Dispatcher.BeginInvoke(new Func <Task>(
                                       async() =>
            {
                // Simulate delayed load
                await Task.Delay(1000);

                DataContext = new ProjectPropertiesViewModel(PropertiesLoader.CreateDefaultContext());
            }));
        }
Exemplo n.º 6
0
        public static void Main(string[] args)
        {
            string file = "test.properties";
            IDictionary <string, string> properties;

            using (TextReader reader = new StreamReader(file))
            {
                properties = PropertiesLoader.Load(reader);
            }

            foreach (var entry in properties)
            {
                Console.WriteLine($"{entry.Key} = {entry.Value}");
            }
        }
Exemplo n.º 7
0
        public LaunchProfilesWindow()
        {
            DataContext = new AsyncLoadViewModel(Designer.Resources.LaunchProfilesWindowAsyncLoadMessage);

            InitializeComponent();

            Dispatcher.BeginInvoke(new Func <Task>(
                                       async() =>
            {
                // Simulate delayed load
                await Task.Delay(1000);

                DataContext = PropertiesLoader.CreateLaunchProfiles();
            }));
        }
Exemplo n.º 8
0
        protected override void Load(object obj, HtmlNode objNode)
        {
            var ctx   = LoadContext.Current;
            var style = ctx.Parent as XamlStyle;

            if (style == null)
            {
                throw new XamlException("Setter的父对象必须为XamlStyle");
            }
            var targetType = style.TargetType;

            if (targetType == null)
            {
                throw new XamlException("请指定正确的Style.TargetType属性");
            }

            var propertyName = objNode.GetAttributeValue("Property", string.Empty);

            if (string.IsNullOrEmpty(propertyName))
            {
                throw new XamlException("请指定正确的Setter.Property属性");
            }

            var setter = obj as Setter;

            setter.Property = DependencyProperty.GetProperty(targetType, propertyName);

            string value = objNode.GetAttributeValue("Value", string.Empty);

            if (!string.IsNullOrEmpty(value))
            {
                //简单值
                var propertyInfo = targetType.ResolveProperty(propertyName);
                PropertiesLoader.SetValue(setter, Setter.ValueProperty, propertyInfo, value);
            }
            else
            {
                var valueNode = objNode.SelectSingleNodeEx("Setter.Value");
                if (valueNode != null)
                {
                    setter.Value = XamlReader.ReadComponent(valueNode.InnerHtml);
                }
            }
        }
        private String CreateConnectionString()
        {
            IDictionary <string, string> prop = null;

            using (TextReader reader = new StreamReader(DB_PROPERTIES))
            {
                prop = PropertiesLoader.Load(reader);
            }
            //Properties prop = PropertiesUtil.loadProperty(DB_PROPERTIES);
            String host     = prop[DB_HOST_PROP];
            String port     = prop[DB_PORT_PROP];
            String db       = prop[DB_NAME_PROP];
            String user     = prop[DB_USER_PROP];
            String password = prop[DB_PASSWORD_PROP];

            string connectionString = "SERVER=" + host + ";" + "DATABASE=" + db + ";" + "UID=" + user + ";" + "PASSWORD="******";";

            Console.WriteLine("ConnectionString ==> " + connectionString);
            return(connectionString);
        }
Exemplo n.º 10
0
        internal Impl(CommandLineOptions options)
        {
            _timeStarted = DateTime.Now;

            _options = options;

            _shadowCopyDirectory = new DirectoryInfo(Path.Combine(_options.SharedWithDockerDirectory.FullName,
                                                                  Consts.ShadowCopyDirectoryName));

            _testResultsDirectory = new DirectoryInfo(Path.Combine(_options.SharedWithDockerDirectory.FullName,
                                                                   Consts.TestResults.DirectoryName));

            _currentTestIterationDirectory = new DirectoryInfo(Path.Combine(_testResultsDirectory.FullName,
                                                                            Consts.TestResults.CurrentIterationDirectoryName));

            if (_options.EnvVarsFile != null)
            {
                using (var streamReader = new StreamReader(_options.EnvVarsFile.FullName))
                    _envVarsForDocker = PropertiesLoader.Load(streamReader);
            }
        }
Exemplo n.º 11
0
        public string CreateConnectionString()
        {
            IDictionary <string, string> prop = null;

            using (TextReader reader = new StreamReader(DB_PROPERTIES))
            {
                prop = PropertiesLoader.Load(reader);
            }

            string host     = prop[DB_HOST_PROP];
            string port     = prop[DB_PORT_PROP];
            string service  = prop[DB_SERVICE_PROP];
            string user     = prop[DB_USER_PROP];
            string password = prop[DB_PASSWORD_PROP];

            // string connectionString = "jdbc:oracle:thin:"+user+"/"+password+"@//"+host+":"+port+"/"+service;

            string connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + host + ")(PORT=" + port + ")))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" + service + ")));User Id=" + user + ";Password="******";Enlist=false;Pooling=true";

            Console.WriteLine("ConnectionString ==> " + connectionString);
            return(connectionString);
        }
Exemplo n.º 12
0
        private Boolean saveProperties()
        {
            string penWidth       = this.tb_pen_width.Text;
            string rectWidth      = this.tb_rect_width.Text;
            string rectHeight     = this.tb_rect_height.Text;
            string maxRevertSteps = this.tb_max_revert_steps.Text;

            if (string.IsNullOrEmpty(penWidth) ||
                string.IsNullOrEmpty(rectWidth) ||
                string.IsNullOrEmpty(rectHeight) ||
                string.IsNullOrEmpty(maxRevertSteps))
            {
                showSaveError("All fields are required");
                return(false);
            }

            try
            {
                propSerivice.penWidth    = Convert.ToSingle(penWidth);
                propSerivice.maxHistorie = Convert.ToInt32(maxRevertSteps);

                propSerivice.rectangleSize = new Size(Convert.ToInt32(rectHeight), Convert.ToInt32(rectWidth));
            } catch (Exception e)
            {
                showSaveError("One of the properties are in the wrong format");
                return(false);
            }

            try
            {
                PropertiesLoader.saveProperties();
            } catch (Exception e)
            {
                MessageBox.Show("Unable to save properties", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(true);
        }
Exemplo n.º 13
0
 private void propertiesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     PropertiesLoader.ShowFileProperties(gamefolder + @"\" + currHier + listView1.SelectedItems[0].Text);
 }