Пример #1
0
        void debugController_ErrorOccurred(FlowSourceManager arg1, FlowExecutionException arg2)
        {
            var bytes = GetBytes(new string[] { MethodName, FileName, ErrorText, ErrorId }, writer =>
            {
                switch (writer.Filename)
                {
                case MethodName:
                    WriteString(writer, ErrorOccurredEvent);
                    break;

                case FileName:
                    WriteString(writer, GetFileName(arg1));
                    break;

                case ErrorText:
                    WriteString(writer, arg2.ToString());
                    break;

                case ErrorId:
                    WriteInt(writer, arg2.SourceObject != null ? arg2.SourceObject.Id : -1);
                    break;
                }
            });

            Send(bytes);
        }
Пример #2
0
        void Controller_OperationAccepted(FlowSourceManager obj)
        {
            var executeInfo = currentExecutor.GetExecuteInfo(obj);

            if (executeInfo != null)
            {
                executeInfo.FlowDrawTab.FlowDrawPanel.SelectionChanged -= FlowDrawPanel_SelectionChanged;
            }
            this.Invoke((Action)(() =>
            {
                toolStripButton2.Enabled = toolStripButton4.Enabled = false;
            }));
        }
Пример #3
0
        void debugController_OperationAccepted(FlowSourceManager obj)
        {
            var bytes = GetBytes(new string[] { MethodName, FileName }, writer =>
            {
                switch (writer.Filename)
                {
                case MethodName:
                    WriteString(writer, OperationAcceptedEvent);
                    break;

                case FileName:
                    WriteString(writer, GetFileName(obj));
                    break;
                }
            });

            Send(bytes);
        }
Пример #4
0
 void Controller_SourceChanged(string arg1, FlowSourceManager arg2)
 {
     this.Invoke((Action)(() =>
     {
         var executeInfo = currentExecutor.GetExecuteInfo(arg2);
         if (executeInfo != null)
         {
             var tab = Tabs.FirstOrDefault(t => t == executeInfo.FlowDrawTab);
             tabControl1.SelectedTab = tab;
             var lastSourceId = flowExecutingPropertyPanel1.SourceId;
             flowExecutingPropertyPanel1.ChangeSource(executeInfo.FlowDrawTab.FilePath, arg1);
             if (lastSourceId != flowExecutingPropertyPanel1.SourceId)
             {
                 tab.FlowDrawPanel.SelectAndFocus(flowExecutingPropertyPanel1.SourceId);
             }
         }
     }));
 }
Пример #5
0
 private static void Execute(object val)
 {
     string[] args = (string[])val;
     try
     {
         Engine engine = new Engine();
         using (FileStream stream = File.Open(args[0], FileMode.Open))
         {
             FlowSourceManager manager = engine.Load(stream, false);
             manager.Initialize();
             engine.Start();
         }
         Environment.ExitCode = 0;
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine(ex);
         Environment.ExitCode = -1;
     }
 }
Пример #6
0
        void Controller_ErrorOccurred(FlowSourceManager arg1, FlowExecutionException arg2)
        {
            var executeInfo = currentExecutor.GetExecuteInfo(arg1);

            this.Invoke((Action)(() =>
            {
                if (executeInfo != null)
                {
                    var errorText = arg2.ToString();
                    if (arg2.SourceObject != null)
                    {
                        executeInfo.FlowDrawTab.FlowDrawPanel.ShowError(arg2.SourceObject.Id, errorText);
                    }
                    else
                    {
                        MessageBox.Show(errorText);
                    }
                }
            }));
        }
Пример #7
0
        void debugController_SourceChanged(string arg1, FlowSourceManager arg2)
        {
            var bytes = GetBytes(new string[] { MethodName, SerializedText, FileName }, writer =>
            {
                switch (writer.Filename)
                {
                case MethodName:
                    WriteString(writer, SourceChangedEvent);
                    break;

                case SerializedText:
                    WriteString(writer, arg1);
                    break;

                case FileName:
                    WriteString(writer, GetFileName(arg2));
                    break;
                }
            });

            Send(bytes);
        }
Пример #8
0
 public void AddFlowSourceManager(string fileName, FlowSourceManager flowSourceManager)
 {
     dict.Add(fileName, flowSourceManager);
 }
Пример #9
0
        void debugController_OperationWaited(FlowSourceManager obj)
        {
            var bytes = GetBytes(new string[] { MethodName, FileName }, writer =>
            {
                switch (writer.Filename)
                {
                case MethodName:
                    WriteString(writer, OperationWaitedEvent);
                    break;

                case FileName:
                    WriteString(writer, GetFileName(obj));
                    break;
                }
            });

            Send(bytes);
            AsyncRead(b =>
            {
                using (MemoryStream stream = new MemoryStream(b))
                    using (PackReader reader = new PackReader(stream))
                    {
                        var methodName = ParseString(reader, MethodName);
                        switch (methodName)
                        {
                        case ContinueMethod:
                            debugController.Continue();
                            return(true);

                        case StepInMethod:
                            debugController.StepIn();
                            return(true);

                        case AddBreakPointMethod:
                            var fileName = ParseString(reader, FileName);
                            FlowSourceManager manager;
                            if (dict.TryGetValue(fileName, out manager))
                            {
                                var id = ParseInt(reader, SourceId);
                                manager.AddBreakPoint(id);
                            }
                            break;

                        case RemoveBreakPointMethod:
                            fileName = ParseString(reader, FileName);
                            if (dict.TryGetValue(fileName, out manager))
                            {
                                var id = ParseInt(reader, SourceId);
                                manager.RemoveBreakPoint(id);
                            }
                            break;

                        case ChangeSourceMethod:
                            fileName = ParseString(reader, FileName);
                            if (dict.TryGetValue(fileName, out manager))
                            {
                                var id = ParseInt(reader, SourceId);
                                debugController.ChangeSource(id);
                            }
                            break;
                        }
                    }
                return(false);
            });
        }
Пример #10
0
 private string GetFileName(FlowSourceManager flowSourceManager)
 {
     return(dict.FirstOrDefault(kvp => kvp.Value == flowSourceManager).Key);
 }
Пример #11
0
 public ExecuteInfo GetExecuteInfo(FlowSourceManager manager)
 {
     dict.TryGetValue(manager, out ExecuteInfo ret);
     return(ret);
 }