예제 #1
0
        private void SetValue(ValueSource vSrc, INIFile f, int count, string s, string v)
        {
            switch (vSrc)
            {
            default:
            case ValueSource.VALUE_OR_KEY:
            case ValueSource.KEY_ONLY:
                f.SetEmptyKey(s, v);
                break;

            case ValueSource.VALUE_ONLY:
                f.SetString(s, count.ToString(), v);
                break;
            }
        }
예제 #2
0
        private void InnerWrite <T>(INIFile f, T value, string fieldName, string defaultSection)
        {
            if (typeof(T).IsClass && value == null)
            {
                return;
            }

            string s = INIAttributeExt.GetSection(Section, defaultSection);
            string k = INIAttributeExt.GetKey(Key, fieldName);
            string v = Parser.Write(value);

            if (!v.Equals(NoWriteValue))
            {
                f.SetString(s, k, v);
            }
        }
예제 #3
0
        private void InnerWrite <T, U>(INIFile f, Registry <T, U> reg, string defaultSection)
        {
            if (reg == default)
            {
                return;
            }

            string s = INIAttributeExt.GetSection(Section, defaultSection);

            foreach (T t in reg.GetKeys())
            {
                string key   = Parser.Write(t);
                string value = Parser.Write(reg.Get(t));
                if (value != (string)NoWriteValue)
                {
                    f.SetString(s, key, value);
                }
            }
        }