Beispiel #1
0
 public void Visit(ConstValue operand)
 {
     _value = operand.Value();
 }
        /// <summary>
        /// <para>
        /// Base on parametersetName to create ciminstances,
        /// either remotely or locally
        /// </para>
        /// </summary>
        /// <param name="cmdlet"><see cref="GetCimInstanceCommand"/> object.</param>
        public void NewCimInstance(NewCimInstanceCommand cmdlet)
        {
            DebugHelper.WriteLogEx();

            string      nameSpace;
            CimInstance cimInstance = null;

            try
            {
                switch (cmdlet.ParameterSetName)
                {
                case CimBaseCommand.ClassNameComputerSet:
                case CimBaseCommand.ClassNameSessionSet:
                {
                    nameSpace   = ConstValue.GetNamespace(cmdlet.Namespace);
                    cimInstance = CreateCimInstance(cmdlet.ClassName,
                                                    nameSpace,
                                                    cmdlet.Key,
                                                    cmdlet.Property,
                                                    cmdlet);
                }

                break;

                case CimBaseCommand.ResourceUriSessionSet:
                case CimBaseCommand.ResourceUriComputerSet:
                {
                    nameSpace   = cmdlet.Namespace;       // passing null is ok for resourceUri set
                    cimInstance = CreateCimInstance("DummyClass",
                                                    nameSpace,
                                                    cmdlet.Key,
                                                    cmdlet.Property,
                                                    cmdlet);
                }

                break;

                case CimBaseCommand.CimClassComputerSet:
                case CimBaseCommand.CimClassSessionSet:
                {
                    nameSpace   = ConstValue.GetNamespace(cmdlet.CimClass.CimSystemProperties.Namespace);
                    cimInstance = CreateCimInstance(cmdlet.CimClass,
                                                    cmdlet.Property,
                                                    cmdlet);
                }

                break;

                default:
                    return;
                }
            }
            catch (ArgumentNullException e)
            {
                cmdlet.ThrowTerminatingError(e, action);
                return;
            }
            catch (ArgumentException e)
            {
                cmdlet.ThrowTerminatingError(e, action);
                return;
            }

            // return if create client only ciminstance
            if (cmdlet.ClientOnly)
            {
                cmdlet.CmdletOperation.WriteObject(cimInstance, null);
                return;
            }

            string target = cimInstance.ToString();

            if (!cmdlet.ShouldProcess(target, action))
            {
                return;
            }

            // create ciminstance on server
            List <CimSessionProxy> proxys = new();

            switch (cmdlet.ParameterSetName)
            {
            case CimBaseCommand.ClassNameComputerSet:
            case CimBaseCommand.CimClassComputerSet:
            case CimBaseCommand.ResourceUriComputerSet:
            {
                IEnumerable <string> computerNames = ConstValue.GetComputerNames(
                    cmdlet.ComputerName);
                foreach (string computerName in computerNames)
                {
                    proxys.Add(CreateSessionProxy(computerName, cmdlet));
                }
            }

            break;

            case CimBaseCommand.CimClassSessionSet:
            case CimBaseCommand.ClassNameSessionSet:
            case CimBaseCommand.ResourceUriSessionSet:
                foreach (CimSession session in cmdlet.CimSession)
                {
                    proxys.Add(CreateSessionProxy(session, cmdlet));
                }

                break;
            }

            foreach (CimSessionProxy proxy in proxys)
            {
                proxy.ContextObject = new CimNewCimInstanceContext(proxy, nameSpace);
                proxy.CreateInstanceAsync(nameSpace, cimInstance);
            }
        }
        /// <summary>
        /// <para>
        /// Refactor to be reused by Get-CimInstance;Remove-CimInstance;Set-CimInstance
        /// </para>
        /// </summary>
        /// <param name="cmdlet"></param>
        protected void GetCimInstanceInternal(CimBaseCommand cmdlet)
        {
            IEnumerable <string> computerNames = ConstValue.GetComputerNames(
                GetComputerName(cmdlet));
            string nameSpace;
            List <CimSessionProxy> proxys       = new();
            bool        isGetCimInstanceCommand = cmdlet is GetCimInstanceCommand;
            CimInstance targetCimInstance       = null;

            switch (cmdlet.ParameterSetName)
            {
            case CimBaseCommand.CimInstanceComputerSet:
                foreach (string computerName in computerNames)
                {
                    targetCimInstance = GetCimInstanceParameter(cmdlet);
                    CimSessionProxy proxy = CreateSessionProxy(computerName, targetCimInstance, cmdlet);
                    if (isGetCimInstanceCommand)
                    {
                        SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
                    }

                    proxys.Add(proxy);
                }

                break;

            case CimBaseCommand.ClassNameComputerSet:
            case CimBaseCommand.QueryComputerSet:
            case CimBaseCommand.ResourceUriComputerSet:
                foreach (string computerName in computerNames)
                {
                    CimSessionProxy proxy = CreateSessionProxy(computerName, cmdlet);
                    if (isGetCimInstanceCommand)
                    {
                        SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
                    }

                    proxys.Add(proxy);
                }

                break;

            case CimBaseCommand.ClassNameSessionSet:
            case CimBaseCommand.CimInstanceSessionSet:
            case CimBaseCommand.QuerySessionSet:
            case CimBaseCommand.ResourceUriSessionSet:
                foreach (CimSession session in GetCimSession(cmdlet))
                {
                    CimSessionProxy proxy = CreateSessionProxy(session, cmdlet);
                    if (isGetCimInstanceCommand)
                    {
                        SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
                    }

                    proxys.Add(proxy);
                }

                break;

            default:
                break;
            }

            switch (cmdlet.ParameterSetName)
            {
            case CimBaseCommand.ClassNameComputerSet:
            case CimBaseCommand.ClassNameSessionSet:
                nameSpace = ConstValue.GetNamespace(GetNamespace(cmdlet));
                if (IsClassNameQuerySet(cmdlet))
                {
                    string query = CreateQuery(cmdlet);
                    DebugHelper.WriteLogEx(@"Query = {0}", 1, query);
                    foreach (CimSessionProxy proxy in proxys)
                    {
                        proxy.QueryInstancesAsync(nameSpace,
                                                  ConstValue.GetQueryDialectWithDefault(GetQueryDialect(cmdlet)),
                                                  query);
                    }
                }
                else
                {
                    foreach (CimSessionProxy proxy in proxys)
                    {
                        proxy.EnumerateInstancesAsync(nameSpace, GetClassName(cmdlet));
                    }
                }

                break;

            case CimBaseCommand.CimInstanceComputerSet:
            case CimBaseCommand.CimInstanceSessionSet:
            {
                CimInstance instance = GetCimInstanceParameter(cmdlet);
                nameSpace = ConstValue.GetNamespace(instance.CimSystemProperties.Namespace);
                foreach (CimSessionProxy proxy in proxys)
                {
                    proxy.GetInstanceAsync(nameSpace, instance);
                }
            }

            break;

            case CimBaseCommand.QueryComputerSet:
            case CimBaseCommand.QuerySessionSet:
                nameSpace = ConstValue.GetNamespace(GetNamespace(cmdlet));
                foreach (CimSessionProxy proxy in proxys)
                {
                    proxy.QueryInstancesAsync(nameSpace,
                                              ConstValue.GetQueryDialectWithDefault(GetQueryDialect(cmdlet)),
                                              GetQuery(cmdlet));
                }

                break;

            case CimBaseCommand.ResourceUriSessionSet:
            case CimBaseCommand.ResourceUriComputerSet:
                foreach (CimSessionProxy proxy in proxys)
                {
                    proxy.EnumerateInstancesAsync(GetNamespace(cmdlet), GetClassName(cmdlet));
                }

                break;

            default:
                break;
            }
        }
