예제 #1
0
        public void DeserializeSettings(string serialization, CombinatorResource resource)
        {
            if (String.IsNullOrEmpty(serialization)) return;

            var settings = _serializer.XmlDeserialize<SerializableSettings>(serialization);

            if (settings.Url != null)
            {
                var resourceManifest = new ResourceManifest();
                resource.RequiredContext.Resource = resourceManifest.DefineResource(resource.Type.ToStringType(), settings.Url.ToString());
                resource.RequiredContext.Resource.SetUrlWithoutScheme(settings.Url);
                resource.IsOriginal = true;
            }

            if (resource.RequiredContext.Settings == null) resource.RequiredContext.Settings = new RequireSettings();
            var resourceSettings = resource.RequiredContext.Settings;
            resourceSettings.Culture = settings.Culture;
            resourceSettings.Condition = settings.Condition;
            resourceSettings.Attributes = settings.Attributes;
        }
예제 #2
0
 public void FillRequiredContext(string name, string url, string culture = "", string condition = "", Dictionary<string, string> attributes = null)
 {
     var requiredContext = new ResourceRequiredContext();
     var resourceManifest = new ResourceManifest();
     requiredContext.Resource = resourceManifest.DefineResource(Type.ToStringType(), name);
     requiredContext.Resource.SetUrl(url);
     requiredContext.Settings = new RequireSettings();
     requiredContext.Settings.Culture = culture;
     requiredContext.Settings.Condition = condition;
     requiredContext.Settings.Attributes = attributes != null ? new Dictionary<string, string>(attributes) : new Dictionary<string, string>();
     RequiredContext = requiredContext;
 }
예제 #3
0
        public void FillRequiredContext(string name, string url, string culture = "", string condition = "", Dictionary<string, string> attributes = null, IDictionary<string, string> tagAttributes = null)
        {
            var requiredContext = new ResourceRequiredContext();
            var resourceManifest = new ResourceManifest();
            requiredContext.Resource = resourceManifest.DefineResource(Type.ToStringType(), name);
            if (!string.IsNullOrEmpty(url)) requiredContext.Resource.SetUrl(url);
            requiredContext.Settings = new RequireSettings
            {
                Name = name,
                Culture = culture,
                Condition = condition,
                Attributes = attributes != null ? new Dictionary<string, string>(attributes) : new Dictionary<string, string>()
            };
            RequiredContext = requiredContext;

            if (tagAttributes != null) requiredContext.Resource.TagBuilder.MergeAttributes(tagAttributes);
        }