Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        isSimulating  = false;
        isGenerating  = false;
        actionMode    = ModeAction.ADD;
        windDirection = 0;
        windSpeed     = 0;
        activeTerrain = Terrain.activeTerrain;
        fireSim       = activeTerrain.GetComponent <FireSimulation>();
        ClearMap();

        fireSim.SetSimulationActive(isSimulating);
    }
 /// <summary>
 /// Creates a new instance of the <see cref="InvitationExceptionMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public InvitationExceptionMode(ModeAction action)
 {
     this.Action = action;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="DeafMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public DeafMode( ModeAction action )
 {
     this.Action = action;
 }
Esempio n. 4
0
 /// <summary>
 ///   Creates a new instance of the <see cref="OperatorMode" /> class 
 ///   with the given <see cref="ModeAction" /> and member's nick.
 /// </summary>
 public OperatorMode(ModeAction action, string nick)
 {
     this.Action = action;
     this.Nick = nick;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="RegisteredNicksOnlyMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public RegisteredNicksOnlyMode( ModeAction action )
 {
     this.Action = action;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="BanMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public BanMode(ModeAction action)
 {
     this.Action = action;
 }
		/// <summary>
		/// Convert a ModeAction into its RFC2812 character.
		/// </summary>
		/// <param name="action">The action enum.</param>
		/// <returns>Either '+' or '-'.</returns>
		public static char ModeActionToChar( ModeAction action ) 
		{
			return Convert.ToChar( (byte) action, CultureInfo.InvariantCulture ) ;
		}
Esempio n. 8
0
		/// <summary>Changes this client's mode. To change another nick's mode
		/// use <see cref="ChangeChannelMode"/>.</summary>
		/// <remarks>
		/// Away cannot be set here but should be set using <see cref="Sender.Away"/> 
		/// or removed using <see cref="Sender.UnAway"/>.
		/// </remarks>
		/// <param name="action">Add or remove a mode.</param>
		/// <param name="mode">The mode to be changed.</param>
		/// <example><code>
		/// //Turn off invisibility
		/// connection.Sender.ChangeUserMode( ModeAction.Remove, UserMode.Invisible );
		/// //Turn on wallops (and get a lot of IRC garbage)
		/// connection.Sender.ChangeUserMode( ModeAction.Add, UserMode.Wallops );
		/// </code></example>
		/// <exception cref="ArgumentException">If the UserMode parameter is Away.</exception> 
		/// <seealso cref="Listener.OnUserModeChange"/>
		public void ChangeUserMode( ModeAction action, UserMode mode ) 
		{
			lock( this ) 
			{
				if ( mode == UserMode.Away ) 
				{
					ClearBuffer();
					throw new ArgumentException("Away mode can only be changed with the Away and Unaway commands.");
				}
				Buffer.Append("MODE");
				Buffer.Append( SPACE );
				Buffer.Append( Connection.ConnectionData.Nick );
				Buffer.Append( SPACE );
				Buffer.Append( Rfc2812Util.ModeActionToChar( action ) );
				Buffer.Append( Rfc2812Util.UserModeToChar( mode ) );
				Connection.SendCommand( Buffer );
			}
		}
 /// <summary>
 /// Creates a new instance of the <see cref="ReceiveServerKillsMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public ReceiveServerKillsMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 10
0
 /// <summary>
 ///   Creates a new instance of the <see cref="AnonymousMode" /> class with the given <see cref="ModeAction" />.
 /// </summary>
 public AnonymousMode(ModeAction action)
 {
     this.Action = action;
 }
 /// <summary>
 /// This user's mode has changed.
 /// </summary>
 /// <param name="action">Whether a mode was added or removed.</param>
 /// <param name="mode">The mode that was changed.</param>
 /// <seealso cref="Listener.OnUserModeChange"/>
 public UserModeChangeEventArgs(ModeAction action, UserMode mode)
 {
     Action = action;
     Mode   = mode;
 }
Esempio n. 12
0
 /// <summary>
 /// Convert a ModeAction into its RFC2812 character.
 /// </summary>
 /// <param name="action">The action enum.</param>
 /// <returns>Either '+' or '-'.</returns>
 public static char ModeActionToChar(ModeAction action)
 {
     return ((byte)action).ToChar(CultureInfo.InvariantCulture);
 }
 /// <summary>
 /// This user's mode has changed.
 /// </summary>
 /// <param name="action">Whether a mode was added or removed.</param>
 /// <param name="mode">The mode that was changed.</param>
 /// <seealso cref="Listener.OnUserModeChange"/>
 public UserModeChangeEventArgs(ModeAction action, UserMode mode)
 {
     Action = action;
     Mode = mode;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="ReceiveOperWallopsMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public ReceiveOperWallopsMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 15
0
 /// <summary>
 ///   Creates a new instance of the <see cref="InviteOnlyMode" /> class with the given <see cref="ModeAction" />.
 /// </summary>
 public InviteOnlyMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 16
0
 internal static bool Execute(ModeAction builtinAction, CommandHint hint, params object[] args)
 {
     return(Execute(builtinAction.ToString(), hint, args));
 }
Esempio n. 17
0
 /// <summary>
 ///   Creates a new instance of the <see cref="InvisibleMode" /> class with the given <see cref="ModeAction" />.
 /// </summary>
 public InvisibleMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 18
0
 /// <summary> Convert a ModeAction into its RFC2812 character. </summary>
 /// <param name="action">The action enum.</param>
 /// <returns>Either '+' or '-'.</returns>
 public static char ModeActionToChar(ModeAction action)
 {
     return((char)((byte)action));
 }
Esempio n. 19
0
 public void OnModeChanged(int mode)
 {
     actionMode = (ModeAction)mode;
 }
 /// <summary>
 ///   Creates a new instance of the <see cref="ReceiveServerNoticesMode" /> class with the given <see cref="ModeAction" />.
 /// </summary>
 public ReceiveServerNoticesMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 21
0
 public void OnUserModeChange( ModeAction action, UserMode mode )
 {
     Assertion.AssertEquals("OnUserModeChange: action", ModeAction.Add, action );
     Assertion.AssertEquals("OnUserModeChange: mode", UserMode.Wallops, mode );
     Console.WriteLine("OnUserModeChange");
 }
 /// <summary>
 /// Creates a new instance of the <see cref="BanMode"/> class 
 /// with the given <see cref="ModeAction"/> and <see cref="User"/>.
 /// </summary>
 public BanMode(ModeAction action, User mask)
 {
     this.Action = action;
     this.Mask = mask;
 }
Esempio n. 23
0
 protected UserMode(ModeAction action)
 {
     Action = action;
 }
Esempio n. 24
0
 /// <summary>
 ///   Creates a new instance of the <see cref="OperatorMode" /> class with the given <see cref="ModeAction" />.
 /// </summary>
 public OperatorMode(ModeAction action)
 {
     this.Action = action;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="ModeratedMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public ModeratedMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 26
0
 protected FlagMode(ModeAction action)
     : base(action)
 {
 }
 /// <summary>
 /// Creates a new instance of the <see cref="TopicGuardedMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public TopicGuardedMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 28
0
 /// <summary>
 ///   Creates a new instance of the <see cref="RestrictedMode" /> class with the given <see cref="ModeAction" />.
 /// </summary>
 public RestrictedMode(ModeAction action)
 {
     this.Action = action;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="VoiceMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public VoiceMode(ModeAction action)
 {
     this.Action = action;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="InvitationExceptionMode"/> class 
 /// with the given <see cref="ModeAction"/> and <see cref="User"/>.
 /// </summary>
 public InvitationExceptionMode(ModeAction action, User mask)
 {
     this.Action = action;
     this.Mask = mask;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="VoiceMode"/> class 
 /// with the given <see cref="ModeAction"/> and member's nick.
 /// </summary>
 public VoiceMode(ModeAction action, String nick)
 {
     this.Action = action;
     this.Nick = nick;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="ReceiveNickChangesMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public ReceiveNickChangesMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 33
0
 /// <summary>
 ///   Creates a new instance of the <see cref="CallerIdMode" /> class with the given <see cref="ModeAction" />.
 /// </summary>
 public CallerIdMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 34
0
 /// <summary>
 /// Convert a ModeAction into its RFC2812 character.
 /// </summary>
 /// <param name="action">The action enum.</param>
 /// <returns>Either '+' or '-'.</returns>
 public static char ModeActionToChar(ModeAction action)
 {
     return(Convert.ToChar((byte)action, CultureInfo.InvariantCulture));
 }
 /// <summary>
 /// Creates a new instance of the <see cref="ReceiveConnectionNoticesMode"/> class with the given <see cref="ModeAction"/>.
 /// </summary>
 public ReceiveConnectionNoticesMode(ModeAction action)
 {
     this.Action = action;
 }
Esempio n. 36
0
		/// <summary>
		/// Change a channel's mode.
		/// </summary>
		/// <remarks>
		/// Possible Errors
		/// 		<list type="bullet">
		/// 			<item><description>ERR_NEEDMOREPARAMS</description></item>
		/// 			<item><description>ERR_KEYSET</description></item>
		/// 			<item><description>ERR_NOCHANMODES</description></item>
		/// 			<item><description>ERR_CHANOPRIVSNEEDED</description></item>
		/// 			<item><description>ERR_USERNOTINCHANNEL</description></item>
		/// 			<item><description>ERR_UNKNOWNMODE</description></item>
		/// 		</list>
		/// </remarks>
		/// <param name="channel">The target channel.</param>
		/// <param name="action">Add or remove.</param>
		/// <param name="mode">The target mode.</param>
		/// <param name="param">An optional parameter for certain modes. If the mode 
		/// does not require one this should be null.</param>
		/// <example><code>
		/// //Give 'nick' the ability to talk on a moderated channel, i.e. add Voice
		/// connection.Sender.ChangeChannelMode("#thresher", ModeAction.Add, ChannelMode.Voice,"nick" );
		/// //Make a channel private
		/// connection.Sender.ChangeChannelMode( "#thresher", ModeAction.Add, ChannelMode.Private, null );
		/// </code></example>
		/// <exception cref="ArgumentException">If the channel name is invalid.</exception> 
		/// <seealso cref="Listener.OnChannelModeChange"/>
		public void ChangeChannelMode( string channel, ModeAction action, ChannelMode mode, string param ) 
		{
			lock( this )
			{
				if (!Rfc2812Util.IsValidChannelName(channel)) 
				{
					ClearBuffer();
					throw new ArgumentException(channel + " is not a valid channel.");
				}
				Buffer.Append("MODE");
				Buffer.Append(SPACE);
				Buffer.Append( channel );
				Buffer.Append(SPACE);
				Buffer.Append( Rfc2812Util.ModeActionToChar( action ) );
				Buffer.Append( Rfc2812Util.ChannelModeToChar( mode ) );
				if( !IsEmpty( param ) ) 
				{
					Buffer.Append(SPACE);
					Buffer.Append( param );
				}
				Connection.SendCommand( Buffer );
			}
		}
Esempio n. 37
0
        private bool UpdateActiveMap(string modeName, bool isActivate)
        {
            string     actionName;
            BaseAction action;

            // construct the new map
            var map = new Dictionary <BaseTrigger, BaseAction>();

            foreach (var triggerPair in _Triggers)
            {
                foreach (var mode in _ActiveModes)
                {
                    actionName = mode.GetActionForTrigger(triggerPair.Key);
                    if (String.IsNullOrEmpty(actionName))
                    {
                        continue; // trigger not in mode
                    }
                    if (actionName.StartsWith("AM:") || actionName.StartsWith("DM:"))
                    {
                        action = ModeAction.Create(actionName);
                    }
                    else if (!_Actions.TryGetValue(actionName, out action))
                    {
                        continue; // must be bad config
                    }
                    map.Add(triggerPair.Value, action);
                    break;
                }
            }

            // check that new map won't instantly deactivate/reactivate
            if (
                map.Count(p => p.Key.IsTriggered &&
                          p.Value is ModeAction &&
                          ((ModeAction)p.Value).IsMatch(modeName, !isActivate)
                          ) > 0
                )
            {
                return(false);
            }

            // check all triggered Triggers in current map to see if action is gone/different in new map
            foreach (var mapPair in _ActiveMap.Where(p => p.Key.IsTriggered))
            {
                if (!map.TryGetValue(mapPair.Key, out action))
                {
                    // mapping is gone...action should end
                    EndAction(action);
                }
                else if (!action.Equals(mapPair.Value))
                {
                    // different action...end old, begin new
                    EndAction(action);
                    BeginAction(mapPair.Value);
                }
            }

            // begin any new triggered action not present in current
            foreach (var mapPair in map)
            {
                if (mapPair.Key.IsTriggered && !_ActiveMap.ContainsKey(mapPair.Key))
                {
                    BeginAction(mapPair.Value);
                }
            }

            _ActiveMap = map;
            return(true);
        }