Beispiel #4
0
        public bool DecodeTelemetryEvent(Results results, out string eventName, out KeyValuePair <string, object>[] properties)
        {
            properties = null;

            // NOTE: the message event is an MI Extension from clrdbg, though we could use in it the future for other debuggers
            eventName = results.TryFindString("event-name");
            if (string.IsNullOrEmpty(eventName) || !char.IsLetter(eventName[0]) || !eventName.Contains('/'))
            {
                Debug.Fail("Bogus telemetry event. 'Event-name' property is missing or invalid.");
                return(false);
            }

            TupleValue tuple;

            if (!results.TryFind("properties", out tuple))
            {
                Debug.Fail("Bogus message event, missing 'properties' property");
                return(false);
            }

            List <KeyValuePair <string, object> > propertyList = new List <KeyValuePair <string, object> >(tuple.Content.Count);

            foreach (NamedResultValue pair in tuple.Content)
            {
                ConstValue resultValue = pair.Value as ConstValue;
                if (resultValue == null)
                {
                    continue;
                }

                string content = resultValue.Content;
                if (string.IsNullOrEmpty(content))
                {
                    continue;
                }

                object value = content;
                int    numericValue;
                if (content.Length >= 3 && content.StartsWith("0x", StringComparison.OrdinalIgnoreCase) && int.TryParse(content.Substring(2), NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out numericValue))
                {
                    value = numericValue;
                }
                else if (int.TryParse(content, NumberStyles.None, CultureInfo.InvariantCulture, out numericValue))
                {
                    value = numericValue;
                }

                if (value != null)
                {
                    propertyList.Add(new KeyValuePair <string, object>(pair.Name, value));
                }
            }

            properties = propertyList.ToArray();

            // If we are processing a clrdbg ProcessCreate event, save the event properties so we can use them to send other events
            if (eventName == "VS/Diagnostics/Debugger/clrdbg/ProcessCreate")
            {
                _clrdbgProcessCreateProperties = properties;
            }

            return(true);
        }
 public static object ComputeDouble(ConstValue constLeft)
 {
     return(Convert.ToDouble(constLeft.Value));
 }
 public static object ComputeFloat(ConstValue constLeft)
 {
     return(Convert.ToSingle(constLeft.Value));
 }
        private void HandleOr(ConstValue constLeft, ConstValue constRight, List <LocalOperation> localOperations, int pos)
        {
            var result = ComputeConstantOperator.ComputeOr(constLeft, constRight);

            FoldConstant(result, localOperations, pos);
        }
 public virtual void Visit(ConstValue operand)
 {
 }
