Exemplo n.º 1
0
 public static IEnumerable <Signature> Resolve(ProcessModel processModel, string patchVersion = "latest")
 {
     return(APIHelper.GetSignatures(processModel, patchVersion));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 创建活动任务转移实例数据
        /// </summary>
        /// <param name="toActivity">活动</param>
        /// <param name="processInstance">流程实例</param>
        /// <param name="fromActivityInstance">开始活动实例</param>
        /// <param name="transitionGUID">转移GUID</param>
        /// <param name="transitionType">转移类型</param>
        /// <param name="flyingType">跳跃类型</param>
        /// <param name="activityResource">活动资源</param>
        /// <param name="session">会话</param>
        internal override void CreateActivityTaskTransitionInstance(ActivityEntity toActivity,
                                                                    ProcessInstanceEntity processInstance,
                                                                    ActivityInstanceEntity fromActivityInstance,
                                                                    string transitionGUID,
                                                                    TransitionTypeEnum transitionType,
                                                                    TransitionFlyingTypeEnum flyingType,
                                                                    ActivityResource activityResource,
                                                                    IDbSession session)
        {
            Boolean isParallel = false;

            if (fromActivityInstance.ActivityType == (short)ActivityTypeEnum.GatewayNode)
            {
                //并发多实例分支判断(AndSplit Multiple)
                var processModel = new ProcessModel(processInstance.ProcessGUID, processInstance.Version);
                var activityNode = processModel.GetActivity(fromActivityInstance.ActivityGUID);
                if (activityNode.GatewaySplitJoinType == GatewaySplitJoinTypeEnum.Split &&
                    activityNode.GatewayDirectionType == GatewayDirectionEnum.AndSplitMI)
                {
                    isParallel = true;
                }
            }


            if (isParallel)
            {
                //并行多实例
                var entity = new ActivityInstanceEntity();
                var plist  = activityResource.NextActivityPerformers[toActivity.ActivityGUID];
                for (var i = 0; i < plist.Count; i++)
                {
                    entity = base.CreateActivityInstanceObject(toActivity, processInstance, activityResource.AppRunner);
                    entity.AssignedToUserIDs   = plist[i].UserID;
                    entity.AssignedToUserNames = plist[i].UserName;
                    entity.ActivityState       = (short)ActivityStateEnum.Ready;
                    //插入活动实例数据
                    entity.ID = base.ActivityInstanceManager.Insert(entity, session);
                    //插入任务
                    base.TaskManager.Insert(entity, plist[i], activityResource.AppRunner, session);
                    //插入转移数据
                    InsertTransitionInstance(processInstance,
                                             transitionGUID,
                                             fromActivityInstance,
                                             entity,
                                             transitionType,
                                             flyingType,
                                             activityResource.AppRunner,
                                             session);
                }
            }
            else
            {
                //普通任务节点
                var toActivityInstance = base.CreateActivityInstanceObject(toActivity, processInstance, activityResource.AppRunner);

                //进入运行状态
                toActivityInstance.ActivityState     = (short)ActivityStateEnum.Ready;
                toActivityInstance.AssignedToUserIDs = GenerateActivityAssignedUserIDs(
                    activityResource.NextActivityPerformers[toActivity.ActivityGUID]);
                toActivityInstance.AssignedToUserNames = GenerateActivityAssignedUserNames(
                    activityResource.NextActivityPerformers[toActivity.ActivityGUID]);

                //插入活动实例数据
                base.ActivityInstanceManager.Insert(toActivityInstance, session);

                //插入任务数据
                base.CreateNewTask(toActivityInstance, activityResource, session);

                //插入转移数据
                InsertTransitionInstance(processInstance,
                                         transitionGUID,
                                         fromActivityInstance,
                                         toActivityInstance,
                                         transitionType,
                                         flyingType,
                                         activityResource.AppRunner,
                                         session);
            }
        }
Exemplo n.º 3
0
        public static RunnerResult ResultFor(ProcessModel processModel, DomainUsage domainUsage)
        {
            switch (processModel)
            {
            case ProcessModel.Default:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                case DomainUsage.None:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                case DomainUsage.Single:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                case DomainUsage.Multiple:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                default:
                    ThrowOutOfRange(domainUsage);
                    break;
                }
                break;

            case ProcessModel.InProcess:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                    return(new RunnerResult {
                        TestRunner = typeof(TestDomainRunner)
                    });

                case DomainUsage.None:
                    return(new RunnerResult {
                        TestRunner = typeof(LocalTestRunner)
                    });

                case DomainUsage.Single:
                    return(new RunnerResult {
                        TestRunner = typeof(TestDomainRunner)
                    });

                case DomainUsage.Multiple:
                    return(new RunnerResult {
                        TestRunner = typeof(MultipleTestDomainRunner)
                    });

                default:
                    ThrowOutOfRange(domainUsage);
                    break;
                }
                break;

            case ProcessModel.Separate:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                case DomainUsage.None:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                case DomainUsage.Single:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                case DomainUsage.Multiple:
                    return(new RunnerResult {
                        TestRunner = typeof(ProcessRunner)
                    });

                default:
                    ThrowOutOfRange(domainUsage);
                    break;
                }
                break;

            case ProcessModel.Multiple:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                    return(new RunnerResult {
                        TestRunner = typeof(MultipleTestProcessRunner)
                    });

                case DomainUsage.None:
                    return(new RunnerResult {
                        TestRunner = typeof(MultipleTestProcessRunner)
                    });

                case DomainUsage.Single:
                    return(new RunnerResult {
                        TestRunner = typeof(MultipleTestProcessRunner)
                    });

                case DomainUsage.Multiple:
                    return(new RunnerResult {
                        TestRunner = typeof(MultipleTestProcessRunner)
                    });

                default:
                    ThrowOutOfRange(domainUsage);
                    break;
                }
                break;

            default:
                ThrowOutOfRange(processModel);
                break;
            }
            throw new ArgumentOutOfRangeException(nameof(domainUsage), domainUsage,
                                                  $"No expected Test result provided for this {nameof(ProcessModel)}/{nameof(DomainUsage)} combination.");
        }
Exemplo n.º 4
0
 public ActionResult CreateProcess(ProcessModel model)
 {
     return(View());
 }
Exemplo n.º 5
0
 /// <summary>
 /// </summary>
 /// <param name="processModel"> </param>
 private static void UpdateProcessID(ProcessModel processModel)
 {
     Constants.ProcessModel = processModel;
 }
