private void mmf_Length_init() { if (IsOwnerOfSharedMemory) { mmf_Length = new BufferReadWrite(Name + "_length", 16, true); } else { mmf_Length = new BufferReadWrite(Name + "_length", 16, false); } }
private void mmf_Update_Flag_init() { if (IsOwnerOfSharedMemory) { mmf_UpdateFlag = new BufferReadWrite(Name + "_flag_update", 8, true); } else { mmf_UpdateFlag = new BufferReadWrite(Name + "_flag_update", 8, false); } }
/// <summary> /// get date time lastest database updated /// </summary> /// <returns></returns> public long Update_DatetimeLastest() { long time = 0; using (var read = new BufferReadWrite(Name + "_flag_update")) { read.Read((IntPtr pr) => { byte[] bArray = new byte[8]; Marshal.Copy(pr, bArray, 0, 8); time = BitConverter.ToInt64(bArray, 0); }); } return(time); }
private void mmf_Length_update(int len_add) { int len = 0; using (var read = new BufferReadWrite(Name + "_length")) { read.Read((IntPtr pr) => { byte[] bArray = new byte[16]; Marshal.Copy(pr, bArray, 0, 16); len = BitConverter.ToInt32(bArray, 0); mmf_Length.Write((IntPtr pw) => { len = len + len_add; bArray = BitConverter.GetBytes(len); Marshal.Copy(bArray, 0, pw, 1); }); }); } event_data_change(); }