public Operand(Token t) { token = t; switch (t.type) { case TokenType.INTERGER: type = ValType.Integer; break; case TokenType.FLOAT: type = ValType.Float; break; case TokenType.BOOL: type = ValType.Bool; break; case TokenType.CHAR: type = ValType.Char; break; case TokenType.STRING: type = ValType.String; break; case TokenType.IDENT: type = ValType.Identifier; break; case TokenType.TYPE: type = ValType.Type; break; } }
public Alarm() { Type = AlarmType.Normal; Operator = OperatorType.GreaterThanEqualTo; ValueType = ValType.Double; Value = ""; }
protected override Value Invoke() { Value value1 = node1.Evaluate(); Value value2 = node2.Evaluate(); Value value3 = node3.Evaluate(); ValType type1 = value1.Type; ValType type2 = value2.Type; ValType type3 = value3.Type; if (CheckArguments(type1, type2, type3)) { try { return(Operate(value1, value2, value3, type1, type2, type3)); } catch (CompilerException sce) { // Catch all CompilerExceptions and add the line number. sce.Line = Line; throw; } } else { throw new CompilerException(Line, 203, Name, value1.TypeString, value2.TypeString, value3.TypeString); } }
protected ShaderProp(PropKey key, ValType valType) { this.key = key; this.keyName = key.ToString(); this.name = keyName.Substring(1); this.propId = Shader.PropertyToID(keyName); Init(valType); }
/// <summary> /// get all attributes from the charactersic with which the specific category is mapping /// </summary> /// <param name="categoryId"></param> /// <param name="apiContext"></param> /// <returns></returns> //private static AttributeSetTypeCollection GetAttributeSetCol(int categoryId,ApiContext apiContext) //{ // IAttributesMaster attributesMaster=new AttributesMaster(); // AttributeSetTypeCollection attributeSTC=new AttributeSetTypeCollection(); // attributesMaster.CategoryCSProvider=new CategoryCSDownloader(apiContext); // attributesMaster.XmlProvider=new AttributesXmlDownloader(apiContext); // //get the characteristic set id of the specified category // IAttributeSetCollection attributeSetCol=attributesMaster.GetItemSpecificAttributeSetsForCategories(new Int32Collection(new int[]{categoryId})); // Assert.IsNotNull(attributeSetCol); // IAttributesXmlProvider iaxp=attributesMaster.XmlProvider; // //download all attributes from ebay // XmlDocument document=iaxp.DownloadXml(); // //write the memory xml to disk // WriteXMLToDisk(document); // AttributeSetTypeCollection attributeSetTypeCol=new AttributeSetTypeCollection(); // //get Required Item specifics by call getAttributesCS // foreach(AttributeSet attributeSet in attributeSetCol) // { // AttributeSetType attributeST=new AttributeSetType(); // attributeST.attributeSetID=attributeSet.attributeSetID; // String xpath="//Characteristics/CharacteristicsSet[@id='"+attributeSet.attributeSetID.ToString()+"']//CharacteristicsList//Initial//Attribute"; // XmlNodeList nodeList; // XmlNode root = document.DocumentElement; // nodeList=root.SelectNodes(xpath); // AttributeTypeCollection attributeTypeCol=new AttributeTypeCollection(); // foreach (XmlNode node in nodeList) // { // AttributeType attributeT=new AttributeType(); // XmlAttributeCollection attributes=node.Attributes; // Assert.IsNotNull(attributes); // XmlNode idNode = attributes.GetNamedItem("id"); // attributeT.attributeID=int.Parse(idNode.Value); // ValTypeCollection valTypeCol=getValue(node); // if(valTypeCol==null) // { // System.Console.WriteLine("can not find any specific value!"); // } // attributeT.Value=valTypeCol; // attributeTypeCol.Add(attributeT); // } // attributeST.Attribute=attributeTypeCol; // attributeSTC.Add(attributeST); // } // return attributeSTC; //} /// <summary> /// get all id value of the valuelist in the xml document /// </summary> /// <param name="xmlNode"></param> /// <returns></returns> private static ValTypeCollection getValue(XmlNode xmlNode) { string xpath = "ValueList/Value"; XmlNodeList nodeList = xmlNode.SelectNodes(xpath); ValTypeCollection valTypeCol = new ValTypeCollection(); foreach (XmlNode node in nodeList) { XmlAttributeCollection attribute = node.Attributes; XmlNode idNode = attribute.GetNamedItem("id"); int valueId = int.Parse(idNode.Value); if (valueId > 0) { ValType valType = new ValType(); valType.ValueID = valueId; valTypeCol.Add(valType); break; } } if (valTypeCol.Count == 0) { return(null); } return(valTypeCol); }
protected ShaderProp(string name, PropKey key, int id, ValType valType) { this.name = name; this.key = key; this.keyName = key.ToString(); this.propId = id; Init(valType); }
public BinaryOperationNode(int lineNo, ValType type, OpType operatorType, SyntaxTreeNode left, SyntaxTreeNode right) : base(lineNo, type) { OperatorType = operatorType; Left = left; Right = right; }
/// <summary> /// Full constructor /// </summary> /// <param name="v">Type of the property</param> /// <param name="min">Minimum value of the property</param> /// <param name="max">Maximum value of the property</param> /// <param name="def">Default value of the property</param> /// <param name="length">Minimum value of the string property</param> public PropDefs(ValType v, object min, object max, object def, int length = 0) { this.attrType = v; this.minVal = min; this.maxVal = max; this.defVal = def; this.minLength = length; }
public override int GetHashCode() { unchecked { var hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (ValType?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0); return(hashCode); } }
/* * public static String TypeToString(ValType type) { * switch (type) * { * case ValType.Boolean: return "Boolean"; * case ValType.Break: return "Break"; * case ValType.Double: return "Double"; * case ValType.Integer: return "Integer"; * case ValType.Layer: return "Layer"; * case ValType.List: return "List"; * case ValType.LoopType: return "LoopType"; * case ValType.Null: return "Null"; * case ValType.Object: return "Object"; * case ValType.Origin: return "Origin"; * case ValType.Return: return "Return"; * case ValType.String: return "String"; * case ValType.Void: return "Void"; * default: return "unknown"; * } * }*/ /// <summary> /// TypeCompare method to ensure implizit convertion from int to float and vice versa. /// </summary> /// <param name="acceptedType">Type to compare with</param> /// <returns></returns> public bool TypeEquals(ValType acceptedType, bool exactType) { if (exactType) { return(type == acceptedType); } else { return(TypeEquals(acceptedType)); } }
public void Update() { var data = new ValType() { I = 1 }; Interlocked.Exchange(ref mData, null); GC.Collect(); GC.WaitForPendingFinalizers(); }
public AtomNode(object value, ValType type) { if (type == ValType.String) { // escape sequences var newString = (String) value; newString = newString.Replace("\\\\", "\\"); newString = newString.Replace("\\\"", "\""); value = newString; } this.value = (value == null) ? Value.NULL : new Value(value, type); }
public AtomNode(object value, ValType type) { if (type == ValType.String) { // escape sequences var newString = (String)value; newString = newString.Replace("\\\\", "\\"); newString = newString.Replace("\\\"", "\""); value = newString; } this.value = (value == null) ? Value.NULL : new Value(value, type); }
public Operand(Token t) { token = t; switch (t.type) { case TokenType.INTERGER: type = ValType.Number; break; case TokenType.IDENT: type = ValType.Identifier; break; } }
private void Init(ValType valType1) { this.valType = valType1; switch(valType1) { case ValType.Bool: case ValType.Float: type = PropType.f; break; case ValType.Color: type = PropType.col; break; case ValType.Tex: type = PropType.tex; break; } }
private static void callVerifyPass() { ILASM.Inline(".maxstack 8"); ValType [] varr = new ValType[1]; varr[0] = new ValType(1, 2, 3); int result = 0; ILASM.Inline("ldloc.0"); ILASM.Inline("ldc.i4.0"); ILASM.Inline("readonly."); ILASM.Inline("ldelema ValType"); ILASM.Inline("call instance int32 ValType::getx()"); ILASM.Inline("stloc.1"); ReadonlyTests.Test(result == 1, "callVerifyPass"); }
public static bool TypeCompare(List <Value> valueList, params ValType[] acceptedTypes) { if (valueList.Count != acceptedTypes.Length) { return(false); } for (int i = 0; i < acceptedTypes.Length; i++) { ValType acceptedType = acceptedTypes[i]; if (!valueList[i].TypeEquals(acceptedType)) { return(false); } } return(true); }
/// <summary> /// Insert an attribute node to AttributeSetType or update the existing attribute node. /// </summary> /// <param name="ast"></param> /// <param name="attributeID"></param> /// <param name="valueID"></param> /// <param name="valStr"></param> public static void InsertToAttributeSet(AttributeSetType ast, int attributeID, int valueID, string valStr) { AttributeType attr = FindAttribute(ast, attributeID); if( attr == null ) { attr = new AttributeType(); attr.attributeID = attributeID; ast.Attribute.Add(attr); } ValType v = new ValType(); v.ValueID = valueID; v.ValueLiteral = valStr; attr.Value = new ValTypeCollection(); attr.Value.Add(v); }
public static string ValTypeToString(ValType type) { switch (type) { case ValType.None: return("none"); case ValType.Bool: return("bool"); case ValType.Int: return("int32"); case ValType.Double: return("float64"); } return("none"); }
ASTNode MatchStatement() { /* * matchstatement : MATCH LPAREN expression RPAREN LBRACE ( (TYPE COLON statement)*? | UNDERSCORE COLON statement? ) RBRACE */ Eat(TokenType.MATCH); Eat(TokenType.LPAREN); var expr = Expression(); Eat(TokenType.RPAREN); Eat(TokenType.LBRACE); List <MatchStatement.MatchCase> matchCases = new List <MatchStatement.MatchCase>(); ASTNode defaultCase = null; while (current_token.type != TokenType.RBRACE && current_token.type != TokenType.EOF) { Token token = current_token; if (token.type == TokenType.UNDERSCORE) { //default case if (defaultCase is null) { Eat(TokenType.UNDERSCORE); Eat(TokenType.COLON); defaultCase = Statement(); continue; } else { Error("More than one default case"); } } Eat(TokenType.TYPE); ValType type = token.lexeme.ToValType(); Eat(TokenType.COLON); var stmt = Statement(); matchCases.Add(new MatchStatement.MatchCase(type, stmt)); } Eat(TokenType.RBRACE); return(new MatchStatement(expr, matchCases, defaultCase)); }
/// <summary> /// Insert an attribute node to AttributeSetType or update the existing attribute node. /// </summary> /// <param name="ast"></param> /// <param name="attributeID"></param> /// <param name="valueID"></param> /// <param name="valStr"></param> public static void InsertToAttributeSet(AttributeSetType ast, int attributeID, int valueID, string valStr) { AttributeType attr = FindAttribute(ast, attributeID); if (attr == null) { attr = new AttributeType(); attr.attributeID = attributeID; ast.Attribute.Add(attr); } ValType v = new ValType(); v.ValueID = valueID; v.ValueLiteral = valStr; attr.Value = new ValTypeCollection(); attr.Value.Add(v); }
private void Init(ValType valType1) { this.valType = valType1; switch (valType1) { case ValType.Bool: case ValType.Float: type = PropType.f; break; case ValType.Color: type = PropType.col; break; case ValType.Tex: type = PropType.tex; break; } }
private static ValTypeCollection ConvertValTypeCollection(ValTypeCollection fromVals) { ValTypeCollection toVals = new ValTypeCollection(); foreach (ValType fromVal in fromVals) { ValType newVal = new ValType(); newVal.Any = fromVal.Any; newVal.SuggestedValueLiteral = fromVal.SuggestedValueLiteral; newVal.ValueID = fromVal.ValueID; newVal.ValueIDSpecified = fromVal.ValueIDSpecified; newVal.ValueLiteral = fromVal.ValueLiteral; toVals.Add(newVal); } return(toVals); }
public bool TypeEquals(ValType acceptedType) { switch (acceptedType) { case ValType.Integer: return(type == ValType.Integer || type == ValType.Double); case ValType.Double: return(type == ValType.Integer || type == ValType.Double); case ValType.StrictInteger: return(type == ValType.Integer); case ValType.StrictDouble: return(type == ValType.Double); default: return(type == acceptedType); } }
public Value(object value, ValType type) { if (value == null) { throw new Exception("v == null"); } this.value = value; this.type = type; /* * if (type == ValType.String) * { * // escape sequences * String newString = AsString(); * newString = newString.Replace("\\\\", "\\"); * newString = newString.Replace("\\\"", "\""); * value = newString; * } */ }
// Token: 0x060001DC RID: 476 RVA: 0x00011380 File Offset: 0x0000F580 private void Init(ValType valType1) { this.valType = valType1; switch (valType1) { case ValType.Tex: this.type = PropType.tex; return; case ValType.Color: this.type = PropType.col; return; case ValType.Float: case ValType.Bool: this.type = PropType.f; return; default: return; } }
/// <summary> /// Return the new value after it's been altered or the change was denied. /// </summary> /// <param name="newValue">attempted new value</param> /// <returns>new value to actually use, maybe constrained or even unchanged if the attempted value is disallowed</returns> private object SafeSetValue(object newValue) { object returnValue = Value; if (newValue == null || (!ValType.IsInstanceOfType(newValue))) { return(returnValue); } if (Value is int) { if ((int)newValue < (int)MinValue) { returnValue = MinValue; } else if ((int)newValue > (int)MaxValue) { returnValue = MaxValue; } else { returnValue = newValue; } // TODO: If and when we end up making warning-level exceptions that don't break // the execution but still get logged, then log such a warning here mentioning // if the value attempted was denied and changed if it was. } else if (Value is bool) { returnValue = newValue; } else { throw new Exception("kOS CONFIG has new type that wasn't supported yet: contact kOS developers"); } return(returnValue); }
private bool verifyAddItem(MySQLWrapper.eBayItem ebayItem) { bool itemListing = false; TextReader tr = new StreamReader("template.txt"); StringBuilder htmlDescription = new StringBuilder(); htmlDescription.Insert(0,tr.ReadToEnd()); tr.Close(); htmlDescription.Replace("{0}", ebayItem.Title); htmlDescription.Replace("{1}", ebayItem.Author); htmlDescription.Replace("{2}", ebayItem.Publisher); htmlDescription.Replace("{3}", ebayItem.publishDate); htmlDescription.Replace("{4}", ebayItem.Binding); htmlDescription.Replace("{5}", ebayItem.ISBN); if (ebayItem.UPC != "") htmlDescription.Replace("{6}", "<b>UPC : </b>" + ebayItem.UPC + "</br>"); else htmlDescription.Replace("{6}", ""); htmlDescription.Replace("{7}", ebayItem.Weight.ToString()); htmlDescription.Replace("{8}", ebayItem.Notes); htmlDescription.Replace("{9}", ebayItem.Description); ItemType item = new ItemType(); item.SKU = ebayItem.SKU; item.Title = ebayItem.Title; item.Description = htmlDescription.ToString(); item.Currency = CurrencyCodeType.INR; item.Country = CountryCodeType.IN; item.ListingType = ListingTypeCodeType.FixedPriceItem; item.Quantity = ebayItem.Quantity; item.Location = eBayLister.UserSettings.Default.itemCityState; item.ListingDuration = getListingDuration(); item.PrimaryCategory = new CategoryType(); if (eBayLister.UserSettings.Default.ListInCategory.Equals("Other Books")) { item.PrimaryCategory.CategoryID = "268"; } else { item.PrimaryCategory.CategoryID = "37558"; } item.StartPrice = new AmountType(); item.StartPrice.currencyID = CurrencyCodeType.INR; item.StartPrice.Value = ebayItem.Price * Convert.ToDouble(eBayLister.UserSettings.Default.ConversionRate); item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection(); item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PaisaPayAccepted); item.ShippingDetails = this.getShippingDetails(); item.ReturnPolicy = this.getReturnPolicy(); string handlingTime = eBayLister.UserSettings.Default.handlingTime; handlingTime = handlingTime.Remove(handlingTime.IndexOf(' ')); item.DispatchTimeMax = Convert.ToInt32(handlingTime); AttributeType conditionAttribute = new AttributeType(); conditionAttribute.attributeLabel = "Condition"; ValTypeCollection valueCollection = new ValTypeCollection(); ValType valueType = new ValType(); if(ebayItem.bookCondition.Contains("Used")) valueType.ValueLiteral = "Used"; else valueType.ValueLiteral = "New"; valueCollection.Add(valueType); conditionAttribute.Value = valueCollection; item.AttributeArray = new AttributeTypeCollection(); item.AttributeArray.Add(conditionAttribute); VerifyAddItemCall apiCall = new VerifyAddItemCall(context); try { FeeTypeCollection fees = apiCall.VerifyAddItem(item); foreach (FeeType fee in fees) { if (fee.Name == "ListingFee") addLogStatus("Success! Listing Fee : " + Convert.ToString(fee.Fee.Value)); } itemListing = true; } catch (ApiException ex) { itemListing = false; MessageBox.Show(ex.Message); Console.WriteLine(ex.Message); } return itemListing; }
public ShaderPropFloat(PropKey key, ValType valType) : base(key, valType) { }
protected ShaderPropFloat(string name, PropKey key, int id, ValType valType) : base(name, key, id, valType) { }
public virtual DASM16Builder GetMethod( String identifier, ValType[] paramTypes ) { return GetMethod( new MethodInfo( identifier, paramTypes, null ) ); }
public MethodInfo( String identifier, ValType[] paramTypes, ValType returnType ) { Identifier = identifier; ParamTypes = paramTypes; ReturnType = returnType; }
/// <summary> /// Create a value of the given type, injecting a ValueDictionary<T> IValueStore /// </summary> static internal Value Create(ValType type, int capacity = 0, string defaultValue = null) { int index = (int)type; return((index < _valCreate.Length) ? _valCreate[index](capacity, defaultValue) : Root.ValuesInvalid); }
public void AddMethod( String identifier, ValType[] paramTypes, ValType returnType, bool inline, DASM16Builder method ) { if ( inline ) myMethods.Add( new MethodInfo( identifier, paramTypes, returnType ), method ); else { String label = "__" + Identifier + "__" + identifier; foreach ( ValType type in paramTypes ) label += "__" + type.Identifier; stStaticASM.AddLabel( label, false ); stStaticASM.AddChild( method ); AddMethod( identifier, paramTypes, returnType, true, "JSR " + label ); } }
public ValType CheckValueType(Node node, Scope inner, Scope outer) { switch (node.GetNodeType()) { case NodeType.Variable: VariableNode variableNode = node as VariableNode; if (!inner.variables.TryGetValue(variableNode.name, out VariableNode val)) { if (!outer.variables.TryGetValue(variableNode.name, out val)) { throw new SemanticException(SemanticErrorCode.UndeclaredVariable, "Variable \"" + variableNode.name + "\" is not declared.", node.Line); } else { variableNode.ValType = val.ValType; variableNode.LocalIndex = val.LocalIndex; } } else { variableNode.ValType = val.ValType; variableNode.LocalIndex = val.LocalIndex; } return(variableNode.ValType); case NodeType.Assign: AssignNode assignNode = node as AssignNode; ValType left = CheckValueType(assignNode.left, inner, outer); ValType right = CheckValueType(assignNode.right, inner, outer); if (assignNode.left.ValType != right && !(assignNode.left.ValType == ValType.Double && right == ValType.Int)) { throw new SemanticException(SemanticErrorCode.IllegalCast, "Cannot cast " + Enum.GetName(typeof(ValType), right) + " to " + Enum.GetName(typeof(ValType), assignNode.left.ValType) + ".", assignNode.right.Line); } if (right == ValType.Int && assignNode.left.ValType == ValType.Double) { DoubleCastNode dcn = new DoubleCastNode(assignNode.right.Line); dcn.content = assignNode.right; assignNode.right = dcn; } assignNode.ValType = left; return(left); case NodeType.Int: return(ValType.Int); case NodeType.Double: return(ValType.Double); case NodeType.Bool: return(ValType.Bool); case NodeType.BinaryOp: BinaryOpNode binaryOpNode = node as BinaryOpNode; ValType l = CheckValueType(binaryOpNode.left, inner, outer); ValType r = CheckValueType(binaryOpNode.right, inner, outer); int v = (int)l * (int)r; if (binaryOpNode.type == BinaryOpType.BitAnd || binaryOpNode.type == BinaryOpType.BitOr) { if (v != 1) { throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Int value.", node.Line); } return(ValType.Int); } else { if (v > 1 && v < 4) { if (l == ValType.Double) { DoubleCastNode dcn = new DoubleCastNode(binaryOpNode.right.Line); dcn.content = binaryOpNode.right; binaryOpNode.right = dcn; } else { DoubleCastNode dcn = new DoubleCastNode(binaryOpNode.left.Line); dcn.content = binaryOpNode.left; binaryOpNode.left = dcn; } binaryOpNode.ValType = ValType.Double; return(ValType.Double); } else if (l == ValType.Bool || r == ValType.Bool) { throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Int or Double.", binaryOpNode.Line); } } binaryOpNode.ValType = l; return(l); case NodeType.LogicOp: LogicOpNode logicOpNode = node as LogicOpNode; left = CheckValueType(logicOpNode.left, inner, outer); right = CheckValueType(logicOpNode.right, inner, outer); if (left != ValType.Bool) { string typeString = Enum.GetName(typeof(ValType), left); throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Bool, but got " + typeString + ".", logicOpNode.left.Line); } if (right != ValType.Bool) { string typeString = Enum.GetName(typeof(ValType), right); throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Bool, but got " + typeString + ".", logicOpNode.right.Line); } logicOpNode.ValType = ValType.Bool; return(ValType.Bool); case NodeType.Comparison: ComparisonNode comparisonNode = node as ComparisonNode; left = CheckValueType(comparisonNode.left, inner, outer); right = CheckValueType(comparisonNode.right, inner, outer); if (left != right) { if (left == ValType.Bool || right == ValType.Bool) { throw new SemanticException(SemanticErrorCode.IllegalCast, "Comparison arguments are not the same type.", comparisonNode.Line); } else if (left == ValType.Int && right == ValType.Double) { DoubleCastNode dcn = new DoubleCastNode(comparisonNode.left.Line); dcn.content = comparisonNode.left; comparisonNode.left = dcn; } else if (right == ValType.Int && left == ValType.Double) { DoubleCastNode dcn = new DoubleCastNode(comparisonNode.right.Line); dcn.content = comparisonNode.right; comparisonNode.right = dcn; } } comparisonNode.ValType = ValType.Bool; return(ValType.Bool); case NodeType.Parenthesis: ParenthesisNode parenthesisNode = node as ParenthesisNode; ValType type = CheckValueType(parenthesisNode.content, inner, outer); parenthesisNode.ValType = type; return(type); case NodeType.IntCast: IntCastNode intCastNode = node as IntCastNode; CheckInScope(intCastNode.content, inner, outer); intCastNode.ValType = ValType.Int; return(ValType.Int); case NodeType.DoubleCast: DoubleCastNode doubleCastNode = node as DoubleCastNode; CheckInScope(doubleCastNode.content, inner, outer); doubleCastNode.ValType = ValType.Double; return(ValType.Double); case NodeType.Not: NotNode notNode = node as NotNode; type = CheckValueType(notNode.content, inner, outer); if (type != ValType.Bool) { string typeString = Enum.GetName(typeof(ValType), type); throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Bool, but got " + typeString + ".", notNode.content.Line); } notNode.ValType = ValType.Bool; return(ValType.Bool); case NodeType.Minus: MinusNode minusNode = node as MinusNode; type = CheckValueType(minusNode.content, inner, outer); if (type == ValType.Bool) { string typeString = Enum.GetName(typeof(ValType), type); throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Int or Double.", minusNode.content.Line); } minusNode.ValType = type; return(type); case NodeType.Neg: NegNode negNode = node as NegNode; type = CheckValueType(negNode.content, inner, outer); if (type != ValType.Int) { string typeString = Enum.GetName(typeof(ValType), type); throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Int, but got " + typeString + ".", negNode.content.Line); } negNode.ValType = type; return(ValType.Int); } return(ValType.None); }
public abstract Value Operate(Value value1, Value value2, Value value3, ValType type1, ValType type2, ValType type3);
public void CheckInScope(Node node, Scope inner, Scope outer) { switch (node.GetNodeType()) { case NodeType.Block: Scope newOuter = new Scope(outer); newOuter.AddScope(inner); GoDeeperInScope(node as BlockNode, newOuter); break; case NodeType.If: IfNode ifNode = node as IfNode; ValType type = CheckValueType(ifNode.check, inner, outer); if (type == ValType.Bool) { CheckInScope(ifNode.ifBlock, inner, outer); if (!(ifNode.elseBlock is null)) { CheckInScope(ifNode.elseBlock, inner, outer); } } else { string typeString = Enum.GetName(typeof(ValType), type); throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Bool, but got " + typeString + ".", node.Line); } break; case NodeType.While: WhileNode whileNode = node as WhileNode; type = CheckValueType(whileNode.check, inner, outer); if (type == ValType.Bool) { CheckInScope(whileNode.block, inner, outer); } else { string typeString = Enum.GetName(typeof(ValType), type); throw new SemanticException(SemanticErrorCode.IllegalCast, "Expected Bool, but got " + typeString + ".", node.Line); } break; case NodeType.Read: ReadNode readNode = node as ReadNode; CheckInScope(readNode.target, inner, outer); break; case NodeType.Write: WriteNode writeNode = node as WriteNode; if (!(writeNode.content is StringNode)) { CheckInScope(writeNode.content, inner, outer); } break; case NodeType.Variable: VariableNode variableNode = node as VariableNode; CheckValueType(variableNode, inner, outer); break; case NodeType.Init: InitNode initNode = node as InitNode; if (inner.variables.ContainsKey(initNode.variable.name)) { throw new SemanticException(SemanticErrorCode.VariableAlreadyDeclared, "Variable \"" + initNode.variable.name + "\" already declared in scope", initNode.variable.Line); } else { inner.variables.Add(initNode.variable.name, initNode.variable); } initNode.variable.LocalIndex = locals.Count; locals.Add(new LocalVariable { Name = initNode.variable.name, Type = initNode.variable.ValType }); break; case NodeType.Assign: AssignNode assignNode = node as AssignNode; CheckValueType(assignNode, inner, outer); break; case NodeType.BinaryOp: BinaryOpNode binaryOpNode = node as BinaryOpNode; CheckValueType(binaryOpNode, inner, outer); break; case NodeType.Comparison: ComparisonNode comparisonNode = node as ComparisonNode; CheckValueType(comparisonNode, inner, outer); break; case NodeType.Parenthesis: ParenthesisNode parenthesisNode = node as ParenthesisNode; CheckInScope(parenthesisNode.content, inner, outer); break; case NodeType.Int: case NodeType.Double: case NodeType.Bool: case NodeType.String: break; case NodeType.LogicOp: LogicOpNode logicNode = node as LogicOpNode; CheckValueType(logicNode, inner, outer); break; case NodeType.IntCast: IntCastNode intCastNode = node as IntCastNode; CheckValueType(intCastNode, inner, outer); break; case NodeType.DoubleCast: DoubleCastNode doubleCastNode = node as DoubleCastNode; CheckValueType(doubleCastNode, inner, outer); break; case NodeType.Not: NotNode notNode = node as NotNode; CheckValueType(notNode, inner, outer); break; case NodeType.Minus: MinusNode minusNode = node as MinusNode; CheckValueType(minusNode, inner, outer); break; case NodeType.Neg: NegNode negNode = node as NegNode; CheckValueType(negNode, inner, outer); break; } }
public virtual bool HasMethod( String identifier, ValType[] paramTypes ) { return HasMethod( new MethodInfo( identifier, paramTypes, null ) ); }
/// <summary> /// 构造函数 /// </summary> public CalVal(CalOpe ope) { this.ope = ope; this.type = ValType.Operator; this.level = ope.level; }
private string addItem(MySQLWrapper.eBayItem ebayItem) { string listedItemId = "-1"; StringBuilder htmlDescription = new StringBuilder(); TextReader tr = new StreamReader("template.txt"); htmlDescription.Insert(0, tr.ReadToEnd()); tr.Close(); htmlDescription.Replace("{0}", ebayItem.Title); htmlDescription.Replace("{1}", ebayItem.Author); htmlDescription.Replace("{2}", ebayItem.Publisher); htmlDescription.Replace("{3}", ebayItem.publishDate); htmlDescription.Replace("{4}", ebayItem.Binding); htmlDescription.Replace("{5}", ebayItem.ISBN); if (ebayItem.UPC != "") htmlDescription.Replace("{6}", "<b>UPC : </b>" + ebayItem.UPC + "</br>"); else htmlDescription.Replace("{6}", ""); htmlDescription.Replace("{7}", ebayItem.Weight.ToString()); htmlDescription.Replace("{8}", ebayItem.Notes); htmlDescription.Replace("{9}", ebayItem.Description); ItemType item = new ItemType(); item.InventoryTrackingMethod = InventoryTrackingMethodCodeType.SKU; item.SKU = ebayItem.SKU; // Title max length 55 chars if (ebayItem.Title.Length > 55) item.Title = ebayItem.Title.Substring(0, 54); else item.Title = ebayItem.Title; if (ebayItem.Image != "") { item.PictureDetails = new PictureDetailsType(); item.PictureDetails.PictureURL.Add(ebayItem.Image); } item.Description = htmlDescription.ToString(); item.Currency = CurrencyCodeType.INR; item.ListingType = ListingTypeCodeType.FixedPriceItem; item.Quantity = ebayItem.Quantity; item.PostalCode = eBayLister.UserSettings.Default.itemPincode; item.Location = eBayLister.UserSettings.Default.itemCityState; item.Country = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), eBayLister.UserSettings.Default.itemCountry, true); item.ListingDuration = getListingDuration(); item.PrimaryCategory = new CategoryType(); if (eBayLister.UserSettings.Default.ListInCategory.Equals("Other Books")) { item.PrimaryCategory.CategoryID = "268"; } else { item.PrimaryCategory.CategoryID = "37558"; } item.StartPrice = new AmountType(); item.StartPrice.currencyID = CurrencyCodeType.INR; item.StartPrice.Value = ebayItem.Price * Convert.ToDouble(eBayLister.UserSettings.Default.ConversionRate); item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection(); item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PaisaPayAccepted); item.ShippingDetails = this.getShippingDetails(); item.ReturnPolicy = this.getReturnPolicy(); string handlingTime = eBayLister.UserSettings.Default.handlingTime; handlingTime = handlingTime.Remove(handlingTime.IndexOf(' ')); item.DispatchTimeMax = Convert.ToInt32(handlingTime); AttributeType conditionAttribute = new AttributeType(); conditionAttribute.attributeLabel = "Condition"; ValTypeCollection valueCollection = new ValTypeCollection(); ValType valueType = new ValType(); if (ebayItem.bookCondition.Contains("Used")) valueType.ValueLiteral = "Used"; else valueType.ValueLiteral = "New"; valueCollection.Add(valueType); conditionAttribute.Value = valueCollection; item.AttributeArray = new AttributeTypeCollection(); item.AttributeArray.Add(conditionAttribute); AddItemCall apiCall = new AddItemCall(context); FeeTypeCollection fees = apiCall.AddItem(item); foreach (FeeType fee in fees) { if (fee.Name == "ListingFee") addLogStatus("Success! Listing Fee : " + Convert.ToString(fee.Fee.Value)); } listedItemId = apiCall.ItemID; return listedItemId; }
public long GetSelfByteLength() { return(Name.GetUE4ByteLength() + Type.GetUE4ByteLength() + 8 + KeyType.GetUE4ByteLength() + ValType.GetUE4ByteLength() + 1 + Length); }
public VariableInfo( ushort offset, VariableInfo info ) { Offset = offset; Name = info.Name; Type = info.Type; Length = info.Length; Reference = info.Reference; Size = info.Size; }
/// <summary> /// get all id value of the valuelist in the xml document /// </summary> /// <param name="xmlNode"></param> /// <returns></returns> private static ValTypeCollection getValue(XmlNode xmlNode) { string xpath="ValueList/Value"; XmlNodeList nodeList=xmlNode.SelectNodes(xpath); ValTypeCollection valTypeCol=new ValTypeCollection(); foreach(XmlNode node in nodeList) { XmlAttributeCollection attribute=node.Attributes; XmlNode idNode=attribute.GetNamedItem("id"); int valueId=int.Parse(idNode.Value); if(valueId>0) { ValType valType=new ValType(); valType.ValueID=valueId; valTypeCol.Add(valType); break; } } if(valTypeCol.Count==0) { return null; } return valTypeCol; }
public VariableInfo( String name, ValType type, bool reference, int arrayLength = 1 ) { Offset = 0xffff; Name = name; Type = type; Length = 1; Reference = reference; Size = ( Reference ? 1 : Type.Size * Length + 1 ); }
public void AddItemFull3() { bool isSucess,isProductSearchPageAvailable; bool existing=false,isbnExisting=false; string message; Int32Collection attributes=new Int32Collection(); CategoryTypeCollection categories=null; CharacteristicsSetTypeCollection characteristics=null; ItemType item= ItemHelper.BuildItem(); //check whether the category is catalog enabled. isSucess=CategoryHelper.IsCatagoryEnabled(this.apiContext,PSPACATEGORYID.ToString(),CategoryEnableCodeType.ProductSearchPageAvailable,out isProductSearchPageAvailable,out message); Assert.IsTrue(isSucess,message); Assert.IsTrue(isProductSearchPageAvailable,message); isSucess=CategoryHelper.IsCatagoryEnabled(this.apiContext,PSPACATEGORYID.ToString(),CategoryEnableCodeType.CatalogEnabled,out isProductSearchPageAvailable,out message); Assert.IsTrue(isSucess,message); Assert.IsTrue(isProductSearchPageAvailable,message); //modify item information approporiately. item.PrimaryCategory.CategoryID=PSPACATEGORYID.ToString(); item.Description = "check whether the item can be added by GetProductSearchPage method way,This is a test item created by eBay SDK SanityTest."; //get characters information using GetCategory2CSCall GetCategory2CSCall csCall=new GetCategory2CSCall(this.apiContext); DetailLevelCodeTypeCollection levels=new DetailLevelCodeTypeCollection(); DetailLevelCodeType level=new DetailLevelCodeType(); level=DetailLevelCodeType.ReturnAll; levels.Add(level); csCall.DetailLevelList=levels; csCall.CategoryID=PSPACATEGORYID.ToString(); csCall.Execute(); //check whether the call is success. Assert.IsTrue(csCall.AbstractResponse.Ack==AckCodeType.Success || csCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.IsNotNull(csCall.ApiResponse.MappedCategoryArray); Assert.Greater(csCall.ApiResponse.MappedCategoryArray.Count,0); categories=csCall.ApiResponse.MappedCategoryArray; foreach(CategoryType category in categories) { if(string.Compare(category.CategoryID,PSPACATEGORYID)==0) { characteristics=category.CharacteristicsSets; existing= true; break; } } //confirm that the category was in the mapping category. Assert.IsTrue(existing,PSPACATEGORYID+" do not exist in the mapping category"); Assert.IsNotNull(characteristics); Assert.Greater(characteristics.Count,0); foreach(CharacteristicsSetType characteristic in characteristics) { attributes.Add(characteristic.AttributeSetID); } //confirm that there is real attributeset in the mapping category. Assert.AreEqual(attributes.Count,1);//there is only one AttributeSetID in the category 279. GetProductSearchPageCall searchPageCall=new GetProductSearchPageCall(this.apiContext); searchPageCall.AttributeSetIDList=attributes; DetailLevelCodeTypeCollection levels2=new DetailLevelCodeTypeCollection(); DetailLevelCodeType level2=new DetailLevelCodeType(); level2=DetailLevelCodeType.ReturnAll; levels2.Add(level2); searchPageCall.DetailLevelList=levels2; searchPageCall.Execute(); //check whether the call is success. Assert.IsTrue(searchPageCall.ApiResponse.Ack==AckCodeType.Success || searchPageCall.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.AreEqual(searchPageCall.ApiResponse.ProductSearchPage.Count,1);//for the input attributeset id is only one. Assert.IsNotNull(searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet);//for the input attributeset id is only one. Assert.IsNotNull(searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet.Characteristics); Assert.Greater(searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet.Characteristics.Count,0); //check the isbn-13 attribute id exists and its value has not been changed. CharacteristicTypeCollection chs = searchPageCall.ApiResponse.ProductSearchPage[0].SearchCharacteristicsSet.Characteristics; foreach(CharacteristicType charactersic in chs) { //check whether the isbn attribute can be used if(charactersic.AttributeID==ISBN13ATTRIBUTEID && (string.Compare(charactersic.Label.Name,"ISBN-13",true)==0)) { isbnExisting=true; break; } } Assert.IsTrue(isbnExisting,"the isbn attribute id is not existing or has been changed!"); //using GetProductSearchResults call to find products. ProductSearchType productSearch=new ProductSearchType(); productSearch.AttributeSetID=attributes[0]; SearchAttributesTypeCollection searchAttributes=new SearchAttributesTypeCollection(); SearchAttributesType searchAttribute=new SearchAttributesType(); searchAttribute.AttributeID=ISBN13ATTRIBUTEID; ValTypeCollection vals=new ValTypeCollection(); ValType val=new ValType(); val.ValueLiteral=ISBN; vals.Add(val); searchAttribute.ValueList=vals; searchAttributes.Add(searchAttribute); productSearch.SearchAttributes=searchAttributes; GetProductSearchResultsCall searchResultsCall=new GetProductSearchResultsCall(this.apiContext); searchResultsCall.ProductSearchList=new ProductSearchTypeCollection(new ProductSearchType[]{productSearch}); searchResultsCall.Execute(); //check whether the call is success. Assert.IsTrue(searchResultsCall.ApiResponse.Ack==AckCodeType.Success || searchResultsCall.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult.Count,0); Assert.AreEqual(int.Parse(searchResultsCall.ApiResponse.ProductSearchResult[0].NumProducts),1); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet.Count,0); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies.Count,0); Assert.IsFalse(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].hasMoreChildren); Assert.IsNotNull(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].ParentProduct.productID); string productID=searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].ParentProduct.productID; ProductListingDetailsType plist=new ProductListingDetailsType(); plist.ProductID=productID; plist.IncludePrefilledItemInformation=true; plist.IncludeStockPhotoURL=true; item.ProductListingDetails=plist; FeeTypeCollection fees; VerifyAddItemCall vi = new VerifyAddItemCall(apiContext); fees = vi.VerifyAddItem(item); Assert.IsNotNull(fees); AddItemCall addItemCall = new AddItemCall(apiContext);; fees = addItemCall.AddItem(item); //check whether the call is success. Assert.IsTrue(addItemCall.AbstractResponse.Ack==AckCodeType.Success || addItemCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.IsTrue(item.ItemID!=string.Empty); Assert.IsNotNull(fees); //caution check ItemType itemOut; isSucess=ItemHelper.GetItem(item,this.apiContext,out message, out itemOut); Assert.IsTrue(isSucess,message); Assert.IsNotNull(itemOut,"Item is null"); Assert.Greater(itemOut.AttributeSetArray.Count,0); Assert.Greater(itemOut.AttributeSetArray[0].Attribute.Count,0); Assert.Greater(itemOut.AttributeSetArray[0].Attribute[0].Value.Count,0); }
public Boolean runTest() { Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer); int iCountErrors = 0; int iCountTestcases = 0; String strLoc = "Loc_000oo"; ObjectManager manager; ISurrogateSelector selector = null; StreamingContext context = new StreamingContext(StreamingContextStates.All); ClsType cls1; ValType val1; Int32 iValue; MemberInfo[] valueMembers; MemberInfo[] classMembers; MemberInfo[] classMembers1; ClsType1 cls2; ClsType2 cls3; ClsType3 cls4; ValType1 val2; SerializationInfo info; try { strLoc = "Loc_97356tsg"; iCountTestcases++; cls1 = new ClsType(); val1 = new ValType(); iValue = 10; classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType), context); valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context); manager = new ObjectManager(selector, context); manager.RecordFixup(2, valueMembers[0], 3); manager.RecordFixup(1, classMembers[0], 2); manager.RegisterObject(cls1, 1); manager.RegisterObject(val1, 2); manager.RegisterObject(iValue, 3); if(cls1.ValueType.I != 0){ iCountErrors++; Console.WriteLine("Err_853rwtg! Change of behavioue, unexpected value returned, " + cls1.ValueType.I); } strLoc = "Loc_7934sgd"; iCountTestcases++; cls1 = new ClsType(); val1 = new ValType(); iValue = 10; classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType), context); valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context); manager = new ObjectManager(selector, context); manager.RecordFixup(2, valueMembers[0], 3); manager.RecordFixup(1, classMembers[0], 2); manager.RegisterObject(cls1, 1); manager.RegisterObject(val1, 2, null, 1, classMembers[0]); manager.RegisterObject(iValue, 3); if(cls1.ValueType.I != 10){ iCountErrors++; Console.WriteLine("Err_23450sdg! Unexpected value returned, " + cls1.ValueType.I); } strLoc = "Loc_734rgt"; iCountTestcases++; cls2 = new ClsType1(); cls3 = new ClsType2(); iValue = 10; classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType1), context); classMembers1 = FormatterServices.GetSerializableMembers(typeof(ClsType2), context); manager = new ObjectManager(selector, context); manager.RecordFixup(2, classMembers1[0], 3); manager.RecordFixup(1, classMembers[0], 2); manager.RegisterObject(cls2, 1); manager.RegisterObject(cls3, 2); manager.RegisterObject(iValue, 3); if(cls2.Cls2.I != 10){ iCountErrors++; Console.WriteLine("Err_987345sg! Change of behavioue, unexpected value returned, " + cls2.Cls2.I); } strLoc = "Loc_9743sg"; iCountTestcases++; cls4 = new ClsType3(); val2 = new ValType1(); iValue = 10; classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType3), context); manager = new ObjectManager(selector, context); manager.RecordDelayedFixup(2, "SerializationTest", 3); manager.RecordFixup(1, classMembers[0], 2); manager.RegisterObject(cls4, 1); info = new SerializationInfo(typeof(ValType1), new FormatterConverter()); manager.RegisterObject(val2, 2, info, 1, classMembers[0]); manager.RegisterObject(iValue, 3); try{ manager.DoFixups(); }catch(ArgumentException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_3497tsdg! Wrong exception thrown, " + ex.GetType().Name); } strLoc = "Loc_8932745rsdf"; iCountTestcases++; cls1 = new ClsType(); val1 = new ValType(); iValue = 10; classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType), context); valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context); manager = new ObjectManager(selector, context); manager.RecordFixup(2, valueMembers[0], 3); manager.RecordFixup(1, classMembers[0], 2); manager.RegisterObject(cls1, 1); manager.RegisterObject(val1, 5, null, 1, classMembers[0]); manager.RegisterObject(iValue, 3); try{ manager.DoFixups(); iCountErrors++; Console.WriteLine("Err_47sg! Exception now thrown"); }catch(SerializationException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_38945gd! Unexpected exception returned, " + ex.GetType().Name); } strLoc = "Loc_8932745rsdf"; iCountTestcases++; cls1 = new ClsType(); val1 = new ValType(); iValue = 10; classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType), context); valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context); manager = new ObjectManager(selector, context); manager.RecordFixup(2, valueMembers[0], 3); manager.RecordFixup(1, classMembers[0], 2); manager.RegisterObject(cls1, 1); try{ manager.RegisterObject(val1, 2, null, 2, classMembers[0]); iCountErrors++; Console.WriteLine("Err_8743gs! Exception now thrown"); }catch(SerializationException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_832745wg! Unexpected exception returned, " + ex.GetType().Name); } strLoc = "Loc_8734sdg"; iCountTestcases++; cls1 = new ClsType(); val1 = new ValType(); iValue = 10; classMembers = FormatterServices.GetSerializableMembers(typeof(ClsType1), context); valueMembers = FormatterServices.GetSerializableMembers(typeof(ValType), context); manager = new ObjectManager(selector, context); manager.RecordFixup(2, valueMembers[0], 3); manager.RecordFixup(1, classMembers[0], 2); manager.RegisterObject(cls1, 1); try{ manager.RegisterObject(val1, 2, null, 1, classMembers[0]); iCountErrors++; Console.WriteLine("Err_47sg! Exception now thrown"); }catch(ArgumentException){ }catch(Exception ex){ iCountErrors++; Console.WriteLine("Err_38945gd! Unexpected exception returned, " + ex.GetType().Name); } } catch (Exception exc_general ) { ++iCountErrors; Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general==\n"+exc_general.StackTrace); } if ( iCountErrors == 0 ) { Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases); return true; } else { Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums ); return false; } }
public ClsType() { valueType = new ValType(); valueType.I = 5; }
private static ValTypeCollection ConvertValTypeCollection(ValTypeCollection fromVals) { ValTypeCollection toVals = new ValTypeCollection(); foreach(ValType fromVal in fromVals) { ValType newVal = new ValType(); newVal.Any = fromVal.Any; newVal.SuggestedValueLiteral = fromVal.SuggestedValueLiteral; newVal.ValueID = fromVal.ValueID; newVal.ValueIDSpecified = fromVal.ValueIDSpecified; newVal.ValueLiteral = fromVal.ValueLiteral; toVals.Add(newVal); } return toVals; }
public abstract bool CheckArguments(ValType type1, ValType type2, ValType type3);
public override string ToString() { var vdb = string.Empty; if (ValType != TagBuilder.ValueType.BinXmlType && ValType != TagBuilder.ValueType.NullType && ValType != TagBuilder.ValueType.StringType) { vdb = $" : Data bytes: {BitConverter.ToString(DataBytes)}"; } return ($"Position: {Position.ToString().PadRight(5)} Size: 0x{Size.ToString("X").PadRight(5)} Type: {ValType.ToString().PadRight(15)} Value: : {GetDataAsString().PadRight(50)}{vdb}"); }
/// <summary> /// 构造函数 /// </summary> public CalVal(CalNum num) { this.num = num; this.type = ValType.Number; }
public void AddMethod( String identifier, ValType[] paramTypes, ValType returnType, bool inline, String asm ) { AddMethod( identifier, paramTypes, returnType, inline, DASM16Assembler.Parse( asm ) ); }
public AtomNode(object value, ValType type, int line) : this(value, type) { this.line = line; }
public void GetProductSearchResultsFull() { bool isbnExisting=false; Int32Collection attributes=new Int32Collection(); Assert.IsNotNull(TestData.ProductSearchPages2); Assert.Greater(TestData.ProductSearchPages2.Count,0); Assert.Greater(TestData.ProductSearchPages2[0].SearchCharacteristicsSet.Characteristics.Count,0); //check whether the call is success. Assert.AreEqual(string.Compare(TestData.Category2CS2.CategoryID,PSPACATEGORYID,true),0); CharacteristicsSetTypeCollection characteristics = TestData.Category2CS2.CharacteristicsSets; //confirm that the category was in the mapping category. Assert.IsNotNull(characteristics); Assert.Greater(characteristics.Count,0); foreach(CharacteristicsSetType characteristic in characteristics) { attributes.Add(characteristic.AttributeSetID); } //check the isbn-13 attribute id exists and its value has not been changed. CharacteristicTypeCollection chs = TestData.ProductSearchPages2[0].SearchCharacteristicsSet.Characteristics; foreach(CharacteristicType charactersic in chs) { //check whether the isbn attribute can be used if(charactersic.AttributeID==ISBN13ATTRIBUTEID && (string.Compare(charactersic.Label.Name,"ISBN-13",true)==0)) { isbnExisting=true; break; } } Assert.IsTrue(isbnExisting,"the isbn attribute id is not existing or has been changed!"); //using GetProductSearchResults call to find products. ProductSearchType productSearch=new ProductSearchType(); productSearch.AttributeSetID=attributes[0]; SearchAttributesTypeCollection searchAttributes=new SearchAttributesTypeCollection(); SearchAttributesType searchAttribute=new SearchAttributesType(); searchAttribute.AttributeID=ISBN13ATTRIBUTEID; ValTypeCollection vals=new ValTypeCollection(); ValType val=new ValType(); val.ValueLiteral=ISBN; vals.Add(val); searchAttribute.ValueList=vals; searchAttributes.Add(searchAttribute); productSearch.SearchAttributes=searchAttributes; GetProductSearchResultsCall searchResultsCall=new GetProductSearchResultsCall(this.apiContext); searchResultsCall.ProductSearchList=new ProductSearchTypeCollection(new ProductSearchType[]{productSearch}); searchResultsCall.Execute(); //check whether the call is success. Assert.IsTrue(searchResultsCall.ApiResponse.Ack==AckCodeType.Success || searchResultsCall.ApiResponse.Ack==AckCodeType.Warning,"do not success!"); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult.Count,0); Assert.AreEqual(int.Parse(searchResultsCall.ApiResponse.ProductSearchResult[0].NumProducts),1); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet.Count,0); Assert.Greater(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies.Count,0); Assert.IsFalse(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].hasMoreChildren); Assert.IsNotNull(searchResultsCall.ApiResponse.ProductSearchResult[0].AttributeSet[0].ProductFamilies[0].ParentProduct.productID); TestData.ProductSearchResults2 = searchResultsCall.ApiResponse.ProductSearchResult; }