Exemplo n.º 6
0
        /// <summary>
        /// 获取当前活动实体
        /// </summary>
        /// <param name="processGUID"></param>
        /// <param name="activityGUID"></param>
        /// <returns></returns>
        public ActivityEntity GetActivityEntity(string processGUID, string activityGUID)
        {
            var processModel = new ProcessModel(processGUID);

            return(processModel.GetActivity(activityGUID));
        }
Exemplo n.º 7
0
 /// <summary>
 /// </summary>
 /// <param name="pid"> </param>
 private static void UpdateProcessID(ProcessModel processModel)
 {
     Constants.ProcessModel = processModel;
 }
Exemplo n.º 8
0
 protected abstract void InitializeView(ViewType viewType, ProcessModel pm);
Exemplo n.º 9
0
 /// <summary>
 /// </summary>
 public void StartScanning(ProcessModel processModel)
 {
     this._processModel      = processModel;
     this._scanTimer.Enabled = true;
 }
Exemplo n.º 10
0
        protected override void ConfigureOptions()
        {
            base.ConfigureOptions();

            this.Add("config=", "{NAME} of a project configuration to load (e.g.: Debug).",
                     v => ActiveConfig = RequiredValue(v, "--config"));

            // Where to Run Tests
            this.Add("process=", "{PROCESS} isolation for test assemblies.\nValues: InProcess, Separate, Multiple. If not specified, defaults to Separate for a single assembly or Multiple for more than one.",
                     v =>
            {
                ProcessModel = RequiredValue(v, "--process", "Single", "InProcess", "Separate", "Multiple");
                // Change so it displays correctly even though it isn't absolutely needed
                if (ProcessModel.ToLower() == "single")
                {
                    ProcessModel = "InProcess";
                }
            });

            this.Add("inprocess", "Synonym for --process:InProcess",
                     v => ProcessModel = "InProcess");

            this.Add("domain=", "{DOMAIN} isolation for test assemblies.\nValues: None, Single, Multiple. If not specified, defaults to Single for a single assembly or Multiple for more than one.",
                     v => DomainUsage = RequiredValue(v, "--domain", "None", "Single", "Multiple"));

            // How to Run Tests
            this.Add("framework=", "{FRAMEWORK} type/version to use for tests.\nExamples: mono, net-3.5, v4.0, 2.0, mono-4.0. If not specified, tests will run under the framework they are compiled with.",
                     v => Framework = RequiredValue(v, "--framework"));

            this.Add("x86", "Run tests in an x86 process on 64 bit systems",
                     v => RunAsX86 = v != null);

            this.Add("dispose-runners", "Dispose each test runner after it has finished running its tests.",
                     v => DisposeRunners = v != null);

            this.Add("shadowcopy", "Shadow copy test files",
                     v => ShadowCopyFiles = v != null);

            this.Add("loaduserprofile", "Load user profile in test runner processes",
                     v => LoadUserProfile = v != null);

            this.Add("skipnontestassemblies", "Skip any non-test assemblies specified, without error.",
                     v => SkipNonTestAssemblies = v != null);

            this.Add("agents=", "Specify the maximum {NUMBER} of test assembly agents to run at one time. If not specified, there is no limit.",
                     v => _maxAgents = RequiredInt(v, "--agents"));

            this.Add("debug", "Launch debugger to debug tests.",
                     v => DebugTests = v != null);

            this.Add("pause", "Pause before running to allow attaching a debugger.",
                     v => PauseBeforeRun = v != null);

            this.Add("list-extensions", "List all extension points and the extensions for each.",
                     v => ListExtensions = v != null);

            this.Add("set-principal-policy=", "Set PrincipalPolicy for the test domain.",
                     v => PrincipalPolicy = RequiredValue(v, "--set-principal-policy", "UnauthenticatedPrincipal", "NoPrincipal", "WindowsPrincipal"));

#if DEBUG
            this.Add("debug-agent", "Launch debugger in nunit-agent when it starts.",
                     v => DebugAgent = v != null);
#endif
        }
