Ejemplo n.º 1
0
        public Archive(string filename, string mimeType)
        {
            this.uri   = StringFu.PathToQuotedFileUri(filename);
            baseStream = new FileStream(filename,
                                        FileMode.Open);
            switch (mimeType)
            {
            case "application/zip":
                baseStream   = new ZipInputStream(baseStream);
                getNextEntry = new GetNextEntryType(GetNextEntryZip);
                method       = "#zip:";
                break;

            case "application/x-bzip-compressed-tar":
                baseStream   = new BZip2InputStream(baseStream);
                baseStream   = new TarInputStream(baseStream);
                getNextEntry = new GetNextEntryType(GetNextEntryTar);
                method       = "#bzip2:#tar:";
                break;

            case "application/x-compressed-tar":
                baseStream   = new GZipInputStream(baseStream);
                baseStream   = new TarInputStream(baseStream);
                getNextEntry = new GetNextEntryType(GetNextEntryTar);
                method       = "#gzip:#tar:";
                break;

            case "application/x-tar":
                baseStream   = new TarInputStream(baseStream);
                getNextEntry = new GetNextEntryType(GetNextEntryTar);
                method       = "#tar:";
                break;

            case "application/x-gzip":
                baseStream   = new GZipInputStream(baseStream);
                getNextEntry = new GetNextEntryType(GetNextEntrySingle);
                method       = "#gzip:";
                break;

            case "application/x-bzip":
                baseStream   = new BZip2InputStream(baseStream);
                getNextEntry = new GetNextEntryType(GetNextEntrySingle);
                method       = "#bzip:";
                break;

            default:
                throw new ArgumentException("Invalid or unsupported mime type.");
            }
        }
Ejemplo n.º 2
0
		public Archive (string filename, string mimeType) {
			this.uri = StringFu.PathToQuotedFileUri (filename);
			baseStream = new FileStream (filename,
						     FileMode.Open);
			switch (mimeType) {
			case "application/zip":
				baseStream = new ZipInputStream (baseStream);
				getNextEntry = new GetNextEntryType (GetNextEntryZip);
				method = "#zip:";
				break;
			case "application/x-bzip-compressed-tar":
				baseStream = new BZip2InputStream (baseStream);
				baseStream = new TarInputStream (baseStream);
				getNextEntry = new GetNextEntryType (GetNextEntryTar);
				method = "#bzip2:#tar:";
				break;
			case "application/x-compressed-tar":
				baseStream = new GZipInputStream (baseStream);
				baseStream = new TarInputStream (baseStream);
				getNextEntry = new GetNextEntryType (GetNextEntryTar);
				method = "#gzip:#tar:";
				break;
			case "application/x-tar":
				baseStream = new TarInputStream (baseStream);
				getNextEntry = new GetNextEntryType (GetNextEntryTar);
				method = "#tar:";
				break;
			case "application/x-gzip":
				baseStream = new GZipInputStream (baseStream);
				getNextEntry = new GetNextEntryType (GetNextEntrySingle);
				method = "#gzip:";
				break;
			case "application/x-bzip":
				baseStream = new BZip2InputStream (baseStream);
				getNextEntry = new GetNextEntryType (GetNextEntrySingle);
				method = "#bzip:";
				break;
			default:
				throw new ArgumentException ("Invalid or unsupported mime type.");
			}
		}