Ejemplo n.º 1
0
        protected WFResource(string url = null, string category = null, string fileName = null,
                             WebHeaderCollection header = null, WFResourceLoader <T> resourceLoader = null,
                             WFResourceRequester wfResourceRequester = null)
        {
            resourceLoader = resourceLoader ?? ResourceLoaders <T> .JsonDotNetLoader;
            // 这写的太屎了
            fileName = fileName ?? (url ?? string.Empty).Split('/').Last().Split('?').First().Split("!").First();

            this.resourceLoader = resourceLoader;
            this.url            = url;
            FileName            = fileName;
            this.header         = header;
            Category            = category;
            requester           = wfResourceRequester ?? RequestResourceFromTheWideWorldOfWeb;
            if (category != null && !WFResourceStatic.CategoryVersionDictionary.ContainsKey(category))
            {
                WFResourceStatic.CategoryVersionDictionary[category] = 0;
            }
            Version = 0;
        }
Ejemplo n.º 2
0
        public static WFResource <T> Create(string url = null, string category = null, string fileName = null, WebHeaderCollection header = null, WFResourceLoader <T> resourceLoader = null, WFResourceRequester requester = null)
        {
            var result = new WFResource <T>(url, category, fileName, header, resourceLoader, requester);

            result.initTask = result.Reload(true);
            return(result);
        }