private void Reverse(int index1, int index2)
 {
     if (IsRootNode(treeView.SelectedNode))
     {
         if (!actionScript)
         {
             script.Reverse(index1, index2);
         }
         else
         {
             action.Reverse(index1, index2);
         }
     }
     else
     {
         int          parent = treeView.SelectedNode.Parent.Index;
         EventCommand esc    = script.Commands[parent];
         esc.Queue.Reverse(index1, index2);
     }
 }
        public override async Task <CommandBase> GetNewCommand()
        {
            if (await this.Validate())
            {
                if (this.command == null)
                {
                    this.command = new EventCommand(this.EventType);
                    if (ChannelSession.Settings.EventCommands.Any(se => se.EventCommandType.Equals(this.command.EventCommandType)))
                    {
                        await DialogHelper.ShowMessage("This event already exists");

                        return(null);
                    }
                    ChannelSession.Settings.EventCommands.Add(this.command);
                }
                this.command.Unlocked = this.UnlockedControl.Unlocked;
                return(this.command);
            }
            return(null);
        }
Ejemplo n.º 3
0
        public virtual void HandleRequest()
        {
            switch (EventCommand.ToLower())
            {
            case "list":
            case "search":
                Get();
                break;

            case "save":
                Save();
                break;

            case "edit":
                Edit();
                break;

            case "delete":
                ResetSearch();
                Delete();
                Get();
                break;

            case "cancel":
                ListMode();
                Get();
                break;

            case "resetsearch":
                ResetSearch();
                Get();
                break;

            case "add":
                Add();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Load and creates a command after saving a command. Returns null if no object
        /// has been loaded.
        /// </summary>
        /// <param name="n">Node with the command infos</param>
        /// <param name="fc">Current flightcomputer</param>
        public static ICommand LoadCommand(ConfigNode n, FlightComputer fc)
        {
            ICommand command = null;

            // switch the different commands
            switch (n.name)
            {
            case "AttitudeCommand":     { command = new AttitudeCommand(); break; }

            case "ActionGroupCommand":  { command = new ActionGroupCommand(); break; }

            case "BurnCommand":         { command = new BurnCommand(); break; }

            case "ManeuverCommand":     { command = new ManeuverCommand(); break; }

            case "CancelCommand":       { command = new CancelCommand(); break; }

            case "TargetCommand":       { command = new TargetCommand(); break; }

            case "EventCommand":        { command = new EventCommand(); break; }

            case "DriveCommand":        { command = new DriveCommand(); break; }

            case "ExternalAPICommand":  { command = new ExternalAPICommand(); break; }
            }

            if (command != null)
            {
                ConfigNode.LoadObjectFromConfig(command, n);
                // additional loadings
                var result = command.Load(n, fc);
                RTLog.Verbose("Loading command {0}={1}", RTLogLevel.LVL1, n.name, result);
                // delete command if we can't load the command correctlys
                if (result == false)
                {
                    command = null;
                }
            }

            return(command);
        }
Ejemplo n.º 5
0
        private async Task SaveAndClose(bool isBasic)
        {
            await this.window.RunAsyncOperation(async() =>
            {
                ActionBase action = this.actionControl.GetAction();
                if (action == null)
                {
                    if (this.actionControl is ChatActionControl)
                    {
                        await DialogHelper.ShowMessage("The chat message must not be empty");
                    }
                    else if (this.actionControl is SoundActionControl)
                    {
                        await DialogHelper.ShowMessage(MixItUp.Base.Resources.EmptySoundFilePath);
                    }
                    return;
                }

                EventCommand newCommand = new EventCommand(this.eventType);
                newCommand.IsBasic      = isBasic;
                newCommand.Actions.Add(action);

                if (this.command != null)
                {
                    ChannelSession.Settings.EventCommands.Remove(this.command);
                }
                ChannelSession.Settings.EventCommands.Add(newCommand);

                await ChannelSession.SaveSettings();

                this.window.Close();

                if (!isBasic)
                {
                    await Task.Delay(250);
                    CommandWindow window            = new CommandWindow(new EventCommandDetailsControl(newCommand));
                    window.CommandSaveSuccessfully += (sender, cmd) => this.CommandSavedSuccessfully(cmd);
                    window.Show();
                }
            });
        }
        // treeview managers
        private void AddCommand(EventCommand esc)
        {
            TreeNode node = esc.Node;

            if (esc.QueueTrigger || esc.Locked)
            {
                if (esc.Queue == null)
                {
                    return;
                }
                List <ActionCommand> queue = esc.Queue.Commands;
                for (int i = 0; queue != null && i < queue.Count; i++)
                {
                    ActionCommand asc   = queue[i];
                    TreeNode      child = asc.Node;
                    node.Nodes.Add(child);
                }
            }
            // Add command
            this.treeView.Nodes.Add(node);
        }
Ejemplo n.º 7
0
        private EventCommand ConvertCassandraRow(Row instance)
        {
            EventCommand eventCommand = new EventCommand();

            eventCommand.TemperatureEvent                = new TemperatureEvent();
            eventCommand.ActuationCommand                = new ActuationCommand();
            eventCommand.TemperatureEvent.Timestamp      = DateTime.Parse(instance["Timestamp"].ToString());
            eventCommand.TemperatureEvent.StationName    = instance["StationName"].ToString();
            eventCommand.TemperatureEvent.DataInfluenced = (DataInfluenced)Enum.Parse(typeof(DataInfluenced), instance["DataInfluenced"].ToString());
            eventCommand.TemperatureEvent.Latitude       = (double)instance["Latitude"];
            eventCommand.TemperatureEvent.Longitude      = (double)instance["Longitude"];
            eventCommand.TemperatureEvent.EventType      = (EventType)Enum.Parse(typeof(EventType), instance["EventType"].ToString());
            eventCommand.TemperatureEvent.Value          = (double)instance["Value"];
            eventCommand.ActuationCommand.Command        = instance["Command"].ToString();
            List <string> args = instance["Args"].ToString().Split("&").ToList();

            eventCommand.ActuationCommand.AdditionalArguments.AddRange(args);
            return(eventCommand);

            Enum.Parse(typeof(EventType), "jp");
        }
Ejemplo n.º 8
0
        public void SpeedTest_50000Calls()
        {
            var conf = new Configuration()
            {
                Name = "Tester", ID = 1234
            };
            var environment = new EventHandlerEnvironment();

            var command = new EventCommand(environment);

            var va = Helpers.InitializeTestVA(conf);

            var dispatcher = va.EventDispatcher;

            for (int i = 0; i < 50000; i++)
            {
                dispatcher.Dispatch(command);
            }

            Assert.IsTrue(true);
        }
Ejemplo n.º 9
0
        internal static void ExecuteCommandEvent(string database, EventCommand waitingevent)
        {
            var store = new ObjectStoreWrapper(database);

            LogWriter.LogInformation("Executing waiting event", LogEntryType.Information);
            #region Execute inline global event handlers
            foreach (var ge in _globaleventhandlers)
            {
                try
                {
                    if (ge != null)
                    {
                        ge(store, waitingevent);
                    }
                }
                catch (Exception ex)
                {
                    LogWriter.LogException(ex);
                }
            }
            #endregion

            var command = JObject.Parse(waitingevent.Command);

            var currenthandlers = ChechHandlers(command);
            if (currenthandlers != null)
            {
                foreach (var hh in currenthandlers)
                {
                    try
                    {
                        hh.HandleCommand(store, command);
                    }
                    catch (Exception ex)
                    {
                        LogWriter.LogException(ex);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void HandleRequest()
        {
            if (!String.IsNullOrEmpty(SalvarAgendamento))
            {
                EventCommand = SalvarAgendamento;
            }

            Console.WriteLine(EventCommand);
            switch (EventCommand.ToLower())
            {
            case "lista":
            case "pesquisar":
                IsAgendamentoMode = false;
                IsListMode        = true;
                GetAgendamentos();

                break;

            case "imprimir":

                break;

            case "salvar":
                IsAgendamentoMode = false;
                IsListMode        = true;
                salvarAgendamento();
                break;

            case "reagendar":
            case "cancelar":
                AtualizarStatus();
                break;

            case "novoagendamento":
                IsAgendamentoMode = true;
                IsListMode        = false;
                GetPacientes();
                break;
            }
        }
Ejemplo n.º 11
0
        public ActionResult Monitor(int id)
        {
            var eventt = EventCommand.Get(id);

            if (LoggedUserIs(RoleEnum.EventAdministrator) && eventt.Organizer.Id != GetLoggedUser().Id)
            {
                return(RedirectToAction("Index", "ManageEvent"));
            }
            var eventtModel = new EventMonitorModel()
            {
                Id                         = eventt.Id,
                Name                       = eventt.Name,
                Latitude                   = eventt.Latitude,
                Longitude                  = eventt.Longitude,
                BeginDateTime              = eventt.BeginDateTime,
                EndDateTime                = eventt.EndDateTime,
                Address                    = eventt.Address.ToDisplay(),
                OrganizerDisplay           = eventt.Organizer.ToDisplay(),
                Status                     = eventt.Status,
                AmountPeople               = Activities.Where(e => e.Event == eventt).Count(),
                IsCollaborativeSearchStart = eventt.CollaborativeSearchDateTime.HasValue,
                IAmOk                      = true,
                LastUpdate                 = eventt.EndDateTime,
                WithoutAnswer              = true,
                IAmNotOk                   = true,
                Clustered                  = true,
            };

            if (eventt.EmergencyDateTime.HasValue)
            {
                eventtModel.EmergencyDateTime = eventt.EmergencyDateTime.Value;
            }
            if (eventt.CollaborativeSearchDateTime.HasValue)
            {
                eventtModel.CollaborativeSearchDateTime = eventt.CollaborativeSearchDateTime.Value;
            }

            return(View(eventtModel));
        }
Ejemplo n.º 12
0
        public void SpeedTest_AdditionalAssembly_100000Calls()
        {
            var conf = new Additional.TestConfiguration()
            {
                id = 1234
            };
            var environment = new EventHandlerEnvironment();
            var command     = new EventCommand(environment);

            var va = Helpers.InitializeTestVA(conf);

            var dispatcher = va.EventDispatcher;

            dispatcher.IncludeAssemblies(typeof(Additional.TestConfiguration).Assembly);

            for (int i = 0; i < 100000; i++)
            {
                dispatcher.Dispatch(command);
            }

            Assert.IsTrue(true);
        }
Ejemplo n.º 13
0
 private async Task PerformUserFirstJoins(IEnumerable <UserViewModel> users)
 {
     try
     {
         EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.MixerUserFirstJoin));
         if (command != null)
         {
             foreach (UserViewModel user in users)
             {
                 if (user.Data.ViewingMinutes == 0)
                 {
                     if (ChannelSession.Constellation.CanUserRunEvent(user, EnumHelper.GetEnumName(OtherEventTypeEnum.MixerUserFirstJoin)))
                     {
                         ChannelSession.Constellation.LogUserRunEvent(user, EnumHelper.GetEnumName(OtherEventTypeEnum.MixerUserFirstJoin));
                         await ChannelSession.Constellation.RunEventCommand(command, user);
                     }
                 }
             }
         }
     }
     catch (Exception ex) { Util.Logger.Log(ex); }
 }
        public void HandleRequest()
        {
            string cmd = EventCommand.ToLower();

            switch (cmd)
            {
            case "reset":
                Reset();
                break;

            case "geterrorqueue":
                GetSelectedErrorQueue();
                break;

            case "selectlabel":
                GetSelectedMessage();
                break;

            case "editbodyselectq":
                SelectOutputQueue();
                break;

            case "editbodycancel":
                Reset();
                break;

            case "post":
                SaveMessage();
                Reset();
                break;

            default:
                var text = $"Command error: {cmd}";
                MessageBox.Show(text, "Unknown Command", MessageBoxButtons.OK);
                Reset();
                break;
            }
        }
Ejemplo n.º 15
0
        public long LogCommand(EventCommand command)
        {
            lock (_filelock)
            {
                CommandSN++;
                if (Configuration.EnableJournaling)
                {
                    if (OpenLogFile())
                    {
                        // Writing the journal
                        if (_ensureatomicwrites)
                        {
                            _logfile.Flush();
                        }

                        _logbuffer.Seek(0, SeekOrigin.Begin);
                        _logbuffer.SetLength(0);

                        _writer.Write('K');
                        _writer.Write(CommandSN);
                        _writer.Write(command.CommandMarker ?? string.Empty);
                        _writer.Write('D');
                        _writer.Write(command.Command);
                        _writer.Flush();

                        // this should be an atomic operation due to filestream flag used during open.
                        _logfile.Write(_logbuffer.ToArray(), 0, (int)_logbuffer.Length);
                        _logfile.Flush(_ensureatomicwrites);

                        if (_logfile.Length - _logfile.Position < _logfilefreespace)
                        {
                            IncreaseFileSize();
                        }
                    }
                }
            }
            return(CommandSN);
        }
Ejemplo n.º 16
0
        public void HandleRequest()
        {
            switch (EventCommand.ToLower())
            {
            case "list":
            case "search":
                Get();
                break;

            case "resetsearch":
                Get();
                break;

            case "add":
                Add();
                break;

            case "cancel":
                ListMode();
                Get();
                break;

            case "save":
                Save();
                if (isValid)
                {
                    Get();
                }
                break;

            case "edit":

                break;

            default:
                break;
            }
        }
Ejemplo n.º 17
0
        public void HandleRequest()
        {
            switch (EventCommand.ToLower())
            {
            case "list":
            case "search":
                Get();
                break;

            case "resetsearch":
                ResetSearch();
                break;

            case "add":
                IsListAreaVisible   = false;
                IsSearchAreaVisible = false;
                IsListAreaVisible   = true;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 18
0
        public void AssertThat_ChangesMadeInMultipleHandlers_PropagateToEnvironment()
        {
            var expectedID   = 1234;
            var expectedName = "Tester";

            var conf = new Configuration()
            {
                Name = "Tester", ID = 1234
            };
            var va = Helpers.InitializeTestVA(conf);

            var environment = va.CreateEventHandlerEnvironment(MFilesAPI.MFEventHandlerType.MFEventHandlerAfterSetProperties);

            var command = new EventCommand(environment);


            Dispatcher dispatcher = va.EventDispatcher;

            dispatcher.Dispatch(command);

            Assert.AreEqual(expectedID, environment.CurrentUserID);
            Assert.AreEqual(expectedName, environment.Input);
        }
Ejemplo n.º 19
0
 public override void EventSourceCommand(string eventSourceName, EventCommand command, FilteringOptions options = null)
 {
     if (options == null)
     {
         options = new FilteringOptions();
     }
     foreach (EventSource source in EventSource.GetSources())
     {
         if (source.Name == eventSourceName)
         {
             DoCommand(source, command, options);
             return;
         }
     }
     _onEventSourceCreated += delegate(EventSource sourceBeingCreated)
     {
         if (eventSourceName != null && eventSourceName == sourceBeingCreated.Name)
         {
             DoCommand(sourceBeingCreated, command, options);
             eventSourceName = null;         // so we only do it once.
         }
     };
 }
Ejemplo n.º 20
0
        private async Task ProcessCardRedemption(JObject jobj)
        {
            string cardData           = string.Empty;
            StreamlootsCardModel card = jobj["data"].ToObject <StreamlootsCardModel>();

            if (card != null)
            {
                UserViewModel user = new UserViewModel(0, card.data.Username);

                UserModel userModel = await ChannelSession.Connection.GetUser(user.UserName);

                if (userModel != null)
                {
                    user = new UserViewModel(userModel);
                }

                EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.StreamlootsCardRedeemed));
                if (command != null)
                {
                    Dictionary <string, string> specialIdentifiers = new Dictionary <string, string>();
                    specialIdentifiers.Add("streamlootscardname", card.data.cardName);
                    specialIdentifiers.Add("streamlootscardimage", card.imageUrl);
                    specialIdentifiers.Add("streamlootscardhasvideo", (!string.IsNullOrEmpty(card.videoUrl)).ToString());
                    specialIdentifiers.Add("streamlootscardvideo", card.videoUrl);
                    specialIdentifiers.Add("streamlootscardsound", card.soundUrl);

                    string message = card.data.Message;
                    if (string.IsNullOrEmpty(message))
                    {
                        message = card.data.LongMessage;
                    }
                    specialIdentifiers.Add("streamlootsmessage", message);

                    await command.Perform(user, arguments : null, extraSpecialIdentifiers : specialIdentifiers);
                }
            }
        }
Ejemplo n.º 21
0
        public void HookPartMenus()
        {
            UIPartActionMenuPatcher.Wrap(vessel, (e, ignoreDelay) =>
            {
                var v = FlightGlobals.ActiveVessel;
                if (v == null || v.isEVA || RTCore.Instance == null)
                {
                    e.Invoke();
                    return;
                }

                var vs = RTCore.Instance.Satellites[v];
                if (vs == null || vs.HasLocalControl)
                {
                    e.Invoke();
                }
                else if (eventWhiteList.Contains(e.name))
                {
                    e.Invoke();
                }
                else if (vs.FlightComputer != null && vs.FlightComputer.InputAllowed)
                {
                    if (ignoreDelay)
                    {
                        e.Invoke();
                    }
                    else
                    {
                        vs.SignalProcessor.FlightComputer.Enqueue(EventCommand.Event(e));
                    }
                }
                else
                {
                    ScreenMessages.PostScreenMessage(new ScreenMessage("No connection to send command on.", 4.0f, ScreenMessageStyle.UPPER_LEFT));
                }
            });
        }
Ejemplo n.º 22
0
        public async Task <IEnumerable <UserViewModel> > RemoveUsers(IEnumerable <uint> userIDs)
        {
            List <UserViewModel> results = new List <UserViewModel>();

            await this.semaphore.WaitAndRelease(() =>
            {
                foreach (uint userID in userIDs)
                {
                    if (this.users.ContainsKey(userID))
                    {
                        UserViewModel user = this.users[userID];
                        this.users.Remove(userID);
                        results.Add(user);
                    }
                }
                return(Task.FromResult(0));
            });

            EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.MixerUserLeft));

            if (command != null)
            {
                foreach (UserViewModel user in results)
                {
                    if (user.IsInChat)
                    {
                        if (ChannelSession.Constellation.CanUserRunEvent(user, EnumHelper.GetEnumName(OtherEventTypeEnum.MixerUserLeft)))
                        {
                            ChannelSession.Constellation.LogUserRunEvent(user, EnumHelper.GetEnumName(OtherEventTypeEnum.MixerUserLeft));
                            await ChannelSession.Constellation.RunEventCommand(command, user);
                        }
                    }
                }
            }

            return(results);
        }
Ejemplo n.º 23
0
        public async Task PerformEvent(EventTrigger trigger)
        {
            if (this.CanPerformEvent(trigger))
            {
                UserViewModel user = trigger.User;
                if (user == null)
                {
                    user = ChannelSession.GetCurrentUser();
                }

                if (this.userEventTracking.ContainsKey(trigger.Type))
                {
                    this.userEventTracking[trigger.Type].Add(user.ID);
                }

                EventCommand command = this.GetEventCommand(trigger.Type);
                if (command != null)
                {
                    Logger.Log(LogLevel.Debug, $"Performing event trigger: {trigger.Type}");

                    await command.Perform(user, platform : trigger.Platform, arguments : trigger.Arguments, extraSpecialIdentifiers : trigger.SpecialIdentifiers);
                }
            }
        }
Ejemplo n.º 24
0
        private async void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            this.PlayButton.Visibility = Visibility.Collapsed;
            this.StopButton.Visibility = Visibility.Visible;

            this.EditButton.IsEnabled   = false;
            this.DeleteButton.IsEnabled = false;
            this.EnableDisableToggleSwitch.IsEnabled = false;

            CommandBase command = this.GetCommandFromCommandButtons <CommandBase>(this);

            if (command != null)
            {
                UserViewModel currentUser = await ChannelSession.GetCurrentUser();

                Dictionary <string, string> extraSpecialIdentifiers = new Dictionary <string, string>();
                if (command is EventCommand)
                {
                    EventCommand eventCommand = command as EventCommand;
                    switch (eventCommand.EventType)
                    {
                    case Mixer.Base.Clients.ConstellationEventTypeEnum.channel__id__hosted:
                        extraSpecialIdentifiers["hostviewercount"] = "123";
                        break;

                    case Mixer.Base.Clients.ConstellationEventTypeEnum.channel__id__resubscribed:
                        extraSpecialIdentifiers["usersubmonths"] = "5";
                        break;
                    }

                    switch (eventCommand.OtherEventType)
                    {
                    case OtherEventTypeEnum.GameWispSubscribed:
                    case OtherEventTypeEnum.GameWispResubscribed:
                        extraSpecialIdentifiers["subscribemonths"] = "999";
                        extraSpecialIdentifiers["subscribetier"]   = "Test Tier";
                        extraSpecialIdentifiers["subscribeamount"] = "$12.34";
                        break;

                    case OtherEventTypeEnum.StreamlabsDonation:
                    case OtherEventTypeEnum.GawkBoxDonation:
                    case OtherEventTypeEnum.TiltifyDonation:
                    case OtherEventTypeEnum.ExtraLifeDonation:
                    case OtherEventTypeEnum.TipeeeStreamDonation:
                    case OtherEventTypeEnum.TreatStreamDonation:
                    case OtherEventTypeEnum.StreamJarDonation:
                        UserDonationModel donation = new UserDonationModel()
                        {
                            Amount    = 12.34,
                            Message   = "Test donation message",
                            ImageLink = currentUser.AvatarLink
                        };

                        switch (eventCommand.OtherEventType)
                        {
                        case OtherEventTypeEnum.StreamlabsDonation: donation.Source = UserDonationSourceEnum.Streamlabs; break;

                        case OtherEventTypeEnum.GawkBoxDonation: donation.Source = UserDonationSourceEnum.GawkBox; break;

                        case OtherEventTypeEnum.TiltifyDonation: donation.Source = UserDonationSourceEnum.Tiltify; break;

                        case OtherEventTypeEnum.ExtraLifeDonation: donation.Source = UserDonationSourceEnum.ExtraLife; break;

                        case OtherEventTypeEnum.TipeeeStreamDonation: donation.Source = UserDonationSourceEnum.TipeeeStream; break;

                        case OtherEventTypeEnum.TreatStreamDonation: donation.Source = UserDonationSourceEnum.TreatStream; break;

                        case OtherEventTypeEnum.StreamJarDonation: donation.Source = UserDonationSourceEnum.StreamJar; break;
                        }

                        foreach (var kvp in donation.GetSpecialIdentifiers())
                        {
                            extraSpecialIdentifiers[kvp.Key] = kvp.Value;
                        }
                        extraSpecialIdentifiers["donationtype"] = "Pizza";
                        break;

                    case OtherEventTypeEnum.PatreonSubscribed:
                        extraSpecialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierNameSpecialIdentifier]   = "Super Tier";
                        extraSpecialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierAmountSpecialIdentifier] = "12.34";
                        extraSpecialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierImageSpecialIdentifier]  = "https://xforgeassets002.xboxlive.com/xuid-2535473787585366-public/b7a1d715-3a9e-4bdd-a030-32f9e2e0f51e/0013_lots-o-stars_256.png";
                        break;

                    case OtherEventTypeEnum.TwitterStreamTweetRetweet:
                        break;

                    case OtherEventTypeEnum.MixerSkillUsed:
                        extraSpecialIdentifiers["skillname"]     = "Lots of stars";
                        extraSpecialIdentifiers["skilltype"]     = EnumHelper.GetEnumName(SkillTypeEnum.Sticker);
                        extraSpecialIdentifiers["skillcosttype"] = "Embers";
                        extraSpecialIdentifiers["skillcost"]     = "50";
                        extraSpecialIdentifiers["skillimage"]    = "https://xforgeassets002.xboxlive.com/xuid-2535473787585366-public/b7a1d715-3a9e-4bdd-a030-32f9e2e0f51e/0013_lots-o-stars_256.png";
                        extraSpecialIdentifiers["skillissparks"] = false.ToString();
                        extraSpecialIdentifiers["skillisembers"] = true.ToString();
                        extraSpecialIdentifiers["skillmessage"]  = "Hello World!";
                        break;

                    case OtherEventTypeEnum.MixerMilestoneReached:
                        extraSpecialIdentifiers["milestoneamount"]               = "100";
                        extraSpecialIdentifiers["milestoneremainingamount"]      = "100";
                        extraSpecialIdentifiers["milestonereward"]               = "$10.00";
                        extraSpecialIdentifiers["milestonenextamount"]           = "100";
                        extraSpecialIdentifiers["milestonenextremainingamount"]  = "100";
                        extraSpecialIdentifiers["milestonenextreward"]           = "$10.00";
                        extraSpecialIdentifiers["milestonefinalamount"]          = "100";
                        extraSpecialIdentifiers["milestonefinalremainingamount"] = "100";
                        extraSpecialIdentifiers["milestonefinalreward"]          = "$10.00";
                        extraSpecialIdentifiers["milestoneearnedamount"]         = "100";
                        extraSpecialIdentifiers["milestoneearnedreward"]         = "$10.00";
                        break;

                    case OtherEventTypeEnum.MixerSparksUsed:
                        extraSpecialIdentifiers["sparkamount"] = "10";
                        break;

                    case OtherEventTypeEnum.MixerEmbersUsed:
                        extraSpecialIdentifiers["emberamount"] = "10";
                        break;
                    }
                }
                else if (command is InteractiveCommand)
                {
                    InteractiveCommand iCommand = (InteractiveCommand)command;

                    extraSpecialIdentifiers["mixplaycontrolid"]   = iCommand.Name;
                    extraSpecialIdentifiers["mixplaycontrolcost"] = "123";
                }
                else if (command is CustomCommand)
                {
                    if (command.Name.Equals(InventoryWindow.ItemsBoughtCommandName) || command.Name.Equals(InventoryWindow.ItemsSoldCommandName))
                    {
                        extraSpecialIdentifiers["itemtotal"]    = "5";
                        extraSpecialIdentifiers["itemname"]     = "Chocolate Bars";
                        extraSpecialIdentifiers["itemcost"]     = "500";
                        extraSpecialIdentifiers["currencyname"] = "CURRENCY_NAME";
                    }
                }

                await command.PerformAndWait(currentUser, new List <string>() { "@" + currentUser.UserName }, extraSpecialIdentifiers);

                if (command is PermissionsCommandBase)
                {
                    PermissionsCommandBase permissionCommand = (PermissionsCommandBase)command;
                    permissionCommand.ResetCooldown(await ChannelSession.GetCurrentUser());
                }
                this.SwitchToPlay();
            }

            this.RaiseEvent(new RoutedEventArgs(CommandButtonsControl.PlayClickedEvent, this));
        }
