Ejemplo n.º 1
0
        /// <summary>
        /// 複製
        /// </summary>
        public GiteaPagesConfiguration Clone()
        {
            var props = typeof(GiteaPagesConfiguration).GetProperties();

            var instance = new GiteaPagesConfiguration();

            foreach (var prop in props)
            {
                var value = prop.GetValue(this);
                prop.SetValue(instance, value);
            }

            return(instance);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 合併設定
        /// </summary>
        /// <param name="config">GiteaPages設定實例,用以覆蓋目前設定</param>
        /// <returns>合併後的設定</returns>
        public GiteaPagesConfiguration Merge(GiteaPagesConfiguration config)
        {
            var instance = Clone();
            var props    = typeof(GiteaPagesConfiguration).GetProperties();

            foreach (var prop in props)
            {
                var value = prop.GetValue(config);
                if (value == null)
                {
                    continue;
                }

                prop.SetValue(instance, value);
            }

            return(instance);
        }