Exemplo n.º 1
0
        private void Save(FlowEngine flowEngine)
        {
            if (flowEngine.Attachment.Owner == -1)
            {
                throw new ArgumentException("Owner is null");
            }
            if (flowEngine.FlowState != FlowState.Finished)
            {
                FlowKey flowKey = new FlowKey()
                {
                    Owner = flowEngine.Attachment.Owner
                };
                if (!this.dicFlow.ContainsKey(flowKey))
                {
                    this.dicFlow.Add(flowKey, flowEngine);
                }
                else if (flowEngine.GetCurrent() == null)
                {
                    this.dicFlow.Remove(flowKey);
                }
                else if (this.dicFlow.ContainsKey(flowKey))
                {
                    this.dicFlow[flowKey] = flowEngine;
                }
            }
            string fileName = FlowManager.GetFlowFile(flowEngine.Attachment.Owner);

            FlowEngine.Save(fileName, flowEngine);
        }
Exemplo n.º 2
0
        public virtual void StartQualificationProcess()
        {
            Guid leadManagementProcessUId = (Guid)Terrasoft.Core.Configuration.SysSettings.GetValue(
                UserConnection, "LeadManagementProcess");
            ProcessSchema schema;

            if (leadManagementProcessUId.IsEmpty())
            {
                schema = UserConnection.ProcessSchemaManager.GetInstanceByName("LeadManagement");
            }
            else
            {
                schema = UserConnection.ProcessSchemaManager.GetInstanceByUId(leadManagementProcessUId);
            }
            bool canUseFlowEngine = ProcessSchemaManager.GetCanUseFlowEngine(UserConnection, schema);

            if (canUseFlowEngine)
            {
                var flowEngine = new FlowEngine(UserConnection);
                var param      = new Dictionary <string, string>();
                param["LeadId"] = Entity.Id.ToString();
                flowEngine.RunProcess(schema, param);
            }
            else
            {
                Process process = schema.CreateProcess(UserConnection);
                process.SetPropertyValue("LeadId", Entity.Id);
                process.Execute(UserConnection);
            }
        }
Exemplo n.º 3
0
 public int Audit(CheckObject entity)
 {
     try
     {
         FlowManager flowMgr    = FlowManager.Instance();
         FlowEngine  flowEngine = flowMgr.Load(entity.Id);
         if (flowEngine == null)
         {
             return(-1);
         }
         if (entity.AuditType == (int)AuditType.Passed)
         {
             flowMgr.Audit(flowEngine, (AuditType)entity.AuditType, entity.AuditDesc, entity.UserId);
         }
         else
         {
             flowMgr.Returned(flowEngine, (AuditType)entity.AuditType, entity.AuditDesc, entity.UserId);
             ProjectEntity project = DataHelper.GetDataItem <ProjectEntity>("Usp_Project_Get", new { Id = entity.Id });
             project.I_State = 165;
             DataHelper.ExecuteNonQuery("Usp_Project_Insert", project);
         }
         WriteLog("流程审核", flowEngine);
         flowMgr.FlowSave(flowEngine);
         return(1);
     }
     catch (Exception ex)
     {
         return(-1);
     }
 }