Exemplo n.º 11
0
        private void SystemSearch()
        {
            SYSTEM_INFO sys_info = new SYSTEM_INFO();

            UnsafeNativeMethods.GetSystemInfo(out sys_info);
            MEMORY_BASIC_INFORMATION64        mem_basic_info = new MEMORY_BASIC_INFORMATION64();
            List <MEMORY_BASIC_INFORMATION64> MemReg         = new List <MEMORY_BASIC_INFORMATION64>();
            long bip = ProcessModel.GetProcessBaseAddress(process);

            foreach (Signature sig in Signatures.Resolve(true))
            {
                if (sig.Heap)
                {
                    IntPtr hModuleSnapshot = new IntPtr();

                    hModuleSnapshot = UnsafeNativeHeap.CreateToolhelp32Snapshot(UnsafeNativeHeap.TH32CS_SNAPHEAPLIST | UnsafeNativeHeap.TH32CS_SNAPMODULE32, (uint)process.Id);

                    if ((int)hModuleSnapshot == UnsafeNativeHeap.INVALID_HANDLE_VALUE)
                    {
                        System.Windows.Forms.MessageBox.Show("Not Heap Access. " + Marshal.GetLastWin32Error().ToString());
                        return;
                    }
                    UnsafeNativeHeap.HEAPENTRY64 pe64     = new UnsafeNativeHeap.HEAPENTRY64();
                    UnsafeNativeHeap.HEAPLIST64  heaplist = new UnsafeNativeHeap.HEAPLIST64();
                    heaplist.dwSize = (uint)Marshal.SizeOf(heaplist);
                    UnsafeNativeHeap.PROCESS_HEAP_ENTRY64 phe64 = new UnsafeNativeHeap.PROCESS_HEAP_ENTRY64();

                    System.Threading.Thread.Sleep(10);
                    bool r = UnsafeNativeHeap.Heap32ListFirst(hModuleSnapshot, ref heaplist);
                    r = UnsafeNativeHeap.Heap32ListNext(hModuleSnapshot, ref heaplist);
                    bool r2;
                    while (r)
                    {
                        phe64.lpData = IntPtr.Zero;

                        int a = Marshal.SizeOf(phe64);          //28 (32)
                        a = Marshal.SizeOf(phe64.lpData);       //4
                        a = Marshal.SizeOf(phe64.cbData);       //4
                        a = Marshal.SizeOf(phe64.cbOverhead);   //2
                        a = Marshal.SizeOf(phe64.iRegionIndex); //2
                        a = Marshal.SizeOf(phe64.wFlags);       //2


                        r2 = UnsafeNativeHeap.HeapWalk((IntPtr)heaplist.th32HeapID, ref phe64);
                        System.Windows.Forms.MessageBox.Show("Not Heap Access. " + Marshal.GetLastWin32Error().ToString());
                        int cc = 0;

                        //System.Windows.Forms.MessageBox.Show("Not Heap Access. " + Marshal.GetLastWin32Error().ToString());
                        while (r2 && cc < 100)
                        {
                            if (pe64.dwBlockSize == 883)
                            {
                                int t = 1;
                            }
                            r2 = UnsafeNativeHeap.Heap32Next(ref pe64);
                            cc++;
                        }

                        r = UnsafeNativeHeap.Heap32ListNext(hModuleSnapshot, ref heaplist);
                    }


                    System.Windows.Forms.MessageBox.Show(Marshal.GetLastWin32Error().ToString());
                    UnsafeNativeHeap.CloseHandle(hModuleSnapshot);
                    continue;

                    //この方法もダメ
                    sig.BaseAddress    = (long)MemoryLib.ReadPointer((IntPtr)sig.PointerAddress);
                    Locations[sig.Key] = sig;
                    continue;

                    ulong proc_min_address = (ulong)sys_info.minimumApplicationAddress;
                    ulong proc_max_address = (ulong)sys_info.maximumApplicationAddress;
                    // saving the values as long ints so I won't have to do a lot of casts later
                    ulong proc_min_address_l = (ulong)proc_min_address;
                    ulong proc_max_address_l = (ulong)proc_max_address;
                    bool  exitFg             = true;
                    while (proc_min_address_l < proc_max_address_l && exitFg)
                    {
                        VirtualQueryEx(processHandle, (IntPtr)proc_min_address, out mem_basic_info, (uint)Marshal.SizeOf(typeof(MEMORY_BASIC_INFORMATION64)));
                        // if this memory chunk is accessible
                        if (mem_basic_info.Protect == MemoryLib.PAGE_READWRITE && mem_basic_info.State == MemoryLib.MEM_COMMIT)
                        {
/*
 *
 *                              if (sig.Key == "PARTYCOUNT")
 *                              {
 *                                  //check Mmeory PalyerNmae
 *                                  ReadPlayerInfo();
 *                                  byte[] pattan = new byte[PlayerInfo.d.Name.Length];
 *                                  byte[] pattan0 = new byte[PlayerInfo.d.Name.Length+1];
 *
 *                                  pattan = System.Text.Encoding.ASCII.GetBytes(PlayerInfo.d.Name);
 *                                  pattan.CopyTo(pattan0,1);
 *                                  pattan0[0] = 1;
 *                                  // read everything in the buffer above
 *                                  int hp = (int)processHandle;
 *                                  int readSize = (int)mem_basic_info.RegionSize;// < 64*1024 ? (int)mem_basic_info.RegionSize : 64 * 1024;
 *                                  byte[] buffer = new byte[readSize];
 *                                  int bytesRead = 0;
 *                                  UnsafeNativeMethods.ReadProcessMemory(hp, (Int64)mem_basic_info.BaseAddress, buffer, readSize, ref bytesRead);
 *                                  int pickup = MemoryLib.FindSuperSig(buffer, pattan0);
 *                                  if (pickup == -1)
 *                                  {
 *                                      proc_min_address_l += mem_basic_info.RegionSize;
 *                                      proc_min_address = proc_min_address_l;
 *                                      continue;
 *                                  }else
 *                                  {
 *                                      sig.BaseAddress = (Int64)mem_basic_info.BaseAddress;
 *                                      sig.Offset = pickup - (0x10 * 24) - 1;
 *                                      Locations[sig.Key] = sig;
 *                                      exitFg = false;
 *                                  }
 *                              }
 */
                        }
                        proc_min_address_l += mem_basic_info.RegionSize;
                        proc_min_address    = proc_min_address_l;
                    }
                }
                else
                {
                    if (sig.Value == "")
                    {
                        sig.BaseAddress    = bip;
                        Locations[sig.Key] = sig;
                        continue;
                    }
                    else
                    {
                        Signature retrnSig = MemoryLib.FindExtendedSignatures(sig);                    //toDo Active Search...
                        sig.BaseAddress    = retrnSig.BaseAddress;
                        Locations[sig.Key] = sig;
                    }
                }
            }
        }
        /// <summary>
        /// 创建流程模型实例
        /// </summary>
        /// <param name="processGUID">流程GUID</param>
        /// <param name="version">版本</param>
        /// <returns>流程模型</returns>
        internal static IProcessModel Create(string processGUID, string version)
        {
            IProcessModel processModel = new ProcessModel(processGUID, version);

            return(processModel);
        }
Exemplo n.º 13
0
        public void ThrowArgumentExceptionWhenCreatingWithAnEmptyGuid()
        {
            Action sut = () => ProcessModel.Create(Guid.Empty);

            sut.Should().Throw <ArgumentException>();
        }
Exemplo n.º 14
0
 public bool EvalFlowCondition(TaskInstance ti, ProcessModel.FlowDef fd, ITaskExecutionContext ctx)
 {
     _pd.SetTaskInstanceInfo(ti, ctx);
     string k = DslUtil.FlowConditionKey(fd.Parent.Id, fd.From, fd.To);
     if (!_pd._conds.ContainsKey(k)) throw new Exception("!no flow cond..");
     _pd.SetTaskInstanceInfo(ti, ctx);
     return _pd._conds[k]();
 }
