コード例 #1
0
        public static ExeObjectStatistics FromFile(string path)
        {
            if (!File.Exists(path))
            {
                throw new FileNotFoundException(null, path);
            }

            ExeVersionString.Match(path);

            ExeObjectStatistics obj = new ExeObjectStatistics();

            using (BinaryReader file = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read), Encoding.ASCII))
            {
                for (int i = 0; i < ExeObjectStatistics.Length; i++)
                {
                    file.BaseStream.Seek(ExeObjectStatistics.BaseOffset + i * ExeObjectEntry.Length, SeekOrigin.Begin);

                    ExeObjectEntry entry = ExeObjectEntry.FromByteArray(file.ReadBytes(ExeObjectEntry.Length));

                    obj.Add(entry);
                }
            }

            return(obj);
        }
コード例 #2
0
 public static void Match(string path)
 {
     if (!ExeVersionString.IsMatch(path))
     {
         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "{0} was not found in {1}", ExeVersionString.XwaExeVersion, path), "path");
     }
 }