コード例 #1
0
		public void Initialize(System.IO.Stream fileStream)
		{
			_zipWorker = new ZipWorker(true);
			_zipWorker.Extract(fileStream);

			if (!_zipWorker.IsValid)
			{
				_isValid = false;
				_exceptionMessage = _zipWorker.ExceptionMessage;

				Close();

				return;
			}

			ReadGlobals();
		}
コード例 #2
0
		private void Dispose(bool disposing)
		{
			// Check to see if Dispose has already been called.

			if (!this.disposed)
			{
				if (disposing)
				{
					if (_xmlReader != null) ((IDisposable) _xmlReader).Dispose();
					if (_sheetStream != null) _sheetStream.Dispose();
					if (_zipWorker != null) _zipWorker.Dispose();
				}

				_zipWorker = null;
				_xmlReader = null;
				_sheetStream = null;

				_workbook = null;
				_cellsValues = null;
				_savedCellsValues = null;

				disposed = true;
			}
		}
コード例 #3
0
        public void ZipWorker_Extract_Test()
        {
            var zipper = new ZipWorker();
            zipper.Extract(Helper.GetTestWorkbook("TestChess"));
            Assert.AreEqual(false, Directory.Exists(zipper.TempPath));
            Assert.AreEqual(false, zipper.IsValid);

            zipper.Extract(Helper.GetTestWorkbook("xTestOpenXml"));

            Assert.AreEqual(true, Directory.Exists(zipper.TempPath));
            Assert.AreEqual(true, zipper.IsValid);

            string tPath = zipper.TempPath;

            zipper.Dispose();

            Assert.AreEqual(false, Directory.Exists(tPath));
        }