Exemple #1
0
		static public List<string> GetFileNames(string fileName, bool includeDirectorys)
		{
			Logger.LogInfo("Getting filesnames within: " + fileName);
			List<string> fileNames = new List<string>();

			using (ZipWrapper zip = new ZipWrapper())
			{
				if (!zip.OpenZip(fileName))
				{
					Logger.LogDebug("Unable to open: " + fileName);
					throw new Exception("Unable to open Zip file:" + fileName);
				}

				int n = zip.NumEntries;
				Logger.LogInfo(string.Format("Zip contains [{0}] files", n.ToString()));

				Chilkat.ZipEntry entry;
				for (int i = 0; i <= n - 1; i++)
				{
					entry = zip.GetEntryByIndex(i);
					if (entry.IsDirectory && !includeDirectorys)//Skip over directories
					{
						continue;
					}

					fileNames.Add(entry.FileName);
					Logger.LogInfo("Zip contains file: " + entry.FileName);
				}
			}

			return fileNames;
		}