public void clear() { using (MutexObject.section(_mutex)) { FileTools.deletePath(_messageDir); } }
public WorkingDir(string lDir) { _dir = Path.Combine(FileTools.getTMP(), lDir); FileTools.deletePath(_dir); Directory.CreateDirectory(_dir); }
public void Dispose() { if (_dir != null) { string dir = _dir; _dir = null; FileTools.deletePath(dir); } }
public void send(Queue <byte[]> sendData) { //Stopwatch sw = new Stopwatch(); // test //sw.Reset(); //sw.Start(); using (MutexObject.section(_mutex)) { //sw.Stop(); //laps.Add(sw.Elapsed.TotalMilliseconds); //sw.Reset(); //sw.Start(); getMessageRange(); //sw.Stop(); //laps.Add(sw.Elapsed.TotalMilliseconds); //sw.Reset(); //sw.Start(); tryRenumber(); //sw.Stop(); //laps.Add(sw.Elapsed.TotalMilliseconds); //sw.Reset(); //sw.Start(); if (_gmrLastNo == -1) { FileTools.deletePath(_messageDir); Directory.CreateDirectory(_messageDir); } //sw.Stop(); //laps.Add(sw.Elapsed.TotalMilliseconds); //sw.Reset(); //sw.Start(); using (FileStream wfs = new FileStream( Path.Combine(_messageDir, StringTools.zPad(_gmrLastNo + 1, 4)), FileMode.Create, FileAccess.Write )) foreach (byte[] block in sendData) { wfs.Write(block, 0, block.Length); } //sw.Stop(); //laps.Add(sw.Elapsed.TotalMilliseconds); //sw.Reset(); //sw.Start(); } //sw.Stop(); //laps.Add(sw.Elapsed.TotalMilliseconds); //sw.Reset(); //sw.Start(); _messagePostEvent.set(); //sw.Stop(); //laps.Add(sw.Elapsed.TotalMilliseconds); }
private byte[] tryRecv() { using (MutexObject.section(_mutex)) { getMessageRange(); if (_gmrFirstNo != -1) { String file = Path.Combine(_messageDir, StringTools.zPad(_gmrFirstNo, 4)); byte[] recvData = File.ReadAllBytes(file); FileTools.deletePath(file); if (_gmrFirstNo == _gmrLastNo) { FileTools.deletePath(_messageDir); } return(recvData); } } return(null); }