public GetMembersModel GetMembers(MemberFilterModel filters) { if (!string.IsNullOrEmpty(filters.searchType) && filters.searchType.Equals("updated")) { var param = HttpContext.Current.Request.Params; var fromDate = param.Get("searchText[from]").Replace(" GMT+0700 (Indochina Time)", ""); var toDate = param.Get("searchText[to]").Replace(" GMT+0700 (Indochina Time)", ""); filters.searchText = $"{fromDate},{toDate}"; } var members = this.Members.Select(m => new GetMember { id = m.id, email = m.email, firstname = m.firstname, lastname = m.lastname, position = m.position, role = m.role, updated = m.updated }).OrderByDescending(m => m.updated); var memberFilter = new GetMembersModel { items = members.Skip((filters.startPage - 1) * filters.limitPage) .Take(filters.limitPage) .ToArray(), totalItems = members.Count() }; if (!string.IsNullOrEmpty(filters.searchType) && !string.IsNullOrEmpty(filters.searchText)) { string searchText = filters.searchText; string searchType = filters.searchType; IEnumerable <GetMember> searchMembers = new GetMember[] { }; switch (searchType) { case "updated": var dates = searchText.Split(','); DateTime fromDate = DateTime.Parse(dates[0]); DateTime toDate = DateTime.Parse(dates[1]); searchMembers = from m in members where m.updated >= fromDate && m.updated <= toDate select m; break; case "role": searchText = Enum.Parse(typeof(RoleAccount), searchText).ToString(); searchMembers = from m in members where m.GetType(). GetProperty(filters.searchType). GetValue(m). ToString(). Contains(searchText) select m; break; default: searchMembers = from m in members where m.GetType(). GetProperty(filters.searchType). GetValue(m). ToString(). ToLower(). Contains(searchText.ToLower()) select m; break; } //if (filters.searchType.Equals("role")) //{ // searchText = Enum.Parse(typeof(RoleAccount), searchText).ToString().ToLower(); //} memberFilter.items = searchMembers.Skip((filters.startPage - 1) * filters.limitPage) .Take(filters.limitPage) .ToArray(); memberFilter.totalItems = searchMembers.Count(); } return(memberFilter); }
[TestMethod] public void DescendingStringTest() { var propertyName = GetMember.Name <TestClass>(x => x.DescendingString); IsReadOnlyProperty(obj, propertyName, "_desc"); }
private static string idIsInUseMessage(string id) { var name = GetMember.DisplayName <CountryViewModel>(c => c.Alpha3Code); return(string.Format(Messages.ValueIsAlreadyInUse, id, name)); }
private static string idIsInUseMessage(string id) { var name = GetMember.DisplayName <CurrencyViewModel>(c => c.IsoCurrencySymbol); return(string.Format(Messages.ValueIsAlreadyInUse, id, name)); }
public static InstructionCollection Parse(Stream input, long instructionsPosition) { var instructions = new SortedList <int, InstructionBase>(); using (var helper = new InstructionParseHelper(input, instructionsPosition)) { var reader = helper.GetReader(); while (helper.CanParse(instructions)) { //now reader the instructions var instructionPosition = helper.CurrentPosition; var type = reader.ReadByteAsEnum <InstructionType>(); var requireAlignment = InstructionAlignment.IsAligned(type); if (requireAlignment) { reader.Align(4); } InstructionBase instruction = null; var parameters = new List <Value>(); switch (type) { case InstructionType.ToNumber: instruction = new ToNumber(); break; case InstructionType.NextFrame: instruction = new NextFrame(); break; case InstructionType.Play: instruction = new Play(); break; case InstructionType.Stop: instruction = new Stop(); break; case InstructionType.Add: instruction = new Add(); break; case InstructionType.Subtract: instruction = new Subtract(); break; case InstructionType.Multiply: instruction = new Multiply(); break; case InstructionType.Divide: instruction = new Divide(); break; case InstructionType.Not: instruction = new Not(); break; case InstructionType.StringEquals: instruction = new StringEquals(); break; case InstructionType.Pop: instruction = new Pop(); break; case InstructionType.ToInteger: instruction = new ToInteger(); break; case InstructionType.GetVariable: instruction = new GetVariable(); break; case InstructionType.SetVariable: instruction = new SetVariable(); break; case InstructionType.StringConcat: instruction = new StringConcat(); break; case InstructionType.GetProperty: instruction = new GetProperty(); break; case InstructionType.SetProperty: instruction = new SetProperty(); break; case InstructionType.Trace: instruction = new Trace(); break; case InstructionType.Random: instruction = new RandomNumber(); break; case InstructionType.Delete: instruction = new Delete(); break; case InstructionType.Delete2: instruction = new Delete2(); break; case InstructionType.DefineLocal: instruction = new DefineLocal(); break; case InstructionType.CallFunction: instruction = new CallFunction(); break; case InstructionType.Return: instruction = new Return(); break; case InstructionType.Modulo: instruction = new Modulo(); break; case InstructionType.NewObject: instruction = new NewObject(); break; case InstructionType.InitArray: instruction = new InitArray(); break; case InstructionType.InitObject: instruction = new InitObject(); break; case InstructionType.TypeOf: instruction = new TypeOf(); break; case InstructionType.Add2: instruction = new Add2(); break; case InstructionType.LessThan2: instruction = new LessThan2(); break; case InstructionType.Equals2: instruction = new Equals2(); break; case InstructionType.ToString: instruction = new ToString(); break; case InstructionType.PushDuplicate: instruction = new PushDuplicate(); break; case InstructionType.GetMember: instruction = new GetMember(); break; case InstructionType.SetMember: instruction = new SetMember(); break; case InstructionType.Increment: instruction = new Increment(); break; case InstructionType.Decrement: instruction = new Decrement(); break; case InstructionType.CallMethod: instruction = new CallMethod(); break; case InstructionType.Enumerate2: instruction = new Enumerate2(); break; case InstructionType.EA_PushThis: instruction = new PushThis(); break; case InstructionType.EA_PushZero: instruction = new PushZero(); break; case InstructionType.EA_PushOne: instruction = new PushOne(); break; case InstructionType.EA_CallFunc: instruction = new CallFunc(); break; case InstructionType.EA_CallMethodPop: instruction = new CallMethodPop(); break; case InstructionType.BitwiseXOr: instruction = new BitwiseXOr(); break; case InstructionType.Greater: instruction = new Greater(); break; case InstructionType.EA_PushThisVar: instruction = new PushThisVar(); break; case InstructionType.EA_PushGlobalVar: instruction = new PushGlobalVar(); break; case InstructionType.EA_ZeroVar: instruction = new ZeroVar(); break; case InstructionType.EA_PushTrue: instruction = new PushTrue(); break; case InstructionType.EA_PushFalse: instruction = new PushFalse(); break; case InstructionType.EA_PushNull: instruction = new PushNull(); break; case InstructionType.EA_PushUndefined: instruction = new PushUndefined(); break; case InstructionType.GotoFrame: instruction = new GotoFrame(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.GetURL: instruction = new GetUrl(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.SetRegister: instruction = new SetRegister(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.ConstantPool: { instruction = new ConstantPool(); var count = reader.ReadUInt32(); var constants = reader.ReadFixedSizeArrayAtOffset <uint>(() => reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.GotoLabel: instruction = new GotoLabel(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.DefineFunction2: { instruction = new DefineFunction2(); var name = reader.ReadStringAtOffset(); var nParams = reader.ReadUInt32(); var nRegisters = reader.ReadByte(); var flags = reader.ReadUInt24(); //list of parameter strings var paramList = reader.ReadFixedSizeListAtOffset <FunctionArgument>(() => new FunctionArgument() { Register = reader.ReadInt32(), Parameter = reader.ReadStringAtOffset(), }, nParams); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger((int)nParams)); parameters.Add(Value.FromInteger((int)nRegisters)); parameters.Add(Value.FromInteger((int)flags)); foreach (var param in paramList) { parameters.Add(Value.FromInteger(param.Register)); parameters.Add(Value.FromString(param.Parameter)); } //body size of the function parameters.Add(Value.FromInteger(reader.ReadInt32())); //skip 8 bytes reader.ReadUInt64(); } break; case InstructionType.PushData: { instruction = new PushData(); var count = reader.ReadUInt32(); var constants = reader.ReadFixedSizeArrayAtOffset <uint>(() => reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.BranchAlways: { instruction = new BranchAlways(); var offset = reader.ReadInt32(); parameters.Add(Value.FromInteger(offset)); helper.ReportBranchOffset(offset); } break; case InstructionType.GetURL2: instruction = new GetUrl2(); break; case InstructionType.DefineFunction: { instruction = new DefineFunction(); var name = reader.ReadStringAtOffset(); //list of parameter strings var paramList = reader.ReadListAtOffset <string>(() => reader.ReadStringAtOffset()); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger(paramList.Count)); foreach (var param in paramList) { parameters.Add(Value.FromString(param)); } //body size of the function parameters.Add(Value.FromInteger(reader.ReadInt32())); //skip 8 bytes reader.ReadUInt64(); } break; case InstructionType.BranchIfTrue: { instruction = new BranchIfTrue(); var offset = reader.ReadInt32(); parameters.Add(Value.FromInteger(offset)); helper.ReportBranchOffset(offset); } break; case InstructionType.GotoFrame2: instruction = new GotoFrame2(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.EA_PushString: instruction = new PushString(); //the constant id that should be pushed parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_PushConstantByte: instruction = new PushConstantByte(); //the constant id that should be pushed parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_GetStringVar: instruction = new GetStringVar(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringVar: instruction = new SetStringVar(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_GetStringMember: instruction = new GetStringMember(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringMember: instruction = new SetStringMember(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_PushValueOfVar: instruction = new PushValueOfVar(); //the constant id that should be pushed parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_GetNamedMember: instruction = new GetNamedMember(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedFuncPop: instruction = new CallNamedFuncPop(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedFunc: instruction = new CallNamedFunc(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedMethodPop: instruction = new CallNamedMethodPop(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_PushFloat: instruction = new PushFloat(); parameters.Add(Value.FromFloat(reader.ReadSingle())); break; case InstructionType.EA_PushByte: instruction = new PushByte(); parameters.Add(Value.FromInteger(reader.ReadByte())); break; case InstructionType.EA_PushShort: instruction = new PushShort(); parameters.Add(Value.FromInteger(reader.ReadUInt16())); break; case InstructionType.End: instruction = new End(); break; case InstructionType.EA_CallNamedMethod: instruction = new CallNamedMethod(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.Var: instruction = new Var(); break; case InstructionType.EA_PushRegister: instruction = new PushRegister(); parameters.Add(Value.FromInteger(reader.ReadByte())); break; case InstructionType.EA_PushConstantWord: instruction = new PushConstantWord(); parameters.Add(Value.FromConstant(reader.ReadUInt16())); break; case InstructionType.EA_CallFuncPop: instruction = new CallFunctionPop(); break; case InstructionType.StrictEqual: instruction = new StrictEquals(); break; default: throw new InvalidDataException("Unimplemented bytecode instruction:" + type.ToString()); } if (instruction != null) { instruction.Parameters = parameters; instructions.Add(instructionPosition, instruction); } } } return(new InstructionCollection(instructions)); }
internal GetMember(RubyContext/*!*/ context, string/*!*/ name, string originalName) : base(name, false) { Assert.NotNull(context); _context = context; _originalName = originalName; if (originalName == null) { string unmangled = RubyUtils.TryUnmangleMethodName(name); if (unmangled != null) { _unmangled = new GetMember(_context, unmangled, originalName); } } }
// แสดงรายการสมาชิก Pagination และ Filter public GetMemberModel GetMembers(MemberFilterOptions filters) { // ดึงข้อมูล และ คัดข้อมูลที่ต้องการแสดง var items = this.MemberItems.Select(m => new GetMember { id = m.id, firstname = m.firstname, lastname = m.lastname, email = m.email, position = m.position, role = m.role, updated = m.updated }) .OrderByDescending(m => m.updated); // เรียบเรียงข้อมูลให้อยู่ในรูปแบบที่ Frontend ต้องการ var memberItems = new GetMemberModel { items = items .Skip((filters.startPage - 1) * filters.limitPage) .Take(filters.limitPage) .ToArray(), totalItems = items.Count() }; // ตรวจสอบการ ค้นหาข้อมูลจากวันที่ หากมีข้อมูลมาก็ทำการ เรียบเรียงข้อมูลใหม่ if (!string.IsNullOrEmpty(filters.searchType) && filters.searchType.Equals("updated")) { var paramItem = HttpContext.Current.Request.Params; var fromDate = paramItem.Get("searchText[from]").Replace(" GMT+0700 (Indochina Time)", ""); var toDate = paramItem.Get("searchText[to]").Replace(" GMT+0700 (Indochina Time)", ""); filters.searchText = $"{fromDate},{toDate}"; } // หากว่ามีการค้นหาข้อมูลเข้ามาในระบบ if (!string.IsNullOrEmpty(filters.searchType) && !string.IsNullOrEmpty(filters.searchText)) { string searchText = filters.searchText; string searchType = filters.searchType; IEnumerable <GetMember> searchItem = new GetMember[] { }; switch (searchType) { // ค้นหาจากวันที่ case "updated": var searchTexts = searchText.Split(','); DateTime fromDate = DateTime.Parse(searchTexts[0]); DateTime toDate = DateTime.Parse(searchTexts[1]); searchItem = from m in items where m.updated >= fromDate && m.updated <= toDate select m; break; // ค้นหาจากสิทธิ์ผู้ใช้งาน case "role": searchItem = from m in items where Convert.ToInt16(m.GetType() .GetProperty(filters.searchType) .GetValue(m)) == Convert.ToInt16(searchText) select m; break; // ค้นหาทั่วไป default: searchItem = from m in items where m.GetType() .GetProperty(filters.searchType) .GetValue(m) .ToString() .ToUpper() .Contains(searchText.ToUpper()) select m; break; } memberItems.items = searchItem .Skip((filters.startPage - 1) * filters.limitPage) .Take(filters.limitPage) .ToArray(); memberItems.totalItems = searchItem.Count(); } return(memberItems); }
public void DescendingStringTest() { var propertyName = GetMember.Name <testClass>(x => x.DescendingString); isReadOnlyProperty(obj, propertyName, "_desc"); //eraldi meetod }
private void combobox_team_SelectedValueChangedAll(object sender, EventArgs e) { try { ComboBox box = (ComboBox)sender; ListBox addbox = null; string teamname = (String)box.SelectedItem; GetMember getmember = new GetMember(getMember); Hashtable memTable = (Hashtable)Invoke(getmember, teamname); int num = box.Parent.Controls.Count; for (int i = 0; i < num; i++) { if ("AddListBox".Equals(box.Parent.Controls[i].Name)) { addbox = (ListBox)box.Parent.Controls[i]; break; } } for (int i = 0; i < num; i++) { if ("CurrInListBox".Equals(box.Parent.Controls[i].Name)) { ListBox listbox = (ListBox)box.Parent.Controls[i]; listbox.Items.Clear(); foreach (DictionaryEntry de in memTable) { string tempname = (String)de.Value; string tempid = (String)de.Key; string item = tempname + "(" + tempid + ")"; if (!addbox.Items.Contains(item)) { listbox.Items.Add(item); } } } } } catch (Exception exception) { logWrite(exception.ToString()); } }
public void DbRecordIsReadOnlyTest() { var name = GetMember.Name <CountryObject>(x => x.DbRecord); Assert.IsTrue(IsReadOnly.Field <CountryObject>(name)); }
public void DisplayNameTest() { Assert.AreEqual("Company", GetMember.DisplayName <FlightView>(o => o.Company)); Assert.AreEqual(string.Empty, GetMember.DisplayName <FlightView>(null)); }
public static ExcelRowClassMapper Create <T>(Expression <Func <T, object> > name, object value, ExcelRowClassMapperType valueType) => new ExcelRowClassMapper(GetMember.Name <T>(name), value, valueType);
private static string idIsInUseMessage(string id) { var name = GetMember.DisplayName <RateView>(c => c.ID); return(string.Format(Messages.ValueIsAlreadyInUse, id, name)); }
public void Parse() { var current = _reader.BaseStream.Position; _reader.BaseStream.Seek(_offset, SeekOrigin.Begin); bool parsing = true; bool branched = false; int branchBytes = 0; while (parsing) { //now reader the instructions var type = _reader.ReadByteAsEnum <InstructionType>(); var aligned = InstructionAlignment.IsAligned(type); if (aligned) { var padding = _reader.Align(4); if (padding > 0) { Items.Add(new Padding(padding)); if (branched) { branchBytes -= (int)padding; if (branchBytes <= 0) { branched = false; branchBytes = 0; } } } } InstructionBase instruction = null; List <Value> parameters = new List <Value>(); switch (type) { case InstructionType.ToNumber: instruction = new ToNumber(); break; case InstructionType.NextFrame: instruction = new NextFrame(); break; case InstructionType.Play: instruction = new Play(); break; case InstructionType.Stop: instruction = new Stop(); break; case InstructionType.Add: instruction = new Add(); break; case InstructionType.Subtract: instruction = new Subtract(); break; case InstructionType.Multiply: instruction = new Multiply(); break; case InstructionType.Divide: instruction = new Divide(); break; case InstructionType.Not: instruction = new Not(); break; case InstructionType.StringEquals: instruction = new StringEquals(); break; case InstructionType.Pop: instruction = new Pop(); break; case InstructionType.ToInteger: instruction = new ToInteger(); break; case InstructionType.GetVariable: instruction = new GetVariable(); break; case InstructionType.SetVariable: instruction = new SetVariable(); break; case InstructionType.StringConcat: instruction = new StringConcat(); break; case InstructionType.GetProperty: instruction = new GetProperty(); break; case InstructionType.SetProperty: instruction = new SetProperty(); break; case InstructionType.Trace: instruction = new Trace(); break; case InstructionType.Delete: instruction = new Delete(); break; case InstructionType.Delete2: instruction = new Delete2(); break; case InstructionType.DefineLocal: instruction = new DefineLocal(); break; case InstructionType.CallFunction: instruction = new CallFunction(); break; case InstructionType.Return: instruction = new Return(); break; case InstructionType.NewObject: instruction = new NewObject(); break; case InstructionType.InitArray: instruction = new InitArray(); break; case InstructionType.InitObject: instruction = new InitObject(); break; case InstructionType.TypeOf: instruction = new InitObject(); break; case InstructionType.Add2: instruction = new Add2(); break; case InstructionType.LessThan2: instruction = new LessThan2(); break; case InstructionType.Equals2: instruction = new Equals2(); break; case InstructionType.ToString: instruction = new ToString(); break; case InstructionType.PushDuplicate: instruction = new PushDuplicate(); break; case InstructionType.GetMember: instruction = new GetMember(); break; case InstructionType.SetMember: instruction = new SetMember(); break; case InstructionType.Increment: instruction = new Increment(); break; case InstructionType.CallMethod: instruction = new CallMethod(); break; case InstructionType.Enumerate2: instruction = new Enumerate2(); break; case InstructionType.EA_PushThis: instruction = new PushThis(); break; case InstructionType.EA_PushZero: instruction = new PushZero(); break; case InstructionType.EA_PushOne: instruction = new PushOne(); break; case InstructionType.EA_CallFunc: instruction = new CallFunc(); break; case InstructionType.EA_CallMethodPop: instruction = new CallMethodPop(); break; case InstructionType.BitwiseXOr: instruction = new BitwiseXOr(); break; case InstructionType.Greater: instruction = new Greater(); break; case InstructionType.EA_PushThisVar: instruction = new PushThisVar(); break; case InstructionType.EA_PushGlobalVar: instruction = new PushGlobalVar(); break; case InstructionType.EA_ZeroVar: instruction = new ZeroVar(); break; case InstructionType.EA_PushTrue: instruction = new PushTrue(); break; case InstructionType.EA_PushFalse: instruction = new PushFalse(); break; case InstructionType.EA_PushNull: instruction = new PushNull(); break; case InstructionType.EA_PushUndefined: instruction = new PushUndefined(); break; case InstructionType.GotoFrame: instruction = new GotoFrame(); parameters.Add(Value.FromInteger(_reader.ReadInt32())); break; case InstructionType.GetURL: instruction = new GetUrl(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.SetRegister: instruction = new SetRegister(); parameters.Add(Value.FromInteger(_reader.ReadInt32())); break; case InstructionType.ConstantPool: { instruction = new ConstantPool(); var count = _reader.ReadUInt32(); var constants = _reader.ReadFixedSizeArrayAtOffset <uint>(() => _reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.GotoLabel: instruction = new GotoLabel(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.DefineFunction2: { instruction = new DefineFunction2(); var name = _reader.ReadStringAtOffset(); var nParams = _reader.ReadUInt32(); var nRegisters = _reader.ReadByte(); var flags = _reader.ReadUInt24(); //list of parameter strings var paramList = _reader.ReadFixedSizeListAtOffset <FunctionArgument>(() => new FunctionArgument() { Register = _reader.ReadInt32(), Parameter = _reader.ReadStringAtOffset(), }, nParams); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger((int)nParams)); parameters.Add(Value.FromInteger((int)nRegisters)); parameters.Add(Value.FromInteger((int)flags)); foreach (var param in paramList) { parameters.Add(Value.FromInteger(param.Register)); parameters.Add(Value.FromString(param.Parameter)); } //body size of the function parameters.Add(Value.FromInteger(_reader.ReadInt32())); //skip 8 bytes _reader.ReadUInt64(); } break; case InstructionType.PushData: { instruction = new PushData(); var count = _reader.ReadUInt32(); var constants = _reader.ReadFixedSizeArrayAtOffset <uint>(() => _reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.BranchAlways: instruction = new BranchAlways(); if (!branched) { branchBytes = _reader.ReadInt32(); parameters.Add(Value.FromInteger(branchBytes)); if (branchBytes > 0) { branchBytes += (int)instruction.Size + 1; branched = true; } } else { parameters.Add(Value.FromInteger(_reader.ReadInt32())); } break; case InstructionType.GetURL2: instruction = new GetUrl2(); break; case InstructionType.DefineFunction: { instruction = new DefineFunction(); var name = _reader.ReadStringAtOffset(); //list of parameter strings var paramList = _reader.ReadListAtOffset <string>(() => _reader.ReadStringAtOffset()); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger(paramList.Count)); foreach (var param in paramList) { parameters.Add(Value.FromString(param)); } //body size of the function parameters.Add(Value.FromInteger(_reader.ReadInt32())); //skip 8 bytes _reader.ReadUInt64(); } break; case InstructionType.BranchIfTrue: instruction = new BranchIfTrue(); if (!branched) { branchBytes = _reader.ReadInt32(); parameters.Add(Value.FromInteger(branchBytes)); if (branchBytes > 0) { branchBytes += (int)instruction.Size + 1; branched = true; } } else { parameters.Add(Value.FromInteger(_reader.ReadInt32())); } break; case InstructionType.GotoFrame2: instruction = new GotoFrame2(); parameters.Add(Value.FromInteger(_reader.ReadByte())); break; case InstructionType.EA_PushString: instruction = new PushString(); //the constant id that should be pushed parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_PushConstantByte: instruction = new PushConstantByte(); //the constant id that should be pushed parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_GetStringVar: instruction = new GetStringVar(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringVar: instruction = new SetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_GetStringMember: instruction = new GetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringMember: instruction = new SetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_PushValueOfVar: instruction = new PushValueOfVar(); //the constant id that should be pushed parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_GetNamedMember: instruction = new GetNamedMember(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedFuncPop: instruction = new CallNamedFuncPop(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedFunc: instruction = new CallNamedFunc(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedMethodPop: instruction = new CallNamedMethodPop(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_PushFloat: instruction = new PushFloat(); parameters.Add(Value.FromFloat(_reader.ReadSingle())); break; case InstructionType.EA_PushByte: instruction = new PushByte(); parameters.Add(Value.FromInteger(_reader.ReadByte())); break; case InstructionType.EA_PushShort: instruction = new PushShort(); parameters.Add(Value.FromInteger(_reader.ReadUInt16())); break; case InstructionType.End: instruction = new End(); if (!branched) { parsing = false; } break; default: throw new InvalidDataException("Unimplemented bytecode instruction:" + type.ToString()); } if (instruction != null) { instruction.Parameters = parameters; Items.Add(instruction); } if (branched) { branchBytes -= (int)instruction.Size + 1; if (branchBytes <= 0) { branched = false; } } } _reader.BaseStream.Seek(current, SeekOrigin.Begin); }
[TestMethod] public void AmountTest() => isReadOnlyProperty(obj, GetMember.Name <Abc.Domain.Quantity.Quantity>(x => x.Amount), 0.0);
public void DescendingStringTest() { var propertyName = GetMember.Name <testClass>(x => x.DescendingString); }
[TestMethod] public void UnitTest() => isReadOnlyProperty(obj, GetMember.Name <Abc.Domain.Quantity.Quantity>(x => x.Unit), null);
public IHtmlContent LabelFor <TResult>(Expression <Func <TModel, TResult> > e, string labelText, object htmlAttributes) => new HtmlContentMock($"LabelFor{GetMember.Name(e)}");
internal SetIndexedProperty(RubyContext/*!*/ context, string/*!*/ name, CallInfo/*!*/ callInfo) { Assert.NotNull(context); _context = context; _getMember = context.MetaBinderFactory.InteropGetMember(name); _setIndex = context.MetaBinderFactory.InteropSetIndex(callInfo); }
[TestMethod] public void DbRecordIsReadOnlyTest() { var name = GetMember.Name <BidObject>(x => x.DbRecord); Assert.IsTrue(IsReadOnly.Field <BidObject>(name)); }