コード例 #1
0
        private void checkIfRomsArePresent(string[] pArchivePaths, ref Dictionary <string, HootRomCheckStruct[]> pHootSet,
                                           string pSetArchiveName, bool pIncludeSubDirectories)
        {
            ArrayList archiveContents;

            string[] setArchiveSplitParameters = { "," };
            string[] setArchiveNames           = pSetArchiveName.Split(setArchiveSplitParameters, StringSplitOptions.RemoveEmptyEntries);

            foreach (string path in pArchivePaths)
            {
                if (Directory.Exists(path))
                {
                    string[] archiveFiles;
                    string   archiveName;

                    foreach (string splitArchiveName in setArchiveNames)
                    {
                        archiveName = splitArchiveName;

                        // add .zip if needed for split archives
                        if (!archiveName.EndsWith(".zip"))
                        {
                            archiveName = archiveName + ".zip";
                        }

                        if (pIncludeSubDirectories)
                        {
                            archiveFiles = Directory.GetFiles(path, archiveName, SearchOption.AllDirectories);
                        }
                        else
                        {
                            archiveFiles = Directory.GetFiles(path, archiveName, SearchOption.TopDirectoryOnly);
                        }

                        if (archiveFiles.Length > 1)
                        {
                            this.progressStruct.Clear();
                            this.progressStruct.GenericMessage = String.Format("WARNING: Multiple copies of {0} found, results may be inaccurate", pSetArchiveName);
                            ReportProgress(this.progress, this.progressStruct);
                        }

                        foreach (string file in archiveFiles)
                        {
                            archiveContents = new ArrayList(CompressionUtil.GetUpperCaseFileList(file));

                            for (int i = 0; i < pHootSet[pSetArchiveName].Length; i++)
                            {
                                if (archiveContents.Contains(pHootSet[pSetArchiveName][i].RomName.Replace('/', Path.DirectorySeparatorChar).ToUpper()))
                                {
                                    pHootSet[pSetArchiveName][i].IsPresent = true;
                                }
                            }
                        }
                    }
                }
            }
        }