コード例 #1
0
ファイル: Send.LogInOut.cs プロジェクト: pie3467/aura
        /// <summary>
        /// Sends ChannelDisconnectR to client.
        /// </summary>
        /// <param name="client"></param>
        public static void ChannelDisconnectR(ChannelClient client)
        {
            var packet = new Packet(Op.DisconnectRequestR, MabiId.Channel);
            packet.PutByte(0);

            client.Send(packet);
        }
コード例 #2
0
        public static async Task <CompanyTopic> Create(ChannelClient client)
        {
            var companyNavigationTarget = new CompanyTopic(client);
            await companyNavigationTarget.Initialize();

            return(companyNavigationTarget);
        }
コード例 #3
0
ファイル: Send.World.cs プロジェクト: Vinna/aura-old
        /// <summary>
        /// Sends EntitiesAppear to client, unless entities is empty.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="entities"></param>
        public static void EntitiesAppear(ChannelClient client, IEnumerable <Entity> entities)
        {
            // Count() is much faster then creating a list, speed being
            // important in this method.
            var count = (short)entities.Count();

            if (count < 1)
            {
                return;
            }

            var packet = new Packet(Op.EntitiesAppear, MabiId.Broadcast);

            packet.PutShort(count);
            foreach (var entity in entities)
            {
                var data = Packet.Empty().AddPublicEntityInfo(entity).Build();

                packet.PutShort((short)entity.DataType);
                packet.PutInt(data.Length);
                packet.PutBin(data);
            }

            client.Send(packet);
        }
コード例 #4
0
 private void OnClientDisconnected(ChannelClient client)
 {
     if (client == this.LoginServer)
     {
         this.ConnectToLogin(false);
     }
 }
コード例 #5
0
	private void RebirthEventReceivePotion(ChannelClient client, Packet packet)
	{
		var entityId = packet.GetLong();
		var creature = client.GetCreatureSafe(packet.Id);

		if (!IsEventActive("new_rebirth_event"))
		{
			Send.MsgBox(creature, L("The event is over."));
			return;
		}

		var duration = PlayTimeNeeded;
		var startPlayTime = (long)creature.Vars.Perm[StartPlayTimeVar];
		var pastPlayTime = TimeSpan.FromSeconds(creature.PlayTime - startPlayTime);
		if (pastPlayTime < duration)
		{
			Send.MsgBox(creature, L("The time isn't over yet."));
			return;
		}

		creature.AcquireItem(Item.Create(RebirthPotion));

		ResetStart(creature);
		SendRebirthEventInfo(creature);
	}
コード例 #6
0
ファイル: new_rebirth_event.cs プロジェクト: xKamuna/aura-1
    private void RebirthEventReceivePotion(ChannelClient client, Packet packet)
    {
        var entityId = packet.GetLong();
        var creature = client.GetCreatureSafe(packet.Id);

        if (!IsEventActive("new_rebirth_event"))
        {
            Send.MsgBox(creature, L("The event is over."));
            return;
        }

        var duration      = PlayTimeNeeded;
        var startPlayTime = (long)creature.Vars.Perm[StartPlayTimeVar];
        var pastPlayTime  = TimeSpan.FromSeconds(creature.PlayTime - startPlayTime);

        if (pastPlayTime < duration)
        {
            Send.MsgBox(creature, L("The time isn't over yet."));
            return;
        }

        creature.AcquireItem(Item.Create(RebirthPotion));

        ResetStart(creature);
        SendRebirthEventInfo(creature);
    }
コード例 #7
0
 /// <summary>
 /// Initializes an instance of <see cref="YoutubeClient"/>.
 /// </summary>
 public YoutubeClient(HttpClient httpClient)
 {
     Videos    = new VideoClient(httpClient);
     Playlists = new PlaylistClient(httpClient);
     Channels  = new ChannelClient(httpClient);
     Search    = new SearchClient(httpClient);
 }
