protected override void onDispose() { base.onDispose(); handler.PostDelayed(new Runnable(() => { ThreadProxy.getInstance().execute(new Runnable(() => { if (session.receiveByteNum == 0 && session.bytesSent == 0) { return; } string configFileDir = $"{VPNConstants.CONFIG_DIR}{TimeFormatUtil.formatYYMMDDHHMMSS(session.vpnStartTime)}"; var parentFile = new File(configFileDir); if (!parentFile.Exists()) { parentFile.Mkdirs(); } var file = new File(parentFile, session.getUniqueName()); if (file.Exists()) { return; } ACache configACache = ACache.get(parentFile); configACache.put(session.getUniqueName(), session); })); }), 1000); }
public void Pack(BinaryWriter writer) { writer.Write(HasBpsd); writer.Write(DType); writer.Write(DVal); writer.Write(DVar); ACache.Pack(writer); writer.Write(Bh); if ((HasBpsd & 0x00000001) != 0) { Bpsd.Pack(writer); } }
public void Unpack(BinaryReader reader) { HasBpsd = reader.ReadInt32(); DType = reader.ReadInt32(); DVal = reader.ReadInt32(); DVar = reader.ReadInt32(); ACache.Unpack(reader); Bh = reader.ReadInt32(); if ((HasBpsd & 0x00000001) != 0) { Bpsd.Unpack(reader); } }
public override int ReadByte() { var buf = ACache.Get <byte>(1); try { int cnt = Read(buf, 0, 1); if (cnt == 0) { return(-1); } return((int)buf[0]); } finally { ACache.Return(ref buf); } }
public override int ReadByte() { byte[] buffer = ACache.Get <byte>(1); try { if (this.Read(buffer, 0, 1) == 0) { return(-1); } else { return((int)buffer[0]); } } finally { ACache.Return <byte>(ref buffer); } }