Beispiel #9
0
 protected override IPhpValue VisitConstValue(ConstValue src)
 {
     return(new PhpConstValue(src.MyValue));
 }
        private void HandleConvFloat(ConstValue constLeft, List <LocalOperation> localOperations, int pos)
        {
            var result = ComputeConstantOperator.ComputeFloat(constLeft);

            FoldConstant(result, localOperations, pos);
        }
Beispiel #11
0
        public void ResetIfShouldResetHitCount()
        {
            FakeConsoleRam ram = new FakeConsoleRam(0xFF);

            ram.Data[4] = 0;

            ReadMemoryValue levelMemoryValue = new ReadMemoryValue
            {
                Address = 0x0004,
                Kind    = MemoryAddressKind.Int8
            };

            ConstValue value = new ConstValue(8);

            ConditionInstruction condition1 = new ConditionInstruction
            {
                CompareInstruction = new CompareInstruction()
                {
                    Left      = levelMemoryValue,
                    Right     = value,
                    Operation = ConditionCompare.Equals
                }
            };

            ConditionInstruction condition2 = new ConditionInstruction
            {
                CompareInstruction = new CompareInstruction()
                {
                    Left      = levelMemoryValue,
                    Right     = new DeltaValue(levelMemoryValue),
                    Operation = ConditionCompare.Greater,
                },
                TargetHitCount = 8
            };

            ResetIfConditionInstruction resetIfCondition3 = new ResetIfConditionInstruction
            {
                CompareInstruction = new CompareInstruction()
                {
                    Left      = levelMemoryValue,
                    Right     = new DeltaValue(levelMemoryValue),
                    Operation = ConditionCompare.Less
                }
            };

            AchievementInstruction achievementInstruction = new AchievementInstruction
            {
                Core = new ConditionGroupInstruction(new[] {
                    condition1,
                    condition2,
                    resetIfCondition3
                }
                                                     )
            };

            Assert.False(achievementInstruction.Evaluate(ram));

            ram.Data[4] = 1;

            Assert.False(achievementInstruction.Evaluate(ram));
            Assert.Equal(1, condition2.CurrentHitCount);

            ram.Data[4] = 2;
            achievementInstruction.Evaluate(ram);
            Assert.Equal(2, condition2.CurrentHitCount);

            ram.Data[4] = 3;
            achievementInstruction.Evaluate(ram);
            Assert.Equal(3, condition2.CurrentHitCount);

            ram.Data[4] = 1;
            achievementInstruction.Evaluate(ram);

            Assert.Equal(0, condition2.CurrentHitCount);
        }
