示例#1
0
        public static IEnumerable <PboEntry> EnumerateEntries(Stream s)
        {
            var reader  = new BinaryReader(s, System.Text.Encoding.ASCII, true);
            var entries = new List <PboEntry>();

            while (true)
            {
                var pboEntry = new PboEntry();
                pboEntry.ReadHeader(reader);
                if (pboEntry.Path.Length == 0)
                {
                    if (entries.Count != 0)
                    {
                        break;
                    }
                    while (reader.ReadStringZ().Length != 0)
                    {
                    }
                }
                else
                {
                    entries.Add(pboEntry);
                }
            }
            foreach (var current in entries)
            {
                current.ReadBodySeq(reader);
                yield return(current);
            }
        }
示例#2
0
 private void ReadDirectoryStructure(DirectoryInfo d, string path)
 {
     foreach (var f in d.EnumerateFiles())
     {
         if (f.Name == "$PBOPREFIX$.txt" || f.Name == "$PBOPREFIX$")
         {
             continue;
         }
         else
         {
             var e = new PboEntry();
             e.FromFile(f, path);
             entries.Add(e);
         }
     }
     foreach (var sd in d.EnumerateDirectories())
     {
         ReadDirectoryStructure(sd, path + sd.Name + "\\");
     }
 }
示例#3
0
        internal static int PathSorter(PboEntry e1, PboEntry e2)
        {
            string text  = e1.Path;
            string text2 = e2.Path;

            text  = text.ToUpperInvariant();
            text2 = text2.ToUpperInvariant();
            int num = Math.Min(text.Length, text2.Length);
            int i   = 0;

            while (i < num)
            {
                char c  = text[i];
                char c2 = text2[i];
                if (c != c2)
                {
                    if (c == '_')
                    {
                        return(1);
                    }
                    if (c2 == '_')
                    {
                        return(-1);
                    }
                    return((int)(c - c2));
                }
                else
                {
                    i++;
                }
            }
            if (text.Length < text2.Length)
            {
                return(-1);
            }
            if (text.Length > text2.Length)
            {
                return(1);
            }
            return(0);
        }
示例#4
0
 protected void ReadPboHeader(BinaryReader reader)
 {
     while (true)
     {
         var pboEntry = new PboEntry();
         pboEntry.ReadHeader(reader);
         if (pboEntry.Path.Length == 0)
         {
             if (entries.Count != 0)
             {
                 break;
             }
             string s;
             while ((s = reader.ReadStringZ()).Length != 0)
             {
                 extensions.Add(s);
             }
         }
         else
         {
             entries.Add(pboEntry);
         }
     }
 }