Пример #1
0
        private void UpdateIniKeyValue(IMethodInvocation input)
        {
            var p = BindStrategy.GetCalledProperty(input);

            if (p == null)  //如果调用了set_开头_ini结尾的函数,返回的p会是null
            {
                return;
            }
            string section = bindStrategy.GetSection(input, p);
            string key     = bindStrategy.GetKey(input, p);

            config.WriteIniData(section, key, input.Arguments[0].ToString());
        }
Пример #2
0
        private void CreateIniFile(IMethodInvocation input)
        {
            var property = BindStrategy.GetCalledProperty(input);
            var fullName = bindStrategy.GetFilePath(input, property);
            var stream   = File.CreateText(fullName);

            stream.Close();

            config = new IniFileOperator(fullName);

            shouldProcess = false;
            foreach (var p in bindStrategy.GetIniProperties(input))
            {
                var value    = p.GetValue(input.Target);
                var valueStr = value != null?value.ToString() : "";

                string section = bindStrategy.GetSection(input, p);
                string key     = bindStrategy.GetKey(input, p);
                config.WriteIniData(section, key, valueStr);
            }
            shouldProcess = true;
        }
Пример #3
0
 public BindIniBehavior(BindStrategy bindStrategy)
 {
     this.bindStrategy = bindStrategy;
 }