private void PageOutTask() { try { var writer = PageFileFormat.CreateWriter() as PacketLogWriter; var option = PageFileFormat.CreateWriterOption(); if (writer == null) { return; } if (!writer.Open(option, page_file_path_)) { return; } foreach (var packet in page_packets_) { writer.WritePacket(packet); } writer.Close(); /* ページアウトしたらメモリをクリア */ lock (page_sync_) { page_packets_ = null; page_load_state_ = false; GC.Collect(); } } catch { } }
private void PageInTask() { try { var packets = new List <PacketObject>(); if (File.Exists(page_file_path_)) { var reader = PageFileFormat.CreateReader() as PacketLogReader; var option = PageFileFormat.CreateReaderOption(); if ((reader != null) && (reader.Open(option, page_file_path_)) ) { var packet = (PacketObject)null; while ((packet = reader.ReadPacket()) != null) { packets.Add(packet); } reader.Close(); } } /* 新しいパケットと差し替え */ lock (page_sync_) { page_packets_ = packets; page_load_state_ = true; } } catch { } }