Exemplo n.º 15
0
        public BaseApiResponse SaveProcessDetail(int?UserId, ProcessModel ProceeObj)
        {
            var response = new BaseApiResponse();

            try
            {
                var UserIdParam = new SqlParameter
                {
                    ParameterName = "UserId",
                    DbType        = DbType.Int32,
                    Value         = (object)UserId ?? DBNull.Value
                };

                var MenuIdParam = new SqlParameter
                {
                    ParameterName = "MenuId",
                    DbType        = DbType.Int32,
                    Value         = (object)ProceeObj.MenuId ?? DBNull.Value
                };
                var ProcessIdParam = new SqlParameter
                {
                    ParameterName = "ProcessId",
                    DbType        = DbType.Int32,
                    Value         = (object)ProceeObj.ProcessId ?? DBNull.Value
                };
                var ProcessNameParam = new SqlParameter
                {
                    ParameterName = "ProcessName",
                    DbType        = DbType.String,
                    Value         = (object)ProceeObj.ProcessName ?? DBNull.Value
                };
                var ProcessDescParam = new SqlParameter
                {
                    ParameterName = "ProcessDesc",
                    DbType        = DbType.String,
                    Value         = (object)ProceeObj.ProcessDesc ?? DBNull.Value
                };

                var IsActiveParam = new SqlParameter
                {
                    ParameterName = "IsActive",
                    DbType        = DbType.Boolean,
                    Value         = (Object)ProceeObj.IsActive != null ? ProceeObj.IsActive : (object)DBNull.Value
                };

                var DisplayOrderParam = new SqlParameter
                {
                    ParameterName = "DisplayOrder",
                    DbType        = DbType.Int16,
                    Value         = (Object)ProceeObj.DisplayOrder != null ? ProceeObj.DisplayOrder : (object)DBNull.Value
                };
                var RegionIdParam = new SqlParameter
                {
                    ParameterName = "SelectedRegion",
                    DbType        = DbType.String,
                    Value         = (object)ProceeObj.SelectedRegion ?? DBNull.Value
                };



                var result = _repository.ExecuteSQL <int>("AddorUpdateProcessDetails", UserIdParam, MenuIdParam, ProcessIdParam, ProcessNameParam, ProcessDescParam, IsActiveParam, DisplayOrderParam, RegionIdParam).FirstOrDefault();
                if (result > 0)
                {
                    response.Success    = true;
                    response.InsertedId = result;
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                response.Message.Add(ex.Message);
            }

            return(response);
        }
Exemplo n.º 16
0
 public void HaveAnId()
 {
     ProcessModel.Create().Id
     .Should().NotBeEmpty();
 }
Exemplo n.º 17
0
        public IList <NativeMemoryRegionInfo> LoadRegions(IntPtr handle, ProcessModel process, List <ProcessModule> systemModules, bool scanAllRegions)
        {
            int COL_ADDR     = 0;
            int COL_PERM     = 1;
            int COL_OFFSET   = 2;
            int COL_DEVICE   = 3;
            int COL_INODE    = 4;
            int COL_PATHNAME = 5;

            Func <string, string[]> splitMaps = s =>
            {
                var ret = new string[6];

                if (s.Length < 42)
                {
                    throw new Exception($"Invalid length of mmap line \"{s}\" ({s.Length} should be at least 42)");
                }

                ret[COL_ADDR]   = s.Substring(0, 19);
                ret[COL_PERM]   = s.Substring(20, 4);
                ret[COL_OFFSET] = s.Substring(25, 8);
                ret[COL_DEVICE] = s.Substring(34, 5);
                if (s.Length == 42)
                {
                    ret[COL_INODE]    = s.Substring(40, 1);
                    ret[COL_PATHNAME] = "";
                }
                else
                {
                    ret[COL_INODE]    = s.Substring(40, 7);
                    ret[COL_PATHNAME] = s.Substring(48).Trim();
                }

                return(ret);
            };

            var regions = new List <NativeMemoryRegionInfo>();
            var found   = false;

            foreach (var line in System.IO.File.ReadAllLines($"/proc/{handle}/maps"))
            {
                if (!found && line.EndsWith(process.ProcessName) == false)
                {
                    continue;
                }

                found = true;

                var cols = splitMaps(line);

                // Not an empty pathname and it is not ending with our process name, then we are done
                if (line.EndsWith(process.ProcessName) == false && (cols[COL_PATHNAME]?.Length ?? 0) > 0)
                {
                    break;
                }

                var addr  = cols[COL_ADDR].Split('-');
                var start = long.Parse(addr[0], System.Globalization.NumberStyles.HexNumber);
                var end   = long.Parse(addr[1], System.Globalization.NumberStyles.HexNumber);

                regions.Add(new NativeMemoryRegionInfo
                {
                    BaseAddress = new IntPtr(start),
                    RegionSize  = new IntPtr(end - start)
                });
            }

            return(regions);
        }
Exemplo n.º 18
0
        public static RunnerResult ResultFor(ProcessModel processModel, DomainUsage domainUsage)
        {
            switch (processModel)
            {
            case ProcessModel.Default:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                case DomainUsage.None:
                case DomainUsage.Single:
                case DomainUsage.Multiple:
                    return(RunnerResult.ProcessRunner);

                default:
                    throw new ArgumentOutOfRangeException(nameof(domainUsage), domainUsage, ExceptionMessage);
                }

            case ProcessModel.InProcess:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                    return(RunnerResult.TestDomainRunner);

                case DomainUsage.None:
                    return(RunnerResult.LocalTestRunner);

                case DomainUsage.Single:
                    return(RunnerResult.TestDomainRunner);

                case DomainUsage.Multiple:
                    return(RunnerResult.TestDomainRunner);

                default:
                    throw new ArgumentOutOfRangeException(nameof(domainUsage), domainUsage, ExceptionMessage);
                }

            case ProcessModel.Separate:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                case DomainUsage.None:
                case DomainUsage.Single:
                case DomainUsage.Multiple:
                    return(RunnerResult.ProcessRunner);

                default:
                    throw new ArgumentOutOfRangeException(nameof(domainUsage), domainUsage, ExceptionMessage);
                }

            case ProcessModel.Multiple:
                switch (domainUsage)
                {
                case DomainUsage.Default:
                case DomainUsage.None:
                case DomainUsage.Single:
                case DomainUsage.Multiple:
                    return(new RunnerResult
                    {
                        TestRunner = typeof(MultipleTestProcessRunner),
                        SubRunners = new[]
                        {
                            RunnerResult.ProcessRunner
                        }
                    });

                default:
                    throw new ArgumentOutOfRangeException(nameof(domainUsage), domainUsage, ExceptionMessage);
                }

            default:
                throw new ArgumentOutOfRangeException(nameof(processModel), processModel, ExceptionMessage);
            }
        }
        public int Execute(ExtendedConsoleOptions options)
        {
            this.workDir = options.work;
            if (workDir == null || workDir == string.Empty)
            {
                workDir = Environment.CurrentDirectory;
            }
            else
            {
                workDir = Path.GetFullPath(workDir);
                if (!Directory.Exists(workDir))
                {
                    Directory.CreateDirectory(workDir);
                }
            }

            TextWriter outWriter      = Console.Out;
            bool       redirectOutput = options.output != null && options.output != string.Empty;

            if (redirectOutput)
            {
                StreamWriter outStreamWriter = new StreamWriter(Path.Combine(workDir, options.output));
                outStreamWriter.AutoFlush = true;
                outWriter = outStreamWriter;
            }

            TextWriter errorWriter   = Console.Error;
            bool       redirectError = options.err != null && options.err != string.Empty;

            if (redirectError)
            {
                StreamWriter errorStreamWriter = new StreamWriter(Path.Combine(workDir, options.err));
                errorStreamWriter.AutoFlush = true;
                errorWriter = errorStreamWriter;
            }

            TextWriter testResultWriter = null;

            if (options.IsResults)
            {
                testResultWriter = new StreamWriter(options.results, false, Encoding.UTF8);
                ((StreamWriter)testResultWriter).AutoFlush = true;
            }
            TestPackage package = MakeTestPackage(options);

            ProcessModel processModel = package.Settings.Contains("ProcessModel")
                ? (ProcessModel)package.Settings["ProcessModel"]
                : ProcessModel.Default;

            DomainUsage domainUsage = package.Settings.Contains("DomainUsage")
                ? (DomainUsage)package.Settings["DomainUsage"]
                : DomainUsage.Default;

            RuntimeFramework framework = package.Settings.Contains("RuntimeFramework")
                ? (RuntimeFramework)package.Settings["RuntimeFramework"]
                : RuntimeFramework.CurrentFramework;

#if CLR_2_0 || CLR_4_0
            Console.WriteLine("ProcessModel: {0}    DomainUsage: {1}", processModel, domainUsage);

            Console.WriteLine("Execution Runtime: {0}", framework);
#else
            Console.WriteLine("DomainUsage: {0}", domainUsage);

            if (processModel != ProcessModel.Default && processModel != ProcessModel.Single)
            {
                Console.WriteLine("Warning: Ignoring project setting 'processModel={0}'", processModel);
            }

            if (!RuntimeFramework.CurrentFramework.Supports(framework))
            {
                Console.WriteLine("Warning: Ignoring project setting 'runtimeFramework={0}'", framework);
            }
#endif

            using (TestRunner testRunner = new DefaultTestRunnerFactory().MakeTestRunner(package))
            {
                testRunner.Load(package);

                if (testRunner.Test == null)
                {
                    testRunner.Unload();
                    Console.Error.WriteLine("Unable to locate fixture {0}", options.fixture);
                    return(FIXTURE_NOT_FOUND);
                }

                ExtendedEventCollector collector = new ExtendedEventCollector(options, outWriter, errorWriter, testResultWriter);

                TestFilter       testFilter = TestFilter.Empty;
                SimpleNameFilter nameFilter = new SimpleNameFilter();

                if (options.run != null && options.run != string.Empty)
                {
                    Console.WriteLine("Selected test(s): " + options.run);
                    foreach (string name in TestNameParser.Parse(options.run))
                    {
                        nameFilter.Add(name);
                    }
                    testFilter = nameFilter;
                }

                if (options.runlist != null && options.runlist != string.Empty)
                {
                    Console.WriteLine("Run list: " + options.runlist);
                    using (StreamReader rdr = new StreamReader(options.runlist))
                    {
                        // NOTE: We can't use rdr.EndOfStream because it's
                        // not present in .NET 1.x.
                        string line = rdr.ReadLine();
                        while (line != null)
                        {
                            if (line[0] != '#')
                            {
                                nameFilter.Add(line);
                            }
                            line = rdr.ReadLine();
                        }
                    }
                    testFilter = nameFilter;
                }

                if (options.include != null && options.include != string.Empty)
                {
                    TestFilter includeFilter = new CategoryExpression(options.include).Filter;
                    Console.WriteLine("Included categories: " + includeFilter.ToString());

                    if (testFilter.IsEmpty)
                    {
                        testFilter = includeFilter;
                    }
                    else
                    {
                        testFilter = new AndFilter(testFilter, includeFilter);
                    }
                }

                if (options.exclude != null && options.exclude != string.Empty)
                {
                    TestFilter excludeFilter = new NotFilter(new CategoryExpression(options.exclude).Filter);
                    Console.WriteLine("Excluded categories: " + excludeFilter.ToString());

                    if (testFilter.IsEmpty)
                    {
                        testFilter = excludeFilter;
                    }
                    else if (testFilter is AndFilter)
                    {
                        ((AndFilter)testFilter).Add(excludeFilter);
                    }
                    else
                    {
                        testFilter = new AndFilter(testFilter, excludeFilter);
                    }
                }

                if (testFilter is NotFilter)
                {
                    ((NotFilter)testFilter).TopLevel = true;
                }

                TestResult result         = null;
                string     savedDirectory = Environment.CurrentDirectory;
                TextWriter savedOut       = Console.Out;
                TextWriter savedError     = Console.Error;

                try
                {
                    result = testRunner.Run(collector, testFilter, false, LoggingThreshold.Off);
                }
                finally
                {
                    outWriter.Flush();
                    errorWriter.Flush();

                    if (redirectOutput)
                    {
                        outWriter.Close();
                    }
                    if (redirectError)
                    {
                        errorWriter.Close();
                    }
                    if (options.IsResults)
                    {
                        testResultWriter.Close();
                    }

                    Environment.CurrentDirectory = savedDirectory;
                    Console.SetOut(savedOut);
                    Console.SetError(savedError);
                }

                Console.WriteLine();

                int returnCode = UNEXPECTED_ERROR;

                if (result != null)
                {
                    string           xmlOutput = CreateXmlOutput(result);
                    ResultSummarizer summary   = new ResultSummarizer(result);

                    if (options.xmlConsole)
                    {
                        Console.WriteLine(xmlOutput);
                    }
                    else
                    {
                        WriteSummaryReport(summary);
                        if (summary.ErrorsAndFailures > 0 || result.IsError || result.IsFailure)
                        {
                            if (options.stoponerror)
                            {
                                Console.WriteLine("Test run was stopped after first error, as requested.");
                                Console.WriteLine();
                            }

                            WriteErrorsAndFailuresReport(result);
                        }
                        if (summary.TestsNotRun > 0)
                        {
                            WriteNotRunReport(result);
                        }

                        if (!options.noresult)
                        {
                            // Write xml output here
                            string xmlResultFile = options.result == null || options.result == string.Empty
                                ? "TestResult.xml" : options.result;

                            using (StreamWriter writer = new StreamWriter(Path.Combine(workDir, xmlResultFile)))
                            {
                                writer.Write(xmlOutput);
                            }
                        }
                    }

                    returnCode = summary.ErrorsAndFailures;
                }

                if (collector.HasExceptions)
                {
                    collector.WriteExceptions();
                    returnCode = UNEXPECTED_ERROR;
                }

                return(returnCode);
            }
        }
        private static bool AttachGame()
        {
            string processName = "ffxiv_dx11";

            Log.Debug($"Finding process {processName}");

            // ko client filtering
            processes = Process.GetProcessesByName(processName).Where(x => { try { return(System.IO.File.Exists(x.MainModule.FileName.Replace("game\\ffxiv_dx11.exe", "boot\\ffxivboot.exe"))); } catch { return(false); } }).ToArray();

            if (processes.Length > 0)
            {
                // supported: English, Chinese, Japanese, French, German, Korean
                string gameLanguage = "English";
                // whether to always hit API on start to get the latest sigs based on patchVersion, or use the local json cache (if the file doesn't exist, API will be hit)
                bool useLocalCache = true;
                // patchVersion of game, or latest
                string       patchVersion = "latest";
                Process      process      = processes[0];
                ProcessModel processModel = new ProcessModel
                {
                    Process = process,
                    IsWin64 = true
                };

                MemoryHandler.Instance.SetProcess(processModel, gameLanguage, patchVersion, useLocalCache);
                var signatures = new List <Signature>();
                // typical signature
                signatures.Add(new Signature
                {
                    Key = "ALLMESSAGES",

                    PointerPath = HermesAddress.GetLatestAddress().Address

                                  /*PointerPath = new List<long>
                                   * {
                                   * 0x01EB7478,
                                   * 0x8L,
                                   * 0x18L,
                                   * 0x20L,
                                   * 0x100L,
                                   * 0x0L
                                   * }
                                   * });*/
                });
                //signatures.Add(new Signature
                //{
                //    Key = "ALLMESSAGES2",
                //    PointerPath = new List<long>
                //{
                //    0x01E7FD80,
                //    0x108L,
                //    0x68L,
                //    0x240L,
                //    0x0L
                //}
                //});

                // adding parameter scanAllMemoryRegions as true makes huge memory leak and CPU usage.Why?
                Scanner.Instance.LoadOffsets(signatures);

                ChatQueue.rq.Enqueue("Dialogue window");
                ChatQueue.lastMsg = "Dialogue window";
                Log.Debug($"Attached {processName}.exe ({gameLanguage})");
                MessageBox.Show($"Attached {processName}.exe");

                return(true);
            }
            else
            {
                Log.Fatal($"Can't find {processName}.exe");
                MessageBox.Show($"Can't find {processName}.exe");
                return(false);
            }
        }