Beispiel #12
0
        private void LoadPayItemDetailInfo()
        {
            PayItemDetailInfoReq request = new PayItemDetailInfoReq();

            if (ValidQueryParam(this.Request.Param, ref request))
            {
                this._payFacade.LoadPayDetailInfoForEdit(request, result =>
                {
                    this.btnNew.IsEnabled = true && AuthMgr.HasFunctionPoint(AuthKeyConst.Invoice_PayItem_InvoiceInputMaintain_Insert);

                    _pageVM = result;
                    this.LayoutRoot.DataContext = _pageVM;
                    this.tbTotalInfo.Text       = string.Format(ResPayItemMaintain.Message_TotalInfo,
                                                                _pageVM.OrderSysNo, ConstValue.Invoice_ToCurrencyString(_pageVM.TotalAmt), ConstValue.Invoice_ToCurrencyString(_pageVM.PaidAmt));
                    this.tbTotalInfo.Visibility = Visibility.Visible;

                    if (_pageVM.OrderType == PayableOrderType.POAdjust || _pageVM.OrderType == PayableOrderType.RMAPOR)
                    {
                        this.btnNew.IsEnabled = false;
                    }
                });
            }
            else
            {
                this.Window.Confirm(ResPayItemMaintain.Message_RecordDataError, (x => {
                    this.Window.Close();
                }));
            }
        }
 public virtual void Visit(ConstValue operand)
 {
     _clazz = _referenceProvider.ForType(operand.Value().GetType());
 }
        /// <summary>
        /// 合计选择项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnTotal_Click(object sender, RoutedEventArgs e)
        {
            var selectedItemList = GetSelectedItemList();

            if (selectedItemList.Count <= 0)
            {
                Window.Alert(ResCommon.Message_AtLeastChooseOneRecord);
                return;
            }

            decimal totalRefundAmt = 0;

            foreach (dynamic item in selectedItemList)
            {
                totalRefundAmt += item.ReturnPrepayAmt;
            }
            string totalInfo = string.Format("共选择了{0}条记录; 合计退款金额:{1}", selectedItemList.Count, ConstValue.Invoice_ToCurrencyString(totalRefundAmt));

            this.tbStatisticInfo.Text       = totalInfo;
            this.tbStatisticInfo.Visibility = Visibility.Visible;
        }
        /// <summary>
        /// <para>
        /// Base on parametersetName to set ciminstances
        /// </para>
        /// </summary>
        /// <param name="cmdlet"><see cref="SetCimInstanceCommand"/> object.</param>
        public void SetCimInstance(SetCimInstanceCommand cmdlet)
        {
            IEnumerable <string> computerNames = ConstValue.GetComputerNames(
                GetComputerName(cmdlet));
            List <CimSessionProxy> proxys = new();

            switch (cmdlet.ParameterSetName)
            {
            case CimBaseCommand.CimInstanceComputerSet:
                foreach (string computerName in computerNames)
                {
                    // create CimSessionProxySetCimInstance object internally
                    proxys.Add(CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet, cmdlet.PassThru));
                }

                break;

            case CimBaseCommand.CimInstanceSessionSet:
                foreach (CimSession session in GetCimSession(cmdlet))
                {
                    // create CimSessionProxySetCimInstance object internally
                    proxys.Add(CreateSessionProxy(session, cmdlet, cmdlet.PassThru));
                }

                break;

            default:
                break;
            }

            switch (cmdlet.ParameterSetName)
            {
            case CimBaseCommand.CimInstanceComputerSet:
            case CimBaseCommand.CimInstanceSessionSet:
                string nameSpace = ConstValue.GetNamespace(GetCimInstanceParameter(cmdlet).CimSystemProperties.Namespace);
                string target    = cmdlet.CimInstance.ToString();
                foreach (CimSessionProxy proxy in proxys)
                {
                    if (!cmdlet.ShouldProcess(target, action))
                    {
                        return;
                    }

                    Exception   exception = null;
                    CimInstance instance  = cmdlet.CimInstance;
                    // For CimInstance parameter sets, Property is an optional parameter
                    if (cmdlet.Property != null)
                    {
                        if (!SetProperty(cmdlet.Property, ref instance, ref exception))
                        {
                            cmdlet.ThrowTerminatingError(exception, action);
                            return;
                        }
                    }

                    proxy.ModifyInstanceAsync(nameSpace, instance);
                }

                break;

            case CimBaseCommand.QueryComputerSet:
            case CimBaseCommand.QuerySessionSet:
                GetCimInstanceInternal(cmdlet);
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGrid_BalanceRefund_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            _facade.Query(_lastQueryVM, e.PageSize, e.PageIndex, e.SortField, result =>
            {
                this.DataGrid_BalanceRefund.ItemsSource = result[0].Rows.ToList("IsChecked", false);
                this.DataGrid_BalanceRefund.TotalCount  = result[0].TotalCount;

                this.tbStatisticInfo.Visibility = Visibility.Collapsed;
                if (result[1] != null && !(result[1].Rows is DynamicXml.EmptyList))
                {
                    string totalInfo                = string.Format("所有统计 --- 退款金额总计(财务审核通过): {0}", ConstValue.Invoice_ToCurrencyString(result[1].Rows[0].TotalAmount));
                    this.tbStatisticInfo.Text       = totalInfo;
                    this.tbStatisticInfo.Visibility = Visibility.Visible;
                }
            });
        }