Exemplo n.º 4
0
        //Method to execute the specified flow a specified number of times.
        public void StartFlowExecution()
        {
            //Register the user
            using (UserContextHolder.Register(_userContext))
            {
                //Create a stopwatch and kick it off, logging a guid to identify the batch of flow runs
                string    threadExecutionId = System.Guid.NewGuid().ToString();
                Stopwatch outerStopWatch    = new Stopwatch();
                Log.Error("Starting Thread: " + threadExecutionId + ", number of executions: " + _executions + ",flow: " + _flowId);
                outerStopWatch.Start();

                //Kick off the specified flow executions with the Flow Engine
                for (int i = 0; i < _executions; i++)
                {
                    //Create a stopwatch and kick it off, logging a guid to identify the individual flow run
                    string    flowExecutionId = System.Guid.NewGuid().ToString();
                    Stopwatch innerStopWatch  = new Stopwatch();
                    Log.Error("Starting Flow Run: " + flowExecutionId);
                    innerStopWatch.Start();

                    //Execute the flow with canned data
                    FlowEngine.StartSyncFlow(FlowEngine.GetFlow(_flowId),
                                             GetFlowStateData());

                    //Stop the stopwatch and log how much time it took for the individual flow run
                    innerStopWatch.Stop();
                    Log.Error("Flow Run " + flowExecutionId + " took: " + innerStopWatch.Elapsed.TotalMilliseconds +
                              " milliseconds.");
                }

                //Stop the stopwatch and log how much time it took for the batch of flow runs
                outerStopWatch.Stop();
                Log.Error("Thread: " + threadExecutionId + ", number of executions: " + _executions + ",flow: " + _flowId + ", took " + outerStopWatch.Elapsed.TotalSeconds + " seconds.");
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 判断是否属于当前人审核
        /// </summary>
        /// <param name="flowEngine"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public bool CanAudit(FlowEngine flowEngine, int userId)
        {
            Step current = flowEngine.GetCurrent();

            if (current == null || current.NodeValidCount == 0)
            {
                return(false);
            }
            IList <Node> nodes = current.Nodes;

            using (AppBLL bll = new AppBLL())
            {
                IList <FunctionEntity> userFuncs = bll.FillList <FunctionEntity>("Usp_Funcs_ByUser", new { UserId = userId });
                foreach (var userFunc in userFuncs)
                {
                    var auditNodes = from node in nodes
                                     where node.Participant.Reference == userFunc.Id || node.Participant.Department == userId
                                     select node;
                    if (auditNodes.Any())
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
 /// <summary>
 /// 拼接当前流程至已存在流程后
 /// </summary>
 /// <param name="newFlowEngine">新流程</param>
 /// <param name="oldFlowEngine">old流程</param>
 public static void Concat(FlowEngine newFlowEngine, FlowEngine oldFlowEngine)
 {
     foreach (var step in newFlowEngine.FlowSteps)
     {
         oldFlowEngine.Add(step);
     }
 }
Exemplo n.º 7
0
        public void TestSimpleFork()
        {
            var eng = new FlowEngine();

            countGood = 0; countBad = 0;

            eng.Start(a => GoodStep(a))
            .ContinueWith(a => BadStep(a))
            .Where(new TupleList <Func <FlowStep, bool>, Action <FlowStep> >
            {
                { a => a.Result.ResultCode == FlowStepResultValues.Success, a => BadStep(a) },
                { a => a.Result.ResultCode == FlowStepResultValues.Failed, a => GoodStep(a) }
            })
            .IfAllSuccess(b => GoodStep(b));

            Assert.AreEqual(3, countGood);
            Assert.AreEqual(1, countBad);

            Assert.AreEqual(countGood + countBad, eng.Steps.Count);
            Assert.AreEqual(countGood, eng.Steps.Count - countBad);
            Assert.AreEqual(countBad, eng.Steps.Count - countGood);

            Assert.IsFalse(eng.AllWasGood());
            Assert.IsTrue(eng.SomethingWasWrong());
        }
Exemplo n.º 8
0
        public void RunStopRestartFlowTest()
        {
            var flowEngine = new FlowEngine(new ProxyGenerator());

            var demoService  = new Mock <IDemoDataService>();
            var flow         = new DemoFlow1(demoService.Object);
            int approveTimes = 0;

            demoService.Setup(s => s.LoadReceivedMessage()).Returns("Important message 1");
            demoService.Setup(s => s.GetSignature(It.IsAny <string>())).Returns("0xAABBEFA7");
            demoService.Setup(s => s.Submit(It.IsAny <string>(), It.IsAny <string>())).Returns(true);

            // the first time it returns false, the second time it returns true
            demoService.Setup(s => s.IsMessageApproved(It.IsAny <string>()))
            .Returns(() =>
            {
                approveTimes++;
                return(approveTimes == 2);
            });

            var flowData = flowEngine.RunFlow(flow);

            Assert.True(flowData.IsStopped);
            Assert.False(flowData.IsFinished);
            Assert.Single(flowData.ModelHistory);
            Assert.True((flowData.ModelHistory[0] as Model1)?.IsLoaded);

            // assume we saved flowData to a database and rerun the flow one day after
            var clonedFlowData = flowData.CloneObject();
            var newFlow        = new DemoFlow1(demoService.Object);

            clonedFlowData = flowEngine.RestartFlow(newFlow, clonedFlowData);
            Assert.False(clonedFlowData.IsStopped);
            Assert.True(clonedFlowData.IsFinished);
        }
 void Start()
 {
     if (WaterMesh != null)
     {
         flow = new FlowEngine(WaterMesh);
         flow.PreProcess();
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 统一创建流程引擎
        /// </summary>
        /// <returns></returns>
        public FlowEngine BuildEngine()
        {
            FlowEngine flowEngine = new FlowEngine();

            flowEngine.FinishedHandler -= new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
            flowEngine.FinishedHandler += new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
            return(flowEngine);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 加载模板,并初始化流程
        /// </summary>
        /// <param name="template">模板名称</param>
        /// <param name="flowAttachment">流程附属数据</param>
        /// <returns></returns>
        public FlowEngine TemplateLoad(string template, FlowAttachment flowAttachment)
        {
            string     file       = this.GetTemplateFile(template);
            FlowEngine flowEngine = FlowEngine.Load(file);

            flowEngine.ResetIdentity();
            flowEngine.Reset(flowAttachment);
            return(flowEngine);
        }
Exemplo n.º 12
0
 /// <summary>
 /// 流程退回
 /// </summary>
 /// <param name="flowEngine"></param>
 public bool Returned(FlowEngine flowEngine, AuditType auditType, string auditDesc, int userId)
 {
     if (this.Audit(flowEngine, auditType, auditDesc, userId))
     {
         flowEngine.Returned();
         return(true);
     }
     return(false);
 }
Exemplo n.º 13
0
 /// <summary>
 /// 流程终止
 /// </summary>
 /// <param name="flowEngine"></param>
 public bool Abort(FlowEngine flowEngine, string auditDesc, int userId)
 {
     if (this.Audit(flowEngine, AuditType.Passed, auditDesc, userId))
     {
         flowEngine.Abort();
         return(true);
     }
     return(false);
 }
        /// <summary>
        /// 提交流程
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="category">分类</param>
        /// <param name="uid">创建人</param>
        /// <param name="depLevel1">中心及职能部门</param>
        /// <param name="depLevel2">中心下属部门</param>
        /// <param name="IsSubmit">1说明是提交流程,需要执行DeleteWorkFlow删除流程数据</param>
        /// <returns></returns>
        public static void Commit(ProjectEntity projectEntity, FlowKinkEntity flowKinkEntity, int userId, bool isSubmit)
        {
            FlowEngine flowEngine = FlowHelper.Build(projectEntity, flowKinkEntity, userId);

            if (isSubmit)
            {
                FlowManager.Instance().Delete(projectEntity.Id);
            }
            FlowManager.Instance().FlowSave(flowEngine);
        }
        //Fetch all the steps using a specified Database Connection Name.
        //The databaseConnectionName parameter will become a step input.
        //The step will return an array of step names and the table they connect to
        public string[] FetchStepsUsingDbConnection(string databaseConnectionName)
        {
            //Create the results list to return
            List<string> stepResultsList = new List<string>();

            //Use the ORM to get all FLOW element registrations
            ElementRegistration[] allFlows = new ORM<ElementRegistration>().Fetch(new WhereCondition[]
            {
                new FieldWhereCondition("is_flow", QueryMatchType.Equals, true),
            });
            
            //Loop through each flow
            foreach (ElementRegistration reg in allFlows)
            {
                //Open the flow 
                Flow flow = FlowEngine.LoadFlowByID(reg.ComponentRegistrationId, false, true);
                FlowStep currentStep = null;
                try
                {
                    //Loop through each step in the current flow
                    foreach (FlowStep step in flow.Steps)
                    {
                        currentStep = step;
                        
                        //If the step is a GetAllStep, Process it 
                        if (step.FlowStepType.Equals("GetAllStep`1"))
                        {
                            //Cast the step.WrappedStep into the appropriate step type.
                            GetAllStep<DatabaseTableDefinition> getAllStep = (GetAllStep<DatabaseTableDefinition>) step.WrappedStep;
                            
                            //If the step is on the appropriate connection, add it to the results.
                            if (string.Equals(getAllStep.DBConnectionName, databaseConnectionName))
                            {
                               stepResultsList.Add("Flow Name: " + flow.Name + " | Step Name: " + step.Name 
                                                   + " | DB Connection Name: " + getAllStep.DBConnectionName + " | Table Name: " + getAllStep.TableName);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (flow != null && currentStep != null)
                    {
                        stepResultsList.Add("Failed | Flow Name: " + flow.Name + " | Step Name: " + currentStep.Name);
                    }

                    if (flow != null)
                    {
                        _log.Error(ex, "Error processing steps for Flow: " + flow.Name + " with ID: " + flow.Id);
                    }
                }
            }

            return stepResultsList.ToArray();
        }
Exemplo n.º 16
0
        /// <summary>
        /// 加载模板
        /// </summary>
        /// <param name="template"></param>
        /// <returns></returns>
        public FlowEngine TemplateLoad(string template)
        {
            string     file       = this.GetTemplateFile(template);
            FlowEngine flowEngine = FlowEngine.Load(file);

            flowEngine.FinishedHandler -= new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
            flowEngine.FinishedHandler += new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
            flowEngine.FlowState        = FlowState.SelfWaiting;
            flowEngine.ResetIdentity();
            return(flowEngine);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 保存模板
        /// </summary>
        /// <param name="template">模板名称</param>
        /// <param name="flowEngine">流程</param>
        /// <remarks>命名: TEMP_0001  TEMP_002</remarks>
        public void TemplateSave(string template, FlowEngine flowEngine)
        {
            string file      = this.GetTemplateFile(template);
            string directory = System.IO.Path.GetDirectoryName(file);

            if (!System.IO.Directory.Exists(directory))
            {
                System.IO.Directory.CreateDirectory(directory);
            }
            FlowEngine.Save(file, flowEngine);
        }
Exemplo n.º 18
0
        public void TestSimpleFlow()
        {
            var eng = new FlowEngine();

            countGood = 0; countBad = 0;

            eng.Start(a => GoodStep(a))
            .ContinueWith(a => GoodStep(a))
            .ContinueWith(a => GoodStep(a));

            Assert.AreEqual(countGood, eng.Steps.Count);
            Assert.IsTrue(eng.AllWasGood());
        }
 private static Step FindByReference(FlowEngine flowEngine, long reference)
 {
     foreach (var step in flowEngine.FlowSteps)
     {
         foreach (var node in step.Nodes)
         {
             if (node.AuditType == AuditType.UnAudit && node.Participant.Reference == reference)
             {
                 return(step);
             }
         }
     }
     return(null);
 }
Exemplo n.º 20
0
 /// <summary>
 /// 普通节点设置IActor
 /// 条件节点设置ICondition
 /// </summary>
 /// <param name="flowEngine">流程对象</param>
 public void Assign(FlowEngine flowEngine, FlowAttachment flowAttachment)
 {
     foreach (var step in flowEngine.FlowSteps)
     {
         foreach (var node in step.Nodes)
         {
             //node.Participant.Actor = new DepartmentActor();
             if (node is NodeCondition)
             {
                 ((NodeCondition)node).Condition = new RevenuCondition();
             }
         }
     }
     flowEngine.Reset(flowAttachment);
 }
        private static Step FindLastReturned(FlowEngine flowEngine)
        {
            IEnumerable <Step> reverseSteps = flowEngine.FlowSteps.Reverse();

            foreach (var step in reverseSteps)
            {
                foreach (var node in step.Nodes)
                {
                    if (node.AuditType == AuditType.Returned)
                    {
                        return(step);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 22
0
        public void TestCountBad()
        {
            var eng = new FlowEngine();

            countGood = 0; countBad = 0;

            eng.Start(a => GoodStep(a))
            .ContinueWith(a => BadStep(a))
            .ContinueWith(a => GoodStep(a));

            Assert.AreEqual(countGood + countBad, eng.Steps.Count);
            Assert.AreEqual(countGood, eng.Steps.Count - countBad);
            Assert.AreEqual(countBad, eng.Steps.Count - countGood);

            Assert.IsFalse(eng.AllWasGood());
            Assert.IsTrue(eng.SomethingWasWrong());
        }
Exemplo n.º 23
0
        public void TestRealFlow()
        {
            var eng = new FlowEngine();

            countGood = 0; countBad = 0;

            eng.Start(a => GoodStep(a))
            .ContinueWith(a => GoodStep(a))
            .ContinueWith(a => GoodStep(a))
            .ContinueWith(a =>
            {
                GoodStep(a);
                eng.Start(b => GoodStep(b))
                .IfSuccess(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b));

                eng.Start(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b));

                eng.Start(b => GoodStep(b))
                .IfSuccess(b => GoodStep(b));
            })
            .ContinueWith(a =>
            {
                GoodStep(a);
                eng.Start(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b));

                eng.Start(b => GoodStep(b))
                .IfSuccess(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b));

                eng.Start(b => GoodStep(b))
                .IfSuccess(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b))
                .ContinueWith(b => GoodStep(b));
            });

            Assert.AreEqual(countGood, eng.Steps.Count);
            Assert.IsTrue(eng.AllWasGood());
        }
Exemplo n.º 24
0
        public GameEngine(string connectionString, string versionNumber, string versionFile)
        {
            _connectionString = connectionString;
            DatabaseHelper.Actualize(connectionString);
            _gameProvider = new GameProvider(connectionString, _api, _limiter);
            IStateProvider stateProvider = new DatabaseStateProvider(connectionString);

            _privateEngine = new FlowEngine(_api, stateProvider, _limiter);
            _publicEngine  = new FlowEngine(_api, stateProvider, _limiter);

            BuildCommonFlow();
            BuildAdminFlow();
            BuildPrivateFlow();
            BuildPublicFlow();

            CheckVersion(versionNumber, versionFile);
            RunStatistic();
        }
Exemplo n.º 25
0
        private static void Test()
        {
            var api = new Telegram.Bot.Api("Paste some key for debugging purposes");

            var flowEngine = new FlowEngine(api, new DatabaseStateProvider(@"Data Source=(localdb)\ProjectsV13;Initial Catalog=MafiaGM;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"), null);

            var mainMenu = flowEngine.AddCommand("start")
                           .EchoReply(new OneLanguageString("Welcome"));

            flowEngine.AddAnyInput()
            .EchoReply(new OneLanguageString("Please, type /Start to start"));
            mainMenu.AddCommand("help")
            .EchoReply(new OneLanguageString("No help for now"));
            mainMenu.AddCommand("sum")
            .EchoReply(new OneLanguageString("Provide A"))
            .AddAnyInput()
            .EchoReply(new OneLanguageString("Provide B (A is {0}"))
            .AddAnyInput()
            .AddDelegateInput(context => (int.Parse(context[0]) + int.Parse(context[1])).ToString())
            .EchoReply(new OneLanguageString("Result is {0}"))
            .Execute(context => context.Echo(context[1] + context[2], context.UserMessageIdOrZero)); //а тут сразу же показываем конкатенацию
            mainMenu.AddCommand("testPar", true)
            .EchoReply(new OneLanguageString("parameter is {0}"));
            mainMenu.AddCommandWithParameter("testAnyPar", new OneLanguageString("Please, enter value"))
            .ForEach(step => step.EchoReply(new OneLanguageString("Value is {0}")));

            int lastUpdate = 0;

            do
            {
                var updates = api.GetUpdates(lastUpdate + 1).Result;
                if (!updates.Any())
                {
                    Thread.Sleep(3000); continue;
                }
                foreach (var update in updates)
                {
                    IState state;
                    flowEngine.Process(update, null, out state);
                    ((DatabaseState)state).SaveAndDispose();
                    lastUpdate = update.Id;
                }
            } while (true);
        }
        public void Complete(AbstractUserContext userContext, string externalEntityInvocationId)
        {
            ORM <ExternalInvocationEntity> externalInvocationEntityOrm = new ORM <ExternalInvocationEntity>();
            ExternalInvocationEntity       externalInvocationEntity    = externalInvocationEntityOrm.Fetch(externalEntityInvocationId);

            // Get the flow engine for the flow we'd like to complete
            FlowEngine engine = FlowEngine.GetEngine(externalInvocationEntity.FlowTrackingId);

            // Call Done to tell the Engine the Step is complete
            engine.Done(externalInvocationEntity.FlowTrackingId, externalInvocationEntity.StepTrackingId, new ResultData("Done"));

            // Mark the Entity Invocation Completed
            externalInvocationEntity.Status = "Completed";

            // Store the entity
            externalInvocationEntityOrm.Store(externalInvocationEntity);

            Log.Warn("Complete Operation Successfully Invoked");
        }
        /// <summary>
        /// 创建流程实例(不保存入库)
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="category">分类</param>
        /// <param name="uid">创建人</param>
        /// <param name="depLevel1">中心及职能部门</param>
        /// <param name="depLevel2">中心下属部门</param>
        /// <returns>流程实例</returns>
        public static FlowEngine Build(ProjectEntity projectEntity, FlowKinkEntity flowKinkEntity, int userId)
        {
            //获取当前模板
            FlowAttachment flowAttachment = new FlowAttachment()
            {
                Owner = projectEntity.Id, Kind = flowKinkEntity.id
            };

            flowAttachment.Creater = userId;

            FlowManager flowMgr    = FlowManager.Instance();
            FlowEngine  flowEngine = flowMgr.TemplateLoad(flowKinkEntity.C_Template);

            flowEngine.Attachment = flowAttachment;

            FlowHelper.Concat(flowAttachment.Owner, flowEngine);

            return(flowEngine);
        }
Exemplo n.º 28
0
        public void TestSimpleCondition()
        {
            var eng = new FlowEngine();

            countGood = 0; countBad = 0;
            eng.Start(a => GoodStep(a))
            .ContinueWith(a => BadStep(a))
            .IfSuccess(a => GoodStep(a))     // This will never be executed
            .IfFailed(a => GoodStep(a));     // This will never be executed

            Assert.AreEqual(1, countGood);

            Assert.AreEqual(countGood + countBad, eng.Steps.Count);
            Assert.AreEqual(countGood, eng.Steps.Count - countBad);
            Assert.AreEqual(countBad, eng.Steps.Count - countGood);

            Assert.IsFalse(eng.AllWasGood());
            Assert.IsTrue(eng.SomethingWasWrong());
        }
        /// <summary>
        /// 增加会签
        /// </summary>
        /// <param name="flowEngine">流程</param>
        /// <param name="funcEntry"></param>
        /// <param name="users"></param>
        private static void AddCountersign(FlowEngine flowEngine, FunctionEntity funcEntry, IList <UserEntity> users)
        {
            Step firstStep = flowEngine.FlowSteps.First();
            Step newStep   = null;

            foreach (var user in users)
            {
                newStep = new StepGeneral();
                Participant participant = new Participant()
                {
                    Department = -1, Category = 1, Reference = (long)funcEntry.Id
                };
                newStep.Add(new Node(funcEntry.C_Name, participant)
                {
                    Description = funcEntry.C_Name
                });

                flowEngine.AddAfter(firstStep, newStep);
                firstStep = newStep;
            }
        }
        /// <summary>
        /// 拼接当前流程至已存在流程后
        /// </summary>
        /// <param name="id">编号</param>
        /// <param name="category">分类</param>
        /// <param name="flowEngine">新流程</param>
        public static void Concat(int id, FlowEngine newFlowEngine)
        {
            FlowManager flowMgr = FlowManager.Instance();

            if (flowMgr.FlowExists(id))
            {
                int        index         = 0;
                FlowEngine oldFlowEngine = flowMgr.Load(id);

                Step returnedStep = FindLastReturned(oldFlowEngine);
                if (returnedStep == null)
                {
                    return;
                }
                SetDisableAtReturned(oldFlowEngine, returnedStep);
                foreach (var step in oldFlowEngine.FlowSteps)
                {
                    newFlowEngine.Insert(step, index++);
                }
            }
        }
Exemplo n.º 31
0
	void Start(){
		if (WaterMesh != null) {
			flow = new FlowEngine(WaterMesh);
			flow.PreProcess();
		}
	}