Exemplo n.º 1
0
        private void delete(RequestHandlerArgument arg)
        {
            var executor = new Executer(arg.MessageBody);
            var result   = executor.Execute();

            arg.Response(result);
        }
Exemplo n.º 2
0
        public ReferenceResultOutput RunExecution(GULossAdaptor guLossAdaptor)
        {
            GraphExecuter Executer;

            switch (graphInfo.Style)
            {
            case AutoGraphStyle.Matrix:
                Executer = new GraphOfMatrixExecuter(graph as GraphOfMatrix);
                break;

            case AutoGraphStyle.Node:
                if (graph is PrimaryGraph)
                {
                    Executer = new PrimaryGraphOfNodesExecuter(graph as PrimaryGraph);
                }
                else if (graph is TreatyGraph)
                {
                    Executer = new TreatyGraphOfNodesExecuter(graph as TreatyGraph);
                }
                else
                {
                    throw new NotSupportedException("Can only handle Node graphs of type Treaty and Primary type");
                }
                break;

            default:
                throw new NotSupportedException("Can only handle graph of style Matrix or Node");
            }

            return(Executer.Execute(guLossAdaptor));
        }
Exemplo n.º 3
0
        protected override async void LoadItemsAsync()
        {
            if (!_favoritesStorage.Any())
            {
                Items = null;
                return;
            }

            IsBusy = true;

            IEnumerable <Trigger> triggers;

            try
            {
                triggers = await Executer.Execute(() => TriggerProxyServer.GetTriggers(null, null,
                                                                                       null, Select.Extend, _favoritesStorage.Favorites().Select(f => f.Id).ToList()));
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
                return;
            }
            finally
            {
                IsBusy = false;
            }

            Items = triggers.OrderBy(trigger => trigger.IsOk)
                    .ThenByDescending(trigger => trigger.Priority)
                    .ThenBy(trigger => trigger.Description)
                    .ToList();
        }
Exemplo n.º 4
0
        private async void LoginAsync(UserCredentials userCredentials)
        {
            IsBusy = !ValidatingSession;

            try
            {
                await Executer.Execute(() => _userManagmentFacade.LoginAsync(userCredentials));
            }
            catch (Exception ex)
            {
                ValidatingSession = false;
                IsBusy            = false;

                Username = userCredentials.Username;
                Password = userCredentials.Password;

                _errorHandler.Handle(ex);
                return;
            }

            UpdateApplicationSettings(userCredentials);
            _eventAggregator.Unsubscribe(this);

            _analyticsService.Login(RememberMe);

            _navigationService.UriFor <MainPageViewModel>()
            .WithParam(vm => vm.TriggerIdFromToast, TriggerIdFromToast)
            .Navigate();

            IsBusy = false;
        }
Exemplo n.º 5
0
        public void executerTest3()
        {
            Executer executer = new Executer("sub main\nset b 2\nprint b\nset a 3\nprint a");
            string   output   = executer.Execute(new System.Threading.CancellationToken());

            Assert.AreEqual("b=2\na=3\n", output);
        }
Exemplo n.º 6
0
        public void executerTest5()
        {
            Executer executer = new Executer("sub main\ncall main");
            string   output   = executer.Execute(new System.Threading.CancellationToken());

            Assert.AreEqual("StackOverflowExeption\n", output);
        }
Exemplo n.º 7
0
        protected override async void LoadItemsAsync()
        {
            IsBusy = true;

            IEnumerable <Trigger> triggers;

            try
            {
                triggers = await Executer.Execute(() => TriggerProxyServer.GetTriggers(null, null,
                                                                                       null, Select.Extend));
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
                return;
            }
            finally
            {
                IsBusy = false;
            }

            Items = triggers.OrderBy(trigger => trigger.IsOk)
                    .ThenByDescending(trigger => trigger.Priority)
                    .ThenBy(trigger => trigger.Description)
                    .Take(DEFAULT_ITEMS_COUNT)
                    .ToList();
        }
        protected override async void LoadItemsAsync()
        {
            IsBusy = true;

            //uint? hostId = HostId > 0 ? HostId : (uint?)null;
            IEnumerable <Trigger> triggers;

            try
            {
                triggers = await Executer.Execute(() => TriggerProxyServer.GetTriggers(HostId, null,
                                                                                       null, Select.None));
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
                return;
            }
            finally
            {
                IsBusy = false;
            }

            Items = triggers.OrderBy(trigger => trigger.IsOk)
                    .ThenByDescending(trigger => trigger.Priority)
                    .ThenBy(trigger => trigger.Description)
                    .ToList();
        }
