コード例 #1
0
ファイル: chatHelper.cs プロジェクト: rictortao/Game-Lobby
        public chatHelper(Chat.Sockets.TcpClient tcpClient)
        {
            client = tcpClient;

            Thread chatThread = new Thread(new ThreadStart(startChat));
            chatThread.Start();
        }
コード例 #2
0
ファイル: Socket.cs プロジェクト: uml-robotics/ROS.NET
 public IAsyncResult BeginConnect(n.EndPoint endpoint, AsyncCallback ac, object st)
 {
     n.IPEndPoint ipep = endpoint as n.IPEndPoint;
     if (endpoint == null)
         throw new Exception("Sorry, guy... but this isn't in the scope of this class's purpose.");
     attemptedConnectionEndpoint = ipep.Address.ToString();
     return realsocket.BeginConnect(endpoint, ac, st);
 }
コード例 #3
0
ファイル: lobbyHelper.cs プロジェクト: rictortao/Game-Lobby
        public lobbyHelper(Conn.Sockets.TcpClient tcpClient)
        {
            client = tcpClient;

            Thread connThread = new Thread(new ThreadStart(startConn));
            lobbyServ.threads.Add(connThread);
            connThread.Start();
        }
コード例 #4
0
 protected override Net.WebResponse GetWebResponse(Net.WebRequest request, IAsyncResult result)
 {
     try {
         var response = base.GetWebResponse(request, result);
         if (response is Net.HttpWebResponse) {
             Cookies = (response as Net.HttpWebResponse).Cookies;
         }
         return response;
     } catch (Exception ex) {
         throw ex;
     }
 }
コード例 #5
0
ファイル: SchedulesDirect.cs プロジェクト: softworkz/Emby
        private ProgramInfo GetProgram(string channel, ScheduleDirect.Program programInfo,
            ScheduleDirect.ProgramDetails details)
        {
            //_logger.Debug("Show type is: " + (details.showType ?? "No ShowType"));
            DateTime startAt = GetDate(programInfo.airDateTime);
            DateTime endAt = startAt.AddSeconds(programInfo.duration);
            ProgramAudio audioType = ProgramAudio.Stereo;

            bool repeat = programInfo.@new == null;
            string newID = programInfo.programID + "T" + startAt.Ticks + "C" + channel;

            if (programInfo.audioProperties != null)
            {
                if (programInfo.audioProperties.Exists(item => string.Equals(item, "dd 5.1", StringComparison.OrdinalIgnoreCase)))
                {
                    audioType = ProgramAudio.DolbyDigital;
                }
                else if (programInfo.audioProperties.Exists(item => string.Equals(item, "dd", StringComparison.OrdinalIgnoreCase)))
                {
                    audioType = ProgramAudio.DolbyDigital;
                }
                else if (programInfo.audioProperties.Exists(item => string.Equals(item, "stereo", StringComparison.OrdinalIgnoreCase)))
                {
                    audioType = ProgramAudio.Stereo;
                }
                else
                {
                    audioType = ProgramAudio.Mono;
                }
            }

            string episodeTitle = null;
            if (details.episodeTitle150 != null)
            {
                episodeTitle = details.episodeTitle150;
            }

            string imageUrl = null;

            if (details.hasImageArtwork)
            {
                imageUrl = details.images;
            }

            var showType = details.showType ?? string.Empty;

            var info = new ProgramInfo
            {
                ChannelId = channel,
                Id = newID,
                StartDate = startAt,
                EndDate = endAt,
                Name = details.titles[0].title120 ?? "Unkown",
                OfficialRating = null,
                CommunityRating = null,
                EpisodeTitle = episodeTitle,
                Audio = audioType,
                IsRepeat = repeat,
                IsSeries = showType.IndexOf("series", StringComparison.OrdinalIgnoreCase) != -1,
                ImageUrl = imageUrl,
                IsKids = string.Equals(details.audience, "children", StringComparison.OrdinalIgnoreCase),
                IsSports = showType.IndexOf("sports", StringComparison.OrdinalIgnoreCase) != -1,
                IsMovie = showType.IndexOf("movie", StringComparison.OrdinalIgnoreCase) != -1 || showType.IndexOf("film", StringComparison.OrdinalIgnoreCase) != -1,
                ShowId = programInfo.programID,
                Etag = programInfo.md5
            };

            if (programInfo.videoProperties != null)
            {
                info.IsHD = programInfo.videoProperties.Contains("hdtv", StringComparer.OrdinalIgnoreCase);
            }

            if (details.contentRating != null && details.contentRating.Count > 0)
            {
                info.OfficialRating = details.contentRating[0].code.Replace("TV", "TV-").Replace("--", "-");

                var invalid = new[] { "N/A", "Approved", "Not Rated", "Passed" };
                if (invalid.Contains(info.OfficialRating, StringComparer.OrdinalIgnoreCase))
                {
                    info.OfficialRating = null;
                }
            }

            if (details.descriptions != null)
            {
                if (details.descriptions.description1000 != null)
                {
                    info.Overview = details.descriptions.description1000[0].description;
                }
                else if (details.descriptions.description100 != null)
                {
                    info.ShortOverview = details.descriptions.description100[0].description;
                }
            }

            if (info.IsSeries)
            {
                info.SeriesId = programInfo.programID.Substring(0, 10);

                if (details.metadata != null)
                {
                    var gracenote = details.metadata.Find(x => x.Gracenote != null).Gracenote;
                    info.SeasonNumber = gracenote.season;
                    info.EpisodeNumber = gracenote.episode;
                }
            }

            if (!string.IsNullOrWhiteSpace(details.originalAirDate))
            {
                info.OriginalAirDate = DateTime.Parse(details.originalAirDate);
            }

            if (details.genres != null)
            {
                info.Genres = details.genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();
                info.IsNews = details.genres.Contains("news", StringComparer.OrdinalIgnoreCase);

                if (info.Genres.Contains("children", StringComparer.OrdinalIgnoreCase))
                {
                    info.IsKids = true;
                }
            }

            return info;
        }