Exemplo n.º 21
0
 public CmdProcessRequest(long id, CommandTypes commandType, ProcessModel model)
     : base(id, commandType)
 {
     this.model = model;
 }
Exemplo n.º 22
0
        /// <summary>
        /// 保存流程定义的xml文件
        /// </summary>
        /// <param name="diagram"></param>
        public void SaveProcessFile(ProcessFileEntity entity)
        {
            var processModel = new ProcessModel(entity.ProcessGUID);

            processModel.SaveProcessFile(entity);
        }
Exemplo n.º 23
0
        // TODO: See if this can be unified with the Gui's MakeTestPackage
        private TestPackage MakeTestPackage(ConsoleOptions options)
        {
            TestPackage      package;
            DomainUsage      domainUsage  = DomainUsage.Default;
            ProcessModel     processModel = ProcessModel.Default;
            RuntimeFramework framework    = null;

            string[] parameters = new string[options.ParameterCount];
            for (int i = 0; i < options.ParameterCount; i++)
            {
                parameters[i] = Path.GetFullPath((string)options.Parameters[i]);
            }

            if (options.IsTestProject)
            {
                NUnitProject project =
                    Services.ProjectService.LoadProject(parameters[0]);

                string configName = options.config;
                if (configName != null)
                {
                    project.SetActiveConfig(configName);
                }

                package      = project.ActiveConfig.MakeTestPackage();
                processModel = project.ProcessModel;
                domainUsage  = project.DomainUsage;
                framework    = project.ActiveConfig.RuntimeFramework;
            }
            else if (parameters.Length == 1)
            {
                package     = new TestPackage(parameters[0]);
                domainUsage = DomainUsage.Single;
            }
            else
            {
                // TODO: Figure out a better way to handle "anonymous" packages
                package             = new TestPackage(null, parameters);
                package.AutoBinPath = true;
                domainUsage         = DomainUsage.Multiple;
            }

            if (options.basepath != null && options.basepath != string.Empty)
            {
                package.BasePath = options.basepath;
            }

            if (options.privatebinpath != null && options.privatebinpath != string.Empty)
            {
                package.AutoBinPath    = false;
                package.PrivateBinPath = options.privatebinpath;
            }

#if CLR_2_0 || CLR_4_0
            if (options.framework != null)
            {
                framework = RuntimeFramework.Parse(options.framework);
            }

            if (options.process != ProcessModel.Default)
            {
                processModel = options.process;
            }
#endif

            if (options.domain != DomainUsage.Default)
            {
                domainUsage = options.domain;
            }

            package.TestName = options.fixture;

            package.Settings["ProcessModel"] = processModel;
            package.Settings["DomainUsage"]  = domainUsage;

            if (framework != null)
            {
                package.Settings["RuntimeFramework"] = framework;
            }

            if (domainUsage == DomainUsage.None)
            {
                // Make sure that addins are available
                CoreExtensions.Host.AddinRegistry = Services.AddinRegistry;
            }

            package.Settings["ShadowCopyFiles"]   = !options.noshadow;
            package.Settings["UseThreadedRunner"] = !options.nothread;
            package.Settings["DefaultTimeout"]    = options.timeout;
            package.Settings["WorkDirectory"]     = this.workDir;
            package.Settings["StopOnError"]       = options.stoponerror;

            if (options.apartment != System.Threading.ApartmentState.Unknown)
            {
                package.Settings["ApartmentState"] = options.apartment;
            }

            return(package);
        }
