Esempio n. 1
0
 internal static ScriptCollection FindScripts(string folder)
 {
     if (Collections.ContainsKey(folder))
     {
         return Collections[folder];
     }
     else
     {
         var collection = new ScriptCollection(folder);
         Collections.Add(folder, collection);
         return collection;
     }
 }
Esempio n. 2
0
 internal static ScriptCollection FindScripts(string folder)
 {
     if (Collections.ContainsKey(folder))
     {
         return(Collections[folder]);
     }
     else
     {
         var collection = new ScriptCollection(folder);
         Collections.Add(folder, collection);
         return(collection);
     }
 }
Esempio n. 3
0
        internal void ScanReferences(ScriptCollection scripts)
        {
            using (StreamReader reader = File.OpenText(this.FullName))
            {
                while (true)
                {
                    if (reader == null)
                    {
                        break;
                    }

                    var reference = reader.ReadLine();

                    if (reference == null)
                    {
                        break;
                    }

                    if (string.IsNullOrWhiteSpace(reference))//blank line
                    {
                        continue;
                    }

                    // ///<reference path="../jquery.validate.js" />
                    if (reference.StartsWith("///") && reference.IndexOf("<reference path=") > -1)
                    {
                        var path = reference.Split('\"')[1];

                        var segments = path.Split('/');

                        var fileName = segments[segments.Length - 1].ToLowerInvariant();

                        if (scripts.ContainsKey(fileName))
                        {
                            var script = scripts.Get(fileName);
                            this.References.Add(script);
                        }

                        continue;
                    }

                    break;
                }
            }
        }
Esempio n. 4
0
        internal void ScanReferences(ScriptCollection scripts)
        {
            using (StreamReader reader = File.OpenText(this.FullName))
            {
                while (true)
                {
                    if (reader == null)
                    {
                        break;
                    }

                    var reference = reader.ReadLine();

                    if (reference == null)
                    {
                        break;
                    }

                    if (string.IsNullOrWhiteSpace(reference))//blank line
                    {
                        continue;
                    }

                    // ///<reference path="../jquery.validate.js" />
                    if (reference.StartsWith("///") && reference.IndexOf("<reference path=") > -1)
                    {
                        var path = reference.Split('\"')[1];

                        var segments = path.Split('/');

                        var fileName = segments[segments.Length - 1].ToLowerInvariant();

                        if (scripts.ContainsKey(fileName))
                        {
                            var script = scripts.Get(fileName);
                            this.References.Add(script);
                        }

                        continue;
                    }

                    break;
                }
            }
        }
Esempio n. 5
0
        void RegisterThis(string folder)
        {
            this._IsRegistered = true;

            this.Loaded = new List<ScriptObject>();

            var fullName = HttpContext.Current.Server.MapPath(folder);

            this.Scripts = ScriptCollectionPool.FindScripts(fullName);
        }