Example #1
0
        public override void Include(FlowController flow, MemoryEntry includeFile)
        {
            //extend current program point as Include

            var files = new HashSet <string>();

            foreach (StringValue possibleFile in includeFile.PossibleValues)
            {
                files.Add(possibleFile.Value);
            }

            foreach (var branchKey in flow.ExtensionKeys)
            {
                if (!files.Remove(branchKey as string))
                {
                    //this include is now not resolved as possible include branch
                    flow.RemoveExtension(branchKey);
                }
            }

            foreach (var file in files)
            {
                //Create graph for every include - NOTE: we can share pp graphs
                var cfg     = AnalysisTestUtils.CreateCFG(_includes[file], null);
                var ppGraph = ProgramPointGraph.FromSource(cfg);
                flow.AddExtension(file, ppGraph, ExtensionType.ParallelInclude);
            }
        }
    /// <summary>
    /// Unity method.
    /// Awake this instance.
    /// </summary>
    public override void Awake()
    {
        base.Awake();

        if (flowController == null)
        {
            flowController = GetComponent <FlowController>();

            if (flowController == null)
            {
                // No flow controller found on this scene, create a new one that will control only this scene.
                flowController        = gameObject.AddComponent <FlowController>();
                flowController.blocks = new FlowBlock[] { this };
            }
        }

        if (playableControllers == null)
        {
            playableControllers = new List <PlayableController>();
        }

        if (playableControllers.Count == 0)
        {
            MonoBehaviour[] scripts = GetComponents <MonoBehaviour>();

            foreach (MonoBehaviour script in scripts)
            {
                if (typeof(PlayableController).IsInstanceOfType(script))
                {
                    playableControllers.Add(script as PlayableController);
                }
            }
        }
    }
Example #3
0
        private static Value _defined(FlowController flow, Value[] arguments)
        {
            Debug.Assert(arguments.Length == 1);

            stringConverter.SetContext(flow);
            var constantName = stringConverter.EvaluateToString(arguments[0]);

            if (constantName == null)
            {
                return(flow.OutSet.AnyBooleanValue);
            }

            MemoryEntry constant;

            if (UserDefinedConstantHandler.TryGetConstant(flow.OutSet, new QualifiedName(new Name(constantName.Value)), out constant))
            {
                return(flow.OutSet.CreateBool(false));
            }
            else
            {
                if (constant.PossibleValues.Any(a => a is UndefinedValue))
                {
                    return(flow.OutSet.AnyBooleanValue);
                }
                else
                {
                    return(flow.OutSet.CreateBool(true));
                }
            }
        }
