예제 #1
0
        public static OpcodeList GetOpcodeListXX()
        {
            var results = new OpcodeList();

            using (var ds = ReadOpcodeList("crudwork.DynamicRuntime.Resources.Opcodes.xml"))
                using (var dt = ds.Tables[0])
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        byte?  value1 = FromHex(dr["HexValue"]);
                        byte?  value2 = FromHex(dr["HexValue2"]);
                        string name   = dr["Name"].ToString();

                        #region Sanity Checks
                        if (!value1.HasValue)
                        {
                            throw new ArgumentNullException("value1", "value1 cannot be null");
                        }
                        if (string.IsNullOrEmpty(name))
                        {
                            throw new ArgumentNullException("name", "name cannot be null");
                        }
                        #endregion

                        results.Add(new Opcode(value1.Value, value2, name));
                    }
                }

            Debug.Assert(results.Count == 219, "Expecting 218 opcodes total; but found " + results.Count);
            return(results);
        }
예제 #2
0
        public static OpcodeList GetOpcodeList()
        {
            var results = new OpcodeList();

            using (var ds = ReadOpcodeList("crudwork.DynamicRuntime.Resources.Opcodes.xml"))
                using (var dt = ds.Tables[0])
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string name    = dr["Name"].ToString();
                        string opValue = dr["OpValue"].ToString();
                        byte[] bytes   = ToByteArray(opValue.Split(','));

                        #region Sanity Checks
                        if (string.IsNullOrEmpty(name))
                        {
                            throw new ArgumentNullException("name cannot be null", "name");
                        }
                        if (string.IsNullOrEmpty(opValue))
                        {
                            throw new ArgumentNullException("OpValue cannot be null", "OpValue");
                        }
                        #endregion

                        results.Add(new Opcode(bytes[0], bytes.Length == 2 ? bytes[1] : (byte?)null, name));
                    }
                }

            Debug.Assert(results.Count == 219, "Expecting 218 opcodes total; but found " + results.Count);
            return(results);
        }