예제 #1
0
 private VariableInfo(RegType registerType, int size, VariableClass @class, VariableFlags flags, string name)
 {
     this._registerType = registerType;
     this._size = (byte)size;
     this._class = @class;
     this._flags = flags;
     this._name = name;
 }
예제 #2
0
            public void Add(RegType type, string name, int number, RegisterUsage usage)
            {
                foreach (var entry in mEntries)
                {
                    if (entry.type == type && entry.name == name && entry.number == number)
                    {
                        if (entry.usage != usage)
                        {
                            throw new InvalidOperationException("Cannot use register in multiple ways yet (mat4/vec4)");
                        }
                        return;
                    }
                }

                {
                    var entry = new Entry();
                    entry.type   = type;
                    entry.name   = name;
                    entry.number = number;
                    entry.usage  = usage;
                    mEntries.Add(entry);
                }
            }
예제 #3
0
        /// <summary>
        /// Construct a register with the specified register attributes
        /// </summary>
        /// <param name="name">register name</param>
        /// <param name="offset">offset (BAR offset for memory mapped register)</param>
        /// <param name="bfType">enumerated type of BitFields contained by this register.</param>
        /// <param name="regType">register type/attribute (one or more bits from RegType, e.g. Cmd|RO).</param>
        /// <param name="driver">The default driver the register uses to read/write.</param>
        protected RegBase(string name, Int32 offset, Type bfType, RegType regType, IRegDriver driver)
        {
            mName    = name;
            mOffset  = offset;
            mBFType  = bfType;
            mDriver  = driver;
            mRegType = regType;
            // Simplify various checks... (the masking operations are taking way longer than expected)
            IsReadOnly           = (mRegType & RegType.RO) != 0;
            IsWriteOnly          = (mRegType & RegType.WO) != 0;
            IsVolatileReadWrite  = (mRegType & RegType.VolatileRw) != 0;
            IsNoForce            = (mRegType & RegType.NoForce) != 0;
            IsForceAllowed       = (mRegType & RegType.NoForce) == 0;
            IsNoValue            = (mRegType & RegType.NoValue) != 0;
            IsNoValueFilter      = (mRegType & RegType.NoValueFilter) != 0;
            IsCannotReadDirectly = (mRegType & RegType.CannotReadDirectly) != 0;
            IsCommand            = (mRegType & RegType.Cmd) != 0;
            IsEvent = (mRegType & RegType.Event) != 0;

            // Mark as dirty unless type is NoForce
            mDirty         = IsForceAllowed;
            IsApplyEnabled = true;

            // Be default, registers are NOT memory mapped (typically the memory
            // mapped implementations are Reg32 and Reg64)
            IsMemoryMapped = false;

            // Optionally initialize the cached value from hardware
            if ((mRegType & RegType.InitializeAtCreation) != 0)
            {
// ReSharper disable DoNotCallOverridableMethodsInConstructor
                // I know this is a virtual method -- must be careful in the implementation to only access RegBase objects
                UpdateRegVal();
// ReSharper restore DoNotCallOverridableMethodsInConstructor
            }
        }
예제 #4
0
		private static string PrefixFromType (RegType t, ProgramType pt)
		{
			switch (t) {
			case RegType.Attribute: return "va";
			case RegType.Constant:  return (pt == ProgramType.Vertex) ? "vc" : "fc";
			case RegType.Temporary: return (pt == ProgramType.Vertex) ? "vt" : "ft";
			case RegType.Output:    return "output_";
			case RegType.Varying:   return "v";
			case RegType.Sampler:   return "sampler";
			default:
				throw new InvalidOperationException("Invalid data!");
			}
		}
예제 #5
0
 public RegDef(int nameEnumValue, int barOffset, Type bfEnumType, RegType eRegType, int size)
     : this(nameEnumValue, barOffset, bfEnumType, eRegType, size, null, string.Empty)
 {
 }
예제 #6
0
			public RegisterUsage GetUsage(RegType type, string name, int number)
			{
				foreach (var entry in mEntries) {
					if (entry.type == type && entry.name == name && entry.number == number) {
						return entry.usage;
					}
				}
				return RegisterUsage.Unused;
			}
예제 #7
0
파일: SnsManager.cs 프로젝트: daneric/Scut
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="user"></param>
 /// <param name="password"></param>
 /// <param name="imei"></param>
 /// <param name="userType"></param>
 /// <param name="isCustom">use custom passport</param>
 /// <returns></returns>
 public static int LoginByDevice(string user, string password, string imei, out RegType userType, bool isCustom = false) {
     if (!SnsCenterUser.CheckDevice(imei))
         throw (new Exception("禁止登录"));
     int userId = 0;
     try {
         var snsCenterUser = new SnsCenterUser(user, password, imei);
         var snsUser = snsCenterUser.GetUserInfo(user);
         if (snsUser == null || snsUser.UserId <= 0) {
             Guid gid;
             userType = Guid.TryParse(password, out gid) ? RegType.Guest : RegType.Normal;
             snsCenterUser.RegType = userType;
             userId = snsCenterUser.InsertSnsUser(isCustom);
             //过期移除
             PassportExpired passportExpired;
             bool result = string.IsNullOrEmpty(imei) ? imeiMap.TryRemove(user, out passportExpired) : imeiMap.TryRemove(imei, out passportExpired);
             return userId;
         }
         userType = snsUser.RegType;
         if (snsCenterUser.ValidatePassport(snsUser)) {
             return snsUser.UserId;
         }
     } finally {
         SnsCenterUser.AddLoginLog(imei, user);
     }
     return userId;
 }