コード例 #8
0
        /// <summary>
        /// Logs incident, increases ban points, and bans account if appropriate.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="level"></param>
        /// <param name="report"></param>
        /// <param name="stacktrace"></param>
        public static void Incident(ChannelClient client, IncidentSeverityLevel level, string report, string stacktrace = null)
        {
            if (client.Account == null)
            {
                return;
            }

            switch (level)
            {
            case IncidentSeverityLevel.Mild: client.Account.AutobanScore += ChannelServer.Instance.Conf.Autoban.MildAmount; break;

            case IncidentSeverityLevel.Moderate: client.Account.AutobanScore += ChannelServer.Instance.Conf.Autoban.ModerateAmount; break;

            case IncidentSeverityLevel.Severe: client.Account.AutobanScore += ChannelServer.Instance.Conf.Autoban.SevereAmount; break;

            default:
                Log.Warning("Autoban.Incident: Unknown severity level {0}", level);
                goto case IncidentSeverityLevel.Mild;
            }

            Log.Info("Account '{0}' total ban score: {1}", client.Account.Id, client.Account.AutobanScore);

            client.Account.LastAutobanReduction = DateTime.Now;

            if (client.Account.AutobanScore >= ChannelServer.Instance.Conf.Autoban.BanAt)
            {
                Ban(client);
            }
        }
コード例 #9
0
 public SecurityViolationEventArgs(ChannelClient offender, IncidentSeverityLevel level, string report, string stacktrace)
 {
     this.Client      = offender;
     this.Level       = level;
     this.Report      = report;
     this.StackReport = stacktrace;
 }
コード例 #10
0
 /// <summary>
 /// Initializes an instance of <see cref="YoutubeClient"/>.
 /// </summary>
 internal YoutubeClient(YoutubeHttpClient httpClient)
 {
     Videos    = new VideoClient(httpClient);
     Playlists = new PlaylistClient(httpClient);
     Channels  = new ChannelClient(httpClient);
     Search    = new SearchClient(httpClient);
 }
コード例 #11
0
        /// <summary>
        /// Sends ChannelDisconnectR to client.
        /// </summary>
        /// <param name="client"></param>
        public static void ChannelDisconnectR(ChannelClient client)
        {
            var packet = new Packet(Op.DisconnectRequestR, MabiId.Channel);

            packet.PutByte(0);

            client.Send(packet);
        }
コード例 #12
0
        /// <summary>
        /// Sends GetChannelList to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="server"></param>
        public static void GetChannelListR(ChannelClient client, ServerInfo server)
        {
            var packet = new Packet(Op.GetChannelListR, MabiId.Channel);

            packet.AddServerInfo(server, ServerInfoType.Client);

            client.Send(packet);
        }
コード例 #13
0
        /// <summary>
        /// Sends DcUnkR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="val"></param>
        public static void DcUnkR(ChannelClient client, long val)
        {
            var packet = new Packet(Op.DcUnkR, MabiId.Channel);

            packet.PutLong(val);

            client.Send(packet);
        }
コード例 #14
0
        public void OnClientMessage(ChannelClient client, string message)
        {
            EventHandler <string> eventHandler = this.MessageReceived;

            if (eventHandler != null)
            {
                eventHandler(this, message);
            }
        }
コード例 #15
0
        /// <summary>
        /// Finds and joins to channel and sends response
        /// </summary>
        private async Task JoinChannel(MqClient client, TmqMessage message)
        {
            Channel channel = _server.FindChannel(message.Target);

            //if auto creation active, try to create channel
            if (channel == null && _server.Options.AutoChannelCreation)
            {
                channel = _server.FindOrCreateChannel(message.Target);
            }

            if (channel == null)
            {
                if (message.ResponseRequired)
                {
                    await client.SendAsync(MessageBuilder.ResponseStatus(message, KnownContentTypes.NotFound));
                }

                return;
            }

            ChannelClient found = channel.FindClient(client.UniqueId);

            if (found != null)
            {
                if (message.ResponseRequired)
                {
                    await client.SendAsync(MessageBuilder.ResponseStatus(message, KnownContentTypes.Ok));
                }

                return;
            }

            ClientJoinResult result = await channel.AddClient(client);

            if (message.ResponseRequired)
            {
                switch (result)
                {
                case ClientJoinResult.Success:
                    await client.SendAsync(MessageBuilder.ResponseStatus(message, KnownContentTypes.Ok));

                    break;

                case ClientJoinResult.Unauthorized:
                    await client.SendAsync(MessageBuilder.ResponseStatus(message, KnownContentTypes.Unauthorized));

                    break;

                case ClientJoinResult.Full:
                    await client.SendAsync(MessageBuilder.ResponseStatus(message, KnownContentTypes.LimitExceeded));

                    break;
                }
            }
        }
