static void InputBufferDynamic()
        {
            String input          = ""; //User input1
            uint   currentAddress = 0;
            uint   line1          = 0;
            uint   line2          = 0;
            uint   line3          = 0;

            //Stopwatch to test execution time
            Stopwatch stopWatch = Stopwatch.StartNew();

            Parser            myParser       = new Parser("", 0);
            TextBufferDynamic tempTextBuffer = new TextBufferDynamic(); //Create temp buffer
            Doublylinked      inputList      = new Doublylinked();      // My text buffer
            DoubleLinkedList  headOfList     = new DoubleLinkedList();  //First node

            while (!input.Equals("q", StringComparison.InvariantCultureIgnoreCase))
            {
                inputList.ResetIndex();
                Console.Write("");
                input = Console.ReadLine();                   //Read input string
                input = input.Replace(" ", "");               //remove space between words

                myParser = new Parser(input, currentAddress); //Sent input token to parser
                //Console.WriteLine("Line 1 is " + myParser.line1 + "Line 2 is " + myParser.line2 + "Line 3 is " + myParser.line3);
                //Console.WriteLine("Current Address is " + currentAddress);

                if (myParser.accept != true && myParser.line1 != 0) // if only one address is enter
                {
                    line1 = myParser.line1;
                }
                else if (myParser.accept)
                {
                    if (line1 != 0)
                    {
                        line2 = myParser.line1;
                    }
                    else
                    {
                        line1 = myParser.line1;
                        line2 = myParser.line2;
                        line3 = myParser.line3;
                    }
                }

                //After parser read the command the switch statement help it choose what to do
                if (myParser.accept)
                {
                    switch (myParser.command)
                    {
                    case 'a':

                        while (input[0] != '.')
                        {
                            input = Console.ReadLine();

                            if (input[0] == '.')
                            {
                                uint totalLine = inputList.GetIndex();
                                unsafe
                                {
                                    tempTextBuffer.Append(line1, headOfList, totalLine, &currentAddress);
                                }
                                headOfList.head = null;

                                break;
                            }

                            inputList.InsertLast(headOfList, input);
                        }
                        break;

                    case 'c':

                        while (input[0] != '.')
                        {
                            input = Console.ReadLine();

                            if (input[0] == '.')
                            {
                                uint totalLine = inputList.GetIndex();
                                unsafe
                                {
                                    tempTextBuffer.Change(line1, line2, headOfList, totalLine, &currentAddress);
                                }

                                headOfList.head = null;

                                break;
                            }

                            inputList.InsertLast(headOfList, input);
                        }
                        break;

                    case 'd':

                        unsafe
                        {
                            tempTextBuffer.Delete(line1, line2, &currentAddress);
                        }
                        headOfList.head = null;

                        break;

                    case 'j':
                        unsafe
                        {
                            tempTextBuffer.Join(line1, line2, &currentAddress);
                        }
                        headOfList.head = null;

                        break;

                    case 'l':
                        unsafe
                        {
                            tempTextBuffer.List(line1, line2, &currentAddress);
                        }
                        headOfList.head = null;

                        break;

                    case 'm':
                        unsafe
                        {
                            tempTextBuffer.Move(line1, line2, line3, &currentAddress);
                        }
                        headOfList.head = null;

                        break;

                    case 'n':
                        unsafe
                        {
                            tempTextBuffer.number(line1, line2, &currentAddress);
                        }
                        headOfList.head = null;

                        break;

                    case 'p':

                        if (line1 != 0 && line2 != 0)
                        {
                            tempTextBuffer.PrintLine(line1, line2, headOfList);
                            headOfList.head = null;
                        }

                        break;

                    case 't':
                        unsafe
                        {
                            tempTextBuffer.Transfer(line1, line2, line3, &currentAddress);
                        }
                        headOfList.head = null;

                        break;

                    case 'w':

                        tempTextBuffer.Write(myParser.para);
                        headOfList.head = null;

                        break;

                    case 'e':
                        stopWatch.Start();
                        tempTextBuffer.Edit(myParser.para);
                        stopWatch.Stop();
                        Console.WriteLine("File load time is " + stopWatch.ElapsedMilliseconds + "ms");
                        headOfList.head = null;

                        break;

                    default:
                        Console.WriteLine("Wrong command");
                        break;
                    }

                    line1 = 0;
                    line2 = 0;
                    line3 = 0;
                }
            }
        }
        /* Copies lines from line1 through line2 and inserts them after line3. For single argument, transfer that one line. */
        public unsafe void Transfer(uint line1, uint line2, uint line3, uint *mainbufferLine)
        {
            {
                uint             index          = line1;
                uint             index2         = line2;
                uint             index3         = line3;
                Doublylinked     tempList       = new Doublylinked();              // Temp helper list
                DoubleLinkedList tempheadOfList = new DoubleLinkedList();          // Temp helper list's first node

                if (line1 >= 1 && line2.Equals(0) && line3 >= 0 && line3 != line1) //is line 2 is 0 then only transfer one line
                {
                    if (headOfList.head != null && line1.Equals(1))                //If location is line 1
                    {
                        tempList.InsertLast(tempheadOfList, headOfList.head.memory.ToString());
                        Append(line3 - 1, tempheadOfList, 0, mainbufferLine); //need to rest set memory each time or creat
                        numberLine     = textBufferList.GetIndex();           // Get the current line number
                        currentAddress = line3 + 1;
                        *mainbufferLine = textBufferList.GetIndex();
                    }
                    else if (line3 >= 1)
                    {
                        DynamicStringLinkNode temp  = headOfList.head; // use to locate line 1 location
                        DynamicStringLinkNode temp2 = headOfList.head;
                        index--;                                       //for line 1 location
                        index3--;
                        while (temp != null && index != 0)             //This while loop is use to locate line 1 string in text buffer
                        {
                            index--;
                            temp = temp.next;                // line1 loaction node, we will copy this node's tring to temp
                        }
                        while (temp2 != null && index3 != 0) //This while loop is use to locate line 3
                        {
                            index3--;
                            temp2 = temp2.next;                                    // line 3 loaction node string
                        }
                        textBufferList.InsertAfter(temp2, temp.memory.ToString()); // Insert line 1 string after line 3
                        numberLine     = textBufferList.GetIndex();                // Get the current line number
                        currentAddress = line3 + 1;
                        *mainbufferLine = textBufferList.GetIndex();
                    }
                    else if (line3.Equals(0))
                    {
                        DynamicStringLinkNode temp = headOfList.head; // use to locate line 1 location
                        index--;                                      //for line 1 location
                        index3--;
                        while (temp != null && index != 0)            //This while loop is use to locate line 1 string in text buffer
                        {
                            index--;
                            temp = temp.next;                                           // line1 loaction node, we will copy this node's tring to temp
                        }
                        textBufferList.InsertFront(headOfList, temp.memory.ToString()); // Insert line 1 string after line 3
                        numberLine     = textBufferList.GetIndex();                     // Get the current line number
                        currentAddress = line3;
                        *mainbufferLine = textBufferList.GetIndex();
                    }
                }
                else if (line1 >= 1 && line2.Equals(line1) && line3 >= 1 && line3 != line1) // if line 1 = line2
                {
                    if (headOfList.head != null && line1.Equals(1))                         //If location is line 1
                    {
                        tempList.InsertLast(tempheadOfList, headOfList.head.memory.ToString());
                        Append(line3 - 1, tempheadOfList, 0, mainbufferLine); //need to rest set memory each time or creat
                        numberLine     = textBufferList.GetIndex();           // Get the current line number
                        currentAddress = line3 + 1;
                        *mainbufferLine = textBufferList.GetIndex();
                    }
                    else
                    {
                        DynamicStringLinkNode temp  = headOfList.head; // use to locate line 1 location
                        DynamicStringLinkNode temp2 = headOfList.head; // use to locate line 3 string
                        index--;                                       //for line 1 location
                        index3--;
                        while (temp != null && index != 0)             //This while loop is use to locate line 1 string in text buffer
                        {
                            index--;
                            temp = temp.next;                // line1 loaction node, we will copy this node's tring to temp
                        }
                        while (temp2 != null && index3 != 0) //Thi1s while loop is use to locate line 3
                        {
                            index3--;
                            temp2 = temp2.next;                                    // line 3 loaction node string
                        }
                        textBufferList.InsertAfter(temp2, temp.memory.ToString()); // Insert line 1 string after line 3
                        numberLine     = textBufferList.GetIndex();                // Get the current line number
                        currentAddress = line3 + 1;
                        *mainbufferLine = textBufferList.GetIndex();
                    }
                }
                else if (line2 > line1) // copy line 1 throut line 2 and inser after line 3
                {
                    if (line3.Equals(0))
                    {
                        index  = line1 - 1;
                        index2 = (line2 - line1 + 1);
                        DynamicStringLinkNode temp  = headOfList.head; // use to locate line 1 location
                        DynamicStringLinkNode temp2 = headOfList.head; // use to locate line 3 string

                        index3--;

                        while (temp != null && index != 0) //If location is line 1. Copy line 1 thorough line 2
                        {
                            temp = temp.next;
                            index--;
                        }

                        while (temp != null && index2 != 0) //If location is line 1. Copy line 1 thorough line 2
                        {
                            tempList.InsertLast(tempheadOfList, temp.memory.ToString());
                            temp = temp.next; // line1 loaction node, we will copy this node's tring to temp
                            index2--;
                        }
                        Append(9999, tempheadOfList, 0, mainbufferLine);
                        numberLine     = textBufferList.GetIndex(); // Get the current line number
                        currentAddress = line3 + (line2 - line1 + 1);
                        *mainbufferLine = textBufferList.GetIndex();
                    }
                    else
                    {
                        index  = line1 - 1;
                        index2 = (line2 - line1 + 1);
                        DynamicStringLinkNode temp  = headOfList.head; // use to locate line 1 location
                        DynamicStringLinkNode temp2 = headOfList.head; // use to locate line 3 string

                        index3--;

                        while (temp != null && index != 0) //If location is line 1. Copy line 1 thorough line 2
                        {
                            temp = temp.next;
                            index--;
                        }

                        while (temp != null && index2 != 0) //If location is line 1. Copy line 1 thorough line 2
                        {
                            tempList.InsertLast(tempheadOfList, temp.memory.ToString());
                            temp = temp.next; // line1 loaction node, we will copy this node's tring to temp
                            index2--;
                        }

                        Append(line3, tempheadOfList, 0, mainbufferLine);
                        numberLine     = textBufferList.GetIndex(); // Get the current line number
                        currentAddress = line3 + (line2 - line1 + 1);
                        *mainbufferLine = textBufferList.GetIndex();
                    }
                }
                else
                {
                    Console.WriteLine("Line index error");
                }
            }
        }