예제 #8
0
 public Register(string dName, uint regNum, RegType rType, DataType dType, ByteOrder bOrder)
     : this(dName, regNum, rType, dType)
 {
     byteOrder = bOrder;
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Sns.SnsCenterUser"/> class.
 /// </summary>
 public SnsCenterUser()
 {
     RegType = RegType.Other;
 }
예제 #10
0
 private static extern int RegQueryValueEx(
     UIntPtr keyBase,
     string valueName,
     IntPtr reserved,
     ref RegType type,
     ref int data,
     ref int dataSize);
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sPassportId"></param>
 /// <param name="passportPwd"></param>
 /// <param name="imei"></param>
 public SnsCenterUser(string sPassportId, string passportPwd, string imei)
 {
     _PassportId = sPassportId.ToUpper();
     _PassportPwd = passportPwd;
     _imei = imei;
     RegType = RegType.Guest;
     RetailID = SysetmRetailID;
 }
예제 #12
0
        public LivenessAnalysis(IList <M68kInstruction> code, RegType regType = RegType.Data)
        {
            CfgNode prev = null;

            var defs = new List <string>();

            var nodes = new List <CfgNode>();

            foreach (M68kInstruction t in code)
            {
                var node = new CfgNode();
                nodes.Add(node);
                node.Instruction = t;

                // TODO: For address registers, this is not enough!!

                /*if (code[i].Register2 != null && code[i].Register2.Type == regType)
                 * {
                 *  var def = code[i].Register2.ToString();
                 *  if (!defs.Contains(def))
                 *  {
                 *      defs.Add(def);
                 *  }
                 *  node.Def.Add(def);
                 * }*/

                var idefs = t.Def(regType).ToList();
                foreach (var def in idefs)
                {
                    if (!defs.Contains(def))
                    {
                        defs.Add(def);
                    }
                    node.Def.Add(def);
                }

                if (prev != null &&
                    (!prev.Instruction.IsBranch() ||
                     (prev.Instruction.IsBranch() && prev.Instruction.TargetLabel == node.Instruction.Label) ||
                     prev.Instruction.IsConditionalBranch()))
                {
                    prev.Succ.Add(node);
                    node.Pred.Add(prev);
                }

                //if (t.Opcode != M68kOpcode.Rts)
                if (!t.IsTerminating)
                {
                    prev = node;
                }
                else
                {
                    prev = null;
                }
            }

            for (int i = 0; i < code.Count; i++)
            {
                if (nodes[i].Instruction.IsBranch())
                {
                    foreach (var node in nodes.Where(n => n.Instruction.Opcode == M68kOpcode.Label))
                    {
                        if (nodes[i].Instruction.TargetLabel != null && node.Instruction.Label == nodes[i].Instruction.TargetLabel.Replace("%", ""))
                        {
                            node.Pred.Add(nodes[i]);
                            nodes[i].Succ.Add(node);
                        }
                    }
                }
            }

            IterativeDataFlowAnalysis(nodes, regType);

            _nodes = nodes;
        }
예제 #13
0
 protected BaseVar(int id, int size, RegType registerType, VariableType variableType)
     : base(id, size)
 {
     _registerType = registerType;
     _variableType = variableType;
 }
예제 #14
0
 public MMVar(int id, RegType registerType, VariableType variableType)
     : base(id, 8, registerType, variableType)
 {
 }
예제 #15
0
 protected BaseVar(RegType registerType, VariableType variableType)
 {
     _registerType = registerType;
     _variableType = variableType;
 }
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.Yes;

            dr = MessageBox.Show("确定要重置注册表?", "Aurora智能提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.No)
            {
                return;
            }

            strRC      = CreateSNCode();
            strInputKC = textBox1.Text;

            if (checkBox1.Checked == true)
            {
                strEnctr = EnText(strRC, DateTime.Now.Date.ToString("yyyy-MM-dd") + "hupo");       //学生版
                if (transform(strEnctr, DateTime.Now.Date.ToString("yyyy-MM-dd") + "hupo") == strInputKC)
                {
                    //调用外部程序导cmd命令行,实际上没Diao用
                    Process p = new Process();
                    p.StartInfo.FileName               = "cmd.exe";
                    p.StartInfo.UseShellExecute        = false;
                    p.StartInfo.RedirectStandardInput  = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.CreateNoWindow         = false;
                    p.Start();
                    //向cmd.exe输入command
                    p.StandardInput.WriteLine("ipconfig");
                    p.StandardInput.WriteLine("exit");                                                                                                 //需要有这句,不然程序会挂机

                    RegistryKey MyReg, RegGUIDType, RegType, RegValidGUIDDays, RegValidDays, RegSuccess, RegCodeAllow, RegStartGUIDDate, RegStartDate; //声明注册表对象
                    MyReg = Registry.CurrentUser;                                                                                                      //获取当前用户注册表项
                    try
                    {
                        RegGUIDType = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");//在注册表项中创建子项
                        RegType     = MyReg.CreateSubKey("Software\\Aurora");

                        RegValidGUIDDays = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegValidDays     = MyReg.CreateSubKey("Software\\Aurora");

                        RegCodeAllow     = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegSuccess       = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegStartGUIDDate = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegStartDate     = MyReg.CreateSubKey("Software\\Aurora");

                        RegType.SetValue("nRegFlag", "0");
                        RegValidDays.SetValue("nValidDays", "10");             //重置为初始
                        RegGUIDType.SetValue("nRegGUIDFlag", "0");
                        RegValidGUIDDays.SetValue("nValidGUIDDays", "10");
                        RegCodeAllow.SetValue("RegCodeAllow", "1");
                        RegSuccess.SetValue("RegSuccess", "false");
                        RegStartGUIDDate.SetValue("StartGUIDDate", DateTime.Now.ToString("yyyy-MM-dd"));
                        RegStartDate.SetValue("StartDate", DateTime.Now.ToString("yyyy-MM-dd"));

                        label1.Visible   = true;
                        label1.Text      = "注册表信息已成功恢复初始设置,重启Aurora生效。";
                        label1.TextAlign = ContentAlignment.MiddleCenter;
                        label1.ForeColor = Color.LawnGreen;
                    }
                    catch { }
                }
                else
                {
                    label1.Visible   = true;
                    label1.Text      = "                        注册码输入错误。";
                    label1.TextAlign = ContentAlignment.MiddleCenter;
                    label1.ForeColor = Color.Red;
                }
            }
            else
            {
                strEnctr = EnText(strRC, "ilovetangwei");       //商业版
                if (transform(strEnctr, "ilovetangwei") == strInputKC)
                {
                    //调用外部程序导cmd命令行,实际上没Diao用
                    Process p = new Process();
                    p.StartInfo.FileName               = "cmd.exe";
                    p.StartInfo.UseShellExecute        = false;
                    p.StartInfo.RedirectStandardInput  = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.CreateNoWindow         = false;
                    p.Start();
                    //向cmd.exe输入command
                    p.StandardInput.WriteLine("ipconfig");
                    p.StandardInput.WriteLine("exit");                                                                                                 //需要有这句,不然程序会挂机

                    RegistryKey MyReg, RegGUIDType, RegType, RegValidGUIDDays, RegValidDays, RegSuccess, RegCodeAllow, RegStartGUIDDate, RegStartDate; //声明注册表对象
                    MyReg = Registry.CurrentUser;                                                                                                      //获取当前用户注册表项
                    try
                    {
                        RegGUIDType = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");//在注册表项中创建子项
                        RegType     = MyReg.CreateSubKey("Software\\Aurora");

                        RegValidGUIDDays = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegValidDays     = MyReg.CreateSubKey("Software\\Aurora");

                        RegCodeAllow     = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegSuccess       = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegStartGUIDDate = MyReg.CreateSubKey("Identities\\{D46B7C02-B796-4AAA-9D4F-2188CF2DBA30}");
                        RegStartDate     = MyReg.CreateSubKey("Software\\Aurora");

                        RegType.SetValue("nRegFlag", "0");
                        RegValidDays.SetValue("nValidDays", "10");             //重置为初始
                        RegGUIDType.SetValue("nRegGUIDFlag", "0");
                        RegValidGUIDDays.SetValue("nValidGUIDDays", "10");
                        RegCodeAllow.SetValue("RegCodeAllow", "1");
                        RegSuccess.SetValue("RegSuccess", "false");
                        RegStartGUIDDate.SetValue("StartGUIDDate", DateTime.Now.ToString("yyyy-MM-dd"));
                        RegStartDate.SetValue("StartDate", DateTime.Now.ToString("yyyy-MM-dd"));

                        label1.Visible   = true;
                        label1.Text      = "注册表信息已成功恢复初始设置,重启Aurora生效。";
                        label1.ForeColor = Color.LawnGreen;
                    }
                    catch { }
                }
                else
                {
                    label1.Visible   = true;
                    label1.Text      = "                        注册码输入错误。";
                    label1.ForeColor = Color.Red;
                }
            }
        }
예제 #17
0
 public Register(string dName, uint regNum, RegType rType, DataType dType, ByteOrder bOrder, Representation repr)
     : this(dName, regNum, rType, dType, bOrder)
 {
     Represent = repr;
 }
예제 #18
0
 /// <summary>
 /// 修改:伍张发
 /// </summary>
 /// <param name="sPassportId"></param>
 /// <param name="passportPwd"></param>
 /// <param name="imei"></param>
 public SnsCenterUser(string sPassportId, string passportPwd, string imei)
 {
     _PassportId = sPassportId.ToUpper();
     _PassportPwd = passportPwd;
     _imei = imei;
     RegType = string.IsNullOrEmpty(imei) ? RegType.Normal : RegType.Guest;
     RetailID = SysetmRetailID;
 }
        private void AddAnotherPerson(RegType regType, ref string email, ref int regID)
        {
            RegisterMgr.VerifyHasAddAnotherPersonButton(true);
            RegisterMgr.ClickAddAnotherPerson();

            RegisterMgr.Checkin();
            RegisterMgr.SelectRegType(regType.ToString());
            email = RegisterMgr.CurrentEmail;
            RegisterMgr.Continue();
            RegisterMgr.EnterProfileInfo();

            regID = RegisterMgr.GetRegIdFromSession();
            RegisterMgr.CurrentRegistrationId = regID;

            // Filling in or selecting Custom Fields
            RegisterMgr.SelectPersonalInfoCustomFields();
            RegisterMgr.Continue();

            // Select Agenda Items
            RegisterMgr.SelectAgendaItems();
        }
예제 #20
0
        private static void DumpRegister(StringBuilder buffer, RegType type, int index)
        {
            Contract.Requires(buffer != null);

            switch (type)
            {
            case RegType.GPB_LO:
                if (index < 8)
                    buffer.AppendFormat("{0}", _reg8l[index]);
                else
                    buffer.AppendFormat("r{0}b", index);

                return;

            case RegType.GPB_HI:
                if (index < 8)
                    buffer.AppendFormat("{0}", _reg8h[index]);
                else
                    buffer.AppendFormat("r{0}b", index);

                return;

            case RegType.GPW:
                if (index < 8)
                    buffer.AppendFormat("{0}", _reg16[index]);
                else
                    buffer.AppendFormat("r{0}w", index);

                return;

            case RegType.GPD:
                if (index < 8)
                    buffer.AppendFormat("e{0}", _reg16[index]);
                else
                    buffer.AppendFormat("r{0}d", index);

                return;

            case RegType.GPQ:
                if (index < 8)
                    buffer.AppendFormat("r{0}", _reg16[index]);
                else
                    buffer.AppendFormat("r{0}", index);

                return;

            case RegType.X87:
                buffer.AppendFormat("st{0}", index);
                return;

            case RegType.MM:
                buffer.AppendFormat("mm{0}", index);
                return;

            case RegType.XMM:
                buffer.AppendFormat("xmm{0}", index);
                return;

            default:
                return;
            }
        }
예제 #21
0
 protected BaseReg(RegType type, RegIndex index, int size)
     : this((RegCode)type | (RegCode)index, size)
 {
 }
예제 #22
0
 public static void SetLoginType(ref RegType regType, ref PwdType pwdType, string passportId)
 {
     string sGetSql = "select top 1 RegType,DeviceID,PwdType from SnsUserInfo where PassportId=@aPassportId";
     List<SqlParameter> listTmp = new List<SqlParameter>();
     listTmp.Add(SqlParamHelper.MakeInParam("@aPassportId", SqlDbType.VarChar, 0, passportId));
     SqlParameter[] paramsGet = listTmp.ToArray();
     using (SqlDataReader aReader = SqlHelper.ExecuteReader(config.connectionString, CommandType.Text, sGetSql, paramsGet))
     {
         if (aReader.Read())
         {
             string deviceID = Convert.ToString(aReader["DeviceID"]);
             RegType rt = (RegType)Enum.ToObject(typeof(RegType), Convert.ToInt32(aReader["RegType"]));
             pwdType = (PwdType)Enum.ToObject(typeof(PwdType), Convert.ToInt32(aReader["PwdType"]));
             if (rt == RegType.Other && regType != RegType.Other)
             {
                 //渠道登陆的用户允许更换包登陆
                 regType = string.IsNullOrEmpty(deviceID) ? RegType.Normal : rt;
             }
             else
             {
                 regType = rt;
             }
         }
     }
 }
예제 #23
0
파일: SnsCenterUser.cs 프로젝트: 0jpq0/Scut
        /// <summary>
        /// Sets the type of the login.
        /// </summary>
        /// <param name="regType">Reg type.</param>
        /// <param name="pwdType">Pwd type.</param>
        /// <param name="passportId">Passport identifier.</param>
        public static void SetLoginType(ref RegType regType, ref PwdType pwdType, string passportId)
        {
            var command = ConnectManager.Provider.CreateCommandStruct("SnsUserInfo", CommandMode.Inquiry);
            command.OrderBy = "USERID ASC";
            command.Columns = "RegType,DeviceID,PwdType";
            command.Filter = ConnectManager.Provider.CreateCommandFilter();
            command.Filter.Condition = command.Filter.FormatExpression("PassportId");
            command.Filter.AddParam("PassportId", passportId);
            command.Parser();

            using (var aReader = ConnectManager.Provider.ExecuteReader(CommandType.Text, command.Sql, command.Parameters))
            {
                if (aReader.Read())
                {
                    string deviceID = Convert.ToString(aReader["DeviceID"]);
                    RegType rt = (RegType)Enum.ToObject(typeof(RegType), Convert.ToInt32(aReader["RegType"]));
                    pwdType = (PwdType)Enum.ToObject(typeof(PwdType), Convert.ToInt32(aReader["PwdType"]));
                    if (rt == RegType.Other && regType != RegType.Other)
                    {
                        //渠道登陆的用户允许更换包登陆
                        regType = string.IsNullOrEmpty(deviceID) ? RegType.Normal : rt;
                    }
                    else
                    {
                        regType = rt;
                    }
                }
            }
        }
예제 #24
0
파일: UserDal.cs 프로젝트: Dasiys/mvcDapper
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="companyName"></param>
        /// <param name="password"></param>
        /// <param name="contact"></param>
        /// <param name="regType"></param>
        /// <returns></returns>
        public int AddUser(string mobile, string companyName, string password, string contact, RegType regType)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("Mobile", mobile);
            param.Add("@CompanyName", companyName);
            param.Add("Password", password);
            param.Add("Contact", contact);
            param.Add("RegType", regType);
            return(ExcuteProc("Proc_RegAdd", param));
        }