コード例 #16
0
    private void HandleMoonGateUse(ChannelClient client, Packet packet)
    {
        var origin      = packet.GetString();
        var destination = packet.GetString();

        var creature = client.GetCreatureSafe(packet.Id);

        var success = UseMoonGate(creature, origin, destination);

        SendMoonGateUseR(creature, success);
    }
コード例 #17
0
ファイル: Send.LogInOut.cs プロジェクト: pie3467/aura
        /// <summary>
        /// Sends ChannelLoginR to client.
        /// </summary>
        /// <remarks>
        /// Sending a negative response doesn't do anything.
        /// </remarks>
        public static void ChannelLoginR(ChannelClient client, long creatureId)
        {
            var packet = new Packet(Op.ChannelLoginR, MabiId.Channel);
            packet.PutByte(true);
            packet.PutLong(creatureId);
            packet.PutLong(DateTime.Now);
            packet.PutInt((int)DateTime.Now.DayOfWeek);
            packet.PutString(""); // http://211.218.233.238/korea/

            client.Send(packet);
        }
コード例 #18
0
        public async Task DemoRun_GetChannelHistoryAsync(RankAllPlatform platform, string userId)
        {
            //Arrange
            ChannelClient client = new ChannelClient();

            //Act
            var result = await client.GetChannelHistoryAsync(platform, userId);

            //Assert
            Assert.NotNull(result);
        }
コード例 #19
0
        /// <summary>
        /// Sends ChannelLoginR to client.
        /// </summary>
        /// <remarks>
        /// Sending a negative response doesn't do anything.
        /// </remarks>
        public static void ChannelLoginR(ChannelClient client, long creatureId)
        {
            var packet = new Packet(Op.ChannelLoginR, MabiId.Channel);

            packet.PutByte(true);
            packet.PutLong(creatureId);
            packet.PutLong(DateTime.Now);
            packet.PutInt((int)DateTime.Now.DayOfWeek);
            packet.PutString("");             // http://211.218.233.238/korea/

            client.Send(packet);
        }
コード例 #20
0
        private void ConnectToChannel()
        {
            ChannelConnectOptions opts = new ChannelConnectOptions(ChannelName)
            {
                Wait    = true,
                Payload = "Hello from donet"
            };

            _channelClient         = _fin.InterApplicationBus.Channel.CreateClient(opts);
            _channelClient.Opened += ChannelClient_Opened;
            _channelClient.Closed += ChannelClient_Closed;
            _channelClient.ConnectAsync();
        }
コード例 #21
0
        /// <summary>
        /// Sends ChannelCharacterInfoRequestR for creature to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="creature">Negative response if null</param>
        public static void ChannelCharacterInfoRequestR(ChannelClient client, Creature creature)
        {
            var packet = new Packet(Op.ChannelCharacterInfoRequestR, MabiId.Channel);

            packet.PutByte(creature != null);

            if (creature != null)
            {
                packet.AddCreatureInfo(creature, CreaturePacketType.Private);
            }

            client.Send(packet);
        }
コード例 #22
0
 private void AddClientToList(ChannelClient client)
 {
     Dispatcher.Invoke(() =>
     {
         clientCount++;
         var clientName = $"Child App {clientCount}";
         connectedClients.Items.Add(new
         {
             Name   = clientName,
             Client = client
         });
     });
 }
コード例 #23
0
 /// <summary>
 /// Запуск прослушивания очередей
 /// </summary>
 public void StartListeningQueues()
 {
     try
     {
         ChannelClient.BasicConsume(QueueClient, false, ConsumerClient);
         ChannelBook.BasicConsume(QueueBook, false, ConsumerBook);
     }
     catch (Exception exception)
     {
         Log.Error(exception.ToString);
         StopApplication();
     }
 }