Exemplo n.º 24
0
 internal void ResolveMemoryStructures(ProcessModel processModel, string patchVersion = "latest")
 {
     this.Structures = APIHelper.GetStructures(processModel, patchVersion);
 }
Exemplo n.º 25
0
        public int Execute(ExtendedConsoleOptions options)
        {
            this.workDir = options.work;
            if (workDir == null || workDir == string.Empty)
            {
                workDir = Environment.CurrentDirectory;
            }
            else
            {
                workDir = Path.GetFullPath(workDir);
                if (!Directory.Exists(workDir))
                {
                    Directory.CreateDirectory(workDir);
                }
            }

            TextWriter outWriter      = Console.Out;
            bool       redirectOutput = options.output != null && options.output != string.Empty;

            if (redirectOutput)
            {
                StreamWriter outStreamWriter = new StreamWriter(Path.Combine(workDir, options.output));
                outStreamWriter.AutoFlush = true;
                outWriter = outStreamWriter;
            }

            TextWriter errorWriter   = Console.Error;
            bool       redirectError = options.err != null && options.err != string.Empty;

            if (redirectError)
            {
                StreamWriter errorStreamWriter = new StreamWriter(Path.Combine(workDir, options.err));
                errorStreamWriter.AutoFlush = true;
                errorWriter = errorStreamWriter;
            }

            TextWriter testResultWriter = null;

            if (options.IsResults)
            {
                testResultWriter = new StreamWriter(options.results, false, Encoding.UTF8);
                ((StreamWriter)testResultWriter).AutoFlush = true;
            }

            TestPackage package = MakeTestPackage(options);

            ProcessModel processModel = package.Settings.Contains("ProcessModel")
                ? (ProcessModel)package.Settings["ProcessModel"]
                : ProcessModel.Default;

            DomainUsage domainUsage = package.Settings.Contains("DomainUsage")
                ? (DomainUsage)package.Settings["DomainUsage"]
                : DomainUsage.Default;

            RuntimeFramework framework = package.Settings.Contains("RuntimeFramework")
                ? (RuntimeFramework)package.Settings["RuntimeFramework"]
                : RuntimeFramework.CurrentFramework;

#if CLR_2_0 || CLR_4_0
            Console.WriteLine("ProcessModel: {0}    DomainUsage: {1}", processModel, domainUsage);

            Console.WriteLine("Execution Runtime: {0}", framework);
#else
            Console.WriteLine("DomainUsage: {0}", domainUsage);

            if (processModel != ProcessModel.Default && processModel != ProcessModel.Single)
            {
                Console.WriteLine("Warning: Ignoring project setting 'processModel={0}'", processModel);
            }

            if (!RuntimeFramework.CurrentFramework.Supports(framework))
            {
                Console.WriteLine("Warning: Ignoring project setting 'runtimeFramework={0}'", framework);
            }
#endif

            using (TestRunner testRunner = new DefaultTestRunnerFactory().MakeTestRunner(package))
            {
                testRunner.Load(package);

                if (testRunner.Test == null)
                {
                    testRunner.Unload();
                    Console.Error.WriteLine("Unable to locate fixture {0}", options.fixture);
                    return(FIXTURE_NOT_FOUND);
                }

                ExtendedEventCollector collector = new ExtendedEventCollector(options, outWriter, errorWriter, testResultWriter);

                TestFilter testFilter;

                if (!CreateTestFilter(options, out testFilter))
                {
                    return(INVALID_ARG);
                }

                TestResult result         = null;
                string     savedDirectory = Environment.CurrentDirectory;
                TextWriter savedOut       = Console.Out;
                TextWriter savedError     = Console.Error;

                try
                {
                    result = testRunner.Run(collector, testFilter, false, LoggingThreshold.Off);
                }
                finally
                {
                    outWriter.Flush();
                    errorWriter.Flush();

                    if (redirectOutput)
                    {
                        outWriter.Close();
                    }

                    if (redirectError)
                    {
                        errorWriter.Close();
                    }

                    if (options.IsResults)
                    {
                        testResultWriter.Close();
                    }

                    Environment.CurrentDirectory = savedDirectory;
                    Console.SetOut(savedOut);
                    Console.SetError(savedError);
                }

                Console.WriteLine();

                int returnCode = UNEXPECTED_ERROR;

                if (result != null)
                {
                    string           xmlOutput = CreateXmlOutput(result);
                    ResultSummarizer summary   = new ResultSummarizer(result);

                    if (options.xmlConsole)
                    {
                        Console.WriteLine(xmlOutput);
                    }
                    else
                    {
                        WriteSummaryReport(summary);

                        bool hasErrors = summary.Errors > 0 || summary.Failures > 0 || result.IsError || result.IsFailure;

                        if (options.stoponerror && (hasErrors || summary.NotRunnable > 0))
                        {
                            Console.WriteLine("Test run was stopped after first error, as requested.");
                            Console.WriteLine();
                        }

                        if (hasErrors)
                        {
                            WriteErrorsAndFailuresReport(result);
                        }

                        if (summary.TestsNotRun > 0)
                        {
                            WriteNotRunReport(result);
                        }

                        if (!options.noresult)
                        {
                            // Write xml output here
                            string xmlResultFile = options.result == null || options.result == string.Empty
                                ? "TestResult.xml" : options.result;

                            using (StreamWriter writer = new StreamWriter(Path.Combine(workDir, xmlResultFile)))
                            {
                                writer.Write(xmlOutput);
                            }
                        }
                    }

                    returnCode = summary.Errors + summary.Failures + summary.NotRunnable;
                }

                if (collector.HasExceptions)
                {
                    collector.WriteExceptions();
                    returnCode = UNEXPECTED_ERROR;
                }

                return(returnCode);
            }
        }