예제 #25
0
 public RegDef(int nameEnumValue, int barOffset, Type bfEnumType, RegType eRegType, Type regImplementationType, string condition)
     : this(nameEnumValue, barOffset, bfEnumType, eRegType, DEFAULT_REG_SIZE, regImplementationType, condition)
 {
 }
예제 #26
0
        public MemoryMap(byte[] memory, string family, string pathUnityTest = "")
        {
            this.memory        = memory;
            this.registersObjs = new Dictionary <string, dynamic>();

            isUnityTest = !string.IsNullOrEmpty(pathUnityTest);

            // Read MTU family XML and prepare setters and getters
            Configuration config     = Configuration.GetInstance(pathUnityTest);
            XmlSerializer serializer = new XmlSerializer(typeof(MemRegisterList));

            // Parameter "family" when testing is full path to use
            string path = (!isUnityTest) ?
                          Path.Combine(config.GetBasePath(), XML_PREFIX + family + XML_EXTENSION) :
                          Path.Combine(pathUnityTest, family + XML_EXTENSION);

            using (TextReader reader = new StreamReader(path))
            {
                MemRegisterList list = Validations.DeserializeXml <MemRegisterList> (reader);

                #region Registers

                if (list.Registers != null)
                {
                    foreach (MemRegister xmlRegister in list.Registers)
                    {
                        try {
                            // TEST: PARA PODER CAPTURAR LA EJECUCION EN UN REGISTRO CONCRETO
                            //if ( string.Equals ( xmlRegister.Id, "P1MeterId" ) )
                            //{
                            //    { }
                            //}

                            RegType type    = ( RegType )Enum.Parse(typeof(RegType), xmlRegister.Type.ToUpper());
                            Type    SysType = typeof(System.Object);

                            switch (type)
                            {
                            case RegType.INT: SysType = typeof(int); break;

                            case RegType.UINT: SysType = typeof(uint); break;

                            case RegType.ULONG: SysType = typeof(ulong); break;

                            case RegType.BOOL: SysType = typeof(bool); break;

                            case RegType.CHAR: SysType = typeof(char); break;

                            case RegType.STRING: SysType = typeof(string); break;
                            }

                            // Creates an instance of the generic class
                            dynamic memoryRegister = Activator.CreateInstance(typeof(MemoryRegister <>)
                                                                              .MakeGenericType(SysType),
                                                                              xmlRegister.Id,
                                                                              type,
                                                                              xmlRegister.Description,
                                                                              xmlRegister.Address,
                                                                              xmlRegister.Size,
                                                                              xmlRegister.WriteAsBool,
                                                                              xmlRegister.Custom_Get,
                                                                              xmlRegister.Custom_Set);

                            // Is not possible to use SysType as Type to invoke generic
                            // method like CreateProperty_Get<T> and is necesary to use Reflection
                            //typeof( MemoryMap ).GetMethod("CreateProperty_Get").MakeGenericMethod(SysType).Invoke(null, new object[] { regObj });
                            //typeof( MemoryMap ).GetMethod("CreateProperty_Set").MakeGenericMethod(SysType).Invoke(null, new object[] { regObj });
                            this.CreateProperty_Get(memoryRegister);
                            this.CreateProperty_Get_ByteArray(memoryRegister);
                            if (xmlRegister.WriteAsBool)
                            {
                                this.CreateProperty_Set(memoryRegister);
                                this.CreateProperty_Set_String(memoryRegister);
                                this.CreateProperty_Set_ByteArray(memoryRegister);
                            }

                            // References to write/set and get methods
                            bool     w    = memoryRegister.write;
                            dynamic  get  = base.registers[METHODS_GET_PREFIX + memoryRegister.id];
                            dynamic  getC = (memoryRegister.HasCustomMethod_Get) ? base.registers[METHODS_GET_CUSTOM_PREFIX + memoryRegister.id] : null;
                            dynamic  getB = base.registers[METHODS_GET_BYTE_PREFIX + memoryRegister.id];
                            dynamic  set  = (w) ? base.registers[METHODS_SET_PREFIX + memoryRegister.id] : null;
                            dynamic  setC = (w && memoryRegister.HasCustomMethod_Set) ? base.registers[METHODS_SET_CUSTOM_PREFIX + memoryRegister.id] : null;
                            dynamic  setS = (w) ? base.registers[METHODS_SET_STRING_PREFIX + memoryRegister.id] : null;
                            dynamic  setB = (w) ? base.registers[METHODS_SET_BYTE_PREFIX + memoryRegister.id] : null;
                            TypeCode tc   = Type.GetTypeCode(SysType.GetType());
                            switch (type)
                            {
                            case RegType.INT:
                                memoryRegister.funcGet       = (Func <int>)get;
                                memoryRegister.funcSet       = (Action <int>)set;
                                memoryRegister.funcGetCustom = (Func <int>)getC;
                                break;

                            case RegType.UINT:
                                memoryRegister.funcGet       = (Func <uint>)get;
                                memoryRegister.funcSet       = (Action <uint>)set;
                                memoryRegister.funcGetCustom = (Func <uint>)getC;
                                break;

                            case RegType.ULONG:
                                memoryRegister.funcGet       = (Func <ulong>)get;
                                memoryRegister.funcSet       = (Action <ulong>)set;
                                memoryRegister.funcGetCustom = (Func <ulong>)getC;
                                break;

                            case RegType.BOOL:
                                memoryRegister.funcGet       = (Func <bool>)get;
                                memoryRegister.funcSet       = (Action <bool>)set;
                                memoryRegister.funcGetCustom = (Func <bool>)getC;
                                break;

                            case RegType.CHAR:
                                memoryRegister.funcGet       = (Func <char>)get;
                                memoryRegister.funcSet       = (Action <char>)set;
                                memoryRegister.funcGetCustom = (Func <char>)getC;
                                break;

                            case RegType.STRING:
                                memoryRegister.funcGet       = (Func <string>)get;
                                memoryRegister.funcSet       = (Action <string>)set;
                                memoryRegister.funcGetCustom = (Func <string>)getC;
                                break;
                            }

                            memoryRegister.funcSetCustom = (Func <dynamic, dynamic>)setC;

                            // All register have this three functions
                            memoryRegister.funcGetByteArray = (Func <byte[]>)getB;
                            memoryRegister.funcSetString    = (Action <string>)setS;
                            memoryRegister.funcSetByteArray = (Action <byte[]>)setB;

                            // BAD: Reference to property itself
                            // OK : Reference to register object and use TrySet|GetMember methods
                            //      to override set and get logic, avoiding ExpandoObject problems
                            // NOTA: No se puede usar "base." porque parece ser invalidaria el comportamiento dinamico
                            AddProperty(memoryRegister);

                            // Add new object to collection where will be
                            // filtered to only recover modified registers
                            this.registersObjs.Add(xmlRegister.Id, memoryRegister);
                        }
                        catch (Exception e)
                        {
                            throw new MemoryMapParseXmlException("ERROR: " + e.Message);
                            Console.WriteLine("ERROR! " + xmlRegister.Id + " -> " + e.Message + " " + e.InnerException);
                        }
                    }
                }

                #endregion

                #region Overloads

                if (list.Overloads != null)
                {
                    foreach (MemOverload xmlOverload in list.Overloads)
                    {
                        try {
                            RegType type    = ( RegType )Enum.Parse(typeof(RegType), xmlOverload.Type.ToUpper());
                            Type    SysType = typeof(System.Object);

                            switch (type)
                            {
                            case RegType.INT: SysType = typeof(int); break;

                            case RegType.UINT: SysType = typeof(uint); break;

                            case RegType.ULONG: SysType = typeof(ulong); break;

                            case RegType.BOOL: SysType = typeof(bool); break;

                            case RegType.CHAR: SysType = typeof(char); break;

                            case RegType.STRING: SysType = typeof(string); break;
                            }

                            // Creates an instance of the generic class
                            dynamic memoryOverload = Activator.CreateInstance(typeof(MemoryOverload <>).MakeGenericType(SysType),
                                                                              xmlOverload.Id,
                                                                              type,
                                                                              xmlOverload.Description,
                                                                              xmlOverload.Registers.Select(o => o.Id).ToArray(),
                                                                              xmlOverload.CustomGet);

                            this.CreateOverload_Get(memoryOverload);

                            dynamic  get = base.registers[METHODS_GET_PREFIX + memoryOverload.id];
                            TypeCode tc  = Type.GetTypeCode(SysType.GetType());
                            switch (type)
                            {
                            case RegType.INT: memoryOverload.funcGet = (Func <int>)get; break;

                            case RegType.UINT: memoryOverload.funcGet = (Func <uint>)get; break;

                            case RegType.ULONG: memoryOverload.funcGet = (Func <ulong>)get; break;

                            case RegType.BOOL: memoryOverload.funcGet = (Func <bool>)get; break;

                            case RegType.CHAR: memoryOverload.funcGet = (Func <char>)get; break;

                            case RegType.STRING: memoryOverload.funcGet = (Func <string>)get; break;
                            }

                            AddProperty(memoryOverload);
                        }
                        catch (Exception e)
                        {
                            throw new MemoryMapParseXmlException("ERROR: " + e.Message);
                            Console.WriteLine("ERROR! " + xmlOverload.Id + " -> " + e.Message + " " + e.InnerException);
                        }
                    }
                }

                #endregion
            }
        }
