AA2Install.Archives._7z.Index C# (CSharp) Method

Index() public static method

Creates a mod index from a 7Zip file
public static Index ( string filename, bool miscFiles = false ) : Mod
filename string Location of the 7Zip file.
miscFiles bool Whether or not to include files that aren't related to mod installation. Default is false.
return Mod
        public static Mod Index(string filename, bool miscFiles = false)
        {
            SevenZipExtractor z = new SevenZipExtractor(filename);

            var subfiles = new List<string>();
            foreach (var d in z.Files)
            {
                string s = d.Filename;
                if (!d.Attributes.HasFlag(Attributes.Directory) &&
                    (miscFiles ||
                    (s.StartsWith(@"AA2_MAKE\") ||
                    s.StartsWith(@"AA2_PLAY\"))))
                {
                    subfiles.Add(s);
                }
            }

            return new Mod(filename, z.UnpackedSize, subfiles);
        }