コード例 #24
0
        /// <summary>
        /// Removes client from the channel, does not call MqClient's remove method
        /// </summary>
        internal async Task RemoveClientSilent(ChannelClient client)
        {
            _clients.Remove(client);

            if (EventHandler != null)
            {
                await EventHandler.OnClientLeft(client);
            }

            if (Options.DestroyWhenEmpty && _clients.Count == 0)
            {
                await CheckAutoDestroy();
            }
        }
コード例 #25
0
        /// <summary>
        /// Sends EnterRegionRequestR for creature to creature's client.
        /// </summary>
        /// <remarks>
        /// Negative response doesn't actually do anything, stucks.
        /// </remarks>
        /// <param name="client"></param>
        /// <param name="creature">Negative response if null</param>
        public static void EnterRegionRequestR(ChannelClient client, Creature creature)
        {
            var packet = new Packet(Op.EnterRegionRequestR, MabiId.Channel);

            packet.PutByte(creature != null);

            if (creature != null)
            {
                packet.PutLong(creature.EntityId);
                packet.PutLong(DateTime.Now);
            }

            client.Send(packet);
        }
コード例 #26
0
        internal static void Initialize(Runtime runtimeInstance)
        {
            intentListeners = new Dictionary <string, Action <ContextBase> >();
            channelClient   = runtimeInstance.InterApplicationBus.Channel.CreateClient(Fdc3ServiceConstants.ServiceChannel);

            registerChannelTopics();

            channelClient.ConnectAsync().ContinueWith(x =>
            {
                if (x.Exception == null)
                {
                    ConnectionInitializationComplete?.Invoke(x.Exception);
                }
            });
        }
コード例 #27
0
        internal Task InitializeAsync()
        {
            if (!string.IsNullOrEmpty(ConnectionManager.RuntimeInfo.FDC3ChannelName))
            {
                channelClient = ConnectionManager.RuntimeInstance.InterApplicationBus.Channel.CreateClient(ConnectionManager.RuntimeInfo.FDC3ChannelName, connectionAlias);
            }
            else
            {
                channelClient = ConnectionManager.RuntimeInstance.InterApplicationBus.Channel.CreateClient(Fdc3ServiceConstants.ServiceChannel, connectionAlias);
            }

            registerChannelTopics();

            return(channelClient.ConnectAsync());
        }
コード例 #28
0
        /// <summary>
        /// Start to process all pending messages.
        /// This method is called after a client is subscribed to the queue.
        /// </summary>
        private async Task ProcessPendingMessages(LinkedList <QueueMessage> list)
        {
            int max = list.Count;

            for (int i = 0; i < max; i++)
            {
                QueueMessage message;
                lock (list)
                {
                    if (list.Count == 0)
                    {
                        return;
                    }

                    message = list.First.Value;
                    list.RemoveFirst();
                    message.IsInQueue = false;
                }

                try
                {
                    ChannelClient cc = _queue.Channel.GetNextRRClient(ref _roundRobinIndex);
                    if (cc == null)
                    {
                        _queue.AddMessage(message, false);
                        break;
                    }

                    ProcessingMessage = message;
                    await ProcessMessage(message, cc);

                    ProcessingMessage = null;
                }
                catch (Exception ex)
                {
                    _queue.Info.AddError();
                    try
                    {
                        Decision decision = await _queue.DeliveryHandler.ExceptionThrown(_queue, message, ex);

                        await _queue.ApplyDecision(decision, message);
                    }
                    catch //if developer does wrong operation, we should not stop
                    {
                    }
                }
            }
        }
コード例 #29
0
ファイル: Send.World.cs プロジェクト: Kuukrow/aura
        /// <summary>
        /// Sends EntitiesDisappear to client, unless entities is empty.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="entities"></param>
        public static void EntitiesDisappear(ChannelClient client, IEnumerable<Entity> entities)
        {
            var count = (short)entities.Count();
            if (count < 1)
                return;

            var packet = new Packet(Op.EntitiesDisappear, MabiId.Broadcast);
            packet.PutShort(count);
            foreach (var entity in entities)
            {
                packet.PutShort((short)entity.DataType);
                packet.PutLong(entity.EntityId);
            }

            client.Send(packet);
        }