예제 #27
0
 public Register(string dName, uint regNum, RegType rType, DataType dType)
     : this(dName, regNum, rType)
 {
     dataType = dType;
 }
예제 #28
0
        // 按钮控件的现实控制
        private void ToolControls_Enabled(RegType regtype)
        {
            if (regtype == RegType.默认)
            {
                this.Controls_Enabled(false);
                this.ToolSB_New.Enabled   = true;
                this.ToolSB_Cost.Enabled  = false;
                this.ToolSB_Reg.Enabled   = false;
                this.ToolSB_Del.Enabled   = false;
                this.ToolSB_Alter.Enabled = false;
                //this.toolsb_look.Enabled = true;
            }
            else if (regtype == RegType.新证)
            {
                this.Controls_Enabled(true);
                this.ToolSB_New.Enabled   = false;
                this.ToolSB_Cost.Enabled  = false;
                this.ToolSB_Reg.Enabled   = true;
                this.ToolSB_Del.Enabled   = false;
                this.ToolSB_Alter.Enabled = false;
                //this.toolsb_look.Enabled = true;
                //this.tbInpatNo.Enabled = false;

                this.dtpregdate.Focus();
            }
            else if (regtype == RegType.修改)
            {
                this.Controls_Enabled(true);
                this.ToolSB_New.Enabled   = true;
                this.ToolSB_Cost.Enabled  = true;
                this.ToolSB_Reg.Enabled   = false;
                this.ToolSB_Del.Enabled   = true;
                this.ToolSB_Alter.Enabled = true;
                //this.toolsb_look.Enabled = true;
                this.tbInpatNo.Enabled = true;
                this.dtpregdate.Focus();
            }
            else if (regtype == RegType.其他)
            {
                this.Controls_Enabled(true);
                this.ToolSB_New.Enabled   = true;
                this.ToolSB_Cost.Enabled  = false;
                this.ToolSB_Reg.Enabled   = false;
                this.ToolSB_Del.Enabled   = false;
                this.ToolSB_Alter.Enabled = false;
                //this.toolsb_look.Enabled = false;
                this.tbInpatNo.Enabled = true;
                this.dtpregdate.Focus();
            }
            else if (regtype == RegType.可修改)
            {
                this.Controls_Enabled(true);
                this.ToolSB_New.Enabled   = false;
                this.ToolSB_Cost.Enabled  = false;
                this.ToolSB_Reg.Enabled   = true;
                this.ToolSB_Del.Enabled   = false;
                this.ToolSB_Alter.Enabled = false;
                //this.toolsb_look.Enabled = true;
                this.tbInpatNo.Enabled = true;
                this.dtpregdate.Focus();
            }
            if (HIS.ZY_BLL.OP_ZYConfigSetting.GetConfigValue("008") == 0)
            {
                this.tbBedNo.Enabled      = false;
                this.tbOriginDept.Enabled = false;
                this.tbOriginDoc.Enabled  = false;
            }
        }
예제 #29
0
        public static object GetValue(ManagementClass mc, RegHive hDefKey, string sSubKeyName, string sValueName)
        {
            RegType rType = GetValueType(mc, hDefKey, sSubKeyName, sValueName);
            ManagementBaseObject inParams = mc.GetMethodParameters("GetStringValue");

            inParams["hDefKey"]     = hDefKey;
            inParams["sSubKeyName"] = sSubKeyName;
            inParams["sValueName"]  = sValueName;
            object oValue = null;

            switch (rType)
            {
            case RegType.REG_SZ:
                ManagementBaseObject outParams = mc.InvokeMethod("GetStringValue", inParams, null);
                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                {
                    oValue = outParams["sValue"];
                }
                else
                {
                    // GetStringValue call failed
                }
                break;

            case RegType.REG_EXPAND_SZ:
                outParams = mc.InvokeMethod("GetExpandedStringValue", inParams, null);
                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                {
                    oValue = outParams["sValue"];
                }
                else
                {
                    // GetExpandedStringValue call failed
                }
                break;

            case RegType.REG_MULTI_SZ:
                outParams = mc.InvokeMethod("GetMultiStringValue", inParams, null);
                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                {
                    oValue = outParams["sValue"];
                }
                else
                {
                    // GetMultiStringValue call failed
                }
                break;

            case RegType.REG_DWORD:
                outParams = mc.InvokeMethod("GetDWORDValue", inParams, null);
                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                {
                    oValue = outParams["uValue"];
                }
                else
                {
                    // GetDWORDValue call failed
                }
                break;

            case RegType.REG_BINARY:
                outParams = mc.InvokeMethod("GetBinaryValue", inParams, null);
                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                {
                    oValue = outParams["uValue"] as byte[];
                }
                else
                {
                    // GetBinaryValue call failed
                }
                break;
            }
            return(oValue);
        }
예제 #30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="passportId"></param>
 /// <param name="password"></param>
 /// <param name="imei"></param>
 public SnsCenterUser(string passportId, string password, string imei) {
     this.passportId = passportId.ToUpper();
     this.password = password;
     this.deviceId = imei;
     RegType = RegType.Guest;
     RetailId = SystemRetailId;
 }
예제 #31
0
파일: SnsCenterUser.cs 프로젝트: luost/Scut
 /// <summary>
 /// 修改:伍张发
 /// </summary>
 /// <param name="sPassportId"></param>
 /// <param name="passportPwd"></param>
 /// <param name="deviceID"></param>
 public SnsCenterUser(string sPassportId, string passportPwd, string deviceID)
 {
     _PassportId = sPassportId.ToUpper();
     _PassportPwd = passportPwd;
     _deviceID = deviceID;
     RegType = string.IsNullOrEmpty(deviceID) ? RegType.Normal : RegType.Guest;
     RetailID = SysetmRetailID;
 }
예제 #32
0
 public RegDef(int nameEnumValue, int barOffset, Type bfEnumType, RegType eRegType)
     : this(nameEnumValue, barOffset, bfEnumType, eRegType, DEFAULT_REG_SIZE, null, string.Empty)
 {
 }
