public T Interpolate(float time, T value, float rate, Func <T, T, float, T> interp_function) { // If the buffers empty, just return the current value if (buffer.Count == 0) { return(value); } int upperboundidx = buffer.FindIndex((BufferEntry it) => { return(it.time > time); }); // If we are too far ahead of the buffer, return the last entry if (upperboundidx == -1) { return(ComputeWorldValue(buffer.Last())); } // If the current value occurs before all values in the buffer, interpolate // towards the first value from the current value using the expected rate. else if (upperboundidx == 0) { BufferEntry entry = buffer.First(); return(interp_function(value, ComputeWorldValue(entry), (entry.time - time) * rate)); } // Otherwise interpolate between the two values surrounding the current value at the current time BufferEntry upper = buffer[upperboundidx]; BufferEntry lower = buffer[upperboundidx - 1]; return(interp_function(ComputeWorldValue(lower), ComputeWorldValue(upper), (time - lower.time) / (upper.time - lower.time))); }
public static int NextOpening(BufferEntry entry, int position, string name) { int index; byte value; int size = entry.PrimarySize; byte[] primary = entry.PrimaryData; while (position < size) { index = position + 1; value = primary[position]; if (value == '\0') { return(-1); } if (value == '<' && entry.IsEqual(ref index, name)) { value = entry.GetByteAt(index); if (value == ' ' || value == '>' || value == '/' || value == '\r' || value == '\n' || value == '\t') { break; } } position = index; } return(position); }
public Page EnterLatch(BufferEntry buffer, LatchFlags flags) { if (LatchLocks.TryGetValue(buffer.Position, out var latchLock)) { if (flags != latchLock.Flags) { throw new InvalidOperationException($"has hold a {flags} lactch of the buffer:{buffer.Position}!"); } return(buffer.Page); } switch (flags) { case LatchFlags.Read: LatchLocks[buffer.Position] = buffer.Latch.EnterReadScope(); break; case LatchFlags.RWRead: LatchLocks[buffer.Position] = buffer.Latch.EnterReadWriteScope(); break; case LatchFlags.Write: LatchLocks[buffer.Position] = buffer.Latch.EnterWriteScope(); break; } return(buffer.Page); }
private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); var numEntries = Count.GetValue(context); numEntries = Math.Max(numEntries, 1); numEntries = Math.Min(numEntries, 500000); var bufferData = new BufferEntry[numEntries]; var color = Color.GetValue(context); var random = new Random(Seed.GetValue(context)); var size = Size.GetValue(context); var end = size * 0.5f; var start = -end; var objectToWorld = context.ObjectToWorld; for (int index = 0; index < numEntries; index++) { float x = random.NextFloat(start.X, end.X); float y = random.NextFloat(start.Y, end.Y); var posInObject = new Vector3(x, y, 0.0f); var posInWorld = Vector3.Transform(posInObject, objectToWorld); bufferData[index].Pos = new Vector3(posInWorld.X, posInWorld.Y, posInWorld.Z); bufferData[index].Id = _id; bufferData[index].Color = new Vector4(color.X, color.Y, color.Z, color.W); } var stride = 32; resourceManager.SetupStructuredBuffer(bufferData, stride * numEntries, stride, ref _buffer); resourceManager.CreateStructuredBufferSrv(_buffer, ref PointCloudSrv.Value); }
internal static void ARPCache_Update(ARPReply_Ethernet arp_reply) { ensureQueueExists(); //foreach (BufferEntry entry in queue) for (int e = 0; e < queue.Count; e++) { BufferEntry entry = queue[e]; if (entry.Status == BufferEntry.EntryStatus.ARP_SENT) { var xDestIP = entry.Packet.DestinationIP.Hash; var xSenderIP = arp_reply.SenderIP.Hash; if (entry.Packet.DestinationIP.CompareTo(arp_reply.SenderIP) == 0) { entry.Packet.DestinationMAC = arp_reply.SenderMAC; entry.Status = BufferEntry.EntryStatus.JUST_SEND; } } else if (entry.Status == BufferEntry.EntryStatus.ROUTE_ARP_SENT) { if (entry.nextHop.CompareTo(arp_reply.SenderIP) == 0) { entry.Packet.DestinationMAC = arp_reply.SenderMAC; entry.Status = BufferEntry.EntryStatus.JUST_SEND; } } } }
public void PutEntries(List <BufferEntry> entries) { int size = CalculateEntriesSize(entries) * 2; this.buffer = new MemoryStreamWrapper(new MemoryStream(size + Constant.INTEGER_BYTES * 4)); buffer.WriteInt32(size); buffer.WriteInt32(entries.Count); BufferEntry firstEntry = entries[0]; buffer.WriteInt32(firstEntry.TokenInfo.Count); buffer.WriteInt32(firstEntry.PosInfo.Count); buffer.WriteInt32(firstEntry.Features.Count); foreach (BufferEntry entry in entries) { foreach (short s in entry.TokenInfo) { buffer.WriteInt16(s); } buffer.Write(entry.PosInfo.ToArray(), 0, entry.PosInfo.Count); foreach (int feature in entry.Features) { buffer.WriteInt32(feature); } } }
public void Insert(float time, T value, Transform parent = null) { BufferEntry entry = new BufferEntry(time, value, parent); // Hardcode a limit on the buffer for now to prevent a leak if (buffer.Count > 20) { buffer.RemoveAt(0); } // Check the end to see if we should just append early if (buffer.Count == 0 || buffer.Last().time <= time) { buffer.Add(entry); } // Otherwise find where we need to insert this frame else { int idx = buffer.FindIndex((BufferEntry it) => { return(it.time > time); }); if (idx == -1) { buffer.Add(entry); } else { buffer.Insert(idx, entry); } } }
public void ReadTokenInfo(Stream input) { try { input.Position = 0; var reader = new StreamReader(input, Encoding.GetEncoding(encoding)); int entryCount = posInfo.GetEntryCount(); while (!reader.EndOfStream) { T entry = Parse(reader.ReadLine().RemapCharIfNeeded()); GenericDictionaryEntry dictionaryEntry = MakeGenericDictionaryEntry(entry); short leftId = dictionaryEntry.GetLeftId(); short rightId = dictionaryEntry.GetRightId(); short wordCost = dictionaryEntry.GetWordCost(); string[] allPosFeatures = dictionaryEntry.GetPartOfSpeechFeatures(); List <int> posFeatureIds = posInfo.MapFeatures(allPosFeatures); string[] featureList = dictionaryEntry.GetOtherFeatures(); List <int> otherFeatureIds = otherInfo.MapFeatures(featureList); BufferEntry bufferEntry = new BufferEntry(); bufferEntry.TokenInfo.Add(leftId); bufferEntry.TokenInfo.Add(rightId); bufferEntry.TokenInfo.Add(wordCost); if (EntriesFitInAByte(entryCount)) { List <Byte> posFeatureIdBytes = CreatePosFeatureIds(posFeatureIds); bufferEntry.PosInfo.AddRange(posFeatureIdBytes); } else { foreach (int posFeatureId in posFeatureIds) { bufferEntry.TokenInfo.Add((short)posFeatureId); } } bufferEntry.Features.AddRange(otherFeatureIds); bufferEntries.Add(bufferEntry); surfaces.Add(dictionaryEntry.GetSurface()); if (dictionaryEntries != null) { dictionaryEntries.Add(dictionaryEntry); } } } catch (IOException ex) { throw new IOException("TokenInfoDictionaryCompilerBase.AnalyzeTokenInfo: " + ex.Message); } }
public LatchScope PopLatch(BufferEntry buffer) { if (LatchLocks.Remove(buffer.Position, out var latchLock)) { return(latchLock); } return(null); }
private T ComputeWorldValue(BufferEntry entry) { T world_value = entry.value; if (entry.parent != null && transform_function != null) { world_value = transform_function(entry.parent, world_value); } return(world_value); }
public int GetLength() { int read = 0; int characters = 0; int length = hierarchy.GetLength(id); int position = hierarchy.GetPosition(id); if (length > 0) { byte value; byte[] data = entry.GetData(0, out int size, out int skip); while (position < size) { value = data[position]; read = value < 128 ? 1 : BufferEntry.GetLength(value); length = length - read; position = position + read; characters = characters + (read <= 3 ? 1 : 2); if (length <= 0) { return(characters); } } while (true) { data = entry.GetData(position, out size, out skip); int offset = position - skip; while (offset < size) { value = data[offset]; read = value < 128 ? 1 : BufferEntry.GetLength(value); length = length - read; position = position + read; characters = characters + (read <= 3 ? 1 : 2); offset = offset + read; if (length <= 0) { return(characters); } } } } return(characters); }
public void TestReadAndLookUpTokenInfo() { List <short> tokenInfo = new List <short>(); List <int> features = new List <int>(); short[] tokenInfos = new short[3]; tokenInfos[0] = 1; tokenInfos[1] = 2; tokenInfos[2] = 3; int[] featureInfos = new int[2]; featureInfos[0] = 73; featureInfos[1] = 99; tokenInfo.Add((short)1); tokenInfo.Add((short)2); tokenInfo.Add((short)3); features.Add(73); features.Add(99); BufferEntry entry = new BufferEntry(); entry.TokenInfo = tokenInfo; entry.Features = features; entry.TokenInfos = tokenInfos; entry.FeatureInfos = featureInfos; List <BufferEntry> bufferEntries = new List <BufferEntry>(); bufferEntries.Add(entry); using (TokenInfoBufferCompiler compiler = new TokenInfoBufferCompiler(bufferEntries)) { using (var outputStream = File.Create(tokenInfoFile)) { compiler.Compile(outputStream); } } using (var inputStream = File.OpenRead(tokenInfoFile)) { using (TokenInfoBuffer tokenInfoBuffer2 = new TokenInfoBuffer(inputStream)) { Assert.AreEqual(99, tokenInfoBuffer2.LookupFeature(0, 1)); Assert.AreEqual(73, tokenInfoBuffer2.LookupFeature(0, 0)); } } }
public void ReadTokenInfo(Stream input) { var entryCount = PosInfo.EntryCount; foreach (var line in input.ReadLines(Encoding)) { var entry = Parse(line); var dictionaryEntry = MakeGenericDictionaryEntry(entry); var leftId = dictionaryEntry.LeftId; var rightId = dictionaryEntry.RightId; var wordCost = dictionaryEntry.WordCost; var allPosFeatures = dictionaryEntry.PartOfSpeechFeatures; var posFeatureIds = PosInfo.MapFeatures(allPosFeatures); var featureList = dictionaryEntry.OtherFeatures; var otherFeatureIds = OtherInfo.MapFeatures(featureList); var bufferEntry = new BufferEntry(); bufferEntry.TokenInfo.Add(leftId); bufferEntry.TokenInfo.Add(rightId); bufferEntry.TokenInfo.Add(wordCost); if (EntriesFitInAByte(entryCount)) { var posFeatureIdBytes = CreatePosFeatureIds(posFeatureIds); bufferEntry.PosInfo.AddRange(posFeatureIdBytes); } else { foreach (var posFeatureId in posFeatureIds) { bufferEntry.TokenInfo.Add((short)posFeatureId); } } bufferEntry.Features.AddRange(otherFeatureIds); BufferEntries.Add(bufferEntry); Surfaces.Add(dictionaryEntry.Surface); if (DictionaryEntries != null) { DictionaryEntries.Add(dictionaryEntry); } } }
public bool CheckLatch(BufferEntry buffer, LatchFlags flags) { if (!LatchLocks.TryGetValue(buffer.Position, out var latch)) { return(false); } switch (flags) { case LatchFlags.Write: return(latch.Flags == LatchFlags.Write || latch.Flags == LatchFlags.RWWrite); default: return(true); } }
public void TestCompleteLookUp() { Dictionary <int, string> resultMap = new Dictionary <int, string>(); resultMap[73] = "hello"; resultMap[42] = "今日は"; resultMap[99] = "素敵な世界"; List <short> tokenInfo = new List <short>(); List <int> features = new List <int>(); tokenInfo.Add((short)1); tokenInfo.Add((short)2); tokenInfo.Add((short)3); features.Add(73); features.Add(99); BufferEntry entry = new BufferEntry(); entry.TokenInfo = tokenInfo; entry.Features = features; List <BufferEntry> bufferEntries = new List <BufferEntry>(); bufferEntries.Add(entry); using (var outStream = File.Create(tokenInfoFile)) { using (TokenInfoBufferCompiler compiler = new TokenInfoBufferCompiler(bufferEntries)) { compiler.Compile(outStream); } } using (var inStream = File.OpenRead(tokenInfoFile)) { using (TokenInfoBuffer tokenInfoBuffer = new TokenInfoBuffer(inStream)) { BufferEntry result = tokenInfoBuffer.LookupEntry(0); Assert.AreEqual("hello", resultMap[result.FeatureInfos[0]]); Assert.AreEqual("素敵な世界", resultMap[result.FeatureInfos[1]]); } } }
private int CalculateEntriesSize(List <BufferEntry> entries) { if (entries.Count == 0) { return(0); } else { int size = 0; BufferEntry entry = entries[0]; size += entry.TokenInfo.Count * Constant.SHORT_BYTES + Constant.SHORT_BYTES; size += entry.PosInfo.Count; size += entry.Features.Count * Constant.INTEGER_BYTES; size *= entries.Count; return(size); } }
public static int NextAttributeValue(BufferEntry entry, int position) { byte value; while (true) { value = entry.GetByteAt(position); if (value == '"' || value == '\0') { break; } position++; } return(value != '\0' ? position : -1); }
private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); var numEntries = Count.GetValue(context); numEntries = Math.Max(numEntries, 1); numEntries = Math.Min(numEntries, 500000); var bufferData = new BufferEntry[numEntries]; var color = Color.GetValue(context); var random = new Random(Seed.GetValue(context)); var radius = Radius.GetValue(context); var objectToWorld = context.ObjectToWorld; for (int index = 0; index < numEntries; index++) { float u = random.NextFloat(0, 1); float v = random.NextFloat(0, 1); float theta = SharpDX.MathUtil.TwoPi * u; float z = 1.0f - 2.0f * v; float phi = (float)Math.Acos(z); float sinPhi = (float)Math.Sin(phi); float x = sinPhi * (float)Math.Cos(theta); float y = sinPhi * (float)Math.Sin(theta); var posInObject = new Vector3(x, y, z); // dir *= radius; posInObject *= random.NextFloat(0.0f, radius); var posInWorld = Vector3.Transform(posInObject, objectToWorld); bufferData[index].Pos = new Vector3(posInWorld.X, posInWorld.Y, posInWorld.Z); bufferData[index].Id = _id; bufferData[index].Color = new Vector4(color.X, color.Y, color.Z, color.W); } var stride = 32; resourceManager.SetupStructuredBuffer(bufferData, stride * numEntries, stride, ref _buffer); resourceManager.CreateStructuredBufferSrv(_buffer, ref PointCloudSrv.Value); }
private void Update(EvaluationContext context) { var resourceManager = ResourceManager.Instance(); string path = Path.GetValue(context); if (string.IsNullOrEmpty(path) || !(new FileInfo(path).Exists)) { return; } var numEntries = File.ReadLines(path).Count(); var bufferData = new BufferEntry[numEntries]; using (var stream = new StreamReader(path)) { try { string line; int index = 0; while ((line = stream.ReadLine()) != null) { var values = line.Split(' '); float x = float.Parse(values[0], CultureInfo.InvariantCulture); float y = float.Parse(values[1], CultureInfo.InvariantCulture); float z = float.Parse(values[2], CultureInfo.InvariantCulture); float r = float.Parse(values[3]) / 255.0f; float g = float.Parse(values[4]) / 255.0f; float b = float.Parse(values[5]) / 255.0f; bufferData[index].Pos = new Vector4(x, y, z, 1.0f); bufferData[index].Color = new Vector4(r, g, b, 1.0f); index++; } } catch (Exception e) { Log.Error("Failed to load point cloud:" + e.Message); } } int stride = 32; resourceManager.SetupStructuredBuffer(bufferData, stride * numEntries, stride, ref Buffer); resourceManager.CreateStructuredBufferSrv(Buffer, ref PointCloudSrv.Value); }
public string[] GetAllFeaturesArray(int wordId) { BufferEntry bufferEntry = tokenInfoBuffer.LookupEntry(wordId); int posLength = bufferEntry.PosInfos.Length; int featureLength = bufferEntry.FeatureInfos.Length; bool partOfSpeechAsShorts = false; if (posLength == 0) { posLength = bufferEntry.TokenInfos.Length - TOKEN_INFO_OFFSET; partOfSpeechAsShorts = true; } String[] result = new String[posLength + featureLength]; if (partOfSpeechAsShorts) { for (int i = 0; i < posLength; i++) { int feature = bufferEntry.TokenInfos[i + TOKEN_INFO_OFFSET]; result[i] = posValues.Get(feature); } } else { for (int i = 0; i < posLength; i++) { int feature = bufferEntry.PosInfos[i] & 0xff; result[i] = posValues.Get(feature); } } for (int i = 0; i < featureLength; i++) { int feature = bufferEntry.FeatureInfos[i]; String s = stringValues.Get(feature); result[i + posLength] = s; } return(result); }
public static int SkipWhiteCharactersForward(BufferEntry entry, int position) { byte value; int size, skip; byte[] data = entry.GetData(0, out size, out skip); while (position < size) { value = data[position]; if (value != ' ' && value != '\r' && value != '\n' && value != '\t') { return(position); } position++; } while (true) { data = entry.GetData(position, out size, out skip); int index = position - skip; while (index < size) { value = data[index]; if (value != ' ' && value != '\r' && value != '\n' && value != '\t') { return(position); } if (value == '\0') { return(-1); } index++; position++; } } }
/// <summary> /// Add a received image to the processing buffer /// </summary> /// <param name="body"></param> public static void Add(ImageBody body) { lock (s_bufferLock) { s_entryDictionary.TryGetValue(body.CameraId, out BufferEntry found); if (found == null) { BufferEntry entry = new BufferEntry() { CameraId = body.CameraId, Body = body }; s_entryDictionary.Add(body.CameraId, entry); s_entryList.Add(entry); found = entry; } // Keep only the latest Body for processing, discarding any unprocessed older ones found.Body = body; } }
public static int NextElementName(BufferEntry entry, int position) { byte value; int size, skip; byte[] data = entry.GetData(0, out size, out skip); while (position < size) { value = data[position]; if (value == '/' || value == '>' || value == ' ' || value == '\r' || value == '\n' || value == '\t') { return(position); } position++; } while (true) { data = entry.GetData(position, out size, out skip); int index = position - skip; while (index < size) { value = data[index]; if (value == '/' || value == '>' || value == ' ' || value == '\r' || value == '\n' || value == '\t') { return(position); } if (value == '\0') { return(-1); } index++; position++; } } }
public void TestCompleteLookUp() { var resultMap = new Dictionary <int, string>(); resultMap.Add(73, "hello"); resultMap.Add(42, "今日は"); resultMap.Add(99, "素敵な世界"); var tokenInfo = new List <short>(); var features = new List <int>(); tokenInfo.Add(1); tokenInfo.Add(2); tokenInfo.Add(3); features.Add(73); features.Add(99); var entry = new BufferEntry(); entry.TokenInfo = tokenInfo; entry.Features = features; var bufferEntries = new List <BufferEntry>(); bufferEntries.Add(entry); using (var ms = new MemoryStream()) { var compiler = new TokenInfoBufferCompiler(ms, bufferEntries); compiler.Compile(); ms.Seek(0, SeekOrigin.Begin); var tokenInfoBuffer = new TokenInfoBuffer(ms); var result = tokenInfoBuffer.LookupEntry(0); resultMap[result.FeatureInfos[0]].Is("hello"); resultMap[result.FeatureInfos[1]].Is("素敵な世界"); } }
public void TestReadAndLookUpTokenInfo() { var tokenInfo = new List <short>(); var features = new List <int>(); var tokenInfos = new short[] { 1, 2, 3 }; var featureInfos = new int[] { 73, 99 }; tokenInfo.Add(1); tokenInfo.Add(2); tokenInfo.Add(3); features.Add(73); features.Add(99); var entry = new BufferEntry(); entry.TokenInfo = tokenInfo; entry.Features = features; entry.TokenInfos = tokenInfos; entry.FeatureInfos = featureInfos; var bufferEntries = new List <BufferEntry>(); bufferEntries.Add(entry); using (var ms = new MemoryStream()) { var compiler = new TokenInfoBufferCompiler(ms, bufferEntries); compiler.Compile(); ms.Seek(0, SeekOrigin.Begin); var tokenInfoBuffer2 = new TokenInfoBuffer(ms); tokenInfoBuffer2.LookupFeature(0, 1).Is(99); tokenInfoBuffer2.LookupFeature(0, 0).Is(73); } }
public T Interpolate(float time, Func <T, T, float, T> interp_function) { if (buffer.Count == 0) { return(default(T)); } int upperboundidx = buffer.FindIndex((BufferEntry it) => { return(it.time > time); }); if (upperboundidx == -1) { return(ComputeWorldValue(buffer.Last())); } else if (upperboundidx == 0) { return(ComputeWorldValue(buffer.First())); } BufferEntry upper = buffer[upperboundidx]; BufferEntry lower = buffer[upperboundidx - 1]; return(interp_function(ComputeWorldValue(lower), ComputeWorldValue(upper), (time - lower.time) / (upper.time - lower.time))); }
public static int SkipWhiteCharactersBackward(BufferEntry entry, int position) { byte value; int size, skip; while (true) { byte[] data = entry.GetData(position, out size, out skip); int index = position - skip; while (index >= 0) { value = data[index]; if (value != ' ' && value != '\r' && value != '\n' && value != '\t') { return(position); } index--; position--; } } }
/// <summary> /// Gets a thumb from the list /// </summary> /// <param name="index">Index of the thumb</param> /// <param name="UseBuffer">If true, it will add the file to the buffer</param> /// <returns>The thumb or null if not found</returns> public BitmapEx this[int index, bool UseBuffer = true] { get { if (index < 0 || index >= Entries.Count || !MainStream.CanRead) { return(null); } tmpBuff = Buffer.FirstOrDefault(t => t.Index == index); if (tmpBuff != null) { return(tmpBuff.Value); } MainStream.Position = Entries[index].Begin; if (UseBuffer) { tmpBmp = (BitmapEx)formatter.Deserialize(MainStream); Buffer.Enqueue(new BufferEntry(index, tmpBmp)); return(tmpBmp); } else { return((BitmapEx)formatter.Deserialize(MainStream)); } } set { if (index >= 0 && index < Entries.Count && MainStream.CanWrite) { MainStream.Position = Entries[index].Begin; formatter.Serialize(MainStream, value); } } }
/* * Function: UpdatePeek * Description: Update the value of the current peek location with the contents of a BufferEntry */ public bool UpdatePeek(BufferEntry be) { //lock (_lck) //{ //lock (PeekData) //{ if (!_valid[peekloc]) { DebugFunctions.push_interrupt(DebugFunctions.Errors.PACKET_BUFFER_INVALID); return(false); } _tkeep[peekloc] = be.Tkeep; _tlast[peekloc] = be.Tlast; _tdata_0[peekloc] = be.Tdata0; _tdata_1[peekloc] = be.Tdata1; _tdata_2[peekloc] = be.Tdata2; _tdata_3[peekloc] = be.Tdata3; _tuser_hi[peekloc] = be.TuserHi; _tuser_low[peekloc] = be.TuserLow; return(true); //} //} }
internal static void Send() { bool wasenabled = false; if (Uszka.Kernel.debugger.enabled) { Uszka.Kernel.debugger.enabled = false; wasenabled = true; } ensureQueueExists(); int _deltaT = 0; int second = 0; while (!(queue.Count < 1)) { if (_deltaT != Cosmos.HAL.RTC.Second) { second++; _deltaT = Cosmos.HAL.RTC.Second; } if (second >= 4) { debugger.Send("No response in 4 secondes..."); break; } //foreach (BufferEntry entry in queue) for (int e = 0; e < queue.Count; e++) { BufferEntry entry = queue[e]; if (entry.Status == BufferEntry.EntryStatus.ADDED) { //Need to figure how this is working if (Config.IsLocalAddress(entry.Packet.DestinationIP) == false) { entry.nextHop = Config.FindRoute(entry.Packet.DestinationIP); if (entry.nextHop == null) { entry.Status = BufferEntry.EntryStatus.DONE; continue; } if (ARPCache.Contains(entry.nextHop) == true) { entry.Packet.DestinationMAC = ARPCache.Resolve(entry.nextHop); entry.NIC.QueueBytes(entry.Packet.RawData); entry.Status = BufferEntry.EntryStatus.DONE; } else { ARPRequest_Ethernet arp_request = new ARPRequest_Ethernet(entry.NIC.MACAddress, entry.Packet.SourceIP, MACAddress.Broadcast, entry.nextHop, MACAddress.None); entry.NIC.QueueBytes(arp_request.RawData); entry.Status = BufferEntry.EntryStatus.ROUTE_ARP_SENT; } continue; } if (ARPCache.Contains(entry.Packet.DestinationIP) == true) { entry.Packet.DestinationMAC = ARPCache.Resolve(entry.Packet.DestinationIP); entry.NIC.QueueBytes(entry.Packet.RawData); entry.Status = BufferEntry.EntryStatus.DONE; } else { ARPRequest_Ethernet arp_request = new ARPRequest_Ethernet(entry.NIC.MACAddress, entry.Packet.SourceIP, MACAddress.Broadcast, entry.Packet.DestinationIP, MACAddress.None); entry.NIC.QueueBytes(arp_request.RawData); entry.Status = BufferEntry.EntryStatus.ARP_SENT; } } else if (entry.Status == BufferEntry.EntryStatus.DHCP_REQUEST) { entry.NIC.QueueBytes(entry.Packet.RawData); entry.Status = BufferEntry.EntryStatus.DONE; } else if (entry.Status == BufferEntry.EntryStatus.JUST_SEND) { entry.NIC.QueueBytes(entry.Packet.RawData); entry.Status = BufferEntry.EntryStatus.DONE; } } int i = 0; while (i < queue.Count) { if (queue[i].Status == BufferEntry.EntryStatus.DONE) { queue.RemoveAt(i); } else { i++; } } } if (wasenabled) { Uszka.Kernel.debugger.enabled = true; } }