コード例 #30
0
	private void RebirthEventInfoRequest(ChannelClient client, Packet packet)
	{
		var entityId = packet.GetLong();
		var creature = client.GetCreatureSafe(packet.Id);

		if (!IsEventActive("new_rebirth_event"))
		{
			Send.MsgBox(creature, L("The event is over."));
			return;
		}

		if (creature.Vars.Perm[StartPlayTimeVar] == null)
			return;

		SendRebirthEventInfo(creature);
	}
コード例 #31
0
        public MythServiceHost(string mythTvPath, string username, string password)
        {
            _password = password;
            _userName = username;
            _mythTvPath = new Uri(mythTvPath);

            _binding = new BasicHttpBinding();
            _binding.MaxReceivedMessageSize = int.MaxValue;

            if (!string.IsNullOrWhiteSpace(username) || !string.IsNullOrWhiteSpace(password))
            {
                _binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            }

            _mythAddress = new EndpointAddress(string.Format("{0}/Myth", mythTvPath));
            _guideAddress = new EndpointAddress(string.Format("{0}/Guide", mythTvPath));
            _videoAddress = new EndpointAddress(string.Format("{0}/Video", mythTvPath));
            _dvrAddress = new EndpointAddress(string.Format("{0}/Dvr", mythTvPath));
            _contentAddress = new EndpointAddress(string.Format("{0}/Content", mythTvPath));
            _channelAddress = new EndpointAddress(string.Format("{0}/Channel", mythTvPath));
            _captureAddress = new EndpointAddress(string.Format("{0}/Capture", mythTvPath));


            DvrService = new DvrClient(_binding, _dvrAddress);
            MythService = new MythClient(_binding, _mythAddress);
            GuideService = new GuideClient(_binding, _guideAddress);
            VideoService = new VideoClient(_binding, _videoAddress);
            ContentService = new ContentClient(_binding, _contentAddress);
            ChannelService = new ChannelClient(_binding, _channelAddress);
            CaptureService = new CaptureClient(_binding, _captureAddress);

            DvrService.ClientCredentials.UserName.UserName = _userName;
            DvrService.ClientCredentials.UserName.Password = _password;
            MythService.ClientCredentials.UserName.UserName = _userName;
            MythService.ClientCredentials.UserName.Password = _password;
            GuideService.ClientCredentials.UserName.UserName = _userName;
            GuideService.ClientCredentials.UserName.Password = _password;
            VideoService.ClientCredentials.UserName.UserName = _userName;
            VideoService.ClientCredentials.UserName.Password = _password;
            ContentService.ClientCredentials.UserName.UserName = _userName;
            ContentService.ClientCredentials.UserName.Password = _password;
            ChannelService.ClientCredentials.UserName.UserName = _userName;
            ChannelService.ClientCredentials.UserName.Password = _password;
            CaptureService.ClientCredentials.UserName.UserName = _userName;
            CaptureService.ClientCredentials.UserName.Password = _password;
        }
コード例 #32
0
        public MythServiceHost(string mythTvPath, string username, string password)
        {
            _password   = password;
            _userName   = username;
            _mythTvPath = new Uri(mythTvPath);

            _binding = new BasicHttpBinding();
            _binding.MaxReceivedMessageSize = int.MaxValue;

            if (!string.IsNullOrWhiteSpace(username) || !string.IsNullOrWhiteSpace(password))
            {
                _binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            }

            _mythAddress    = new EndpointAddress(string.Format("{0}/Myth", mythTvPath));
            _guideAddress   = new EndpointAddress(string.Format("{0}/Guide", mythTvPath));
            _videoAddress   = new EndpointAddress(string.Format("{0}/Video", mythTvPath));
            _dvrAddress     = new EndpointAddress(string.Format("{0}/Dvr", mythTvPath));
            _contentAddress = new EndpointAddress(string.Format("{0}/Content", mythTvPath));
            _channelAddress = new EndpointAddress(string.Format("{0}/Channel", mythTvPath));
            _captureAddress = new EndpointAddress(string.Format("{0}/Capture", mythTvPath));


            DvrService     = new DvrClient(_binding, _dvrAddress);
            MythService    = new MythClient(_binding, _mythAddress);
            GuideService   = new GuideClient(_binding, _guideAddress);
            VideoService   = new VideoClient(_binding, _videoAddress);
            ContentService = new ContentClient(_binding, _contentAddress);
            ChannelService = new ChannelClient(_binding, _channelAddress);
            CaptureService = new CaptureClient(_binding, _captureAddress);

            DvrService.ClientCredentials.UserName.UserName     = _userName;
            DvrService.ClientCredentials.UserName.Password     = _password;
            MythService.ClientCredentials.UserName.UserName    = _userName;
            MythService.ClientCredentials.UserName.Password    = _password;
            GuideService.ClientCredentials.UserName.UserName   = _userName;
            GuideService.ClientCredentials.UserName.Password   = _password;
            VideoService.ClientCredentials.UserName.UserName   = _userName;
            VideoService.ClientCredentials.UserName.Password   = _password;
            ContentService.ClientCredentials.UserName.UserName = _userName;
            ContentService.ClientCredentials.UserName.Password = _password;
            ChannelService.ClientCredentials.UserName.UserName = _userName;
            ChannelService.ClientCredentials.UserName.Password = _password;
            CaptureService.ClientCredentials.UserName.UserName = _userName;
            CaptureService.ClientCredentials.UserName.Password = _password;
        }