예제 #33
0
파일: SnsCenterUser.cs 프로젝트: luost/Scut
        /// <summary>
        /// 增加空密码处理
        /// 修改:伍张发
        /// </summary>
        /// <returns></returns>
        public int GetUserId()
        {
            RegType regType = RegType;
            PwdType pwdType = PwdType.DES;
            SetLoginType(ref regType, ref pwdType, PassportId);

            var command = ConnectManager.Provider.CreateCommandStruct("SnsUserInfo", CommandMode.Inquiry);
            command.OrderBy = "USERID ASC";
            command.Columns = "USERID,PASSPORTID,DEVICEID,REGTYPE,RETAILID,RETAILUSER,WEIXINCODE";
            command.Filter = ConnectManager.Provider.CreateCommandFilter();

            string password = _PassportPwd;

            if (regType == RegType.Normal)
            {
                if (pwdType == PwdType.MD5)
                {
                    password = CryptoHelper.DES_Decrypt(password, GameEnvironment.Setting.ProductDesEnKey);
                    password = PasswordEncryptMd5(password);
                }
                command.Filter.Condition = string.Format("{0} AND {1}",
                        command.Filter.FormatExpression("PassportId"),
                        command.Filter.FormatExpression("PassportPwd")
                    );
                command.Filter.AddParam("PassportId", _PassportId);
                command.Filter.AddParam("PassportPwd", password);
            }
            else if (regType == RegType.Guest)
            {
                if (pwdType == PwdType.MD5)
                {
                    password = CryptoHelper.DES_Decrypt(password, GameEnvironment.Setting.ProductDesEnKey);
                    if (password.Length != 32)
                    {
                        //判断是否已经MD5加密
                        password = PasswordEncryptMd5(password);
                    }
                }

                command.Filter.Condition = string.Format("{0} AND {1} AND {2} AND {3}",
                        command.Filter.FormatExpression("DeviceID"),
                        command.Filter.FormatExpression("PassportPwd"),
                        command.Filter.FormatExpression("PassportId"),
                        command.Filter.FormatExpression("RegType")
                    );
                command.Filter.AddParam("DeviceID", _deviceID);
                command.Filter.AddParam("PassportPwd", password);
                command.Filter.AddParam("PassportId", _PassportId);
                command.Filter.AddParam("RegType", (int)regType);
            }
            else
            {
                command.Filter.Condition = string.Format("{0} AND {1}",
                        command.Filter.FormatExpression("RetailID"),
                        command.Filter.FormatExpression("RetailUser")
                    );
                command.Filter.AddParam("RetailID", RetailID);
                command.Filter.AddParam("RetailUser", RetailUser);
            }

            command.Parser();

            using (var aReader = ConnectManager.Provider.ExecuteReader(CommandType.Text, command.Sql, command.Parameters))
            {
                SnsCenterUser user = new SnsCenterUser();
                if (aReader.Read())
                {
                    try
                    {
                        _userid = Convert.ToInt32(aReader["userid"]);
                        _PassportId = aReader["PassportId"].ToString();
                        _deviceID = aReader["DeviceID"].ToNotNullString();
                        RegType = aReader["RegType"].ToEnum<RegType>();
                        RetailID = aReader["RetailID"].ToNotNullString();
                        RetailUser = aReader["RetailUser"].ToNotNullString();
                        WeixinCode = aReader["WeixinCode"].ToNotNullString();
                    }
                    catch (Exception ex)
                    {
                        TraceLog.WriteError("GetUserId method error:{0}, sql:{0}", ex, command.Sql);
                    }
                    return _userid;
                }
                else
                {
                    return 0;
                }
            }
        }
예제 #34
0
 public RegDef(int nameEnumValue, int barOffset, Type bfEnumType, RegType eRegType, int size, string condition)
     : this(nameEnumValue, barOffset, bfEnumType, eRegType, size, null, condition)
 {
 }
예제 #35
0
        public List <accounts> WMI_REG(string remoteHostName, string userName, string password, string basekey, string key)
        {
            List <accounts> acc = new List <accounts>();

            ManagementScope   ms = null;
            ConnectionOptions wmiServiceOptions = new ConnectionOptions();

            wmiServiceOptions.Impersonation  = ImpersonationLevel.Impersonate;
            wmiServiceOptions.Authentication = AuthenticationLevel.PacketPrivacy;

            string connectionString = string.Format("\\\\{0}\\root\\default", remoteHostName);

            try
            {
                if (remoteHostName != "." && remoteHostName != "localhost" && userName != "$using current credentials")
                {
                    wmiServiceOptions.Username = userName;
                    wmiServiceOptions.Password = password;
                    ms = new ManagementScope(connectionString, wmiServiceOptions);
                }
                else
                {
                    ms = new ManagementScope(connectionString, wmiServiceOptions);
                }


                ManagementClass registry = new ManagementClass(ms, new ManagementPath("StdRegProv"), null);
                //ManagementBaseObject inParams=
                //ManagementBaseObject inParams = registry.GetMethodParameters("GetStringValue");
                ManagementBaseObject inParams = registry.GetMethodParameters("EnumKey");
                Console.WriteLine("Returning a specific value for a specified key is done");
                uint HKEY = new uint();
                if (basekey == "HKLM")
                {
                    HKEY = LOCAL_MACHINE;
                }
                if (basekey == "HKCU")
                {
                    HKEY = CURRENT_USER;
                }

                inParams.SetPropertyValue("hDefKey", HKEY);
                inParams.SetPropertyValue("sSubKeyName", key);

                //inParams["hDefKey"] = LOCAL_MACHINE;
                //inParams["sSubKeyName"] = key;

                string[] error = (string[])registry.InvokeMethod("EnumKey", inParams, null).Properties["sNames"].Value;

                foreach (string k in error)
                {
                    try
                    {
                        if (k.Contains("Data"))
                        {
                            accounts resultItem = new accounts();
                            //string[] subs = (string[])registry.InvokeMethod("EnumKey", inParams, null).Properties["sNames"].Value;
                            inParams = registry.GetMethodParameters("EnumValues");
                            inParams.SetPropertyValue("hDefKey", LOCAL_MACHINE);
                            inParams.SetPropertyValue("sSubKeyName", key + "\\" + k);

                            Type     t           = resultItem.GetType();
                            string[] information = (string[])registry.InvokeMethod("EnumValues", inParams, null).Properties["sNames"].Value;
                            //string[] types = (string[])registry.InvokeMethod("EnumValues", inParams, null).Properties["Types"].Value;
                            foreach (PropertyInfo p in t.GetProperties())
                            {
                                for (int i = 0; i < information.Length; i++)
                                {
                                    if (p.Name == information[i])
                                    {
                                        uint youint = System.Convert.ToUInt32(inParams["hDefKey"].ToString());
                                        inParams = registry.GetMethodParameters("GetStringValue");
                                        inParams.SetPropertyValue("hDefKey", LOCAL_MACHINE);
                                        inParams.SetPropertyValue("sSubKeyName", key + "\\" + k);
                                        inParams.SetPropertyValue("sValueName", p.Name);

                                        RegType         rType  = GetValueType(registry, youint, inParams["sSubKeyName"].ToString(), inParams["sValueName"].ToString());
                                        ManagementClass mc     = registry;
                                        object          oValue = null;
                                        try
                                        {
                                            switch (rType)
                                            {
                                            case RegType.REG_SZ:
                                                ManagementBaseObject outParams = mc.InvokeMethod("GetStringValue", inParams, null);

                                                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                                                {
                                                    oValue = outParams["sValue"];
                                                }
                                                else
                                                {
                                                    // GetStringValue call failed
                                                }
                                                break;

                                            case RegType.REG_EXPAND_SZ:
                                                outParams = mc.InvokeMethod("GetExpandedStringValue", inParams, null);

                                                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                                                {
                                                    oValue = outParams["sValue"];
                                                }
                                                else
                                                {
                                                    // GetExpandedStringValue call failed
                                                }
                                                break;

                                            case RegType.REG_MULTI_SZ:
                                                outParams = mc.InvokeMethod("GetMultiStringValue", inParams, null);

                                                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                                                {
                                                    oValue = outParams["sValue"];
                                                }
                                                else
                                                {
                                                    // GetMultiStringValue call failed
                                                }
                                                break;

                                            case RegType.REG_DWORD:
                                                outParams = mc.InvokeMethod("GetDWORDValue", inParams, null);

                                                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                                                {
                                                    oValue = outParams["uValue"];
                                                }
                                                else
                                                {
                                                    // GetDWORDValue call failed
                                                }
                                                break;

                                            case RegType.REG_BINARY:
                                                outParams = mc.InvokeMethod("GetBinaryValue", inParams, null);

                                                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                                                {
                                                    oValue = outParams["uValue"] as byte[];
                                                }
                                                else
                                                {
                                                    // GetBinaryValue call failed
                                                }
                                                break;
                                            }
                                            p.SetValue(resultItem, oValue, null);
                                            //p.SetValue(resultItem, this.FixString(registry.InvokeMethod("GetStringValue", inParams, null).Properties["sValue"].Value), null);
                                            //p.SetValue(resultItem, this.FixString(registry.InvokeMethod("GetBinaryValue", inParams, null).Properties["sValue"].Value), null);
                                        }
                                        catch
                                        {
                                        }
                                        break;
                                    }
                                }
                            }
                            if (resultItem.Pattern.Length > 0)
                            {
                                Array.Reverse(resultItem.Pattern);
                                //bootkey << System.Convert.ToInt16(resultItem.Pattern);

                                acc.Add(resultItem);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                ////inParams["sValueName"] = keyToRead;
                //Console.WriteLine("Invoking Method");
                ////object[] args;
                //ManagementBaseObject outParams = registry.InvokeMethod("EnumKey", inParams, null);
                //Console.WriteLine("Invoking Method");

                //Console.WriteLine(outParams["sValue"].ToString());
                //error[0] = outParams["sValue"].ToString();
                //    }
                //    catch (Exception ex)
                //    {

                //    }
            }
            catch (Exception e)
            {
                Console.WriteLine("[-] Error!");
            }
            return(acc);
        }
예제 #36
0
			public void Add (RegType type, string name, int number, RegisterUsage usage)
			{
				foreach (var entry in mEntries) {

					if (entry.type == type && entry.name == name && entry.number == number) {
						if (entry.usage != usage) {
							throw new InvalidOperationException ("Cannot use register in multiple ways yet (mat4/vec4)");
						}
						return;
					}
				}

				{
					var entry = new Entry ();
					entry.type = type;
					entry.name = name;
					entry.number = number;
					entry.usage = usage;
					mEntries.Add (entry);
				}
			}
예제 #37
0
 public SegmentReg(RegType type, RegIndex index)
     : this((RegCode)type | (RegCode)index)
 {
 }
예제 #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Sns.SnsCenterUser"/> class.
 /// </summary>
 public SnsCenterUser()
 {
     RegType = RegType.Other;
 }
예제 #39
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (base.IsPost)
            {
                RegType regType      = (RegType)System.Enum.Parse(typeof(RegType), WebUtils.GetFormString("_regtype", "Normal"));
                string  strGroupName = WebUtils.GetFormString("_usergroupname", "个人会员");
                System.Collections.Generic.IEnumerable <UserGroupInfo> source = from p in UserGroup.GetCacheUserGroupList()
                                                                                where p.GroupName.Equals(strGroupName)
                                                                                select p;
                System.Collections.Generic.IEnumerable <UserLevelInfo> source2 = (from p in UserLevel.GetCacheUserLevelList()
                                                                                  orderby p.Integral
                                                                                  select p).Take(1);
                TaoBaoAreaInfo iPAreaFromTaoBao = IPUtils.GetIPAreaFromTaoBao(IPUtils.GetIP());
                UserInfo       userInfo         = new UserInfo
                {
                    UserName      = WebUtils.GetFormString("_regname"),
                    Password      = WebUtils.GetFormString("_regpwd"),
                    GroupID       = ((source.Count <UserGroupInfo>() > 0) ? source.First <UserGroupInfo>().AutoID : 0),
                    LevelID       = ((source2.Count <UserLevelInfo>() > 0) ? source2.First <UserLevelInfo>().AutoID : 0),
                    Email         = ((regType == RegType.ByEmail) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regemail")),
                    Mobile        = ((regType == RegType.ByMobile) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regmobile")),
                    Country       = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country),
                    Province      = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.region),
                    City          = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.city),
                    County        = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country),
                    Status        = 99,
                    AutoTimeStamp = System.DateTime.Now
                };
                string[] array = PageBase.config.SysUserName.Split(new char[]
                {
                    ','
                });
                string strA = string.Empty;
                switch (regType)
                {
                case RegType.ByMobile:
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Mobile);
                    if (lastCheckCode != null)
                    {
                        strA = lastCheckCode.ValidateCode;
                    }
                    goto IL_27A;
                }

                case RegType.ByEmail:
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Email);
                    if (lastCheckCode != null)
                    {
                        strA = lastCheckCode.ValidateCode;
                    }
                    goto IL_27A;
                }
                }
                strA = base.ValidateCode;
