using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace InsertErase { class Program { // Outputs the contents of Packet with Text prefix static void DisplayContents(mn.Packet Packet, string Text) { // Move cursor to start of packet Packet.SetCursor(0); // Return string containing contents of packet string Contents = Packet.GetString(Packet.GetUsedSize(),true); // Write packet contents to screen Console.WriteLine(Text); Console.WriteLine(Contents); } static void Main() { // Create packet containing "Hello World" mn.Packet Packet = new mn.Packet("Hello World"); DisplayContents(Packet, "Packet before inserting 'Big':"); // Create empty space after hello Packet.SetCursor(5); Packet.Insert(4); Packet.AddString(" Big", 0, false); DisplayContents(Packet, "Packet after inserting 'Big':"); // Erase the word big Packet.Erase(6, 4); DisplayContents(Packet, "Packet after erasing 'Big':"); // Exit Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } }