Exemple #1
0
        public static Dictionary <string, SepDependInfo> ParseFile(string filePath)
        {
            Dictionary <string, SepDependInfo> ret = new Dictionary <string, SepDependInfo>();

            try
            {
                using (var stream = File.OpenRead(filePath))
                {
                    using (StreamReader sr = new StreamReader(stream, Encoding.UTF8))
                    {
                        while (sr.Peek() > -1)
                        {
                            string line = sr.ReadLine();
                            if (line.Length == 0)
                            {
                                continue;
                            }
                            SepDependInfo info = SepDependInfo.ParseString(line);
                            if (null != info)
                            {
                                ret.Add(info.name, info);
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Debug.Log(ex.Message);
            }
            return(ret);
        }
Exemple #2
0
 public void MergeSepDepend(SepDependInfo info)
 {
     foreach (string dep in info.depends)
     {
         if (!dependBundles.Contains(dep))
         {
             dependBundles.Add(dep);
         }
     }
 }
Exemple #3
0
        public static SepDependInfo ParseString(string infoStr)
        {
            if (string.IsNullOrEmpty(infoStr))
            {
                return(null);
            }
            string[] parts = infoStr.Split(new char[] { ':' });
            if (parts.Length < 2)
            {
                return(null);
            }
            SepDependInfo info = new SepDependInfo();

            info.name = parts[0];
            if (!string.IsNullOrEmpty(parts[1]))
            {
                string[] deps = parts[1].Split(new char[] { ',' });
                foreach (string dep in deps)
                {
                    info.depends.Add(dep);
                }
            }
            return(info);
        }