IL_27A:
                if (PageBase.config.VerifycodeForReg && string.Compare(strA, WebUtils.GetFormString("_regyzm"), true) != 0)
                {
                    base.WriteJsonTip(base.GetCaption("ValidateCodeIncorrect"));
                }
                else if (userInfo.GroupID.Equals(0) || userInfo.LevelID.Equals(0))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MemberInfoNotComplete"));
                }
                else if (!SinGooCMS.BLL.User.IsValidUserName(userInfo.UserName) && !ValidateUtils.IsEmail(userInfo.UserName) && !ValidateUtils.IsMobilePhone(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_InvalidUserName"));
                }
                else if (array.Length > 0 && array.Contains(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_SystemRetainsUserName").Replace("${username}", userInfo.UserName));
                }
                else if (SinGooCMS.BLL.User.IsExistsByName(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_UserNameAlreadyExists"));
                }
                else if (userInfo.Password.Length < 6)
                {
                    base.WriteJsonTip(base.GetCaption("Reg_UserPwdLenNeed"));
                }
                else if (userInfo.Password != WebUtils.GetFormString("_regpwdagain"))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_2PwdInputNoMatch"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Email) && !ValidateUtils.IsEmail(userInfo.Email))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_EmailTypeError"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Email) && SinGooCMS.BLL.User.IsExistsByEmail(userInfo.Email))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_EmailAddressAlreadyExists"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Mobile) && !ValidateUtils.IsMobilePhone(userInfo.Mobile))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MobileTypeError"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Mobile) && SinGooCMS.BLL.User.IsExistsByMobile(userInfo.Mobile))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MobileAlreadyExists"));
                }
                else
                {
                    int autoID = 0;
                    System.Collections.Generic.IList <UserFieldInfo> fieldListByModelID      = UserField.GetFieldListByModelID(userInfo.GroupID, true);
                    System.Collections.Generic.Dictionary <string, UserFieldInfo> dictionary = new System.Collections.Generic.Dictionary <string, UserFieldInfo>();
                    foreach (UserFieldInfo current in fieldListByModelID)
                    {
                        current.Value = WebUtils.GetFormString(current.FieldName);
                        dictionary.Add(current.FieldName, current);
                    }
                    UserStatus userStatus = SinGooCMS.BLL.User.Reg(userInfo, dictionary, ref autoID);
                    if (userStatus.Equals(UserStatus.Success))
                    {
                        new MsgService(userInfo).SendRegMsg();
                        new MsgService().SendRegMsg2Mger();
                        if (PageBase.config.RegGiveIntegral > 0)
                        {
                            userInfo.AutoID = autoID;
                            AccountDetail.AddIntegral(userInfo, 1, (double)PageBase.config.RegGiveIntegral, "注册赠送积分");
                        }
                        UserInfo    userInfo2   = new UserInfo();
                        LoginStatus loginStatus = SinGooCMS.BLL.User.UserLogin(userInfo.UserName, userInfo.Password, ref userInfo2);
                        string      text        = base.Server.UrlDecode(WebUtils.GetFormString("_regreturnurl"));
                        if (!string.IsNullOrEmpty(text))
                        {
                            base.WriteJsonTip(true, base.GetCaption("Reg_Success"), text);
                        }
                        else
                        {
                            base.WriteJsonTip(true, base.GetCaption("Reg_Success"), "/user/regsuccess.html?info=" + base.Server.UrlEncode(base.GetCaption("Reg_SuccessWillJumpMemberCenter")));
                        }
                    }
                    else
                    {
                        base.WriteJsonTip(base.GetCaption("Reg_FailWithMsg").Replace("${msg}", base.GetCaption("UserStatus_" + userStatus.ToString())));
                    }
                }
            }
            else
            {
                System.Collections.Generic.IEnumerable <UserGroupInfo> source3 = from p in UserGroup.GetCacheUserGroupList()
                                                                                 where p.GroupName.Equals("个人会员")
                                                                                 select p;
                base.Put("usermodel", UserField.GetFieldListByModelID((source3.Count <UserGroupInfo>() > 0) ? source3.First <UserGroupInfo>().AutoID : 0, true));
                base.Put("returnurl", WebUtils.GetQueryString("returnurl"));
                base.UsingClient("user/注册.html");
            }
        }
예제 #40
0
        public void EditRegKey(string baseKey, string sKey, string subKey, object value, RegType regType)
        {
            //Binary = 3,
            //DWord = 4,
            //ExpandString = 2,
            //MultiString = 7,
            //None = -1,
            //QWord = 11,
            //String = 1,
            //Unknown = 0

            if (regType == RegType.Binary)
            {
                string val   = value.ToString();
                byte[] bytes = Encoding.UTF8.GetBytes(val);
                if (baseKey == "HKEY_LOCAL_MACHINE" || baseKey == "HKEY_CURRENT_USER")
                {
                    if (baseKey == "HKEY_LOCAL_MACHINE")
                    {
                        RegistryKey key = Registry.LocalMachine.OpenSubKey(sKey, true);
                        key.SetValue(subKey, bytes, (RegistryValueKind)(int)regType);
                        key.Close();
                    }
                    else
                    {
                        RegistryKey key = Registry.CurrentUser.OpenSubKey(sKey, true);
                        key.SetValue(subKey, bytes, (RegistryValueKind)(int)regType);
                        key.Close();
                    }
                }
            }
            else
            {
                if (baseKey == "HKEY_LOCAL_MACHINE" || baseKey == "HKEY_CURRENT_USER")
                {
                    if (baseKey == "HKEY_LOCAL_MACHINE")
                    {
                        RegistryKey key = Registry.LocalMachine.OpenSubKey(sKey, true);
                        key.SetValue(subKey, value, (RegistryValueKind)(int)regType);
                        key.Close();
                    }
                    else
                    {
                        RegistryKey key = Registry.CurrentUser.OpenSubKey(sKey, true);
                        key.SetValue(subKey, value, (RegistryValueKind)(int)regType);
                        key.Close();
                    }
                }
            }
        }
