public override void CloseIO() { try { if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId)) { NeoDatis.Tool.DLogger.Debug("Closing file with size " + fileWriter.Length()); } // Problem found by mayworm : necessary for MacOSX if (fileWriter.IsLocked()) { fileWriter.UnlockFile(); } fileWriter.Close(); } catch (System.IO.IOException e) { NeoDatis.Tool.DLogger.Error(NeoDatis.Tool.Wrappers.OdbString.ExceptionToString(e, true)); } fileWriter = null; if (IsForTransaction() && AutomaticDeleteIsEnabled()) { bool b = NeoDatis.Tool.IOUtil.DeleteFile(wholeFileName); if (!b) { throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.CanNotDeleteFile .AddParameter(wholeFileName)); } } }
public virtual void TestOdbFileIo() { NeoDatis.Tool.Wrappers.IO.OdbFileIO fileIO = new NeoDatis.Tool.Wrappers.IO.OdbFileIO (NeoDatis.Odb.Test.ODBTest.Directory + "testLock1", true, null); fileIO.Seek(1024); fileIO.Write((byte)10); fileIO.LockFile(); AssertEquals(true, fileIO.IsLocked()); fileIO.Close(); }
/// <summary>Simple lock</summary> /// <exception cref="System.IO.IOException">System.IO.IOException</exception> public virtual void TestOdbFileIo() { NeoDatis.Tool.Wrappers.IO.OdbFileIO fileIO = new NeoDatis.Tool.Wrappers.IO.OdbFileIO (NeoDatis.Odb.Test.ODBTest.Directory + "testLock1", true, null); fileIO.Seek(1024); fileIO.Write((byte)10); fileIO.LockFile(); AssertEquals(true, fileIO.IsLocked()); fileIO.Close(); }