コード例 #33
0
ファイル: sealstones.cs プロジェクト: asuralove/HyddwnServer
    private CommandResult HandleResetSealStone(ChannelClient client, Creature sender, Creature target, string message, IList <string> args)
    {
        if (args.Count < 2 || !sealStones.Contains(args[1].ToLower()))
        {
            Send.ServerMessage(sender, L("Seal Stones: ") + string.Join(", ", sealStones));
            return(CommandResult.InvalidArgument);
        }

        var ident = args[1].ToLower();

        GlobalVars.Perm["SealStoneId" + ident]   = null;
        GlobalVars.Perm["SealStoneName" + ident] = null;

        Send.ServerMessage(sender, L("The seal stone's variables were reset, restart server or reload scripts to make it whole again."));

        return(CommandResult.Okay);
    }
コード例 #34
0
ファイル: RoundRobinQueueState.cs プロジェクト: ciker/twino
        public async Task <PushResult> Push(QueueMessage message)
        {
            ChannelClient cc = _queue.Channel.GetNextRRClient(ref _roundRobinIndex);

            if (cc == null)
            {
                _queue.AddMessage(message, false);
                return(PushResult.NoConsumers);
            }

            ProcessingMessage = message;
            PushResult result = await ProcessMessage(message, cc);

            ProcessingMessage = null;

            return(result);
        }
コード例 #35
0
ファイル: new_rebirth_event.cs プロジェクト: xKamuna/aura-1
    private void RebirthEventInfoRequest(ChannelClient client, Packet packet)
    {
        var entityId = packet.GetLong();
        var creature = client.GetCreatureSafe(packet.Id);

        if (!IsEventActive("new_rebirth_event"))
        {
            Send.MsgBox(creature, L("The event is over."));
            return;
        }

        if (creature.Vars.Perm[StartPlayTimeVar] == null)
        {
            return;
        }

        SendRebirthEventInfo(creature);
    }
コード例 #36
0
ファイル: Send.World.cs プロジェクト: Kuukrow/aura
        /// <summary>
        /// Sends EntitiesAppear to client, unless entities is empty.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="entities"></param>
        public static void EntitiesAppear(ChannelClient client, IEnumerable<Entity> entities)
        {
            var count = (short)entities.Count();
            if (count < 1)
                return;

            var packet = new Packet(Op.EntitiesAppear, MabiId.Broadcast);
            packet.PutShort(count);
            foreach (var entity in entities)
            {
                var data = Packet.Empty().AddPublicEntityInfo(entity).Build(false);

                packet.PutShort((short)entity.DataType);
                packet.PutInt(data.Length);
                packet.PutBin(data);
            }

            client.Send(packet);
        }