예제 #41
0
        /// <summary>
        /// 增加空密码处理
        /// 修改:伍张发
        /// </summary>
        /// <returns></returns>
        public int GetUserId()
        {
            RegType regType = RegType;
            PwdType pwdType = PwdType.DES;

            SetLoginType(ref regType, ref pwdType, PassportId);
            List <SqlParameter> listTmp = new List <SqlParameter>();
            string sGetSql  = "select top 1 userid,PassportId,DeviceID,RegType,RetailID,RetailUser,WeixinCode from SnsUserInfo ";
            string password = _PassportPwd;

            if (regType == RegType.Normal)
            {
                if (pwdType == PwdType.MD5)
                {
                    password = CryptoHelper.DES_Decrypt(password, GameEnvironment.ProductDesEnKey);
                    password = PasswordEncryptMd5(password);
                }
                sGetSql += "where PassportId=@aPassportId and PassportPwd=@PassportPwd";
                listTmp.Add(SqlParamHelper.MakeInParam("@aPassportId", SqlDbType.VarChar, 0, _PassportId));
                listTmp.Add(SqlParamHelper.MakeInParam("@PassportPwd", SqlDbType.VarChar, 0, password));
            }
            else if (regType == RegType.Guest)
            {
                if (pwdType == PwdType.MD5)
                {
                    password = CryptoHelper.DES_Decrypt(password, GameEnvironment.ProductDesEnKey);
                    if (password.Length != 32)
                    {
                        //判断是否已经MD5加密
                        password = PasswordEncryptMd5(password);
                    }
                }
                sGetSql += "where (DeviceID=@DeviceID and PassportPwd=@PassportPwd ) and PassportId=@aPassportId and RegType=@RegType";
                listTmp.Add(SqlParamHelper.MakeInParam("@aPassportId", SqlDbType.VarChar, 0, _PassportId));
                listTmp.Add(SqlParamHelper.MakeInParam("@DeviceID", SqlDbType.VarChar, 0, _deviceID));
                listTmp.Add(SqlParamHelper.MakeInParam("@PassportPwd", SqlDbType.VarChar, 0, password));
                listTmp.Add(SqlParamHelper.MakeInParam("@RegType", SqlDbType.Int, 0, (int)regType));
            }
            else
            {
                sGetSql += "where RetailID=@RetailID and RetailUser=@RetailUser";
                listTmp.Add(SqlParamHelper.MakeInParam("@RetailID", SqlDbType.VarChar, 0, RetailID));
                listTmp.Add(SqlParamHelper.MakeInParam("@RetailUser", SqlDbType.VarChar, 0, RetailUser));
            }
            SqlParameter[] paramsGet = listTmp.ToArray();
            using (SqlDataReader aReader = SqlHelper.ExecuteReader(config.connectionString, CommandType.Text, sGetSql, paramsGet))
            {
                SnsCenterUser user = new SnsCenterUser();
                if (aReader.Read())
                {
                    try
                    {
                        _userid     = Convert.ToInt32(aReader["userid"]);
                        _PassportId = aReader["PassportId"].ToString();
                        _deviceID   = aReader["DeviceID"].ToNotNullString();
                        RegType     = aReader["RegType"].ToEnum <RegType>();
                        RetailID    = aReader["RetailID"].ToNotNullString();
                        RetailUser  = aReader["RetailUser"].ToNotNullString();
                        WeixinCode  = aReader["WeixinCode"].ToNotNullString();
                    }
                    catch (Exception ex)
                    {
                        TraceLog.WriteError("GetUserId method error:{0}, sql:{0}", ex, sGetSql);
                    }
                    return(_userid);
                }
                else
                {
                    return(0);
                }
            }
        }
