Ejemplo n.º 1
0
 /// <summary>
 /// Creates a processing result with the specified state.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <param name="message">The message.</param>
 /// <returns></returns>
 public static ProcessResult Create(ProcessState state, string message)
 {
     var result = new ProcessResult();
     result.State = state;
     result.Message = message;
     return result;
 }
Ejemplo n.º 2
0
 public ProcessReturnValue()
 {
     this.fileName = "result";
     this.status = ProcessState.Accepted;
     this.statusMessage = "";
     this.returnValues = new List<OutputData>();
     this.responseForm = new ResponseFormType("wps:ResponseForm");
 }
Ejemplo n.º 3
0
 public ProcessReturnValue(SerializationInfo info, StreamingContext ctxt)
 {
     fileName = (string)info.GetValue("fileName", typeof(string));
     status = (ProcessState)info.GetValue("status", typeof(ProcessState));
     statusMessage = (string)info.GetValue("statusMessage", typeof(string));
     returnValues = (List<OutputData>)info.GetValue("returnValues", typeof(List<OutputData>));
     responseForm = (ResponseFormType)info.GetValue("responseForm", typeof(ResponseFormType));
     percentageCompleted = (int)info.GetValue("percentageCompleted", typeof(int));
 }
Ejemplo n.º 4
0
 public void Start()
 {
     thread = new Thread(new ThreadStart(Run));
     thread.IsBackground = true;
     isRun = true;
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     state = ProcessState.Stared;
 }
Ejemplo n.º 5
0
 public void Fail()
 {
     if (State == ProcessState.Running || State == ProcessState.Paused)
     {
         State = ProcessState.Succeeded;
         return;
     }
     throw new InvalidOperationException("Invalid process transition. Process must be either running or paused to fail.");
 }
Ejemplo n.º 6
0
        private void SetState(ProcessState NewState)
        {
            if (State != NewState)
            {
                State    = NewState;
                Signaled = true;

                Signal();
            }
        }
Ejemplo n.º 7
0
        private void SetState(ProcessState newState)
        {
            if (State != newState)
            {
                State     = newState;
                _signaled = true;

                Signal();
            }
        }