コード例 #37
0
        private OpenFinProxy()
        {
            string unique = Guid.NewGuid().ToString();

            _runtime = Runtime.GetRuntimeInstance(new RuntimeOptions
            {
                //Version = "19.89.60.5",
                Version = "18.87.55.19"
                          //UUID = unique //ProcessHelper.IsOms ? EzeOMSUuid : NonEzeOMSUuid
            });

            // get command line args, check to see if we’re running as the “server”
            string[] commandLine = Environment.GetCommandLineArgs();

            bool isChannelProvider = bool.Parse(commandLine[1]);

            _runtime.Connect(async() =>
            {
                Console.WriteLine("----------------------- Application connected to OpenFin -----------------------");

                if (isChannelProvider)
                {
                    _channelProvider = _runtime.InterApplicationBus.Channel.CreateProvider("1");
                    _channelProvider.RegisterTopic <string>("SayHello", (payload) => { return($"Hello {payload}!"); });
                    Console.WriteLine("----------------------- Channel 1 created  -----------------------");
                }
                else
                {
                    // "may" be an issue
                    //_channelClient = _runtime.InterApplicationBus.Channel.CreateClient(new ChannelConnectOptions("1")
                    //{
                    //	Wait = true
                    //});
                    _channelClient = _runtime.InterApplicationBus.Channel.CreateClient("1");

                    await _channelClient.ConnectAsync();                     // await here never finishes, and without connection, the sub/pub fails
                    Debugger.Launch();
                    Console.WriteLine("----------------------- ChannelClient created  -----------------------");
                }

                IsConnected = true;
            });
        }
コード例 #38
0
ファイル: Send.World.cs プロジェクト: tkiapril/aura
		/// <summary>
		/// Sends EntitiesAppear to client, unless entities is empty.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="entities"></param>
		public static void EntitiesAppear(ChannelClient client, IEnumerable<Entity> entities)
		{
			// Count() is much faster then creating a list, speed being
			// important in this method.
			var count = (short)entities.Count();
			if (count < 1)
				return;

			var packet = new Packet(Op.EntitiesAppear, MabiId.Broadcast);
			packet.PutShort(count);
			foreach (var entity in entities)
			{
				var data = Packet.Empty().AddPublicEntityInfo(entity).Build();

				packet.PutShort((short)entity.DataType);
				packet.PutInt(data.Length);
				packet.PutBin(data);
			}

			client.Send(packet);
		}
コード例 #39
0
ファイル: Send.LogInOut.cs プロジェクト: Rai/aura
		/// <summary>
		/// Sends DcUnkR to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="val"></param>
		public static void DcUnkR(ChannelClient client, long val)
		{
			var packet = new Packet(Op.DcUnkR, MabiId.Channel);
			packet.PutLong(val);

			client.Send(packet);
		}
コード例 #40
0
ファイル: moongates.cs プロジェクト: kangtianyu/aura
	private void MoonGateUse(ChannelClient client, Packet packet)
	{
		var origin = packet.GetString();
		var destination = packet.GetString();

		var creature = client.GetCreatureSafe(packet.Id);

		// Check gates
		MoonGate originGate, destinationGate;
		if (!gatesStr.TryGetValue(origin, out originGate) || !gatesStr.TryGetValue(destination, out destinationGate))
		{
			Send.Notice(creature, Localization.Get("This moon gate is currently not operable. Please report."));
			return;
		}

		// Check origin gate
		if (originGate.Prop.State == "closed")
		{
			// Don't log, someone could be waiting with the map open and
			// select a destination too late.
			SendMoonGateUseR(creature, false);
			return;
		}

		// Check range to origin gate
		if (creature.RegionId != originGate.Prop.Info.Region || !creature.GetPosition().InRange(originGate.Prop.GetPosition(), 1000))
		{
			// Could happen due to desync? The range at least.
			SendMoonGateUseR(creature, false);
			return;
		}

		// Check if char has target
		if (!CanUseGate(creature, destinationGate))
		{
			Log.Warning("MoongateScript.MoonGateUse: Creature '{0:X16}' tried to warp to moon gate that he can't use.", creature.EntityId);
			SendMoonGateUseR(creature, false);
			return;
		}

		creature.Warp(destinationGate.Prop.GetLocation());

		SendMoonGateUseR(creature, true);
	}