Beispiel #17
0
    // Update is called once per frame
    void Update()
    {
        if (CurrentGameState == GameState.GamePlaying)
        {
            //            Vector2 clickPoint = Vector2.zero;
            //#if UNITY_EDITOR
            //            if (Input.GetMouseButtonDown(1))
            //            {
            //                clickPoint = Input.mousePosition;
            //            }


            //#else
            //        if (Input.touchCount == 1) {
            //            clickPoint = Input.touches[0].position;
            //        }
            //#endif
            //            Ray ray = Camera.main.ScreenPointToRay(clickPoint);
            //            RaycastHit2D hit2D = Physics2D.Raycast(ray.origin, ray.direction,100,1 << LayerMask.NameToLayer(ConstValue.LayerName.MAP));
            //            if (hit2D.collider != null)
            //            {
            //                Operation(hit2D);
            //            }

            if (PlayerPrefs.GetInt(ConstValue.XmlDataKeyName.PlayerInGameSuccessCount) > 0 && //玩家顺利通过第一关
                !UIController._Instance.UpdateGameTimeLine(-GameTimeLineSpeed * Time.deltaTime))
            {
                GameOver();
            }

            //第二种玩法
            if (Input.GetMouseButtonDown(0) && !CenterCube.IsRotating)
            {
                Vector2 clickPoint = Vector2.zero;
#if UNITY_EDITOR
                clickPoint = Input.mousePosition;
#else
                if (Input.touchCount == 1)
                {
                    clickPoint = Input.touches[0].position;
                }
#endif
                clickPoint = Camera.main.ScreenToWorldPoint(clickPoint);

                if (clickPoint.y < Tools._Instance.topBorder - Tools._Instance.height * (1f / 7f))
                {
                    if (clickPoint.x >= Tools._Instance.leftBorder + Tools._Instance.width / 2f)
                    {
                        CenterCube.RotateSelf(+1);
                    }
                    else
                    {
                        CenterCube.RotateSelf(-1);
                    }
                    AudioContorller._Instance.PlayAudioOneTimeNotStopLast(9, 0.65f); //音效
                }
            }
        }

        if (CurrentGameState == GameState.GameCheck && !CenterCube.IsRotating && currentMoveCube != null)
        {
            if (currentMoveCube.GetComponent <MoveCube>().IsArrive)
            {
                Check center = CenterCube.GetComponent <Check>();
                if (!IsRightResult(CenterCube.transform, currentMoveCube.transform))
                {
                    //GameOver();
                    GameReLevel();
                    GameStart();
                    AudioContorller._Instance.PlayAudioOneTimeNotStopLast(4, 1f); //音效
                }
                else
                {
                    UIController._Instance.PlayerCurrentScore++;
                    AudioContorller._Instance.PlayAudioOneTimeNotStopLast(3, 1f); //音效

                    if (PlayerPrefs.GetInt(ConstValue.XmlDataKeyName.PlayerBestScore) == 0)
                    {
                        PlayerPrefs.SetInt(ConstValue.XmlDataKeyName.PlayerBestScore, UIController._Instance.PlayerCurrentScore);
                    }
                    else if (PlayerPrefs.GetInt(ConstValue.XmlDataKeyName.PlayerBestScore) < UIController._Instance.PlayerCurrentScore)
                    {
                        PlayerPrefs.SetInt(ConstValue.XmlDataKeyName.PlayerBestScore, UIController._Instance.PlayerCurrentScore);
                    }
                    UIController._Instance.UpdateGameTimeLine(GameTimeLineSpeed * 2f);
                    //for (int i = 0; i < center.innerCheck.Count; i++)
                    //{
                    //    if (!center.innerCheck[i].HaveCheck)
                    //    {
                    //        break;
                    //    }
                    //    if (i == center.innerCheck.Count - 1) //四个数字全队
                    //    {
                    //        //LevelUp
                    //        CurrentGameState = GameState.GameLeveling; //游戏进入升级状态
                    //        GameRightRoundCount++; //这个数值需要持久化
                    //        GameRightRoundCount %= 3;
                    //        //UpdateCenterLevelString(ConstValue.GetInstance().levelStrings[GameRightRoundCount]);
                    //        //BuildMoveCube();

                    //        //全部正确之后初始化新的背景 和 文字 在此处插入对背景和移动方块的颜色控制
                    //        StartCoroutine(ScenesController._Instance
                    //            .DestroyScenes(new Color(Random.Range(0f,1f),Random.Range(0f,1f),Random.Range(0f,1f))));
                    //    }
                    //}
                    if (center.IsFinishLevel())
                    {
                        //LevelUp
                        CurrentGameState = GameState.GameLeveling;                                                //游戏进入升级状态
                        if (!PlayerData.GetInstance().IsAllStringRight(ConstValue.GetInstance().levelStrings[0])) //第一个词条没有收集完成
                        {
                            if (PlayerPrefs.GetInt(ConstValue.XmlDataKeyName.PlayerInGameSuccessCount) != 0)
                            {
                                GameRightRoundCount = PlayerPrefs.GetInt(ConstValue.XmlDataKeyName.PlayerInGameSuccessCount);
                            }
                            GameRightRoundCount++;                                                                       //这个数值需要持久化
                            PlayerPrefs.SetInt(ConstValue.XmlDataKeyName.PlayerInGameSuccessCount, GameRightRoundCount); //更新用户数据
                        }

                        //UpdateCenterLevelString(ConstValue.GetInstance().levelStrings[GameRightRoundCount]);
                        //BuildMoveCube();

                        //全部正确之后初始化新的背景 和 文字 在此处插入对背景和移动方块的颜色控制
                        //StartCoroutine(ScenesController._Instance
                        //   .DestroyScenes(new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f))));
                        center.GetComponent <Check>().RightWordEffect();
                        StartCoroutine(StartNextLevel(0.45f));
                    }
                    else
                    {
                        center.GetComponent <Check>().RightWordEffect();
                        GameStart();
                    }
                }
            }
        }
    }
