UnityEditor.WebTemplateManagerBase.Load C# (CSharp) Method

Load() private method

private Load ( string path ) : WebTemplate
path string
return WebTemplate
        private WebTemplate Load(string path)
        {
            if (!Directory.Exists(path) || (Directory.GetFiles(path, "index.*").Length < 1))
            {
                return null;
            }
            char[] separator = new char[] { '/', '\\' };
            string[] strArray = path.Split(separator);
            WebTemplate template2 = new WebTemplate {
                m_Name = strArray[strArray.Length - 1]
            };
            if ((strArray.Length > 3) && strArray[strArray.Length - 3].Equals("Assets"))
            {
                template2.m_Path = "PROJECT:" + template2.m_Name;
            }
            else
            {
                template2.m_Path = "APPLICATION:" + template2.m_Name;
            }
            string[] files = Directory.GetFiles(path, "thumbnail.*");
            if (files.Length > 0)
            {
                template2.m_Thumbnail = new Texture2D(2, 2);
                template2.m_Thumbnail.LoadImage(File.ReadAllBytes(files[0]));
            }
            List<string> list = new List<string>();
            MatchCollection matchs = new Regex(@"\%UNITY_CUSTOM_([A-Z_]+)\%").Matches(File.ReadAllText(Directory.GetFiles(path, "index.*")[0]));
            IEnumerator enumerator = matchs.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Match current = (Match) enumerator.Current;
                    string item = current.Value.Substring("%UNITY_CUSTOM_".Length);
                    item = item.Substring(0, item.Length - 1);
                    if (!list.Contains(item))
                    {
                        list.Add(item);
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            template2.m_CustomKeys = list.ToArray();
            return template2;
        }