コード例 #1
0
 public Instruction(OPCODE opcode, int?a, int?b, int?c)
 {
     Opcode = opcode;
     A      = a ?? 0;
     B      = b ?? 0;
     C      = c ?? 0;
 }
コード例 #2
0
        private static GAISWriter HandleReader(GAISReader gr)
        {
            OPCODE op = (OPCODE)gr.ReadInt32();

            switch (op)
            {
            case OPCODE.REGISTER:
                HandleRegister(gr);
                return(null);

            case OPCODE.REMOVE:
                HandleRemove(gr);
                return(null);

            case OPCODE.VIDEO_START:
                return(HandleVideoStart(gr));

            case OPCODE.VIDEO_END:
                return(HandleVideoEnd(gr));

            case OPCODE.VIDEO_UPDATE:
                return(HandleVideoUpdate(gr));

            default:
                return(null);
            }
        }
コード例 #3
0
 public HttpWebSocketFrame(bool fin, bool mask, byte[] maskKey, OPCODE opCode, byte[] payload)
 {
     this.Fin        = fin;
     this.Mask       = mask;
     this.MaskKey    = maskKey;
     this.OpCode     = opCode;
     this.PayloadLen = (uint)payload.Length;
     this.Payload    = payload;
 }
コード例 #4
0
ファイル: DnsHeader.cs プロジェクト: u314B/open.etaxbill.core
        internal bool ParseHeader(byte[] query)
        {
            try
            {
                /*
                 *                              1  1  1  1  1  1
                 * 0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                      ID                       |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    QDCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    ANCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    NSCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    ARCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |
                 | QDCOUNT
                 |  an unsigned 16 bit integer specifying the number of
                 |  entries in the question section.
                 |
                 | ANCOUNT
                 |  an unsigned 16 bit integer specifying the number of
                 |  resource records in the answer section.
                 */

                //----- Parse query headers -----------------------------//
                // Get reply code
                var id          = (query[0] << 8 | query[1]);
                var opcode      = ((query[2] >> 3) & 15);
                var replyCode   = (query[3] & 15);
                var queryCount  = (query[4] << 8 | query[5]);
                var answerCount = (query[6] << 8 | query[7]);
                var nsCount     = (query[8] << 8 | query[9]);
                var arCount     = (query[10] << 8 | query[11]);
                //-------------------------------------------------------//

                m_QID     = id;
                m_OPCODE  = (OPCODE)opcode;
                m_RCODE   = (RCODE)replyCode;
                m_QDCOUNT = queryCount;
                m_ANCOUNT = answerCount;
                m_NSCOUNT = nsCount;
                m_ARCOUNT = arCount;

                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #5
0
 public static bool indexUnused(OPCODE code, int operandIndex)
 {
     if (operandIndex >= 3 || operandIndex < 0)
     {
         throw new IndexOutOfRangeException("There are a maximum of 3 operands!");
     }
     OPTYPES[] validTypes = allowedOperandTypeMap[code];
     if (validTypes != null)
     {
         return(validTypes[operandIndex] == OPTYPES.NONE);
     }
     else
     {
         throw new System.Exception("Opcode not found in dictionary!");
     }
 }
コード例 #6
0
ファイル: VM.cs プロジェクト: FI0r1an/CispSharp
        private void BinaryBoolOperation(OPCODE opcode)
        {
            Data r = false;
            Data a2 = Pop(), a1 = Pop();

            switch (opcode)
            {
            case OPCODE.LT:
                r = a1 < a2;
                break;

            case OPCODE.GT:
                r = a1 > a2;
                break;

            case OPCODE.LE:
                r = a1 <= a2;
                break;

            case OPCODE.GE:
                r = a1 >= a2;
                break;

            case OPCODE.EQ:
                r = ((double)a1 == a2) || ((bool)a1 == a2) || ((string)a1 == a2);
                break;

            case OPCODE.NE:
                r = ((double)a1 != a2) || ((bool)a1 != a2) || ((string)a1 != a2);
                break;

            case OPCODE.OR:
                r = a1 || a2;
                break;

            case OPCODE.XOR:
                r = (bool)a1 != a2;
                break;

            case OPCODE.AND:
                r = a1 && a2;
                break;
            }
            Push(r);
        }
コード例 #7
0
ファイル: VM.cs プロジェクト: FI0r1an/CispSharp
        private void BinaryOperation(OPCODE opcode)
        {
            Data r = 0;
            Data a2 = Pop(), a1 = Pop();

            switch (opcode)
            {
            case OPCODE.ADD:
                r = (double)a1 + a2;
                break;

            case OPCODE.SUB:
                r = (double)a1 - a2;
                break;

            case OPCODE.MUL:
                r = (double)a1 * a2;
                break;

            case OPCODE.DIV:
                if (a2 == 0f)
                {
                    Result = STEP.ERROR;
                }
                r = (double)a1 / a2;
                break;

            case OPCODE.MOD:
                r = (double)a1 % a2;
                break;

            case OPCODE.SHR:
                r = a1 >> a2;
                break;

            case OPCODE.SHL:
                r = a1 << a2;
                break;
            }
            Push(r);
        }
コード例 #8
0
ファイル: VM.cs プロジェクト: FI0r1an/CispSharp
        private void UnaryOperation(OPCODE opcode)
        {
            Data r  = 0;
            Data a1 = Pop();

            switch (opcode)
            {
            case OPCODE.NOT:
                r = !a1;
                break;

            case OPCODE.INC:
                r = a1 + 1f;
                break;

            case OPCODE.DEC:
                r = a1 - 1f;
                break;
            }
            Push(r);
        }
コード例 #9
0
ファイル: Vm.cs プロジェクト: MuranagaTamura/LessVm
        public bool StepRun()
        {
            if (IsEnd)
            {
                return(false);
            }
            if (_itr != null)
            {
                _itr.MoveNext();
                switch (_itr.Current)
                {
                case VmStatus.HALT:
                    IsEnd = true;
                    return(PushError("組み込み関数からHALTを検出しました"));

                case VmStatus.FINISH:
                    _itr = null;
                    SetFromVmStatus(_status);
                    return(true);

                case VmStatus.CONTINUE:
                    return(true);

                default:
                    IsEnd = true;
                    return(PushError("組み込み関数で不正な値が検出されました"));
                }
            }
            if (_code.IsEnd)
            {
                return(false);
            }
            OPCODE op = (OPCODE)_code.ReadByte();

            if (_opTable.TryGetValue(op, out Func <BytecodeStream, bool> opFunc))
            {
                return(opFunc(_code));
            }
            return(PushError($"実行できないOPCODEです => {op}"));
        }
コード例 #10
0
ファイル: Client.cs プロジェクト: Deadknight/GearCamChat
        private void Run()
        {
            while (true)
            {
                try
                {
                    if (tcpClient.Available > 0)
                    {
                        GAISReader gr = new GAISReader(tcpClient.GetStream());

                        OPCODE op = (OPCODE)gr.ReadInt32();

                        switch (op)
                        {
                        case OPCODE.RESPONSE:
                            HandleResponse(gr);
                            break;

                        case OPCODE.VIDEO_START:
                            HandleVideoStart(gr);
                            break;

                        case OPCODE.VIDEO_END:
                            HandleVideoEnd(gr);
                            break;

                        case OPCODE.VIDEO_UPDATE:
                            HandleVideoUpdate(gr);
                            break;
                        }
                    }
                }
                catch
                {
                    tcpClient.Close();
                }

                Thread.Sleep(100);
            }
        }
コード例 #11
0
ファイル: Header.cs プロジェクト: Moerty/dnstools
        public override string ToString()
        {
            switch (QR)
            {
            case DNS.QR.Q:
                return(string.Format("Request: {0}",
                                     OPCODE.ToString()
                                     ));

            case DNS.QR.R:
                return(string.Format("{0}: {1} RD={2} RA={3} {4} {5}",
                                     (AA ? "Authoritative Response" : "Non-Authoritative Response"),
                                     OPCODE.ToString(),
                                     (RD ? "1" : "0"),
                                     (RA ? "1" : "0"),
                                     RCODE.ToString(),
                                     (TC ? "TRUNCATED " : "")
                                     ));
            }
            // throw new InvalidOperationException("Unexpected QR value.");
            // CA1065	Do not raise exceptions in unexpected locations
            return(null);
        }
コード例 #12
0
ファイル: Dns_Header.cs プロジェクト: ramonsmits/emailsender
 /// <summary>
 ///
 /// </summary>
 /// <param name="id"></param>
 /// <param name="opcode"></param>
 public Dns_Header(int id, OPCODE opcode)
 {
     m_QID     = id;
     m_OPCODE  = opcode;
     m_QDCOUNT = 1;
 }
コード例 #13
0
 public Instruction(OPCODE opCODE, List <MODE> modes, List <int> parameters)
 {
     this.OpCode     = opCODE;
     this.Modes      = modes;
     this.Parameters = parameters;
 }
コード例 #14
0
 public CODETYPE getTypeForOpCode(OPCODE code)
 {
     return(typeMap[code]);
 }
コード例 #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <param name="opcode"></param>
 public Dns_Header(int id,OPCODE opcode)
 {
     m_QID     = id;
     m_OPCODE  = opcode;
     m_QDCOUNT = 1;
 }
コード例 #16
0
        internal bool ParseHeader(byte[] query)
        {
            try
            {
                /*
                                                1  1  1  1  1  1
                  0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                      ID                       |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    QDCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    ANCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    NSCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                 |                    ARCOUNT                    |
                 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

                QDCOUNT
                    an unsigned 16 bit integer specifying the number of
                    entries in the question section.

                ANCOUNT
                    an unsigned 16 bit integer specifying the number of
                    resource records in the answer section.
                */

                //----- Parse query headers -----------------------------//
                // Get reply code
                int id          = (query[0]  << 8 | query[1]);
                int opcode      = ((query[2] >> 3) & 15);
                int replyCode   = (query[3]  & 15);
                int queryCount  = (query[4]  << 8 | query[5]);
                int answerCount = (query[6]  << 8 | query[7]);
                int nsCount     = (query[8]  << 8 | query[9]);
                int arCount     = (query[10] << 8 | query[11]);
                //-------------------------------------------------------//

                m_QID     = id;
                m_OPCODE  = (OPCODE)opcode;
                m_RCODE   = (RCODE)replyCode;
                m_QDCOUNT = queryCount;
                m_ANCOUNT = answerCount;
                m_NSCOUNT = nsCount;
                m_ARCOUNT = arCount;

                return true;
            }
            catch{
                return false;
            }
        }
コード例 #17
0
 public Instruction(OPCODE opcode, int argument)
 {
     this.opcode   = opcode;
     this.argument = argument;
 }
コード例 #18
0
ファイル: Dns_Client.cs プロジェクト: ramonsmits/emailsender
        /// <summary>
        /// Parses answer.
        /// </summary>
        /// <param name="reply"></param>
        /// <param name="queryID"></param>
        /// <returns>Returns Dns_Answer[] collection if answer parsed successfully or throws exception if failed.</returns>
        private DnsServerResponse ParseAnswers(byte[] reply, int queryID)
        {
            //--- Parse headers ------------------------------------//

            /*
             *                                                              1  1  1  1  1  1
             * 0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                      ID                       |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    QDCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    ANCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    NSCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    ARCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |
             | QDCOUNT
             |      an unsigned 16 bit integer specifying the number of
             |      entries in the question section.
             |
             | ANCOUNT
             |      an unsigned 16 bit integer specifying the number of
             |      resource records in the answer section.
             */

            // Get reply code
            int    id          = (reply[0] << 8 | reply[1]);
            OPCODE opcode      = (OPCODE)((reply[2] >> 3) & 15);
            RCODE  replyCode   = (RCODE)(reply[3] & 15);
            int    queryCount  = (reply[4] << 8 | reply[5]);
            int    answerCount = (reply[6] << 8 | reply[7]);
            int    nsCount     = (reply[8] << 8 | reply[9]);
            int    arCount     = (reply[10] << 8 | reply[11]);

            //---- End of headers ---------------------------------//

            // Check that it's query what we want
            if (queryID != id)
            {
                throw new Exception("This isn't query with ID what we expected");
            }

            int pos = 12;

            //----- Parse question part ------------//
            for (int q = 0; q < queryCount; q++)
            {
                string dummy = "";
                GetQName(reply, ref pos, ref dummy);
                //qtype + qclass
                pos += 4;
            }
            //--------------------------------------//


            /*
             *                                                         1  1  1  1  1  1
             * 0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                                               |
             | /                                               /
             | /                      NAME                     /
             |                                               |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                      TYPE                     |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                     CLASS                     |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                      TTL                      |
             |                                               |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                   RDLENGTH                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
             | /                     RDATA                     /
             | /                                               /
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             */

            ArrayList answers = new ArrayList();

            //---- Start parsing aswers ------------------------------------------------------------------//
            for (int i = 0; i < answerCount; i++)
            {
                string name = "";
                if (!GetQName(reply, ref pos, ref name))
                {
                    throw new Exception("Error parisng anser");
                }

                int type     = reply[pos++] << 8 | reply[pos++];
                int rdClass  = reply[pos++] << 8 | reply[pos++];
                int ttl      = reply[pos++] << 24 | reply[pos++] << 16 | reply[pos++] << 8 | reply[pos++];
                int rdLength = reply[pos++] << 8 | reply[pos++];

                object answerObj = null;
                switch ((QTYPE)type)
                {
                case QTYPE.A:
                    answerObj = ParseARecord(reply, ref pos, rdLength);
                    pos      += rdLength;
                    break;

                case QTYPE.NS:
                    answerObj = ParseNSRecord(reply, ref pos, rdLength);
                    //	pos += rdLength;
                    break;

                case QTYPE.CNAME:
                    answerObj = ParseCNAMERecord(reply, ref pos, rdLength);
                    //	pos += rdLength;
                    break;

                case QTYPE.PTR:
                    answerObj = ParsePTRRecord(reply, ref pos, rdLength);
                    //	pos += rdLength;
                    break;

                case QTYPE.MX:
                    answerObj = ParseMxRecord(reply, ref pos);
                    break;

                case QTYPE.TXT:
                    answerObj = ParseTXTRecord(reply, ref pos, rdLength);
                    break;

                case QTYPE.AAAA:
                    answerObj = ParseAAAARecord(reply, ref pos, rdLength);
                    pos      += rdLength;
                    break;

                default:
                    answerObj = "dummy";                             // Dummy place holder for now
                    pos      += rdLength;
                    break;
                }

                // Add answer to answer list
                if (answerObj != null)
                {
                    answers.Add(answerObj);
                }
            }
            //-------------------------------------------------------------------------------------------//

            return(new DnsServerResponse(true, replyCode, answers));
        }
コード例 #19
0
        /// <summary>
        /// Parses query.
        /// </summary>
        /// <param name="reply">Dns server reply.</param>
        /// <param name="queryID">Query id of sent query.</param>
        /// <returns></returns>
        private DnsServerResponse ParseQuery(byte[] reply, int queryID)
        {
            //--- Parse headers ------------------------------------//

            /* RFC 1035 4.1.1. Header section format
             *
             *                                                                          1  1  1  1  1  1
             *            0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                      ID                       |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    QDCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    ANCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    NSCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |                    ARCOUNT                    |
             +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
             |
             |          QDCOUNT
             |                  an unsigned 16 bit integer specifying the number of
             |                  entries in the question section.
             |
             |          ANCOUNT
             |                  an unsigned 16 bit integer specifying the number of
             |                  resource records in the answer section.
             |
             |          NSCOUNT
             |              an unsigned 16 bit integer specifying the number of name
             |  server resource records in the authority records section.
             |
             |          ARCOUNT
             |              an unsigned 16 bit integer specifying the number of
             |  resource records in the additional records section.
             |
             */

            // Get reply code
            int    id                     = (reply[0] << 8 | reply[1]);
            OPCODE opcode                 = (OPCODE)((reply[2] >> 3) & 15);
            RCODE  replyCode              = (RCODE)(reply[3] & 15);
            int    queryCount             = (reply[4] << 8 | reply[5]);
            int    answerCount            = (reply[6] << 8 | reply[7]);
            int    authoritiveAnswerCount = (reply[8] << 8 | reply[9]);
            int    additionalAnswerCount  = (reply[10] << 8 | reply[11]);

            //---- End of headers ---------------------------------//

            // Check that it's query what we want
            if (queryID != id)
            {
                throw new Exception("This isn't query with ID what we expected");
            }

            int pos = 12;

            //----- Parse question part ------------//
            for (int q = 0; q < queryCount; q++)
            {
                string dummy = "";
                GetQName(reply, ref pos, ref dummy);
                //qtype + qclass
                pos += 4;
            }
            //--------------------------------------//

            // 1) parse answers
            // 2) parse authoritive answers
            // 3) parse additional answers
            List <DNS_rr_base> answers            = ParseAnswers(reply, answerCount, ref pos);
            List <DNS_rr_base> authoritiveAnswers = ParseAnswers(reply, authoritiveAnswerCount, ref pos);
            List <DNS_rr_base> additionalAnswers  = ParseAnswers(reply, additionalAnswerCount, ref pos);

            return(new DnsServerResponse(true, replyCode, answers, authoritiveAnswers, additionalAnswers));
        }
コード例 #20
0
 public Loader Write(ushort address, OPCODE opcode, string label = null)
 {
     return(Write(address, (byte)opcode, label));
 }
コード例 #21
0
 public Instruction(OPCODE opcode, string target)
 {
     this.opcode = opcode;
     this.target = target;
 }
コード例 #22
0
        ///* instruction decoding */

        static void mkdecode( OPCODE[] big, OPCODE[] lit)
        {
            foreach(var op in lit)
            {
                int n = (~ op.mask) & 0xFFFF;
                for( int i = 0 ; i <= n ; i++)
                {
                    big[op.encoding | i] = op;
                }
            }
        }
コード例 #23
0
        static void Main(string[] args)
        {
            string input = String.Empty;

            help();
            bool bRunning = true;

            while (bRunning)
            {
                try
                {
                    switch (state)
                    {
                    case SPISTATE.SYNC:
                        Console.Write("\n>");
                        input = Console.ReadLine();
                        if (input == "quit")
                        {
                            bRunning = false; break;
                        }
                        if (input == "help")
                        {
                            help(); break;
                        }
                        if (input == "list")
                        {
                            listOpcodes(); break;
                        }
                        OPCODE opcode  = (OPCODE)Byte.Parse(input, System.Globalization.NumberStyles.HexNumber);
                        string command = Enum.GetName(typeof(OPCODE), opcode);
                        if (command == null)
                        {
                            Console.WriteLine("Command not implemented!");
                            continue;
                        }
                        Console.WriteLine(command);
                        Console.WriteLine(sendSPIByte((byte)opcode));
                        break;

                    case SPISTATE.WAIT_HIBYTE:
                        Console.Write("\n>HIBYTE>");
                        input = Console.ReadLine();
                        if (input == "quit")
                        {
                            bRunning = false; break;
                        }
                        if (input == "help")
                        {
                            help(); break;
                        }
                        if (input == "list")
                        {
                            listOpcodes(); break;
                        }
                        byte hibyte = Byte.Parse(input, System.Globalization.NumberStyles.HexNumber);
                        Console.WriteLine(String.Format("{0:x2}", sendSPIByte(hibyte)));
                        break;

                    case SPISTATE.WAIT_LOBYTE:
                        Console.Write("\n>LOBYTE>");
                        input = Console.ReadLine();
                        if (input == "quit")
                        {
                            bRunning = false; break;
                        }
                        if (input == "help")
                        {
                            help(); break;
                        }
                        if (input == "list")
                        {
                            listOpcodes(); break;
                        }
                        byte lobyte = Byte.Parse(input, System.Globalization.NumberStyles.HexNumber);
                        Console.WriteLine(String.Format("{0:x2}", sendSPIByte(lobyte)));

                        Console.WriteLine(String.Format("Complete data for opcode {0:x2} is {1:x4}", currentOpcode, currentData));
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Not Understood!");
                }
            }
        }
コード例 #24
0
 public Loader Write(OPCODE opcode, string label = null)
 {
     return(Write((byte)opcode, label));
 }
コード例 #25
0
 public Instruction(OPCODE opcode)
 {
     this.opcode = opcode;
 }
コード例 #26
0
 public void AddInstruction(OPCODE opcode) => this.Add(opcode);
コード例 #27
0
ファイル: Computer.cs プロジェクト: weber-knecht/AoC2019
        public Instruction CreateInstruction(int positionPointer)
        {
            int memoryValue = this.Memory[positionPointer];

            string opCodeMode = memoryValue.ToString("D5");

            OPCODE      code  = (OPCODE)int.Parse(opCodeMode.Substring(3, 2));
            List <MODE> modes = new List <MODE>();

            MODE modeParam1;
            MODE modeParam2;
            MODE modeParam3;

            List <int> parameters = new List <int>();

            switch (code)
            {
            case OPCODE.add:
                modeParam1 = (MODE)int.Parse(opCodeMode.Substring(2, 1));
                modeParam2 = (MODE)int.Parse(opCodeMode.Substring(1, 1));
                modeParam3 = (MODE)int.Parse(opCodeMode.Substring(0, 1));

                modes.Add(modeParam1);
                modes.Add(modeParam2);
                modes.Add(modeParam3);

                parameters.Add(this.Memory[positionPointer + 1]);
                parameters.Add(this.Memory[positionPointer + 2]);
                parameters.Add(this.Memory[positionPointer + 3]);
                break;

            case OPCODE.multiply:
                modeParam1 = (MODE)int.Parse(opCodeMode.Substring(2, 1));
                modeParam2 = (MODE)int.Parse(opCodeMode.Substring(1, 1));
                modeParam3 = (MODE)int.Parse(opCodeMode.Substring(0, 1));

                modes.Add(modeParam1);
                modes.Add(modeParam2);
                modes.Add(modeParam3);

                parameters.Add(this.Memory[positionPointer + 1]);
                parameters.Add(this.Memory[positionPointer + 2]);
                parameters.Add(this.Memory[positionPointer + 3]);
                break;

            case OPCODE.Input:
                modeParam1 = (MODE)int.Parse(opCodeMode.Substring(2, 1));

                modes.Add(modeParam1);

                parameters.Add(this.Memory[positionPointer + 1]);
                break;

            case OPCODE.Output:
                modeParam1 = (MODE)int.Parse(opCodeMode.Substring(2, 1));

                modes.Add(modeParam1);

                parameters.Add(this.Memory[positionPointer + 1]);
                break;

            case OPCODE.finish:
                break;

            default:
                throw new ArgumentException("Create Instruction: Unkown IntCode: " + code.ToString());
            }

            return(new Instruction(code, modes, parameters));
        }