Example #4
0
        public override void Eval(FlowController flow, MemoryEntry code)
        {
            //extend current program point as Eval

            var codes = new HashSet <string>();

            foreach (StringValue possibleFile in code.PossibleValues)
            {
                codes.Add(possibleFile.Value);
            }

            foreach (var branchKey in flow.ExtensionKeys)
            {
                if (!codes.Remove(branchKey as string))
                {
                    //this eval is now not resolved as possible eval branch
                    flow.RemoveExtension(branchKey);
                }
            }

            foreach (var sourceCode in codes)
            {
                //Create graph for every evaluated code - NOTE: we can share pp graphs
                var cfg     = AnalysisTestUtils.CreateCFG(sourceCode, null);
                var ppGraph = ProgramPointGraph.FromSource(cfg);
                flow.AddExtension(sourceCode, ppGraph, ExtensionType.ParallelEval);
            }
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UnaryOperationEvaluator" /> class.
 /// </summary>
 /// <param name="flowController">Flow controller of program point.</param>
 /// <param name="booleanEvaluator">Converter for boolean casting.</param>
 /// <param name="stringEvaluator">Converter for string casting.</param>
 public UnaryOperationEvaluator(FlowController flowController, BooleanConverter booleanEvaluator,
                                StringConverter stringEvaluator)
     : base(flowController)
 {
     booleanConverter = booleanEvaluator;
     stringConverter  = stringEvaluator;
 }
Example #6
0
	/// <summary>
	/// Unity method.
	/// Awake this instance. 
	/// </summary>
	public override void Awake ()
	{
		base.Awake ();
		
		if (flowController == null) {
			flowController = GetComponent<FlowController>();
			
			if (flowController == null) {
				// No flow controller found on this scene, create a new one that will control only this scene.
				flowController = gameObject.AddComponent<FlowController>();
				flowController.blocks = new FlowBlock[]{this};
			}
		}
		
		if (playableControllers == null) {
			playableControllers = new List<PlayableController>();
		}
		
		if (playableControllers.Count == 0) {
			MonoBehaviour[] scripts = GetComponents<MonoBehaviour>();
			
			foreach (MonoBehaviour script in scripts) {
				if (typeof(PlayableController).IsInstanceOfType(script)) {
					playableControllers.Add(script as PlayableController);
				}
			}
		}
	}
Example #7
0
        public void InitializeTest()
        {
            this.Container = new UnityContainer();
            this.Container.RegisterInstance <ILogger>(new Logger());
            this.Scheduler = new DeterministicTaskScheduler();
            this.Container.RegisterInstance(typeof(TaskScheduler), this.Scheduler);
            this.MockRibbonPresenter = TestHelper.CreateAndRegisterMock <ITeamRibbonPresenter>(this.Container);
            this.MockRibbonPresenter.Setup(p => p.Initialise(It.IsAny <Func <Uri> >())).Callback((Func <Uri> rebindCallback) => this.CapturedRebindCallback = rebindCallback);
            this.MockTeamProjectPickerPresenter = TestHelper.CreateAndRegisterMock <ITeamProjectPickerPresenter>(this.Container);
            this.MockWorkItemQueryAndLayoutPickerWizardPresenter = TestHelper.CreateAndRegisterMock <IWorkItemQueryAndLayoutPickerWizardPresenter>(this.Container);
            this.MockTeamProjectDocumentManager = TestHelper.CreateAndRegisterMock <ITeamProjectDocumentManager>(this.Container);
            this.MockTeamProjectDocument        = TestHelper.CreateAndRegisterMock <ITeamProjectDocument>(this.Container);
            this.MockTeamProjectDocument.Setup(doc => doc.IsInsertable).Returns(true);
            this.MockFile                    = TestHelper.CreateAndRegisterMock <IFile>(this.Container);
            this.MockDirectory               = TestHelper.CreateAndRegisterMock <IDirectory>(this.Container);
            this.MockApplication             = TestHelper.CreateAndRegisterMock <IWordApplication>(this.Container);
            this.MockSettings                = TestHelper.CreateAndRegisterMock <ISettings>(this.Container);
            this.MockLayoutDesignerPresenter = TestHelper.CreateAndRegisterMock <ILayoutDesignerPresenter>(this.Container);

            this.MockTeamProjectDocumentManager.Setup(manager => manager.ActiveContainer).Callback(() => System.Console.WriteLine("Active container call")).Returns(this.Container);
            this.MockTeamProjectDocumentManager.Setup(manager => manager.ActiveDocument).Returns(this.MockTeamProjectDocument.Object);

            this.MockApplication.Setup(app => app.UserTemplatesPath).Returns(RoamingTemplateDir);

            this.Sut = this.Container.Resolve <FlowController>();

            this.Sut.Initialise();
        }
        /// <summary>
        /// 1. winpcap 설치
        /// 2. DB설치
        /// 3. 회사코드등록
        /// 4. WeDo 설치
        /// 5. 데이터 생성
        /// </summary>
        /// <param name="stateSaver"></param>
        public override void Install(IDictionary stateSaver)
        {
            Logger.info("Install");

            WindowWrapper wrapper = GetWrapper();

            FlowController flowController = new FlowController(wrapper, this.Context);

            flowController.DoMain();


            //2. DB설치
            //Logger.info(Environment.CurrentDirectory);
            //foreach (string key in Environment.GetEnvironmentVariables().Keys) {
            //    Logger.info(key + ":"+ Environment.GetEnvironmentVariable(key) );
            //}



            //4.WeDo설치 <=== 실제 인스톨
            Logger.info("WeDo 설치 시작.");
            base.Install(stateSaver);

            Logger.info("WeDo 설치 완료.");

            //5.데이터 생성 :

            //6.방화벽 설정
        }
Example #9
0
        /// <summary>
        /// Checks number of arguments in called function.
        /// </summary>
        /// <param name="flow">FlowControllers</param>
        /// <param name="nativeFunction">NativeFunction</param>
        /// <returns>true if the arguments count matches, false otherwise</returns>
        static public bool checkArgumentsCount(FlowController flow, NativeFunction nativeFunction)
        {
            List <NativeFunction> nativeFunctions = new List <NativeFunction>();

            nativeFunctions.Add(nativeFunction);
            return(checkArgumentsCount(flow, nativeFunctions));
        }
Example #10
0
        /// <summary>
        /// Report a warning for the position of current expression.
        /// </summary>
        /// <param name="flow">Flow controller of program point providing data for evaluation.</param>
        /// <param name="message">Message of the warning.</param>
        /// <param name="cause">Cause of the warning.</param>
        private static void SetWarning(FlowController flow, string message, AnalysisWarningCause cause)
        {
            var warning = new AnalysisWarning(flow.CurrentScript.FullName,
                                              message, flow.CurrentPartial, flow.CurrentProgramPoint, cause);

            AnalysisWarningHandler.SetWarning(flow.OutSet, warning);
        }
Example #11
0
        private static Value _md5(FlowController flow, Value[] arguments)
        {
            stringConverter.SetContext(flow);
            var stringValue = stringConverter.EvaluateToString(arguments[0]);

            if (stringValue == null)
            {
                return(flow.OutSet.AnyStringValue);
            }

            var phpBytes = new PhpBytes(stringValue.Value);

            Debug.Assert(arguments.Length > 0);

            if (arguments.Length > 1)
            {
                booleanConverter.SetContext(flow.OutSet.Snapshot);
                var isRawOutput = booleanConverter.EvaluateToBoolean(arguments[1]);

                if ((isRawOutput == null) || isRawOutput.Value)
                {
                    // TODO: Implement precisely
                    return(flow.OutSet.AnyStringValue);
                }
            }

            return(flow.OutSet.CreateString(PhpHash.MD5(phpBytes)));
        }
Example #12
0
        private static BooleanValue WarnModuloByZero(FlowController flow)
        {
            SetWarning(flow, "Modulo by zero", AnalysisWarningCause.DIVISION_BY_ZERO);

            // Modulo by zero returns false boolean value
            return(flow.OutSet.CreateBool(false));
        }
Example #13
0
        public override IEnumerable <ThrowInfo> Throw(FlowController flow, FlowOutputSet outSet, ThrowStmt throwStmt, MemoryEntry throwedValue)
        {
            //TODO this is only simple implementation
            var exceptionObj = (ObjectValue)throwedValue.PossibleValues.First();

            var catchBlocks = outSet.ReadControlVariable(CatchBlocks_Storage).ReadMemory(outSet.Snapshot);

            var throwBranches = new List <ThrowInfo>();

            //find catch blocks with valid scope and matching catch condition
            foreach (InfoValue <CatchBlockDescription> blockInfo in catchBlocks.PossibleValues)
            {
                var throwedType = outSet.ObjectType(exceptionObj).QualifiedName;

                //check catch condition
                if (blockInfo.Data.CatchedType.QualifiedName != throwedType)
                {
                    continue;
                }

                var branch = new ThrowInfo(blockInfo.Data, throwedValue);
                throwBranches.Add(branch);
            }

            return(throwBranches);
        }
    public float mMoveCount = 0; // Amount of movements this unit has done

    void Awake()
    {
        mCharacterStats = GetComponent <CharacterStats>();
        mMovementStack  = new Stack <Vector3>();
        mAnimator       = GetComponent <Animator>();
        mFlowController = GameObject.Find("FlowController").GetComponent <FlowController>();
    }
Example #15
0
        /// <summary>
        /// Try to convert dividend into integer and perform modulo operation. Warn if modulo by zero.
        /// </summary>
        /// <param name="flow">Flow controller of program point providing data for evaluation.</param>
        /// <param name="dividend">String dividend of modulo operation.</param>
        /// <param name="divisor">Integer divisor of modulo operation.</param>
        /// <returns><c>false</c> whether <paramref name="divisor" /> is zero, otherwise remainder.</returns>
        public static Value Modulo(FlowController flow, string dividend, int divisor)
        {
            if (divisor != 0)
            {
                int    integerValue;
                double floatValue;
                bool   isInteger;
                TypeConversion.TryConvertToNumber(dividend, false, out integerValue,
                                                  out floatValue, out isInteger);

                // Here we distinguish whether the integer dividend is known or not
                if (isInteger)
                {
                    // Value has the same sign as dividend
                    return(flow.OutSet.CreateInt(integerValue % divisor));
                }
                else
                {
                    return(WorstModuloResult(flow.OutSet, divisor));
                }
            }
            else
            {
                return(WarnModuloByZero(flow));
            }
        }
Example #16
0
        /// <summary>
        /// Creates an object a initialize default with defualt fields.
        /// </summary>
        /// <param name="flow">FlowController</param>
        /// <param name="type">Type to resolve</param>
        /// <returns>ObjectValue</returns>
        private static Value CreateObject(FlowController flow, string type)
        {
            var           objectAnalyzer = NativeObjectAnalyzer.GetInstance(flow.OutSet);
            QualifiedName typeName       = new QualifiedName(new Name(type));

            if (objectAnalyzer.ExistClass(typeName))
            {
                ClassDecl   decl      = objectAnalyzer.GetClass(typeName);
                var         fields    = objectAnalyzer.GetClass(typeName).Fields;
                ObjectValue value     = flow.OutSet.CreateObject(flow.OutSet.CreateType(decl));
                var         newObject = flow.OutSet.GetLocalControlVariable(new VariableName(".tmpObject" + type));
                newObject.WriteMemory(flow.OutSet.Snapshot, new MemoryEntry(value));
                if (value is ObjectValue)
                {
                    foreach (FieldInfo field in fields.Values)
                    {
                        if (field.IsStatic == false)
                        {
                            var newField = newObject.ReadField(flow.OutSet.Snapshot, new VariableIdentifier(field.Name.Value));
                            try {
                                newField.WriteMemory(flow.OutSet.Snapshot, NativeAnalyzerUtils.ResolveReturnValue(field.Type, flow));
                            } catch (Exception) {}
                        }
                    }
                }
                return(value);
            }
            else
            {
                return(flow.OutSet.AnyObjectValue);
            }
        }
Example #17
0
        /// <summary>
        /// For arguments passed by reference: it assignes new values, and copies flags form inputValues.
        /// </summary>
        /// <param name="flow">FlowController</param>
        /// <param name="inputValues">Input values into analyzed function</param>
        /// <param name="nativeFunctions">Info about analyzed function</param>
        /// <returns>List of assigned values into aliases</returns>
        public static List <Value> ResolveAliasArguments(FlowController flow, List <Value> inputValues, List <NativeFunction> nativeFunctions)
        {
            List <Value> result        = new List <Value>();
            MemoryEntry  argc          = flow.InSet.ReadVariable(new VariableIdentifier(".argument_count")).ReadMemory(flow.OutSet.Snapshot);
            int          argumentCount = ((IntegerValue)argc.PossibleValues.ElementAt(0)).Value;

            foreach (var nativeFunction in nativeFunctions)
            {
                if (nativeFunction.MinArgumentCount <= argumentCount && nativeFunction.MaxArgumentCount >= argumentCount)
                {
                    int functionArgumentNumber = 0;
                    for (int i = 0; i < argumentCount; i++)
                    {
                        MemoryEntry arg = flow.InSet.ReadVariable(Argument(i)).ReadMemory(flow.InSet.Snapshot);

                        NativeFunctionArgument functionArgument = nativeFunction.Arguments.ElementAt(functionArgumentNumber);
                        if (functionArgument.ByReference == true)
                        {
                            MemoryEntry res = NativeAnalyzerUtils.ResolveReturnValue(functionArgument.Type, flow);
                            res = new MemoryEntry(FlagsHandler.CopyFlags(inputValues, res.PossibleValues));
                            flow.OutSet.GetVariable(Argument(i)).WriteMemory(flow.OutSet.Snapshot, res);
                            result.AddRange(res.PossibleValues);
                        }


                        //incremeneting functionArgumentNumber
                        if (nativeFunction.Arguments.ElementAt(functionArgumentNumber).Dots == false)
                        {
                            functionArgumentNumber++;
                        }
                    }
                }
            }
            return(result);
        }
Example #18
0
        /// <summary>
        /// Checks arguments in functions and generates warning if the arguments don't match.
        /// </summary>
        /// <param name="flow">FlowControllers</param>
        /// <param name="nativeFunction">NativeFunction</param>
        public static void checkArgumentTypes(FlowController flow, NativeFunction nativeFunction)
        {
            List <NativeFunction> nativeFunctions = new List <NativeFunction>();

            nativeFunctions.Add(nativeFunction);
            checkArgumentTypes(flow, nativeFunctions);
        }
Example #19
0
 private static AnyValue WarnPossibleModuloByZero(FlowController flow)
 {
     // As right operant can be range of values, can possibly be 0 too
     // That causes division by zero and returns false
     SetWarning(flow, "Division by any integer, possible division by zero",
                AnalysisWarningCause.DIVISION_BY_ZERO);
     return(flow.OutSet.AnyValue);
 }
Example #20
0
        /// <summary>
        /// Warn that modulo by abstract boolean value has occurred and return any abstract value.
        /// </summary>
        /// <param name="flow">Flow controller of program point providing data for evaluation.</param>
        /// <returns>Any abstract value.</returns>
        public static AnyValue ModuloByAnyBooleanValue(FlowController flow)
        {
            SetWarning(flow, "Possible division by zero (converted from boolean false)",
                       AnalysisWarningCause.DIVISION_BY_ZERO);

            // Division or modulo by false returns false boolean value
            return(flow.OutSet.AnyValue);
        }
Example #21
0
        /// <summary>
        /// Warn that modulo by null has occurred and return result of operation, <c>false</c> value.
        /// </summary>
        /// <param name="flow">Flow controller of program point providing data for evaluation.</param>
        /// <returns><c>false</c> value that is result of modulo by zero.</returns>
        public static BooleanValue ModuloByNull(FlowController flow)
        {
            SetWarning(flow, "Modulo by zero (converted from null)",
                       AnalysisWarningCause.DIVISION_BY_ZERO);

            // Modulo by null returns false boolean value
            return(flow.OutSet.CreateBool(false));
        }
Example #22
0
 private void ProcessJoinResult(SessionJoinResultPacket obj)
 {
     if (obj.Result == SessionJoinResultPacket.SessionJoinResult.Succesful)
     {
         // Change the view
         FlowController.WebControl.DocumentReady -= WebControlOnDocumentReady;
         FlowController.ChangeView(new InRoomView());
     }
 }
Example #23
0
    private void Start()
    {
        // Initialize our managers that use the update manager early.
        // This prevents them from being created during an update loop.
        TimerManager manager = Service.TimerManager;

        gameFlow = new FlowController();
        gameFlow.StartGame();
    }
Example #24
0
        /// <summary>
        /// Models constructor of native object
        /// </summary>
        /// <param name="flow">FlowController</param>
        public void Construct(FlowController flow)
        {
            if (NativeAnalyzerUtils.checkArgumentsCount(flow, Method))
            {
                NativeAnalyzerUtils.checkArgumentTypes(flow, Method);
            }

            initObject(flow);
        }
        public ComputedDataModel StartDataFlow()
        {
            //Creates an instance of th Flow controller
            controller = new FlowController();
            //Stores the result of the SecureComputation in a List of doubles.
            var ComputationResult = controller.StartDataProcessing(UserDataPlain);

            return(ComputationResult);
        }
Example #26
0
        private static void _write_argument(FlowController flow)
        {
            var arg0Entry = GetNumberedArgument(flow.OutSet, 0);
            var arg0      = arg0Entry.ReadMemory(flow.InSet.Snapshot).PossibleValues.First() as StringValue;

            var value = new MemoryEntry(flow.OutSet.CreateString(arg0.Value + "_WrittenInArgument"));

            arg0Entry.WriteMemory(flow.OutSet.Snapshot, value);
        }
Example #27
0
        private static void _method_GetValue(FlowController flow)
        {
            var outSet      = flow.OutSet;
            var outSnapshot = outSet.Snapshot;

            var thisEntry = outSet.GetVariable(thisIdentifier);
            var value     = thisEntry.ReadField(outSnapshot, valueIdentifier);

            FunctionResolverBase.SetReturn(outSet, value.ReadMemory(outSnapshot));
        }
Example #28
0
 public void Die()
 {
     transform.parent   = null;
     collider2D.enabled = false;
     dying     = true;
     timer     = 0;
     startingY = transform.localPosition.y;
     FlowController.playerDied(charact);
     //transform.localScale = new Vector3 (1, scaleDeathCurve.Evaluate (timer), 1);
 }
        private void ButtonStart_Click(object sender, EventArgs e)
        {
            string errorMsg = "";

            if (!fileChosen)
            {
                errorMsg += "Choose an output file." + Environment.NewLine;
            }
            if (!commandsLoaded)
            {
                errorMsg += "Commands were not loaded." + Environment.NewLine;
            }
            if (!spectChosen)
            {
                errorMsg += "Spectromenter is not configured." + Environment.NewLine;
            }
            if (!(fileChosen & commandsLoaded & spectChosen))
            {
                var msgbox = MessageBox.Show("Unable to start: " + Environment.NewLine + Environment.NewLine + errorMsg, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (data != null)
            {
                data.Clear();
            }
            valvesCon    = new ValvesController(ValvePortName);
            flowCon      = new FlowController(FCPortName);
            spectrometer = new Spectrometer(ref wrapper, specIndex, specIntegrTime, specAverage, specBoxcar);
            //clear the file
            File.Create(filePath).Close();
            eofStream = File.AppendText(filePath);
            eofStream.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<eksperymenty>" + Environment.NewLine + "<komentarz>"
                            + Environment.NewLine + commentTextBox.Text + "</komentarz> ");

            data        = new ArrayList();
            timeSum     = 0;
            elapsedTime = 0;
            expNumber   = 0;

            ProgressLabel.Visible    = true;
            ExpNumberLabel.Visible   = true;
            frequencyTextBox.Enabled = false;
            timer.Interval           = frequency * 1000;

            foreach (int[] commandLine in commands)
            {
                timeSum += commandLine[0];
            }

            singleExpTime = 0;
            this.ApplyCommands(0);
            dateOfStart   = DateTime.Now;
            timer.Enabled = true;
        }
Example #30
0
 /// <summary>
 /// Specify possible result of modulo operation when dividend is unknown. Warn if modulo by zero.
 /// </summary>
 /// <param name="flow">Flow controller of program point providing data for evaluation.</param>
 /// <param name="divisor">Integer divisor of modulo operation.</param>
 /// <returns><c>false</c> whether <paramref name="divisor" /> is zero, otherwise remainder.</returns>
 public static Value AbstractModulo(FlowController flow, int divisor)
 {
     if (divisor != 0)
     {
         return(WorstModuloResult(flow.OutSet, divisor));
     }
     else
     {
         return(WarnModuloByZero(flow));
     }
 }
Example #31
0
 /// <summary>
 /// Perform modulo operation of interval dividend and integer divisor. Warn if modulo by zero.
 /// </summary>
 /// <param name="flow">Flow controller of program point providing data for evaluation.</param>
 /// <param name="dividend">Integer interval dividend of modulo operation.</param>
 /// <param name="divisor">Integer divisor of modulo operation.</param>
 /// <returns><c>false</c> whether <paramref name="divisor" /> is zero, otherwise remainder.</returns>
 public static Value Modulo(FlowController flow, IntervalValue <int> dividend, int divisor)
 {
     if (divisor != 0)
     {
         return(Modulo(flow.OutSet, dividend, divisor));
     }
     else
     {
         return(WarnModuloByZero(flow));
     }
 }
        // ReSharper disable InconsistentNaming
        public void FlowController_HandleConfigureDecisionExpressionMessageAndIsNewTrue_WizardNotShown()
        // ReSharper restore InconsistentNaming
        {
            #region setup first Mock ModelItem

            var env = EnviromentRepositoryTest.CreateMockEnvironment();

            var properties = new Dictionary<string, Mock<ModelProperty>>();
            var propertyCollection = new Mock<ModelPropertyCollection>();
            var testAct = new DsfFlowDecisionActivity { ExpressionText = "Not Null Test Value" };

            var prop = new Mock<ModelProperty>();
            prop.Setup(p => p.ComputedValue).Returns(testAct);
            properties.Add("Condition", prop);

            propertyCollection.Protected().Setup<ModelProperty>("Find", "Condition", true).Returns(prop.Object);

            var source = new Mock<ModelItem>();
            source.Setup(s => s.Properties).Returns(propertyCollection.Object);

            #endregion

            #region setup decision Mock ModelItem

            var crmDecision = new Mock<IContextualResourceModel>();
            crmDecision.Setup(r => r.Environment).Returns(env.Object);
            crmDecision.Setup(r => r.ResourceName).Returns("Test");
            crmDecision.Setup(res => res.WorkflowXaml).Returns(new StringBuilder(StringResourcesTest.xmlServiceDefinition));

            var decisionProperties = new Dictionary<string, Mock<ModelProperty>>();
            var decisionPropertyCollection = new Mock<ModelPropertyCollection>();

            var decisionProp = new Mock<ModelProperty>();
            decisionProp.Setup(p => p.ComputedValue).Returns(string.Empty);
            decisionProperties.Add("Condition", decisionProp);

            decisionPropertyCollection.Protected().Setup<ModelProperty>("Find", "Condition", true).Returns(decisionProp.Object);

            var decisionModelItem = new Mock<ModelItem>();
            decisionModelItem.Setup(s => s.Properties).Returns(decisionPropertyCollection.Object);
            decisionModelItem.Setup(s => s.ItemType).Returns(typeof(FlowDecision));

            prop.Setup(p => p.Value).Returns(decisionModelItem.Object);

            #endregion

            #region setup Environment Model

            env.Setup(c => c.Connection).Returns(new Mock<IEnvironmentConnection>().Object);

            #endregion

            var flowController = new FlowController(new Mock<IPopupController>().Object);
            var message = new ConfigureDecisionExpressionMessage { ModelItem = source.Object, EnvironmentModel = env.Object, IsNew = true };

            flowController.Handle(message);
        }
Example #33
0
	/// <summary>
	/// Called when the flow controller finishes playing a state.
	/// </summary>
	/// <param name='theController'>
	/// The flow controller.
	/// </param>
	public void OnFlowAnimationFinished(FlowController theController)
	{
		finishedControllers = 0;
		
		foreach (PlayableController controller in playableControllers) 
		{
			if (controller.IsPlaying()) {
				controller.OnPlayingFinished += OnControllerFinished;
			} 
			else {
				finishedControllers++;
			}
		}
		
		if (finishedControllers >= playableControllers.Count) {
			DoAllControllersFinished();
		}
	}
    void OnEnable()
    {
        _target = (FlowController)target;

        RebuildMaterialIndexArray();
    }
 void OnDisable()
 {
     _target = null;
 }
    void OnEnable()
    {
        _target = (FlowController)target;

        if (EditorGUIUtility.isProSkin)
            icon = Resources.Load("Flow_Icon_Editor_Pro") as Texture2D;
        else
            icon = Resources.Load("Flow_Icon_Editor_Free") as Texture2D;

        facebookIcon = Resources.Load("facebook_icon") as Texture2D;
        youtubeIcon = Resources.Load("youtube_icon") as Texture2D;

        RebuildMaterialIndexArray();
    }