예제 #1
0
        private void InitializeSettings(XElement xe)
        {
            Name = xe.Attr <string>(SchemaConstants.Set.Name);

            var duration = ModelUtils.GetString(xe, SchemaConstants.Set.Duration, Settings.DefaultDuration == null
                                                                                ? null
                                                                                : Settings.DefaultDuration.ToString());

            DurationInDays = TimeSpan.FromDays(int.Parse(duration, CultureInfo.InvariantCulture));

            Type = xe.Attr <ResourceType>(SchemaConstants.Set.Type);

            var debugEnabled = xe.Attr <string>(SchemaConstants.Set.DebugEnabled);

            DebugEnabled = string.IsNullOrEmpty(debugEnabled)
                               ? Settings.DefaultDebugEnabled                 // use parent if not specified
                               : debugEnabled.Equals(SchemaConstants.Set.Auto, StringComparison.OrdinalIgnoreCase)
                                     ? HttpContext.Current.IsDebuggingEnabled // use web.config if autor
                                     : bool.Parse(debugEnabled);

            IgnorePipelineWhenDebug = (bool)xe.Attr <string>(SchemaConstants.Set.IgnorePipelineWhenDebug)
                                      .ConvertToType(typeof(bool), Settings.DefaultIgnorePipelineWhenDebug);

            CompressionEnabled = (bool)xe.Attr <string>(SchemaConstants.Set.CompressionEnabled)
                                 .ConvertToType(typeof(bool), Settings.DefaultCompressionEnabled);
        }
예제 #2
0
        private void InitializeVersion(XElement xe, Settings parent)
        {
            Version = ModelUtils.GetString(xe, SchemaConstants.Set.Version, parent.DefaultVersion);

            var generatorType = xe.Attr <string>(SchemaConstants.Set.VersionGenerator);

            if (string.IsNullOrEmpty(generatorType))
            {
                VersionGeneratorType = parent.DefaultVersionGeneratorType;
            }
            else
            {
                VersionGeneratorType = ModelUtils.LoadType("Generator",
                                                           generatorType,
                                                           SchemaConstants.VersionGenerator.ValidTypes);
            }

            if (IsAutoVersion)
            {
                Hash = ComputeHash();
            }
        }