コード例 #41
0
ファイル: Send.Character.cs プロジェクト: tkiapril/aura
		/// <summary>
		/// Sends EnterRegionRequestR for creature to creature's client.
		/// </summary>
		/// <remarks>
		/// Negative response doesn't actually do anything, stucks.
		/// </remarks>
		/// <param name="client"></param>
		/// <param name="creature">Negative response if null</param>
		public static void EnterRegionRequestR(ChannelClient client, Creature creature)
		{
			var packet = new Packet(Op.EnterRegionRequestR, MabiId.Channel);
			packet.PutByte(creature != null);

			if (creature != null)
			{
				packet.PutLong(creature.EntityId);
				packet.PutLong(DateTime.Now);
			}

			client.Send(packet);
		}
コード例 #42
0
ファイル: Send.Character.cs プロジェクト: tkiapril/aura
		/// <summary>
		/// Sends negative ChannelCharacterInfoRequestR to client.
		/// </summary>
		/// <param name="client"></param>
		public static void ChannelCharacterInfoRequestR_Fail(ChannelClient client)
		{
			ChannelCharacterInfoRequestR(client, null);
		}
コード例 #43
0
ファイル: Send.Character.cs プロジェクト: tkiapril/aura
		/// <summary>
		/// Sends ChannelCharacterInfoRequestR for creature to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="creature">Negative response if null</param>
		public static void ChannelCharacterInfoRequestR(ChannelClient client, Creature creature)
		{
			var packet = new Packet(Op.ChannelCharacterInfoRequestR, MabiId.Channel);
			packet.PutByte(creature != null);

			if (creature != null)
			{
				packet.AddCreatureInfo(creature, CreaturePacketType.Private);
			}

			client.Send(packet);
		}
コード例 #44
0
ファイル: Send.LogInOut.cs プロジェクト: Rai/aura
		/// <summary>
		/// Sends GetChannelList to client.
		/// </summary>
		/// <param name="client"></param>
		/// <param name="server"></param>
		public static void GetChannelListR(ChannelClient client, ServerInfo server)
		{
			var packet = new Packet(Op.GetChannelListR, MabiId.Channel);
			packet.AddServerInfo(server, ServerInfoType.Client);

			client.Send(packet);
		}
コード例 #45
0
ファイル: moongates.cs プロジェクト: tkiapril/aura
	private void HandleMoonGateUse(ChannelClient client, Packet packet)
	{
		var origin = packet.GetString();
		var destination = packet.GetString();

		var creature = client.GetCreatureSafe(packet.Id);

		var success = UseMoonGate(creature, origin, destination);

		SendMoonGateUseR(creature, success);
	}
コード例 #46
0
ファイル: moongates.cs プロジェクト: tkiapril/aura
	private void HandleMoonGateInfoRequest(ChannelClient client, Packet packet)
	{
		var creature = client.GetCreatureSafe(packet.Id);

		SendMoonGateInfoRequestR(creature, currentGateKeyword, nextGateKeyword);
	}
コード例 #47
0
ファイル: jail.cs プロジェクト: xKamuna/aura
	public CommandResult JailCommand(ChannelClient client, Creature sender, Creature target, string message, IList<string> args)
	{
		if (args.Count < 3)
			return CommandResult.InvalidArgument;

		var name = args[1];

		TimeSpan duration;
		if(args[2] == "life")
		{
			duration = TimeSpan.FromDays(7 * 20); // 7 days * 20 = 20 Erinn years
		}
		else if (!TimeSpan.TryParse(args[2], out duration))
		{
			Send.ServerMessage(sender, Localization.Get("Invalid duration format Examples: 2 (2 days), 2:00 (2 hours), 0:05 (5 minutes)"), name);
			return CommandResult.Okay;
		}

		var creature = ChannelServer.Instance.World.GetPlayer(name);
		if (creature == null)
		{
			Send.ServerMessage(sender, Localization.Get("Character '{0}' not found."), name);
			return CommandResult.Okay;
		}

		JailScript.Jail(creature, duration);

		Send.ServerMessage(sender, Localization.Get("Jailed '{0}' for {1}."), name, FormatTS(duration));
		Send.ServerMessage(creature, Localization.Get("You've been jailed for {0} by {1}."), FormatTS(duration), sender.Name);

		return CommandResult.Okay;
	}