Beispiel #18
0
 public abstract void Declare(Identifier Type, ConstValue Data);
Beispiel #19
0
 public ConstVariable(IdContainer Container, CodeString Name, Identifier Type, ConstValue Value)
     : base(Container, Name, Type)
 {
     this.ConstInitValue = Value;
     this.DeclaredIdType = DeclaredIdType.Constant;
 }
 public static object ComputeXor(ConstValue constLeft, ConstValue constRight)
 {
     return((int)constLeft.Value ^ (int)constRight.Value);
 }
Beispiel #21
0
        public bool CalcValue(PluginRoot Plugin, BeginEndMode Mode = BeginEndMode.Both, bool CreateAssignNodes = false, bool EnableUntyped = false)
        {
            InitValue = null;
            if (InitString.IsValid)
            {
                var NMode = Mode & BeginEndMode.Begin;
                InitValue = Expressions.CreateExpression(InitString, Plugin, NMode);
                if (InitValue == null)
                {
                    return(false);
                }

                if (CreateAssignNodes)
                {
                    var Node = Expressions.CreateReference(Plugin.Container, this, Plugin, InitString);
                    if (Node == null)
                    {
                        return(false);
                    }

                    InitValue = Expressions.SetValue(Node, InitValue, Plugin, InitString, false);
                    if (InitValue == null)
                    {
                        return(false);
                    }
                }

                InitValue = Plugin.FinishNode(InitValue);
                if (InitValue == null)
                {
                    return(false);
                }

                if (!CreateAssignNodes && TypeOfSelf.RealId is AutomaticType)
                {
                    if (!EnableUntyped && InitValue.Type.RealId is AutomaticType)
                    {
                        Plugin.State.Messages.Add(MessageId.Untyped, Name);
                        return(false);
                    }

                    Children[0] = InitValue.Type;
                }

                var TypeMgrnPlugin = Plugin.GetPlugin <TypeMngrPlugin>();
                if (!TypeOfSelf.IsEquivalent(InitValue.Type) && !(TypeOfSelf.RealId is AutomaticType))
                {
                    InitValue = TypeMgrnPlugin.Convert(InitValue, TypeOfSelf, InitString);
                    if (InitValue == null)
                    {
                        return(false);
                    }
                }

                if ((Mode & BeginEndMode.End) != 0)
                {
                    InitValue = Plugin.End(InitValue);
                    if (InitValue == null)
                    {
                        return(false);
                    }
                }

                var ConstVal = InitValue as ConstExpressionNode;
                if (ConstVal != null)
                {
                    ConstInitValue = ConstVal.Value;
                }
            }
            else if (TypeOfSelf.RealId is AutomaticType)
            {
                if (!EnableUntyped)
                {
                    Plugin.State.Messages.Add(MessageId.Untyped, Name);
                    return(false);
                }
            }

            return(true);
        }
 public static object ComputeClt(ConstValue constLeft, ConstValue constRight)
 {
     return((int)constLeft.Value < (int)constRight.Value ? 1 : 0);
 }
Beispiel #23
0
 private BoogieType(ConstValue c)
 {
     Const = c;
 }