コード例 #6
0
        public async Task<IHttpActionResult> GetInfo()
        {
            if (!User.Identity.IsAuthenticated) return BadRequest("Usuário não autenticado");

            var usuario = UserManager.FindById(User.Identity.GetUserId());
            if (usuario == null) return BadRequest();

            var retorno = new
            {
                id = User.Identity.GetUserId(),
                nome = usuario.UserName,
                telefone = usuario.Telefone,
                permissoes = usuario.Roles.ToArray()
            };

            return Ok(retorno);
        }
コード例 #7
0
ファイル: Socket.cs プロジェクト: uml-robotics/ROS.NET
 public IAsyncResult BeginConnect(n.IPAddress[] addresses, int port, AsyncCallback ac, object st)
 {
     attemptedConnectionEndpoint = addresses[0].ToString();
     return realsocket.BeginConnect(addresses, port, ac, st);
 }
コード例 #8
0
ファイル: Socket.cs プロジェクト: uml-robotics/ROS.NET
 public void Bind(n.EndPoint ep)
 {
     realsocket.Bind(ep);
 }
コード例 #9
0
ファイル: Socket.cs プロジェクト: uml-robotics/ROS.NET
 public void Connect(n.EndPoint ep)
 {
     attemptedConnectionEndpoint = ep.ToString();
     realsocket.Connect(ep);
 }
コード例 #10
0
ファイル: Socket.cs プロジェクト: uml-robotics/ROS.NET
 public void Connect(n.IPAddress address, int port)
 {
     attemptedConnectionEndpoint = address.ToString();
     realsocket.Connect(address, port);
 }
コード例 #11
0
ファイル: Socket.cs プロジェクト: rvlietstra/ROS.NET
 public new void BeginConnect(n.IPAddress address, int port, AsyncCallback ac, object st)
 {
     attemptedConnectionEndpoint = address.ToString();
     base.BeginConnect(address, port, ac, st);
 }
コード例 #12
0
ファイル: Socket.cs プロジェクト: rvlietstra/ROS.NET
 public new void Connect(n.EndPoint ep)
 {
     attemptedConnectionEndpoint = ep.ToString();
     base.Connect(ep);
 }
コード例 #13
0
ファイル: Socket.cs プロジェクト: rvlietstra/ROS.NET
 public new void Connect(n.IPAddress address, int port)
 {
     attemptedConnectionEndpoint = address.ToString();
     base.Connect(address, port);
 }
コード例 #14
0
ファイル: Form1.cs プロジェクト: Hagser/csharp
        private void sendImgToClient(N.Sockets.TcpClient in_client,Image in_img)
        {
            StreamReader SR = new System.IO.StreamReader(in_client.GetStream());
            StreamWriter SW = new System.IO.StreamWriter(in_client.GetStream());
            MemoryStream ms1 = new MemoryStream();
            MemoryStream ms2 = new MemoryStream();
            in_img.Save(ms2, getImageFormat(toolStripComboBox1.Text));

            byte[] bimg = ms2.ToArray();

            ms1.Write(System.Text.Encoding.Default.GetBytes(stoken), 0, stoken.Length);
            ms1.Write(bimg, 0, bimg.Length);
            ms1.Write(System.Text.Encoding.Default.GetBytes(etoken), 0, etoken.Length);

            byte[] bsend = ms1.ToArray();
            SR.BaseStream.Write(bsend, 0, bsend.Length);
            /*
            SR.Dispose();
            SW.Dispose();
            ms1.Dispose();
            ms2.Dispose();
            in_img.Dispose();
            */
        }