Ejemplo n.º 25
0
 public static void SendCommand(EventSource eventSource, EventCommand command, IDictionary <string, string> commandArguments);
Ejemplo n.º 26
0
 /// <summary>
 /// Position the cursor at beginning of Interpreter
 /// </summary>
 public void Reset(EventCommand[] _list)
 {
     for(int i=0; i<branch.Length; i++)
     {
         branch[i].Reset();
     }
     list = _list;
     index = 0;
 }
        public MainWindowViewModel()
        {
            OpenConnectionCommand = new RelayCommand(OpenConnection);
            OpenLogsCommand = new EventCommand<IList>(open_logs, x => x.Count > 0);
            ManagerWebsitesCommand = new EventCommand<IList>(ManageWebsites, x => x.Count > 0);            
            TabItemsViewModelCollection = new ObservableCollection<TabItemViewModel>();
            CloseTabCommand = new EventCommand<TabItemViewModel>(close_tabs);
            DeploymentSelectionChangedCommand = new EventCommand<object>(k => { OpenLogsCommand.RaiseCanExecuteChanged(); });
           //  public RelayCommand CloseTabCommand { get; set; }
            
            //TODO Fix the watermarks.
            StorageAccount = "Azure Storage Account";
            StorageKey = "Key";
            ConfigurationFolder = "Not Used";

            //LogViewer = new TextEditorWrapper();


            LoadConnectionInfo();
        }
 public ProductClickCommand(ProductClickActionFieldObject clickAction, ProductFieldObject product, EventCommand trackingEvent)
 {
     _clickAction   = clickAction;
     _product       = product;
     _trackingEvent = trackingEvent;
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Send a command to a particular EventSource identified by 'eventSource'
        /// 
        /// Calling this routine simply forwards the command to the EventSource.OnEventCommand
        /// callback.  What the EventSource does with the command and its arguments are from that point
        /// EventSource-specific.  
        /// 
        /// The eventSource is passed the EventListener that issued the command along with the command and
        /// arguments.  The contract is that to the extent possible the eventSource should not affect other
        /// EventListeners (eg filtering events), however sometimes this simply is not possible (if the
        /// command was to provoke a GC, or a System flush etc).   
        /// </summary>
        public static void SendCommand(EventSource eventSource, EventCommand command, IDictionary<string, string> commandArguments)
        {
            if (eventSource == null)
                throw new ArgumentNullException("eventSource");

            // User-defined EventCommands should not conflict with the reserved commands.
            if ((int)command <= (int)EventCommand.Update && (int)command != (int)EventCommand.SendManifest)
                throw new ArgumentException("Invalid command value.", "command");

            eventSource.SendCommand(null, 0, 0, command, true, EventLevel.LogAlways, EventKeywords.None, commandArguments);
        }
Ejemplo n.º 30
0
        // This is the internal entry point that code:EventListeners call when wanting to send a command to a
        // eventSource. The logic is as follows
        // 
        // * if Command == Update
        //     * enabled, level, matchAnyKeywords are used to set a default for all events for the
        //         curEventSource.  In particular, if 'enabled' is false, 'level' and
        //         'matchAnyKeywords' are not used.  
        //     * OnEventCommand is invoked, which may cause calls to
        //         code:EventSource.EnableEventForDispatcher which may cause changes in the filtering
        //         depending on the logic in that routine.
        // * else (command != Update)
        //     * Simply call OnEventCommand. The expectation is that filtering is NOT changed.
        //     * The 'enabled' 'level', matchAnyKeyword' arguments are ignored (must be true, 0, 0).  
        // 
        // dispatcher == null has special meaning. It is the 'ETW' dispatcher.
        internal void SendCommand(EventListener listener, EventCommand command, bool enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary<string, string> commandArguments)
        {
            m_lastCommandException = null;
            try
            {
                InsureInitialized();

                // Find the per-EventSource dispatcher cooresponding to registered dispatcher
                EventDispatcher eventSourceDispatcher = GetDispatcher(listener);
                if (eventSourceDispatcher == null && listener != null)     // dispatcher == null means ETW dispatcher
                    throw new ArgumentException(SR.EventSource_ListenerNotFound);

                if (commandArguments == null)
                    commandArguments = new Dictionary<string, string>();

                if (command == EventCommand.Update)
                {
                    // Set it up using the 'standard' filtering bitfields
                    for (int i = 0; i < m_eventData.Length; i++)
                        EnableEventForDispatcher(eventSourceDispatcher, i, IsEnabledByDefault(i, enable, level, matchAnyKeyword));

                    command = EventCommand.Disable;
                    if (enable)
                    {
                        command = EventCommand.Enable;
                        if (!m_eventSourceEnabled)
                        {
                            // EventSource turned on for the first time, simply copy the bits.  
                            m_level = level;
                            m_matchAnyKeyword = matchAnyKeyword;
                        }
                        else
                        {
                            // Already enabled, make it the most verbose of the existing and new filter
                            if (level > m_level)
                                m_level = level;
                            if (matchAnyKeyword == 0)
                                m_matchAnyKeyword = 0;
                            else if (m_matchAnyKeyword != 0)
                                m_matchAnyKeyword |= matchAnyKeyword;
                        }

                        // Send the manifest if we are writing to ETW 
                        if (eventSourceDispatcher == null)
                        {
                            // eventSourceDispatcher == null means this is the ETW manifest
                            // If we are not completely initalized we can't send the manifest because WriteEvent
                            // will fail (handle was not returned from OS API).  We will try again after the
                            // constuctor completes.  
                            if (!m_ETWManifestSent && m_completelyInited)
                            {
                                m_ETWManifestSent = true;
                                SendManifest(m_rawManifest);
                            }
                        }
                    }

                    this.OnEventCommand(new EventCommandEventArgs(command, commandArguments, this, eventSourceDispatcher));

                    if (enable)
                    {
                        m_eventSourceEnabled = true;
                    }
                    else
                    {
                        // If we are disabling, maybe we can turn so 'quick checks' to filter
                        // quickly.  These are all just optimizations (since later checks will still filter)

                        // reset the 'manifestSent' bit for the listener.   
                        if (eventSourceDispatcher == null)
                            m_ETWManifestSent = false;          // Null dispatcher means ETW dispatcher.  

                        // There is a good chance EnabledForAnyListener are not as accurate as
                        // they could be, go ahead and get a better estimate.  
                        for (int i = 0; i < m_eventData.Length; i++)
                        {
                            m_eventData[i].EnabledForAnyListener = false;
                            for (EventDispatcher dispatcher = m_Dispatchers; dispatcher != null; dispatcher = dispatcher.m_Next)
                            {
                                if (dispatcher.m_EventEnabled[i])
                                {
                                    m_eventData[i].EnabledForAnyListener = true;
                                    break;
                                }
                            }
                        }

                        // If no events are enabled, disable the global enabled bit.
                        if (!AnyEventEnabled())
                        {
                            m_level = 0;
                            m_matchAnyKeyword = 0;
                            m_eventSourceEnabled = false;
                        }
                    }
                }
                else
                {
                    if (command == EventCommand.SendManifest)
                        SendManifest(m_rawManifest);

                    // These are not used for non-update commands and thus should always be 'default' values
                    Contract.Assert(enable == true);
                    Contract.Assert(m_level == EventLevel.LogAlways);
                    Contract.Assert(m_matchAnyKeyword == EventKeywords.None);

                    this.OnEventCommand(new EventCommandEventArgs(command, commandArguments, null, null));
                }
            }
            catch (Exception e)
            {
                // Remember any exception and rethrow.  
                m_lastCommandException = e;
                throw;
            }
        }
 public LocalDataViewCommandGoToCreateMode(EventCommand command)
     : base(command)
 {
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Send a command to an eventSource.   Be careful this is async.  You may wish to do a WaitForEnable
 /// </summary>
 public abstract void EventSourceCommand(string eventSourceName, EventCommand command, FilteringOptions options = null);
Ejemplo n.º 33
0
 private void DoCommand(EventSource source, EventCommand command, FilteringOptions options)
 {
     if (command == EventCommand.Enable)
         _listener.EnableEvents(source, options.Level, options.Keywords, options.Args);
     else if (command == EventCommand.Disable)
         _listener.DisableEvents(source);
     else
         throw new NotImplementedException();
 }
Ejemplo n.º 34
0
 public override void EventSourceCommand(string eventSourceName, EventCommand command, FilteringOptions options = null)
 {
     if (options == null)
         options = new FilteringOptions();
     foreach (EventSource source in EventSource.GetSources())
     {
         if (source.Name == eventSourceName)
         {
             DoCommand(source, command, options);
             return;
         }
     }
     _onEventSourceCreated += delegate (EventSource sourceBeingCreated)
     {
         if (eventSourceName != null && eventSourceName == sourceBeingCreated.Name)
         {
             DoCommand(sourceBeingCreated, command, options);
             eventSourceName = null;         // so we only do it once.  
         }
     };
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Send a command to an eventSource.   Be careful this is async.  You may wish to do a WaitForEnable 
 /// </summary>
 public abstract void EventSourceCommand(string eventSourceName, EventCommand command, FilteringOptions options = null);
Ejemplo n.º 36
0
        public override void EventSourceCommand(string eventSourceName, EventCommand command, FilteringOptions options = null)
        {
            if (command == EventCommand.Enable)
            {
                if (options == null)
                    options = new FilteringOptions();

                _session.EnableProvider(eventSourceName, (TraceEventLevel)options.Level, (ulong)options.Keywords,
                    new TraceEventProviderOptions() { Arguments = options.Args });
            }
            else if (command == EventCommand.Disable)
            {
                _session.DisableProvider(TraceEventProviders.GetEventSourceGuidFromName(eventSourceName));
            }
            else
                throw new NotImplementedException();
            Thread.Sleep(200);          // Calls are async, give them time to work.  
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Send a command to a particular EventSource identified by 'eventSource'
        /// 
        /// Calling this routine simply forwards the command to the EventSource.OnEventCommand
        /// callback.  What the EventSource does with the command and its arguments are from that point
        /// EventSource-specific.  
        /// 
        /// The eventSource is passed the EventListener that issued the command along with the command and
        /// arguments.  The contract is that to the extent possible the eventSource should not affect other
        /// EventListeners (eg filtering events), however sometimes this simply is not possible (if the
        /// command was to provoke a GC, or a System flush etc).   
        /// </summary>
        public static void SendCommand(EventSource eventSource, EventCommand command, IDictionary<string, string> commandArguments)
        {
            if (eventSource == null)
                throw new ArgumentNullException(nameof(eventSource));

            // User-defined EventCommands should not conflict with the reserved commands.
            if ((int)command <= (int)EventCommand.Update && (int)command != (int)EventCommand.SendManifest)
                throw new ArgumentException(SR.ArgumentOutOfRange_NeedPosNum, nameof(command));

            eventSource.SendCommand(null, command, true, EventLevel.LogAlways, EventKeywords.None, commandArguments);
        }
Ejemplo n.º 38
0
 internal EventCommandEventArgs(EventCommand command, IDictionary<string, string> arguments, EventSource eventSource, EventDispatcher dispatcher)
 {
     this.Command = command;
     this.Arguments = arguments;
     this.eventSource = eventSource;
     this.dispatcher = dispatcher;
 }
Ejemplo n.º 39
0
 protected virtual void initTarget(Object target)
 {
     // target可以让我们得到当前绘制的Component对象
     m_Target = (EventCommand)target;
 }
Ejemplo n.º 40
0
        // This is the internal entry point that code:EventListeners call when wanting to send a command to a
        // eventSource. The logic is as follows
        // 
        // * if Command == Update
        //     * perEventSourceSessionId specifies the per-provider ETW session ID that the command applies 
        //         to (if listener != null)
        //         perEventSourceSessionId = 0 - reserved for EventListeners
        //         perEventSourceSessionId = 1..SessionMask.MAX - reserved for activity tracing aware ETW sessions
        //                  perEventSourceSessionId-1 represents the bit in the reserved field (bits 44..47) in 
        //                  Keywords that identifies the session
        //         perEventSourceSessionId = SessionMask.MAX+1 - reserved for legacy ETW sessions; these are 
        //                  discriminated by etwSessionId
        //     * etwSessionId specifies a machine-wide ETW session ID; this allows correlation of
        //         activity tracing across different providers (which might have different sessionIds
        //         for the same ETW session)
        //     * enable, level, matchAnyKeywords are used to set a default for all events for the
        //         eventSource.  In particular, if 'enabled' is false, 'level' and
        //         'matchAnyKeywords' are not used.  
        //     * OnEventCommand is invoked, which may cause calls to
        //         code:EventSource.EnableEventForDispatcher which may cause changes in the filtering
        //         depending on the logic in that routine.
        // * else (command != Update)
        //     * Simply call OnEventCommand. The expectation is that filtering is NOT changed.
        //     * The 'enabled' 'level', matchAnyKeyword' arguments are ignored (must be true, 0, 0).  
        // 
        // dispatcher == null has special meaning. It is the 'ETW' dispatcher.
        internal void SendCommand(EventListener listener, int perEventSourceSessionId, int etwSessionId,
                                  EventCommand command, bool enable, 
                                  EventLevel level, EventKeywords matchAnyKeyword, 
                                  IDictionary<string, string> commandArguments)
        {
            m_lastCommandException = null;
            bool shouldReport = (perEventSourceSessionId > 0) && (perEventSourceSessionId <= SessionMask.MAX);

            try
            {
                lock (EventListener.EventListenersLock)
                {
                    EnsureInitialized();

                    // Find the per-EventSource dispatcher cooresponding to registered dispatcher
                    EventDispatcher eventSourceDispatcher = GetDispatcher(listener);
                    if (eventSourceDispatcher == null && listener != null)     // dispatcher == null means ETW dispatcher
                        throw new ArgumentException(Environment.GetResourceString("EventSource_ListenerNotFound"));

                    if (commandArguments == null)
                        commandArguments = new Dictionary<string, string>();

                    if (command == EventCommand.Update)
                    {
                        // Set it up using the 'standard' filtering bitfields (use the "global" enable, not session specific one)
                        for (int i = 0; i < m_eventData.Length; i++)
                            EnableEventForDispatcher(eventSourceDispatcher, i, IsEnabledByDefault(i, enable, level, matchAnyKeyword));

                        if (enable)
                        {
                            if (!m_eventSourceEnabled)
                            {
                                // EventSource turned on for the first time, simply copy the bits.  
                                m_level = level;
                                m_matchAnyKeyword = matchAnyKeyword;
                            }
                            else
                            {
                                // Already enabled, make it the most verbose of the existing and new filter
                                if (level > m_level)
                                    m_level = level;
                                if (matchAnyKeyword == 0)
                                    m_matchAnyKeyword = 0;
                                else if (m_matchAnyKeyword != 0)
                                    m_matchAnyKeyword |= matchAnyKeyword;
                            }
                        }

                        // interpret perEventSourceSessionId's sign, and adjust perEventSourceSessionId to 
                        // represent 0-based positive values
                        bool bSessionEnable = (perEventSourceSessionId >= 0);
                        if (perEventSourceSessionId == 0 && enable == false)
                            bSessionEnable = false;

                        if (listener == null)
                        {
                            if (!bSessionEnable) 
                                perEventSourceSessionId = -perEventSourceSessionId;
                            // for "global" enable/disable (passed in with listener == null and
                            //  perEventSourceSessionId == 0) perEventSourceSessionId becomes -1
                            --perEventSourceSessionId;
                        }

                        command = bSessionEnable ? EventCommand.Enable : EventCommand.Disable;

                        // perEventSourceSessionId = -1 when ETW sent a notification, but the set of active sessions
                        // hasn't changed.
                        // sesisonId = SessionMask.MAX when one of the legacy ETW sessions changed
                        // 0 <= perEventSourceSessionId < SessionMask.MAX for activity-tracing aware sessions
                        Contract.Assert(perEventSourceSessionId >= -1 && perEventSourceSessionId <= SessionMask.MAX);

                        // Send the manifest if we are enabling an ETW session
                        if (bSessionEnable && eventSourceDispatcher == null)
                        {
                            // eventSourceDispatcher == null means this is the ETW manifest

                            // SendCommand can be called from the EventSource constructor as a side effect of 
                            // ETW registration.   Unfortunately when this callback is active the provider is
                            // not actually enabled (WriteEvents will fail).   Thus if we detect this condition
                            // (that we are still being constructed), we simply skip sending the manifest.  
                            // When the constructor completes we will try again and send the manifest at that time. 
                            //
                            // Note that we unconditionally send the manifest whenever we are enabled, even if
                            // we were already enabled.   This is because there may be multiple sessions active
                            // and we can't know that all the sessions have seen the manifest.  
                            if (m_completelyInited)
                                SendManifest(m_rawManifest);
                            else
                                m_deferedSendManifest = true;
                        }

#if FEATURE_ACTIVITYSAMPLING
                        if (bSessionEnable && perEventSourceSessionId != -1)
                        {
                            bool participateInSampling = false;
                            string activityFilters;
                            int sessionIdBit;

                            ParseCommandArgs(commandArguments, out participateInSampling, 
                                            out activityFilters, out sessionIdBit);

                            if (listener == null && commandArguments.Count > 0 && perEventSourceSessionId != sessionIdBit)
                            {
                                throw new ArgumentException(Environment.GetResourceString("EventSource_SessionIdError", 
                                                            perEventSourceSessionId+SessionMask.SHIFT_SESSION_TO_KEYWORD,
                                                            sessionIdBit+SessionMask.SHIFT_SESSION_TO_KEYWORD));
                            }

                            if (listener == null)
                            {
                                UpdateEtwSession(perEventSourceSessionId, etwSessionId, true, activityFilters, participateInSampling);
                            }
                            else
                            {
                                ActivityFilter.UpdateFilter(ref listener.m_activityFilter, this, 0, activityFilters);
                                eventSourceDispatcher.m_activityFilteringEnabled = participateInSampling;
                            }
                        }
                        else if (!bSessionEnable && listener == null)
                        {
                            // if we disable an ETW session, indicate that in a synthesized command argument
                            if (perEventSourceSessionId >= 0 && perEventSourceSessionId < SessionMask.MAX)
                            {
                                commandArguments["EtwSessionKeyword"] = (perEventSourceSessionId+SessionMask.SHIFT_SESSION_TO_KEYWORD).ToString(CultureInfo.InvariantCulture);
                            }
                        }
#endif // FEATURE_ACTIVITYSAMPLING

                        this.OnEventCommand(new EventCommandEventArgs(command, commandArguments, this, eventSourceDispatcher));

#if FEATURE_ACTIVITYSAMPLING
                        if (listener == null && !bSessionEnable && perEventSourceSessionId != -1)
                        {
                            // if we disable an ETW session, complete disabling it
                            UpdateEtwSession(perEventSourceSessionId, etwSessionId, false, null, false);
                        }
#endif // FEATURE_ACTIVITYSAMPLING

                        if (enable)
                        {
                            m_eventSourceEnabled = true;
                        }
                        else
                        {
                            // If we are disabling, maybe we can turn on 'quick checks' to filter
                            // quickly.  These are all just optimizations (since later checks will still filter)

#if FEATURE_ACTIVITYSAMPLING
                            // Turn off (and forget) any information about Activity Tracing.  
                            if (listener == null)
                            {
                                // reset all filtering information for activity-tracing-aware sessions
                                for (int i = 0; i < SessionMask.MAX; ++i)
                                {
                                    EtwSession etwSession = m_etwSessionIdMap[i];
                                    if (etwSession != null)
                                        ActivityFilter.DisableFilter(ref etwSession.m_activityFilter, this);
                                }
                                m_activityFilteringForETWEnabled = new SessionMask(0);
                                m_curLiveSessions = new SessionMask(0);
                                // reset activity-tracing-aware sessions
                                if (m_etwSessionIdMap != null)
                                    for (int i = 0; i < SessionMask.MAX; ++i)
                                        m_etwSessionIdMap[i] = null;
                                // reset legacy sessions
                                if (m_legacySessions != null)
                                    m_legacySessions.Clear();
                            }
                            else
                            {
                                ActivityFilter.DisableFilter(ref listener.m_activityFilter, this);
                                eventSourceDispatcher.m_activityFilteringEnabled = false;
                            }
#endif // FEATURE_ACTIVITYSAMPLING

                            // There is a good chance EnabledForAnyListener are not as accurate as
                            // they could be, go ahead and get a better estimate.  
                            for (int i = 0; i < m_eventData.Length; i++)
                            {
                                bool isEnabledForAnyListener = false;
                                for (EventDispatcher dispatcher = m_Dispatchers; dispatcher != null; dispatcher = dispatcher.m_Next)
                                {
                                    if (dispatcher.m_EventEnabled[i])
                                    {
                                        isEnabledForAnyListener = true;
                                        break;
                                    }
                                }
                                m_eventData[i].EnabledForAnyListener = isEnabledForAnyListener;
                            }

                            // If no events are enabled, disable the global enabled bit.
                            if (!AnyEventEnabled())
                            {
                                m_level = 0;
                                m_matchAnyKeyword = 0;
                                m_eventSourceEnabled = false;
                            }
                        }
#if FEATURE_ACTIVITYSAMPLING
                        UpdateKwdTriggers(enable);
#endif // FEATURE_ACTIVITYSAMPLING
                    }
                    else
                    {
                        if (command == EventCommand.SendManifest)
                            SendManifest(m_rawManifest);

                        // These are not used for non-update commands and thus should always be 'default' values
                        Contract.Assert(enable == true);
                        Contract.Assert(m_level == EventLevel.LogAlways);
                        Contract.Assert(m_matchAnyKeyword == EventKeywords.None);

                        this.OnEventCommand(new EventCommandEventArgs(command, commandArguments, null, null));
                    }

#if FEATURE_ACTIVITYSAMPLING
                    if (m_completelyInited && (listener != null || shouldReport))
                    {
                        SessionMask m = SessionMask.FromId(perEventSourceSessionId); 
                        ReportActivitySamplingInfo(listener, m);
                    }
                    OutputDebugString(string.Format(CultureInfo.InvariantCulture, "{0}.SendCommand(session {1}, cmd {2}, enable {3}, level {4}): live sessions {5:x}, sampling {6:x}", 
                                      m_name, perEventSourceSessionId, command, enable, level, 
                                      (ulong) m_curLiveSessions, (ulong) m_activityFilteringForETWEnabled));
#endif // FEATURE_ACTIVITYSAMPLING
                }
            }
            catch (Exception e)
            {
                // Remember any exception and rethrow.  
                m_lastCommandException = e;
                throw;
            }
        }
Ejemplo n.º 41
0
 /// <summary>
 /// Event Setup
 /// </summary>
 /// <param Name="_list">list of event commands</param>
 /// <param Name="_event_id">event ID</param>
 public void Setup(EventCommand[] _list, int _event_id)
 {
     // Clear inner situation of interpreter
     Clear();
     // Remember map ID
     mapId = InGame.Map.MapId;
     // Remember event ID
     eventId = _event_id;
     // Remember list of event commands
     list = _list;
     // Initialize index
     index = 0;
 }
Ejemplo n.º 42
0
 public BasicEventCommandEditorControl(CommandWindow window, EventCommand command)
     : this(window, command.EventType, BasicCommandTypeEnum.None)
 {
     this.command = command;
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Load and creates a command after saving a command. Returns null if no object
        /// has been loaded.
        /// </summary>
        /// <param name="n">Node with the command infos</param>
        /// <param name="fc">Current flightcomputer</param>
        public static ICommand LoadCommand(ConfigNode n, FlightComputer fc)
        {
            ICommand command = null;

            // switch the different commands
            switch (n.name)
            {
                case "AttitudeCommand":     { command = new AttitudeCommand(); break; }
                case "ActionGroupCommand":  { command = new ActionGroupCommand(); break; }
                case "BurnCommand":         { command = new BurnCommand(); break; }
                case "ManeuverCommand":     { command = new ManeuverCommand(); break; }
                case "CancelCommand":       { command = new CancelCommand(); break; }
                case "TargetCommand":       { command = new TargetCommand(); break; }
                case "EventCommand":        { command = new EventCommand(); break; }
                case "DriveCommand":        { command = new DriveCommand(); break; }
                case "ExternalAPICommand":  { command = new ExternalAPICommand(); break; }
            }

            if (command != null)
            {
                ConfigNode.LoadObjectFromConfig(command, n);
                // additional loadings
                var result = command.Load(n, fc);
                RTLog.Verbose("Loading command {0}({1})={2}", RTLogLevel.LVL1, n.name, command.CmdGuid, result);
                // delete command if we can't load the command correctlys
                if (result == false)
                    command = null;
            }

            return command;
        }