public static List <SystemFile> GetFiles(int packageId, string path, bool includeFiles) { OS.OperatingSystem os = GetOS(packageId); string fullPath = GetFullPackagePath(packageId, path); List <SystemFile> filteredFiles = new List <SystemFile>(); SystemFile[] files = os.GetFiles(fullPath); foreach (SystemFile file in files) { if (file.IsDirectory || includeFiles) { filteredFiles.Add(file); } } return(filteredFiles); }