예제 #42
0
        public string GetFilthyStdOut(string strKey)
        {
            StringBuilder strOut = new StringBuilder();
            bool          bSeenFinishedMarker = false;

            Console.WriteLine("[i] Getting stdout from registry from " + strKey);

            ManagementClass registry = new ManagementClass(this.Scope, new ManagementPath("StdRegProv"), null);

            // Enumerate the values
            ManagementBaseObject inParams = registry.GetMethodParameters("EnumValues");

            inParams["sSubKeyName"] = strKey;
            inParams["hDefKey"]     = RegHive.HKEY_LOCAL_MACHINE;
            ManagementNamedValueCollection objCtx = new ManagementNamedValueCollection();

            objCtx.Add("__ProviderArchitecture", 64);
            objCtx.Add("__RequiredArchitecture", true);
            InvokeMethodOptions invokeOptions = new InvokeMethodOptions();

            invokeOptions.Context = objCtx;
            ManagementBaseObject outParams = registry.InvokeMethod("EnumValues", inParams, invokeOptions);

            string[] strValues = outParams["sNames"] as string[];

            try
            {
                if (Convert.ToUInt32(outParams["ReturnValue"]) == 0)
                {
                }
                else
                {
                    Console.WriteLine("[!] Failed to get values " + outParams["ReturnValue"].ToString());
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("[!] Failed to get values - command likely not valid i.e. generated no stdout output - " + ex.Message.ToString());
                return(null);
            }

            try
            {
                foreach (string value in strValues)
                {
                    try
                    {
                        RegType rType = GetValueType(registry, RegHive.HKEY_LOCAL_MACHINE, strKey, value);

                        switch (rType)
                        {
                        case RegType.REG_SZ:
                            inParams = registry.GetMethodParameters("GetStringValue");
                            inParams["sSubKeyName"] = strKey;
                            inParams["sValueName"]  = value;
                            inParams["hDefKey"]     = RegHive.HKEY_LOCAL_MACHINE;

                            ManagementBaseObject outParams2 = registry.InvokeMethod("GetStringValue", inParams, invokeOptions);

                            if (outParams2.Properties["sValue"].Value != null)
                            {
                                if (outParams2.Properties["sValue"].Value.ToString().Contains("CDOFINISHED"))
                                {
                                    bSeenFinishedMarker = true;
                                }
                                else
                                {
                                    strOut.AppendLine(outParams2.Properties["sValue"].Value.ToString());
                                }
                            }
                            else
                            {
                            }



                            // One of ours
                            int  intMy;
                            bool isNumeric = int.TryParse("123", out intMy);
                            if (isNumeric && intMy > 0)
                            {
                                inParams = registry.GetMethodParameters("DeleteValue");
                                inParams["sSubKeyName"] = strKey;
                                inParams["sValueName"]  = value;
                                inParams["hDefKey"]     = RegHive.HKEY_LOCAL_MACHINE;
                                registry.InvokeMethod("DeleteValue", inParams, invokeOptions);
                            }

                            break;

                        default:
                            break;
                        }
                    }
                    catch
                    {
                        continue;
                    }
                }

                if (bSeenFinishedMarker == false)
                {
                    Console.WriteLine("[!] WARNING: Didn't see stdout output finished marker - output may be truncated");
                }
                else
                {
                    Console.WriteLine("[i] Full command output received");
                }
                return(strOut.ToString());
            }
            catch
            {
                Console.WriteLine("[i] No registry keys indicating no output");
                return("");
            }
        }
예제 #43
0
        public IEnumerable <string> Use(RegType regType)
        {
            if (Opcode == M68kOpcode.RegUse)
            {
                foreach (var du in DefsUses)
                {
                    yield return(du);
                }
            }

            if (Opcode == M68kOpcode.Cmp || Opcode == M68kOpcode.Lsr)
            {
                if (Register1 != null)
                {
                    yield return(Register1.ToString());
                }
                yield return(Register2.ToString());

                yield break;
            }

            if (Register1 != null && Register1.Type == regType)
            {
                yield return(Register1.ToString());
            }

            if ((Opcode == M68kOpcode.Add || Opcode == M68kOpcode.Sub || Opcode == M68kOpcode.Adda) && Register2 != null && Register2.Type == regType)
            {
                yield return(Register2.ToString());
            }

            if (Register2 != null && Register2.Type == regType)
            {
                switch (AddressingMode2)
                {
                case M68kAddressingMode.Address:
                case M68kAddressingMode.AddressWithOffset:
                case M68kAddressingMode.AddressWithPostIncrement:
                case M68kAddressingMode.AddressWithPostDecrement:
                case M68kAddressingMode.AddressWithPreDecrement:
                case M68kAddressingMode.AddressWithPreIncrement:
                    yield return(Register2.ToString());

                    break;
                }
            }

            if (Opcode == M68kOpcode.Rts)
            {
                if (regType == RegType.Data)
                {
                    if (FinalRegister1.HasValue)
                    {
                        yield return("D0");
                    }
                    yield return("D2");

                    yield return("D3");

                    yield return("D4");

                    yield return("D5");

                    yield return("D6");

                    yield return("D7");
                }
                if (regType == RegType.Address)
                {
                    yield return("A2");

                    yield return("A3");

                    yield return("A4");

                    yield return("A5");

                    yield return("A6");
                }
            }
        }
예제 #44
0
 public RegistrationModel(RegType rType, Type objectType)
 {
     RType      = rType;
     ObjectType = objectType ?? throw new ArgumentNullException(nameof(objectType));
 }
예제 #45
0
        public IEnumerable <string> Def(RegType regType)
        {
            // MOVE D2,D0   Def: D0
            // MOVE (A2)+,D0   Def: D0, A2
            // MOVE (A2)+,A1   Def: A2
            // MOVE (A2)+,(A1)-   Def: A2,A1

            if (Opcode == M68kOpcode.Jsr)
            {
                if (regType == RegType.Data)
                {
                    yield return("D0");

                    yield return("D1");
                }
                if (regType == RegType.Address)
                {
                    yield return("A0");

                    yield return("A1");
                }
            }

            if (Opcode == M68kOpcode.RegDef)
            {
                foreach (var du in DefsUses)
                {
                    if ((du[0] == 'D' && regType == RegType.Data) || (du[0] == 'A' && regType == RegType.Address))
                    {
                        yield return(du);
                    }
                }
            }

            if (Opcode == M68kOpcode.Cmp)
            {
                yield break;
            }

            if (Register2 != null && AddressingMode2 == M68kAddressingMode.Register && Register2.Type == regType)
            {
                yield return(Register2.ToString());
            }

            if (Register1 != null && Register1.Type == regType)
            {
                switch (AddressingMode1)
                {
                case M68kAddressingMode.AddressWithPostIncrement:
                case M68kAddressingMode.AddressWithPostDecrement:
                case M68kAddressingMode.AddressWithPreDecrement:
                case M68kAddressingMode.AddressWithPreIncrement:
                    yield return(Register1.ToString());

                    break;
                }
            }

            if (Register2 != null && Register2.Type == regType)
            {
                switch (AddressingMode2)
                {
                case M68kAddressingMode.AddressWithPostIncrement:
                case M68kAddressingMode.AddressWithPostDecrement:
                case M68kAddressingMode.AddressWithPreDecrement:
                case M68kAddressingMode.AddressWithPreIncrement:
                    yield return(Register2.ToString());

                    break;
                }
            }
        }
예제 #46
0
 public X87Var(int id, RegType registerType, VariableType variableType)
     : base(id, 12, registerType, variableType)
 {
 }
예제 #47
0
 public bool IsRegType(RegType regType)
 {
     return IsReg && ((BaseReg)this).RegisterType == regType;
 }
예제 #48
0
 public RegFormat(RegType rTipo, int nTamanho, int nDec)
 {
     this._type    = rTipo;
     this._length  = nTamanho;
     this.nDecimal = nDec;
 }
예제 #49
0
 public bool IsRegTypeMem(RegType regType)
 {
     return IsMem || IsRegType(regType);
 }
예제 #50
0
        public void EditRegKey(string baseKey, string sKey, string subKey, object value, RegType regType)
        {
            //Binary = 3,
            //DWord = 4,
            //ExpandString = 2,
            //MultiString = 7,
            //None = -1,
            //QWord = 11,
            //String = 1,
            //Unknown = 0

            if ((baseKey != "HKEY_LOCAL_MACHINE" && baseKey != "HKEY_CURRENT_USER" && baseKey != "HKEY_USERS") || value == null)
            {
                return;
            }

            string val = value.ToString();

            RegistryKey key = null;

            switch (baseKey)
            {
            case "HKEY_LOCAL_MACHINE":
                key = Registry.LocalMachine.OpenSubKey(sKey, true);
                break;

            case "HKEY_CURRENT_USER":
                key = Registry.CurrentUser.OpenSubKey(sKey, true);
                break;

            case "HKEY_USERS":
                key = Registry.Users.OpenSubKey(sKey, true);
                break;
            }

            string fullKeyPath = baseKey + "\\" + sKey;

            if (!regKeyPaths.Contains(fullKeyPath) && key != null)
            {
                regKeyPaths.Add(fullKeyPath);
                ExportRegistry(baseKey + "\\" + sKey, Directory.GetCurrentDirectory() + "\\utils\\backup\\" + sKey.Substring(sKey.LastIndexOf('\\') + 1) + ".reg");
            }

            if (key == null)
            {
                switch (baseKey)
                {
                case "HKEY_LOCAL_MACHINE":
                    key = Registry.LocalMachine.CreateSubKey(sKey, true);
                    break;

                case "HKEY_CURRENT_USER":
                    key = Registry.CurrentUser.CreateSubKey(sKey, true);
                    break;

                case "HKEY_USERS":
                    key = Registry.Users.CreateSubKey(sKey, true);
                    break;
                }
            }

            if (regType == RegType.Binary)
            {
                byte[] bytes = Encoding.UTF8.GetBytes(val);
                key.SetValue(subKey, bytes, (RegistryValueKind)(int)regType);
            }
            else
            {
                key.SetValue(subKey, value, (RegistryValueKind)(int)regType);
            }
            key.Close();
        }
        public static InterferenceGraph MakeGraph(IList <CfgNode> nodes, RegType regType, IList <string> preColored)
        {
            var graph = new HashSet <Tuple <string, string> >();
            var g     = new InterferenceGraph {
                Graph = graph
            };

            int added = 0;

            foreach (var p1 in preColored)
            {
                foreach (var p2 in preColored)
                {
                    if (p1 != p2 && !g.IsEdgeBetween(p1, p2) && !g.IsEdgeBetween(p2, p1))
                    {
                        g.Graph.Add(new Tuple <string, string>(p1, p2));
                        added++;
                    }
                }
                g.Nodes.Add(p1);
            }

            foreach (var node in nodes.Where(n => n != null))
            {
                foreach (var def in node.Def.Where(dn => IsRegType(regType, dn)))
                {
                    foreach (var o in node.Out.Where(dn => IsRegType(regType, dn)))
                    {
                        if (o != def && !graph.Contains(new Tuple <string, string>(def, o)) && !graph.Contains(new Tuple <string, string>(o, def)))
                        {
                            graph.Add(new Tuple <string, string>(def, o));
                        }
                        g.Nodes.Add(o);
                        g.Nodes.Add(def);
                    }
                }

                var inst = node.Instruction;

                if (inst.Register1 != null && inst.Register2 != null &&
                    inst.Register1.Type == regType && inst.Register2.Type == regType &&
                    inst.AddressingMode1 == M68kAddressingMode.Register && inst.AddressingMode2 == M68kAddressingMode.Register)
                {
                    var a = node.Instruction.Register1.ToString();
                    var c = node.Instruction.Register2.ToString();

                    if (node.Instruction.Opcode == M68kOpcode.Move)
                    {
                        //g.Moves.Add(a);
                        //g.Moves.Add(c);
                        g.Moves.Add(node.Instruction);
                    }

                    foreach (var b in node.Out.Where(dn => IsRegType(regType, dn)))
                    {
                        if (b != c && !graph.Contains(new Tuple <string, string>(a, b)) && !graph.Contains(new Tuple <string, string>(b, a)))
                        {
                            graph.Add(new Tuple <string, string>(a, b));
                        }
                        g.Nodes.Add(b);
                    }
                    g.Nodes.Add(c);
                }
            }

            return(g);
        }
예제 #52
0
 public GPReg(RegType type, RegIndex index)
     : this((RegCode)type | (RegCode)index)
 {
 }
 static bool IsRegType(RegType regType, string regName)
 {
     return((regType == RegType.Data && regName[0] == 'D') || (regType == RegType.Address && regName[0] == 'A') || (regType == RegType.ConditionCode && regName.StartsWith("CCR")));
 }
예제 #54
0
 public GPVar(int id, int size, RegType registerType, VariableType variableType)
     : base(id, size, registerType, variableType)
 {
 }
예제 #55
0
        /// <summary>
        /// 增加空密码处理
        /// 修改:伍张发
        /// </summary>
        /// <returns></returns>
        public int GetUserId()
        {
            RegType regType = RegType;
            PwdType pwdType = PwdType.DES;

            SetLoginType(ref regType, ref pwdType, PassportId);

            var command = ConnectManager.Provider.CreateCommandStruct("SnsUserInfo", CommandMode.Inquiry);

            command.OrderBy = "USERID ASC";
            command.Columns = "USERID,PASSPORTID,DEVICEID,REGTYPE,RETAILID,RETAILUSER,WEIXINCODE";
            command.Filter  = ConnectManager.Provider.CreateCommandFilter();

            string password = _PassportPwd;

            if (regType == RegType.Normal)
            {
                if (pwdType == PwdType.MD5)
                {
                    password = PasswordEncryptMd5(_PassportPwd);
                }
                command.Filter.Condition = string.Format("{0} AND {1}",
                                                         command.Filter.FormatExpression("PassportId"),
                                                         command.Filter.FormatExpression("PassportPwd")
                                                         );
                command.Filter.AddParam("PassportId", _PassportId);
                command.Filter.AddParam("PassportPwd", password);
            }
            else if (regType == RegType.Guest)
            {
                if (pwdType == PwdType.MD5)
                {
                    if (password.Length != 32)
                    {
                        //判断是否已经MD5加密
                        password = PasswordEncryptMd5(_PassportPwd);
                    }
                }

                command.Filter.Condition = string.Format("{0} AND {1} AND {2} AND {3}",
                                                         command.Filter.FormatExpression("DeviceID"),
                                                         command.Filter.FormatExpression("PassportPwd"),
                                                         command.Filter.FormatExpression("PassportId"),
                                                         command.Filter.FormatExpression("RegType")
                                                         );
                command.Filter.AddParam("DeviceID", _deviceID);
                command.Filter.AddParam("PassportPwd", password);
                command.Filter.AddParam("PassportId", _PassportId);
                command.Filter.AddParam("RegType", (int)regType);
            }
            else
            {
                command.Filter.Condition = string.Format("{0} AND {1}",
                                                         command.Filter.FormatExpression("RetailID"),
                                                         command.Filter.FormatExpression("RetailUser")
                                                         );
                command.Filter.AddParam("RetailID", RetailID);
                command.Filter.AddParam("RetailUser", RetailUser);
            }

            command.Parser();

            using (var aReader = ConnectManager.Provider.ExecuteReader(CommandType.Text, command.Sql, command.Parameters))
            {
                SnsCenterUser user = new SnsCenterUser();
                if (aReader.Read())
                {
                    try
                    {
                        _userid     = Convert.ToInt32(aReader["userid"]);
                        _PassportId = aReader["PassportId"].ToString();
                        _deviceID   = aReader["DeviceID"].ToNotNullString();
                        RegType     = aReader["RegType"].ToEnum <RegType>();
                        RetailID    = aReader["RetailID"].ToNotNullString();
                        RetailUser  = aReader["RetailUser"].ToNotNullString();
                        WeixinCode  = aReader["WeixinCode"].ToNotNullString();
                    }
                    catch (Exception ex)
                    {
                        TraceLog.WriteError("GetUserId method error:{0}, sql:{0}", ex, command.Sql);
                    }
                    return(_userid);
                }
                else
                {
                    return(0);
                }
            }
        }
        private void RegisterWithRegType(RegType regType)
        {
            RegisterMgr.OpenRegisterPage();
            RegisterMgr.Checkin();
            RegisterMgr.SelectRegType(regType.ToString());
            RegisterMgr.Continue();
            RegisterMgr.EnterProfileInfo();
            RegisterMgr.Continue();

            if (this.regTypeFees[regType] != null)
            {
                RegisterMgr.PayMoney(RegisterManager.PaymentMethod.Check);
            }

            RegisterMgr.FinishRegistration();
            RegisterMgr.ConfirmRegistration();

            this.registrationIds.Add(Convert.ToInt32(RegisterMgr.GetConfirmationPageValueForPrimaryAttendee(
                RegisterManager.ConfirmationPageField.RegistrationId)));
        }
예제 #57
0
 public static byte GenRegId(byte rid, RegType type)
 => (byte)(rid * 4 + type);