コード例 #1
0
ファイル: ConfigBase.cs プロジェクト: tkhs-dev/Tetris
        public bool Load()
        {
            var value = SerializableBase.Load(GetType(), Directory, Name + ".xml") as ConfigBase;

            SetValue(value ?? GetDefault());
            return(value != null);
        }
コード例 #2
0
        protected void SetValue(SerializableBase value)
        {
            var type = value.GetType();

            foreach (var prop in type.GetProperties().Where(x => !x.CustomAttributes.Any(x => x.AttributeType == typeof(XmlIgnoreAttribute))))
            {
                this.GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(value));
            }
        }