Exemplo n.º 26
0
 public void SetStructures(ProcessModel processModel, string patchVersion = "latest")
 {
     Structures = APIHelper.GetStructures(processModel, patchVersion);
 }
Exemplo n.º 27
0
 public void RegisterProcess(ProcessModel process)
 {
     process.Active = true;
     repository.Register(process);
 }
Exemplo n.º 28
0
        /// <summary>
        /// Returns a test runner based on the settings in a TestPackage.
        /// Any setting that is "consumed" by the factory is removed, so
        /// that downstream runners using the factory will not repeatedly
        /// create the same type of runner.
        /// </summary>
        /// <param name="package">The TestPackage to be loaded and run</param>
        /// <returns>A TestRunner</returns>
        public override ITestEngineRunner MakeTestRunner(TestPackage package)
        {
            int assemblyCount = 0;
            int projectCount  = 0;

            foreach (var testFile in package.TestFiles)
            {
                if (PathUtils.IsAssemblyFileType(testFile))
                {
                    assemblyCount++;
                }
                else if (ServiceContext.ProjectService.CanLoadFrom(testFile))
                {
                    projectCount++;
                }
            }

            // If we have multiple projects or a project plus assemblies
            // then defer to the AggregatingTestRunner, which will make
            // the decision on a file by file basis so that each project
            // runs with its own settings.
            if (projectCount > 1 || projectCount > 0 && assemblyCount > 0)
            {
                return(new AggregatingTestRunner(ServiceContext, package));
            }

            // If we have a single project by itself, expand it here.
            if (projectCount > 0 && assemblyCount == 0)
            {
                var p = new TestPackage(package.TestFiles[0]);

                foreach (var key in package.Settings.Keys)
                {
                    p.Settings[key] = package.Settings[key];
                }

                ServiceContext.ProjectService.ExpandProjectPackage(p);

                package = p;
            }

            // TODO: What about bad extensions?

            ProcessModel processModel = GetTargetProcessModel(package);

            package.Settings.Remove(PackageSettings.ProcessModel);

            switch (processModel)
            {
            default:
            case ProcessModel.Default:
                if (package.TestFiles.Count > 1)
                {
                    return(new MultipleTestProcessRunner(this.ServiceContext, package));
                }
                else
                {
                    return(new ProcessRunner(this.ServiceContext, package));
                }

            case ProcessModel.Multiple:
                return(new MultipleTestProcessRunner(this.ServiceContext, package));

            case ProcessModel.Separate:
                return(new ProcessRunner(this.ServiceContext, package));

            case ProcessModel.Single:
                return(base.MakeTestRunner(package));
            }
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            //string modelFilename = "../../testdata/UserTaskFoo-c.bpmn";
            string modelFilename = "../../testdata/flow.bpmn";

            Console.WriteLine("Model: " + modelFilename);
            Console.WriteLine("READSTART: " + modelFilename);
            var model = new ProcessModel(File.OpenRead(modelFilename));

            Console.WriteLine("READEND: " + modelFilename);
            Console.WriteLine("INITSTART: " + modelFilename);
            var processInstance = model.ProcessInstance();

            Console.WriteLine("INITEND: " + modelFilename);
            processInstance.SetDefaultHandlers();
            processInstance.SetHandler("task", new MyTaskHandler());
            processInstance.SetHandler("startEvent", new MyStartHandler());

            var processInstanceInputParameters = new Dictionary <string, object>()
            {
                { "processVar1", "value1" }, { "processVar2", 50 }
            };

            Console.WriteLine("DUMPSTART: " + modelFilename);
            int nNodes = processInstance.Nodes.Count;

            Console.WriteLine("NodeDump: " + nNodes.ToString());
            foreach (string k in processInstance.Nodes.Keys)
            {
                ProcessNode n = processInstance.Nodes[k];
                Console.WriteLine(n.NodeSerialNumber.ToString()
                                  + "\t" + k
                                  + "\t" + n.NodeName
                                  + "\t" + n.NodeType
                                  + "\t" + ((n.PreviousNodes != null) ? n.PreviousNodes.Count.ToString() : "(null)")
                                  + "\t" + ((n.NextNodes != null) ? n.NextNodes.Count.ToString() : "(null)")
                                  + "\t" + ((n.InputParameters != null) ? n.InputParameters.Count.ToString() : "(null)")
                                  + "\t" + ((n.OutputParameters != null) ? n.OutputParameters.Count.ToString() : "(null)")
                                  + "\t" + ((n.Expression != null) ? n.Expression : "(null)")
                                  );
            }

            List <string> keys = new List <string>();

            int[] ids = new int[nNodes + 1];
            foreach (string k in processInstance.Nodes.Keys)
            {
                keys.Add(k);
            }
            int nIDs = 0;

            foreach (string k in processInstance.Nodes.Keys)
            {
                ids[processInstance.Nodes[k].NodeSerialNumber] = nIDs++;
            }

            Console.WriteLine("NodeKeys: " + nNodes.ToString());
            for (int i = 1; i <= nNodes; i++)
            {
                int    id = ids[i];
                string k  = keys[id];
                Console.WriteLine(i.ToString() + "\t" + id.ToString() + "\t" + k);
            }

            Console.WriteLine("NodeDump (sorted): " + nNodes.ToString());
            for (int i = 1; i <= nNodes; i++)
            {
                int         id = ids[i];
                string      k  = keys[id];
                ProcessNode n  = processInstance.Nodes[k];
                Console.WriteLine(n.NodeSerialNumber.ToString()
                                  + "\t" + k
                                  + "\t" + n.NodeName
                                  + "\t" + n.NodeType
                                  + "\t" + ((n.PreviousNodes != null) ? n.PreviousNodes.Count.ToString() : "(null)")
                                  + "\t" + ((n.NextNodes != null) ? n.NextNodes.Count.ToString() : "(null)")
                                  + "\t" + ((n.InputParameters != null) ? n.InputParameters.Count.ToString()  : "(null)")
                                  + "\t" + ((n.OutputParameters != null) ? n.OutputParameters.Count.ToString() : "(null)")
                                  + "\t" + ((n.Expression != null) ? n.Expression : "(null)")
                                  );
            }
            Console.WriteLine("DUMPEND: " + modelFilename);

            Console.WriteLine("Press ENTER to see BPMV byecode...");
            Console.ReadLine();

            processInstance.Serialize1ProcessTemplate();

            //Console.WriteLine("Count:\t[" + processInstance.Nodes.Count.ToString() + "]");
            //foreach (string k in processInstance.Nodes.Keys)
            //{
            //    ProcessNode n = processInstance.Nodes[k];
            //    Console.WriteLine("[" + n.NodeID.ToString() + "]"
            //        + "\t" + k
            //        + "\t" + n.NodeName
            //        + "\t" + n.NodeType
            //        + "\t" + ((n.PreviousNodes != null) ? n.PreviousNodes.Count.ToString() : "(null)")
            //        + "\t" + ((n.NextNodes != null) ? n.NextNodes.Count.ToString() : "(null)")
            //        + "\t" + ((n.InputParameters != null) ? n.InputParameters.Count.ToString() : "(null)")
            //        + "\t" + ((n.OutputParameters != null) ? n.OutputParameters.Count.ToString() : "(null)")
            //        + "\t" + ((n.Expression != null) ? n.Expression : "(null)")
            //        );
            //}

            Console.WriteLine("Press ENTER to start process off-chain...");
            Console.ReadLine();

            processInstance.Serialize1ProcessInstance();
            Console.WriteLine("EXECSTART: " + modelFilename);
            processInstance.Start(processInstanceInputParameters);
            Console.WriteLine("EXECEND: " + modelFilename);
            Console.WriteLine("Press ENTER after completion of process off-chain processing");
            Console.ReadLine();
            processInstance.Serialize1ProcessInstance();

            Console.WriteLine("Press ENTER to exit...");
            Console.ReadLine();
        }
Exemplo n.º 30
0
 internal NodeMediatorAndSplit(ActivityEntity activity, ProcessModel processModel, IDbSession session)
     : base(activity, processModel, session)
 {
 }
Exemplo n.º 31
0
 /// <summary>
 /// 初期化処理
 /// </summary>
 /// <param name="rootProjectModel"></param>
 /// <param name="projModel"></param>
 /// <param name="procModel"></param>
 public override void Init(ProjectModel rootProjectModel, ProjectModel projModel, ProcessModel procModel)
 {
     try
     {
         this.RootProjectModel    = rootProjectModel;
         this.CurrentProjectModel = projModel;
         this.ProcessModel        = procModel;
     }
     catch (Exception ex)
     {
         throw Program.ThrowException(ex);
     }
 }
Exemplo n.º 32
0
 public bool ValidateAndSaveProcessDefinition(ProcessModel.ProcessDef pd, bool save, out List<string> errors, out List<string> warnings)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 33
0
 public ProcessInstance(ProcessModel model)
 {
     LoadDataFromModel(model);
 }