Ejemplo n.º 8
0
        protected override bool ProcessInteractionObject(Interactable interactable, ProcessState processState)
        {
            if (interactable.GetComponent <InteractableUi>() != null && uiLaser != null)
            {
                                #if UNITY_EDITOR
                if (debugInteractor)
                {
                    Debug.Log(name + ": Check selected UI operation: " + 0 + " for state: " + processState);
                }
                                #endif

                InteractionEventData eventData = new InteractionEventData()
                {
                    controller = this
                };

                bool operationStateChanged = false;
                if (DriverOperationStarted(0))
                {
                    eventData.operationId = 0;

                    downedInteractable = interactable;

                    uiLaser.PassButtonDown(interactable);

                    operationStateChanged = true;
                }

                if (DriverOperationEnded(0))
                {
                    eventData.operationId = 0;

                    downedInteractable = null;

                    uiLaser.PassButtonUp(interactable, clickTolerance);

                    interactable.RemovePressedState(this);

                    SurfaceTopHoveredObject();

                    operationStateChanged = true;
                }

                if (!operationStateChanged)
                {
                    // Held
                    eventData.operationId = 0;
                }
            }
            else
            {
                return(base.ProcessInteractionObject(interactable, processState));
            }
            return(true);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Assumes that nextElementId is a valid task/state
        /// </summary>
        private List <InstanceEvent> MoveProcessToNext(
            Instance instance,
            string nextElementId,
            ClaimsPrincipal user)
        {
            List <InstanceEvent> events = new List <InstanceEvent>();

            ProcessState previousState     = JsonConvert.DeserializeObject <ProcessState>(JsonConvert.SerializeObject(instance.Process));
            ProcessState currentState      = instance.Process;
            string       previousElementId = currentState.CurrentTask?.ElementId;

            ElementInfo nextElementInfo = ProcessHelper.Process.GetElementInfo(nextElementId);

            DateTime now = DateTime.UtcNow;

            // ending previous element if task
            if (ProcessHelper.IsTask(previousElementId))
            {
                instance.Process = previousState;
                events.Add(GenerateProcessChangeEvent(InstanceEventType.process_EndTask.ToString(), instance, now, user));
                instance.Process = currentState;
            }

            // ending process if next element is end event
            if (ProcessHelper.IsEndEvent(nextElementId))
            {
                currentState.CurrentTask = null;
                currentState.Ended       = now;
                currentState.EndEvent    = nextElementId;

                events.Add(GenerateProcessChangeEvent(InstanceEventType.process_EndEvent.ToString(), instance, now, user));

                // add submit event (to support Altinn2 SBL)
                events.Add(GenerateProcessChangeEvent(InstanceEventType.Submited.ToString(), instance, now, user));
            }
            else if (ProcessHelper.IsTask(nextElementId)) // starting next task
            {
                currentState.CurrentTask = new ProcessElementInfo
                {
                    Flow           = currentState.CurrentTask.Flow + 1,
                    ElementId      = nextElementId,
                    Name           = nextElementInfo.Name,
                    Started        = now,
                    AltinnTaskType = nextElementInfo.AltinnTaskType,
                    Validated      = null,
                };

                events.Add(GenerateProcessChangeEvent(InstanceEventType.process_StartTask.ToString(), instance, now, user));
            }

            // current state points to the instance's process object. The following statement is unnecessary, but clarifies logic.
            instance.Process = currentState;

            return(events);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Set process state to cancelled and stop the vertex host process if possible
        /// </summary>
        public void Cancel(bool suppressNotifications)
        {
            DryadLogger.LogMethodEntry(this.DryadId);

            lock (syncRoot)
            {
                if (state == ProcessState.Completed)
                {
                    // Process has already completed before cancelation made it here, do nothing
                    DryadLogger.LogInformation("Cancel process", "Process {0} has already exited", DryadId);
                    DryadLogger.LogMethodExit();
                    return;
                }
                DryadLogger.LogInformation("Cancel process", "Process {0} has not already exited", DryadId);
                state          = ProcessState.Completed;
                this.cancelled = true;
            }

            // If the process started, kill it
            if (systemProcess != null)
            {
                try
                {
                    // Killing the process will trigger Process_Exited
                    DryadLogger.LogInformation("Cancel process", "Killing system process for process id {0}", DryadId);

                    if (suppressNotifications)
                    {
                        // Remove the Exited event handler
                        systemProcess.Exited -= this.Process_Exited;
                    }
                    systemProcess.Kill();
                    DryadLogger.LogMethodExit();
                    return;
                }
                catch (Exception e)
                {
                    //
                    // Failed to kill process - log exception
                    //
                    DryadLogger.LogError(0, e, "Failed to kill system process for process id {0}", DryadId);
                }
            }
            else
            {
                DryadLogger.LogInformation("Cancel process", "Process {0} has not started yet", DryadId);
            }

            // Process was either not running or failed to die, trigger Process_Exited ourself
            if (!suppressNotifications)
            {
                Process_Exited(this, null);
            }
            DryadLogger.LogMethodExit();
        }
Ejemplo n.º 11
0
 static void GetProcessor([Domain("currentBar")] Bar b)
 {
     if (Resources.cpus > 0)
     {
         state = ProcessState.RUN;
     }
     else
     {
         TimeUpdate.tickEnabled = true;
     }
 }
Ejemplo n.º 12
0
        public static void PreProcessSQLTree(ref Node parentNode)
        {
            ProcessState state     = new ProcessState();
            var          childList = new List <Node>(parentNode.Children);

            PreProcessChildren(ref childList, state);
            //if (state.ScriptOutsideOfProcedure && !state.IsTransactionIsolationSet)
            //{
            //  parentNode.InsertChildAtIndex(CreateIsolationNode(), 0);
            //}
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Processes a single statement from the decompiler and returns an AST entry for it
        /// </summary>
        /// <param name="network">The top-level network.</param>
        /// <param name="proc">The process where the method is located.</param>
        /// <param name="method">The method where the statement is found.</param>
        /// <param name="statement">The decompiler statement to process.</param>
        protected virtual Statement Decompile(NetworkState network, ProcessState proc, MethodState method, ICSharpCode.Decompiler.CSharp.Syntax.ReturnStatement statement)
        {
            var s = new ReturnStatement()
            {
                Parent = method
            };

            s.ReturnExpression = Decompile(network, proc, method, s, statement.Expression);

            return(s);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Locates the target for an expression, and throws an exception if not found.
        /// </summary>
        /// <returns>The data element.</returns>
        /// <param name="network">The top-level network.</param>
        /// <param name="proc">The process where the method is located.</param>
        /// <param name="method">The method where the statement is found.</param>
        /// <param name="statement">The statement where the expression is found.</param>
        /// <param name="expression">The expression to examine.</param>
        protected virtual DataElement LocateDataElement(NetworkState network, ProcessState proc, MethodState method, Statement statement, ICSharpCode.Decompiler.CSharp.Syntax.Expression expression)
        {
            var res = TryLocateDataElement(network, proc, method, statement, expression);

            if (res == null)
            {
                throw new Exception($"Unable to locate item for {expression}");
            }

            return(res);
        }
Ejemplo n.º 15
0
        //操作类型
        public static ProcessState ToProcessState(object objOpt)
        {
            ProcessState processState = ProcessState.Run;

            try
            {
                processState = (ProcessState)System.Enum.Parse(typeof(ProcessState), Convert.ToString(objOpt), true);
            }
            catch { }
            return(processState);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Parses a a parameter reference and returns a new AST reference
 /// </summary>
 /// <returns>The constant element.</returns>
 /// <param name="network">The top-level network.</param>
 /// <param name="proc">The process where the method is located.</param>
 /// <param name="method">The method the parameter belongs to.</param>
 /// <param name="parameter">The parameter to parse.</param>
 protected virtual Parameter ParseParameter(NetworkState network, ProcessState proc, MethodState method, ParameterDefinition parameter)
 {
     return(new Parameter()
     {
         CecilType = parameter.ParameterType,
         Name = parameter.Name,
         DefaultValue = null,
         Source = parameter,
         Parent = method
     });
 }
Ejemplo n.º 17
0
 static void GetStack([Domain("currentBar")] Bar b)
 {
     if (Resources.stacks > 0)
     {
         state = ProcessState.READY;
     }
     else
     {
         TimeUpdate.tickEnabled = true;
     }
 }
Ejemplo n.º 18
0
 //if the state is running state
 public bool isRunningState(ProcessState state)
 {
     if (state == ProcessState.Cleanup || state == ProcessState.Running || state == ProcessState.Setup)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 19
0
 public void FireStateChange(int processId, ProcessState newState)
 {
     try
     {
         vertexScheduler.ProcessChangeState(processId, newState);
     }
     catch (Exception e)
     {
         DryadLogger.LogError(0, e, "Failed to change state to {0} for process {1}", newState.ToString(), processId);
     }
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Locates a bus by reference
        /// </summary>
        /// <returns>The bus.</returns>
        /// <param name="network">The top-level network.</param>
        /// <param name="proc">The process where the method is located.</param>
        /// <param name="method">The method the expression is found.</param>
        /// <param name="expression">The expression used to initialize the bus.</param>
        protected virtual Bus LocateBus(NetworkState network, ProcessState proc, MethodState method, ICSharpCode.Decompiler.CSharp.Syntax.Expression expression)
        {
            var de = TryLocateElement(network, proc, method, null, expression);

            if (de is AST.Bus)
            {
                return(de as AST.Bus);
            }

            throw new Exception("Need to walk the tree?");
        }
Ejemplo n.º 21
0
 public void FireStateChange(int processId, ProcessState newState)
 {
     try
     {
         vertexScheduler.ProcessChangeState(processId, newState);
     }
     catch (Exception e)
     {
         DryadLogger.LogError(0, e, "Failed to change state to {0} for process {1}", newState.ToString(), processId);
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Copy Constructor.
 /// </summary>
 /// <param name="p"></param>
 public Process(Process p)
 {
     this._state = p._state;
     this._executiontime = p._executiontime;
     this._name = p._name;
     this._hasRun = p._hasRun;
     this._waitingtime = p._waitingtime;
     this._turnaroundtime = p._turnaroundtime;
     this._responsetime = p._responsetime;
     this._activeTimeOnProc = p._activeTimeOnProc;
 }
Ejemplo n.º 23
0
        public XComputeProcess(int m_id)
        {
            this.m_id              = m_id;
            this.m_currentState    = ProcessState.Uninitialized;
            this.m_exitCode        = 0;
            m_stateChangeListeners = new Dictionary <ProcessState, StateChangeEventHandler>();
            m_stateChangeWaiters   = new Dictionary <ProcessState, List <ManualResetEvent> >();
            m_stateChangeTimers    = new Dictionary <StateChangeEventHandler, Timer>();

            m_propertyListeners = new Dictionary <string, Dictionary <ulong, GetSetPropertyEventHandler> >();
        }
Ejemplo n.º 24
0
        public void Update()
        {
            _state  = _process.Responding ? ProcessState.Active : ProcessState.NotResponding;
            _memory = _process.PagedMemorySize64 / 1024;

            _memoryPercent = Math.Round((double)_memory / TotalRam * 1000) / 10;

            _threadCount = _process.Threads.Count;

            if (_username == null)
            {
                _username = GetProcessUser(_process);
            }

            if (!_system)
            {
                try
                {
                    if (_filePath == null)
                    {
                        _filePath = _process.MainModule.FileName;
                    }
                }
                catch (Exception)
                {
                    _filePath = "N/A";
                }

                try
                {
                    _startDate = _process.StartTime;
                }
                catch (Exception)
                {
                    _system = false;
                }
            }

            try
            {
                float f1 = _processCounter.NextValue();
                _cpuUsage = f1 / Environment.ProcessorCount;
            }
            catch (Exception)
            {
                // ignored
            }

            OnPropertyChanged($"CPULoad");
            OnPropertyChanged($"State");
            OnPropertyChanged($"MemoryPercent");
            OnPropertyChanged($"Memory");
            OnPropertyChanged($"ThreadCount");
        }
Ejemplo n.º 25
0
        private void PushSubSearchAttributeToStack(ProcessState top, BlobFieldAttribute attrib, PropertyInfo prop, object target)
        {
            ProcessState state = new ProcessState(EProcessingState.SubFieldSearch, depth, target);

            state.Attributes.Add(attrib);
            state.Properties.Add(prop);

            state.WorkingType = top.WorkingType;

            processStack.Push(state);
        }
Ejemplo n.º 26
0
 public Process()
 {
     CurrentState = ProcessState.Inactive;
     transitions  = new Dictionary <StateTransition, ProcessState>
     {
         { new StateTransition(ProcessState.Inactive, Command.Active), ProcessState.Active },
         { new StateTransition(ProcessState.Active, Command.Terminated), ProcessState.Inactive },
         { new StateTransition(ProcessState.Active, Command.Raised), ProcessState.Raised },
         { new StateTransition(ProcessState.Raised, Command.Handled), ProcessState.Inactive }
     };
 }
Ejemplo n.º 27
0
        public async Task <IHttpActionResult> PostAppoval(MdPeriod instance)
        {
            var result = new TransferObj <MdPeriod>();
            var exist  = _service.Find(instance);

            if (exist != null)
            {
                if (instance.TrangThai == (int)ApprovalState.IsComplete)
                {
                    return(BadRequest("Kỳ này đã được duyệt!"));
                }
                var unitCode            = _service.GetCurrentUnitCode();
                var exsitPeriodNotClose = _service.Repository.DbSet.Any(x => x.Year == exist.Year && x.Period < exist.Period && x.TrangThai != (int)ApprovalState.IsComplete && x.UnitCode == unitCode);
                if (exsitPeriodNotClose)
                {
                    return(BadRequest("Chưa khóa kỳ trước"));
                }

                var          talbeName     = instance.GetTableName();
                var          preTalbeName  = _service.GetPreTableName(instance);
                ProcessState stateOfPeriod = _service.CheckProcess(instance);
                switch (stateOfPeriod)
                {
                case ProcessState.IsPending:
                    try
                    {
                        _close.ProcedureCloseInventory(preTalbeName, talbeName, instance.UnitCode, instance.Year, instance.Period);
                        exist.TrangThai   = (int)ApprovalState.IsComplete;
                        exist.ObjectState = ObjectState.Modified;
                        result.Status     = true;
                        result.Message    = "Khóa sổ thành công";
                        _service.UnitOfWork.Save();
                    }
                    catch (Exception e)
                    {
                        return(InternalServerError(e));
                    }
                    break;

                case ProcessState.IsComplete:
                    break;

                case ProcessState.IsRunning:
                    return(BadRequest("Đang trong quá trình khóa"));

                case ProcessState.IsError:
                    break;

                default:
                    break;
                }
            }
            return(Ok(result));
        }
Ejemplo n.º 28
0
        public async Task <ActionResult <ProcessState> > GetProcessState(
            [FromRoute] string org,
            [FromRoute] string app,
            [FromRoute] int instanceOwnerId,
            [FromRoute] Guid instanceGuid)
        {
            Instance instance = await instanceService.GetInstance(app, org, instanceOwnerId, instanceGuid);

            ProcessState processState = instance.Process;

            return(Ok(processState));
        }
 public DistributedProcessModel(string host, string process, string path, int portNum, bool local)
 {
     hostName = host;
     processName = process;
     processPath = path;
     port = portNum;
     arguments.Add(host);
     arguments.Add(port.ToString());
     procState = ProcessState.Stopped;
     routing = new RouteModel(host, port - 10000, local);
     routing.openServerSocket();
 }
        public void AddProcessStateTest()
        {
            DataChamber           data   = new DataChamber();
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog      catalog         = new Catalog("Andrzej", "Sapkowski", 2000, "The Witcher", 8);
            ProcessState processState    = new ProcessState(catalog, "Znak", 1990, "Good");

            test.AddProcessState(processState);

            Assert.AreEqual(test.ReadProcessState(5), processState);
        }
Ejemplo n.º 31
0
        public void GetProcessStateOfInstanceWithoutProcessReturnsNull()
        {
            Mock <HttpContext> contextMock = MockContext();

            ProcessController processController = NewProcessController(contextMock, null);

            ActionResult <ProcessState> result = processController.GetProcessState(org, app, int.Parse(instanceOwnerId), instanceGuid).Result;

            ProcessState state = result.Value;

            Assert.Null(state);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Notify URI of state change
        /// </summary>
        /// <param name="replyUri">where to send state change notification</param>
        /// <param name="processId">vertex process id</param>
        /// <param name="newState">updated state</param>
        /// <returns>success/failure of state change notification</returns>
        public static bool FireStateChange(string replyUri, int processId, ProcessState newState)
        {
            DryadLogger.LogMethodEntry(replyUri, processId, newState);

            bool result = false;
            VertexCallbackServiceClient client = GetClient(replyUri);

            //
            // Try to notify GM of state change up to numRetries times
            //
            for (int index = 0; index < numRetries; index++)
            {
                try
                {
                    //
                    // If client is null, try reopening it
                    //
                    if (client == null)
                    {
                        client = CreateClient(replyUri);
                    }

                    //
                    // Make FireStateChange WCF call, return success
                    //
                    client.FireStateChange(processId, newState);
                    result = true;
                    break;
                }
                catch (Exception e)
                {
                    if (shuttingDown)
                    {
                        // if shutting down, just return
                        DisposeClient(ref client);
                        return(true);
                    }
                    else
                    {
                        //
                        // If call failed, try reopening WCF client and calling again
                        //
                        client = ReopenClientForRetry(replyUri, e);
                    }
                }
            }

            //
            // If failure occurs after X retry attempts, report error
            //
            DryadLogger.LogMethodExit(result);
            return(result);
        }
Ejemplo n.º 33
0
    //returns first CafeNPC from activeNPC queue that fits state description. Returns null if there are no CafeNPC objects in that state.
    public CafeNPC firstCustomer(ProcessState state)
    {
        foreach (CafeNPC npc in GameManager.instance.activeNPC)
        {
            if (npc.state == state)
            {
                return(npc);
            }
        }

        return(null);
    }
        public Process()
        {
            CurrentState = ProcessState.WithoutMesh;
            transitions  = new Dictionary <StateTransition, ProcessState>
            {
                { new StateTransition(ProcessState.WithoutMesh, Command.FindServer), ProcessState.Searching },
                { new StateTransition(ProcessState.HasMesh, Command.FindServer), ProcessState.Searching },

                { new StateTransition(ProcessState.Searching, Command.Download), ProcessState.Downloading },
                { new StateTransition(ProcessState.Downloading, Command.DownloadFinished), ProcessState.HasMesh },
            };
        }
        private ChangelogIdentificationType OrderChangelogAsyncCaller(ChangelogOrderType order)
        {
            int id = -1;

            int.TryParse(order.datasetId, out id);
            IChangelogProvider changelogprovider;
            OrderChangelog     resp;
            int    startindex = -1;
            int    count      = -1;
            string initType;
            var    datasets = from d in db.Datasets where d.DatasetId == id select d;

            initType = datasets.First().DatasetProvider;
            //Initiate provider from config/dataset
            Type providerType = Assembly.GetExecutingAssembly().GetType(initType);

            changelogprovider = Activator.CreateInstance(providerType) as IChangelogProvider;
            changelogprovider.Intitalize(id);


            int.TryParse(order.startIndex, out startindex);
            int.TryParse(order.count, out count);

            if (startindex == -1)
            {
                throw new Exception("MissingParameterValue : startindex");
            }
            if (count == -1)
            {
                throw new Exception("MissingParameterValue : count");
            }

            if (datasets.First().ServerMaxCount.HasValue&& (datasets.First().ServerMaxCount < count || count == 0))
            {
                count = (int)datasets.First().ServerMaxCount;
            }

            resp = changelogprovider.CreateChangelog(startindex, count, "", id);

            // Create the delegate.
            OrderChangelogAsync caller = OrderChangeLogAsync;
            ProcessState        state  = new ProcessState(resp.changelogId);

            state.Request = caller;

            caller.BeginInvoke(changelogprovider, startindex, count, "", id,
                               CallbackProcessStatus, state);

            ChangelogIdentificationType res = new ChangelogIdentificationType();

            res.changelogId = resp.changelogId;
            return(res);
        }
Ejemplo n.º 36
0
 protected override void SetProcessState(ProcessState State)
 {
     switch (State)
     {
     case ProcessState.Error:
     case ProcessState.Running:
     case ProcessState.Stopped:
         ProcessStatusText = string.Format("Đã ngừng đọc", TotalError);
         break;
     }
     base.SetProcessState(State);
 }
Ejemplo n.º 37
0
        public DownloadDialogModel(Encoder encoder, Video video)
        {
            this.encoder = encoder;
            this.encoder.OnEncodeProgress += EncoderOnEncodeProgress;
            this.encoder.OnEncodeFinished += EncoderOnEncodeFinished;

            this.video = video;

            title = TitleDownloading;
            active = true;
            state = ProcessState.Downloading;
        }
Ejemplo n.º 38
0
        protected ProcessState GetState(ProcessInfo process)
        {
            ProcessState result;

            if (!States.TryGetValue(process.Process.Id, out result))
            {
                result = new ProcessState(process);
                States[process.Process.Id] = result;
            }

            return(result);
        }
Ejemplo n.º 39
0
        public ProcessState MoveNext()
        {
            Command command = CurrentState switch
            {
                ProcessState.Active => Command.Raised,
                ProcessState.Raised => Command.Handled,
                _ => Command.Active,
            };

            CurrentState = GetNext(command);
            return(CurrentState);
        }
Ejemplo n.º 40
0
 public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
 {
     ExpressionArrayArgument intExpArg = (ExpressionArrayArgument)func.Argument;
     Int64 integer = -1;
     foreach (IOperandTerm int64Term in intExpArg.TermList)
     {
         integer = int64Term.GetIntValue(exm);
         if(isDel)
             exm.VEvaluator.DelCharacter(integer);
         else
             exm.VEvaluator.AddCharacter(integer, isSp);
     }
 }
Ejemplo n.º 41
0
 public void Debug(int processID)
 {
     debugger = new CorDebugger(CorDebugger.GetDefaultDebuggerVersion());
     process = debugger.DebugActiveProcess(processID, false);
     process.OnException += OnException;
     process.OnCreateAppDomain += OnNewAppDomain;
     process.OnProcessExit += OnExit;
     process.OnModuleLoad += OnModuleLoad;
     process.OnBreakpoint += OnBreakpoint;
     process.OnStepComplete += OnStepComplete;
     process.Continue(false);
     state = ProcessState.Started;
     subscriber.Published(string.Format("Successfully attached to Process with ID [{0}]", processID));
 }
Ejemplo n.º 42
0
        public void StartProcess()
        {
            State = ProcessState.Running;

            _programData.Lot.LotProgress = 0;
            for (int w = 0; w < 5; w++)
            {
                _programData.Lot.WaferProgress = 0;
                _programData.Lot.WaferId = (w + 1).ToString();
                for (int d = 0; d < 100; d++)
                {
                    Thread.Sleep(20);
                    _programData.Lot.WaferProgress = d;
                }
                _programData.Lot.WaferProgress = 100;
                _programData.Lot.WaferId = "";
                Thread.Sleep(100);
                _programData.Lot.LotProgress = 20 * (w + 1);
            }
            _programData.Lot.LotProgress = 100;

            State = ProcessState.Idle;
        }
Ejemplo n.º 43
0
 public bool CheckValidity()
 {
     try
     {
         GBDebug.WriteLine(assembly);
         GBDebug.Assert(prState == ProcessState.PendingValidation, "Process state error. It is " + prState + ". It must be " + ProcessState.PendingValidation);
         userProcess = (GBProcess)assembly.CreateInstance(ProcessMainClass);
         if (userProcess == null)
         {
             prState = ProcessState.InitError;
             GBInfo.WriteLine(ProcessMainClass + " not found.");
             return false;
         }
         prState = ProcessState.StartPending;
         return true;
     }
     catch (Exception)
     {
         prState = ProcessState.InitError;
         return false;
     }
 }
Ejemplo n.º 44
0
        internal void Start()
        {
            GBDebug.Assert(prState == ProcessState.StartPending, "Process state error. It is " + prState + ". It must be " + ProcessState.StartPending);
            GBInfo.WriteLine("Starting process " + assembly.GetName());

            // FIXME: Doing nothing
            userProcess.Start();

            if (currentScene != null)
                currentScene.LoadNotLoadedResources();

            prState = ProcessState.Running;
        }
Ejemplo n.º 45
0
 public void LoadModuleFromFile(string fileName)
 {
     GBDebug.Assert(prState == ProcessState.NotLoaded, "Process state error. It is " + prState + ". It must be " + ProcessState.NotLoaded);
     name = fileName;
     completeFileName = GBFileSystem.CompleteFileNameForFile(baseDir, fileName + "." + ModuleExtension);
     if (GBFileSystem.FileExists(completeFileName))
     {
         assembly = Assembly.LoadFrom(completeFileName);
         GBDebug.Assert(assembly != null, "Assembly " + fileName + " cannot be loaded");
         prState = ProcessState.PendingValidation;
     }
     else
     {
         prState = ProcessState.InitError;
         throw new GBException(GBException.Reason.FileNotFound);
     }
 }
Ejemplo n.º 46
0
 public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
 {
     string label = null;
     LogicalLine jumpto = null;
     if (func.Argument.IsConst)
     {
         label = func.Argument.ConstStr;
         jumpto = func.JumpTo;
     }
     else
     {
         label = ((SpCallArgment)func.Argument).FuncnameTerm.GetStrValue(exm);
         if (Config.ICVariable)
             label = label.ToUpper();
         jumpto = state.CurrentCalled.CallLabel(GlobalStatic.Process, label);
     }
     if (jumpto == null)
     {
         if (!func.Function.IsTry())
             throw new CodeEE("指定されたラベル名\"$" + label + "\"は現在の関数内に存在しません");
         if (func.JumpToEndCatch != null)
             state.JumpTo(func.JumpToEndCatch);
         return;
     }
     else if (jumpto.IsError)
         throw new CodeEE("指定されたラベル名\"$" + label + "\"は無効な$ラベル行です");
     state.JumpTo(jumpto);
 }
Ejemplo n.º 47
0
        CommandResult CloneParentOperation(SingleSteppingEngine new_thread)
        {
            if (parent.current_state == ProcessState.SingleThreaded) {
                current_state = ProcessState.SingleThreaded;
                return new ThreadCommandResult (new_thread.Thread);
            }

            if (parent.current_state != ProcessState.Running)
                throw new InternalError ();

            current_state = ProcessState.Running;
            if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Global)
                current_operation = parent.current_operation;
            else if ((parent.current_operation.ThreadingModel & ThreadingModel.ThreadingMode) == ThreadingModel.Process)
                current_operation = new ProcessCommandResult (this, parent.current_operation.ThreadingModel);
            else
                throw new InternalError ();

            return current_operation;
        }
Ejemplo n.º 48
0
 public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
 {
     exm.VEvaluator.InitRanddata();
 }
Ejemplo n.º 49
0
        internal void OperationCompleted(SingleSteppingEngine caller, TargetEventArgs result, ThreadingModel model)
        {
            if (!ThreadManager.InBackgroundThread && Inferior.HasThreadEvents)
                throw new InternalError ();

            if (current_state == ProcessState.Stopping)
                return;
            else if (current_state != ProcessState.Running)
                throw new InternalError ();

            if ((result != null) && (caller != main_thread) &&
                ((result.Type == TargetEventType.TargetExited) || (result.Type == TargetEventType.TargetSignaled)))
                return;

            current_state = ProcessState.Stopping;
            SuspendUserThreads (model, caller);

            lock (this) {
                current_state = ProcessState.Stopped;
                current_operation.Completed ();
                current_operation = null;
                stopped_event.Set ();
            }
        }
 public ProcessStateInfo(int msg, Stream data) : base(msg, data)
 {
     Id = readStream.ReadInt32();
     Alias = readStream.ReadString();
     State = (ProcessState)readStream.ReadByte();
 }
Ejemplo n.º 51
0
 public virtual void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
 {
     throw new ExeEE("未実装 or 呼び出しミス");
 }
Ejemplo n.º 52
0
        internal CommandResult StartOperation(ThreadingModel model, SingleSteppingEngine caller)
        {
            if (!ThreadManager.InBackgroundThread)
                throw new InternalError ();

            if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
                throw new TargetException (TargetError.NotStopped);

            if ((model & ThreadingModel.ThreadingMode) == ThreadingModel.Single) {
                current_state = ProcessState.SingleThreaded;
                if ((model & ThreadingModel.ResumeThreads) != 0)
                    ResumeUserThreads (model, caller);
                return new ThreadCommandResult (caller.Thread);
            } else if ((model & ThreadingModel.ThreadingMode) != ThreadingModel.Process) {
                throw new ArgumentException ();
            }

            lock (this) {
                current_state = ProcessState.Running;
                stopped_event.Reset ();
                current_operation = new ProcessCommandResult (this, model);
            }

            ResumeUserThreads (model, caller);
            return current_operation;
        }
Ejemplo n.º 53
0
        internal void OnProcessExitedEvent()
        {
            DropGlobalThreadLock ();

            if (current_state == ProcessState.Running) {
                current_state = ProcessState.Exited;
                current_operation.Completed ();
                current_operation = null;
                stopped_event.Set ();
            }

            if (!is_forked)
                session.OnProcessExited (this);
            session.MainThreadGroup.RemoveThread (main_thread.ID);
            manager.Debugger.OnProcessExitedEvent (this);
        }
Ejemplo n.º 54
0
            public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
            {
                LogicalLine ifJumpto = func.JumpTo;//ENDIF
                //チェック済み
                //if (func.IfCaseList == null)
                //	throw new ExeEE("IFのIF-ELSEIFリストが適正に作成されていない");
                //if (func.JumpTo == null)
                //	throw new ExeEE("IFに対応するENDIFが設定されていない");

                InstructionLine line = null;
                for (int i = 0; i < func.IfCaseList.Count; i++)
                {
                    line = func.IfCaseList[i];
                    if (line.IsError)
                        continue;
                    if (line.FunctionCode == FunctionCode.ELSE)
                    {
                        ifJumpto = line;
                        break;
                    }

                    //ExpressionArgument expArg = (ExpressionArgument)(line.Argument);
                    //チェック済み
                    //if (expArg == null)
                    //	throw new ExeEE("IFチェック中。引数が解析されていない。", func.IfCaseList[i].Position);

                    //1730 ELSEIFが出したエラーがIFのエラーとして検出されていた
                    state.CurrentLine = line;
                    Int64 value = ((ExpressionArgument)(line.Argument)).Term.GetIntValue(exm);
                    if (value != 0)//式が真
                    {
                        ifJumpto = line;
                        break;
                    }
                }
                if (ifJumpto != func)//自分自身がジャンプ先ならそのまま
                    state.JumpTo(ifJumpto);
                //state.RunningLine = null;
            }
Ejemplo n.º 55
0
        internal void StartGlobalOperation(ThreadingModel model, SingleSteppingEngine caller, OperationCommandResult operation)
        {
            if (!ThreadManager.InBackgroundThread)
                throw new InternalError ();

            if ((current_state != ProcessState.Stopped) && (current_state != ProcessState.SingleThreaded))
                throw new TargetException (TargetError.NotStopped);

            lock (this) {
                current_state = ProcessState.Running;
                stopped_event.Reset ();
                current_operation = operation;
            }

            ResumeUserThreads (model, caller);
        }
Ejemplo n.º 56
0
        private void DownloaderRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            title = TitleEncoding;
            state = ProcessState.Encoding;

            SetChanged();
        }
Ejemplo n.º 57
0
        internal void Stop()
        {
            main_thread.Invoke (delegate {
                current_state = ProcessState.Stopping;

                SuspendUserThreads (ThreadingModel.Process, null);
                current_state = ProcessState.Stopped;
                if (current_operation != null) {
                    current_operation.Completed ();
                    current_operation = null;
                }
                stopped_event.Set ();
                return null;
            }, null);
        }
Ejemplo n.º 58
0
 public void LoadMetadata(string fileName)
 {
     GBDebug.Assert(prState == ProcessState.NotLoaded, "Process state error. It is " + prState + ". It must be " + ProcessState.NotLoaded);
     completePropertiesFileName = GBFileSystem.CompleteFileNameForFile(baseDir, fileName + "." + MetaDataExtension);
     if (GBFileSystem.FileExists(completePropertiesFileName))
     {
         metadata = GBXMLContainer.LoadOrNull(completePropertiesFileName);
         GBDebug.WriteLine(metadata);
     }
     else
     {
         prState = ProcessState.InitError;
         throw new GBException(GBException.Reason.FileNotFound);
     }
 }
Ejemplo n.º 59
0
        /// <summary>
        /// Runs the process. Assesses the correct state based on process' current executiontimeunit type.
        /// </summary>
        public void Run()
        {
            //If the process has never run before, run.
            if (!this._hasRun) this._hasRun = true;

            //Decrement the execution time.
            this._executiontime--;
            //Increase turnaround time.
            this._turnaroundtime++;

            //If there's no time remaining after running, change state to complete.
            if (this._executiontime.Remaining == 0) this._state = ProcessState.COMPLETE;

            else
            {
                //Change process state to IO if necessary.
                if (this._executiontime.Current.Type == ExecutionTimeType.IO) this._state = ProcessState.IO;
                //Change process state to Ready if necessary.
                else if (this._executiontime.Current.Type == ExecutionTimeType.BURST) this._state = ProcessState.READY;

            }
        }
Ejemplo n.º 60
0
 public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state)
 {
     exm.Console.SetStringStyle(FontStyle.Regular);
 }