예제 #1
0
        private void ApplyTransformModel(TransformModel transformModel)
        {
            if (transformModel == null) { throw new ArgumentNullException("transformModel"); }

            this.Model = transformModel;
            this.TextAppSettings.Text = this.BuildStringFrom(this.Model.AppSettings);
            this.TextConnectionStrings.Text = this.BuildStringFrom(this.Model.ConnectionStrings);
            this.TextConfigContents.Text = this.Model.ConfigContents;
            this.InvalidateVisual();
        }
예제 #2
0
        private void ApplyTransformModel(TransformModel transformModel)
        {
            if (transformModel == null)
            {
                throw new ArgumentNullException("transformModel");
            }

            this.Model = transformModel;
            this.TextAppSettings.Text       = this.BuildStringFrom(this.Model.AppSettings);
            this.TextConnectionStrings.Text = this.BuildStringFrom(this.Model.ConnectionStrings);
            this.TextConfigContents.Text    = this.Model.ConfigContents;
            this.InvalidateVisual();
        }
예제 #3
0
        public static TransformModel BuildFromCurrent()
        {
            TransformModel tm = new TransformModel();
            foreach (string key in ConfigurationManager.AppSettings.AllKeys) {
                tm.AppSettings.Add(key, ConfigurationManager.AppSettings[key]);
            }

            foreach (ConnectionStringSettings cn in ConfigurationManager.ConnectionStrings) {
                tm.ConnectionStrings.Add(cn.Name, cn.ConnectionString);
            }

            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            tm.ConfigContents = File.ReadAllText(config.FilePath);

            return tm;
        }
예제 #4
0
        public static TransformModel BuildFromCurrent()
        {
            TransformModel tm = new TransformModel();

            foreach (string key in ConfigurationManager.AppSettings.AllKeys)
            {
                tm.AppSettings.Add(key, ConfigurationManager.AppSettings[key]);
            }

            foreach (ConnectionStringSettings cn in ConfigurationManager.ConnectionStrings)
            {
                tm.ConnectionStrings.Add(cn.Name, cn.ConnectionString);
            }

            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            tm.ConfigContents = File.ReadAllText(config.FilePath);

            return(tm);
        }
예제 #5
0
 private void WindowOnLoad(object sender, RoutedEventArgs e)
 {
     this.ApplyTransformModel(TransformModel.BuildFromCurrent());
 }