Exemplo n.º 9
0
        public static void Main(string[] args)
        {
            string file = null;

            if (args.Length > 0 && File.Exists(args[0]))
            {
                file = args[0];
            }
            if (file == null)
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Title       = "Open";
                dialog.FileName    = "";
                dialog.Multiselect = false;
                dialog.Filter      = "Tbasic 2.0 Script (*.tba)|*.tba|All Files (*.*)|*.*";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    file = dialog.FileName;
                }
                else
                {
                    return;
                }
            }

            try {
                Executer exec = new Executer();
                exec.Global.LoadStandardLibrary();
                exec.Execute(File.ReadAllLines(file));
            }
            catch (ScriptParsingException ex) {
                MessageBox.Show(ex.Message, "Tbasic Script Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 10
0
        public void executerTest4()
        {
            Executer executer
                = new Executer("sub main\nset a 2\nprint a\ncall foo\nsub foo\nset a 3\ncall boo\nsub boo\nprint a");
            string output = executer.Execute(new System.Threading.CancellationToken());

            Assert.AreEqual("a=2\na=3\n", output);
        }
Exemplo n.º 11
0
        public void STOPTest()
        {
            string expected = "00 00 00 00 00 00 00 00 00 00 00 00 00 00";

            string result = Executer.Execute("stop;");

            AreEqual(expected, result);
        }
Exemplo n.º 12
0
        public void CBRTest()
        {
            string expected = "00 00 00 00 00 00 00 00 FC 22 00 00 00 00";

            string result = Executer.Execute("if R1 goto R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 13
0
        public void STTest()
        {
            string expected = "00 00 00 00 00 00 00 00 CC 22 00 00 00 00";

            string result = Executer.Execute("*R1 := R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 14
0
        public void LDCTest()
        {
            string expected = "00 00 00 00 00 00 00 00 C8 A1 00 00 00 00";

            string result = Executer.Execute("R1 := 5;");

            AreEqual(expected, result);
        }
Exemplo n.º 15
0
        public void LDTest()
        {
            string expected = "00 00 00 00 00 00 00 00 C4 22 00 00 00 00";

            string result = Executer.Execute("R1 := *R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 16
0
        public void ASRest()
        {
            string expected = "00 00 00 00 00 00 00 00 DC 22 00 00 00 00";

            string result = Executer.Execute("R1 >>= R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 17
0
        public void LDATest()
        {
            string expected = "00 00 00 00 00 00 00 00 08 41 00 00 00 05 00 00 00 00";

            string result = Executer.Execute("R1 := R2 + 5;");

            AreEqual(expected, result);
        }
Exemplo n.º 18
0
        public void ASLTest()
        {
            string expected = "00 00 00 00 00 00 00 00 E0 22 00 00 00 00";

            string result = Executer.Execute("R1 <<= R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 19
0
        public void CNDTest()
        {
            string expected = "00 00 00 00 00 00 00 00 F8 22 00 00 00 00";

            string result = Executer.Execute("R1 ?= R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 20
0
        public void ORTest()
        {
            string expected = "00 00 00 00 00 00 00 00 E4 22 00 00 00 00";

            string result = Executer.Execute("R1 |= R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 21
0
        public void AddTest()
        {
            string expected = "00 00 00 00 00 00 00 00 D4 22 00 00 00 00";

            string result = Executer.Execute("R1 += R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 22
0
        public void MOVTest()
        {
            string expected = "00 00 00 00 00 00 00 00 D0 22 00 00 00 00";

            string result = Executer.Execute("R1 := R2;");

            AreEqual(expected, result);
        }
Exemplo n.º 23
0
        public void Run(int startFrom = 0)
        {
            try
            {
                if (Running)
                {
                    Interrupt();
                }

                Running = true;

                Interval = 0;

                Executer executer = new Executer();

                generic.Oriole.ExecutingScene = this;

                for (int i = startFrom; i < EXData.Length; EXLine = i, i++)
                {
                    if (!Running)
                    {
                        break;
                    }
                    else
                    {
                        UI.SelectLine(i);

                        if (EXData[i].Length < 1)
                        {
                            continue;
                        }

                        if (EXData[i][0] != NOSLEEP_SIGNATURE)
                        {
                            System.Threading.Thread.Sleep(Interval);
                        }

                        if (EXData[i].ToLower() == END_SIGNATURE)
                        {
                            Interrupt();
                        }
                        else
                        {
                            executer.Execute(EXData[i]);
                        }
                    }
                }

                generic.Oriole.ExecutingScene = null;
            }
            catch (Exception e)
            {
                Interrupt();

                MessageBox.Show(e.Message + " Line: " + (EXLine + 1),
                                "Interpretation error! Interrupted.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 24
0
        public void Update(IServices services)
        {
            EnsureInitialized();

            while (true)
            {
                if (_currentState != null)
                {
                    if (!_currentState.IsCompleted)
                    {
                        return;
                    }

                    _currentState = null;
                }

                if (_currentExecutor != null)
                {
                    while (_currentExecutor.Next(out var current))
                    {
                        if (current == null)
                        {
                            throw new InvalidOperationException();
                        }

                        if (current == BreakAwaitable.Instance)
                        {
                            break;
                        }

                        if (current == SpinAwaitable.Instance)
                        {
                            return;
                        }

                        _currentState = current.GetAwaiter();
                        if (!_currentState.IsCompleted)
                        {
                            return;
                        }
                    }

                    _currentState = null;

                    _currentExecutor.Complete();
                    _currentExecutor = null;
                }

                if (_executionQueue.Count <= 0)
                {
                    break;
                }

                _currentExecutor = _executionQueue.Dequeue();
                _currentExecutor.Execute(services);
            }
        }
Exemplo n.º 25
0
    public override void Execute()
    {
        Retain();                   // This method shows that execution will take some time, important for commandBinder.Bind<>().InSequence()...

        Debug.Log("F**k Yeee!");

        coinsBalanceChangedSignal.AddListener(OnBalanceChange);

        Executer.Execute(WaitAndGo());
    }
Exemplo n.º 26
0
 void Start()
 {
     compileButton.onClick.AddListener(() => {
         try
         {
             consoleArea = executer.Execute(textArea);
         }
         catch (Exception e)
         {
             consoleArea = "Exception caught.\nExecution failed\n\n" + e.Message + "\n\n" + e.StackTrace;
         }
     });
 }
Exemplo n.º 27
0
 public string Execute(string query)
 {
     try
     {
         var executor = new Executer(query);
         var result   = executor.Execute().ToString(Newtonsoft.Json.Formatting.Indented);
         return(ResponseString(RoseResult.Ok, "Ok", result));
     }
     catch (Exception e)
     {
         return(ResponseString(RoseResult.UnknownError, e.Message, null));
     }
 }
Exemplo n.º 28
0
 /// <summary>
 /// اجرای قوانین برای پرسنل مشخص شده
 /// </summary>
 public void GTS_ExecuteByPersonID(string CallerIdentity, decimal PersonId)
 {
     try
     {
         Executer engine = new Executer();
         engine.Execute(CallerIdentity, PersonId, DateTime.Now.Date);
     }
     catch (BaseException ex)
     {
         logger.Logger.Error(String.Format("Error On TotalWebservice PersonID:{0},Message:{1}", PersonId, ex.GetLogMessage()));
         logger.Flush();
         throw new GTSWebserviceException(ex.GetLogMessage(), String.Format("TotalWebService.GTS_ExecuteByPersonID({0})", PersonId));
     }
 }
Exemplo n.º 29
0
        public override void Execute(Executer exec)
        {
            if (!Header.Text.EndsWithIgnoreCase(" then"))
            {
                throw ThrowHelper.ExpectedToken("THEN");
            }

            Evaluator eval = new Evaluator(
                new StringSegment(Header.Text,
                                  Header.Text.IndexOf(' ') + 1,      // Get rid of the IF
                                  Header.Text.LastIndexOf(' ') - 2), // Get rid of the THEN
                exec
                );

            if (eval.EvaluateBool())
            {
                exec.Execute(Body);
            }
            else if (HasElseBlock)
            {
                exec.Execute(Else.Body);
            }
        }
Exemplo n.º 30
0
 private void executeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         Executer executer = new Executer(readProcesesFromTable(dataGridMain));
         Proces.TcList.Clear();
         executer.Execute();
         UpdateTableFromExecuter(dataGridMain, executer);
     } catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         Proces.TcList.Clear();
     }
 }
Exemplo n.º 31
0
        static IAsyncResult beginOperation(BaseCommand command, AsyncCallback callback, object state)
        {
            Executer exe = new Executer(callback, state, command);
            ThreadPool.QueueUserWorkItem(s => exe.Execute());

            return exe.AsyncResult;
        }
Exemplo n.º 32
0
        static IAsyncResult beginOperation(BaseCommand command, AsyncCallback callback, object state)
        {
            TransferAsyncResult result = new TransferAsyncResult(callback, state);

            Executer exe = new Executer(result, command);
            ThreadPool.QueueUserWorkItem(s => exe.Execute());

            return result;
        }