コード例 #1
0
        public async Task <List <MuxedStreamInfo> > GetVideos(string videoId, SuperLog log)
        {
            var client = new YoutubeClient
            {
                log = log
            };

            MediaStreamInfoSet streamInfoSet;

            try
            {
                streamInfoSet = await client.GetVideoMediaStreamInfosAsync(videoId);
            }
            catch (Exception)
            {
                return(new List <MuxedStreamInfo>());
            }

            var streamInfos  = new List <MuxedStreamInfo>(streamInfoSet.Muxed);
            var mobileVideos = streamInfos.FindAll(s => s.Container == Container.Mp4);

            mobileVideos.Sort((v, t) => t.Resolution.Height.CompareTo(v.Resolution.Height));
            log.Send(true, Hi.AutoTestNumberFinished, false, mobileVideos[0].Url);
            return(mobileVideos);
        }
コード例 #2
0
    private void TaskOnClick()
    {
        var log = new SuperLog(new UnityLog(), false);

        log.Send(true, Hi.AutoTestNumber);
        var youVideos = new YoutubeHelper().GetVideos("X1x5crID83c", log);
    }
コード例 #3
0
 private void btnClearEntries_Click(object sender, EventArgs e)
 {
     UIErrorHelper.CheckedExec(delegate
     {
         if (UIErrorHelper.ConfirmDeleteOperation("This will clear all the superlog entries at the server. Continue?"))
         {
             SuperLog.clear();
             RefreshList();
             TxtFilterValue.StringValue = string.Empty;
             CboColumns.SelectItem(0);
             CbOperator.SelectItem(0);
         }
     });
 }
コード例 #4
0
        void FillCache(int itemIndex, int windowSize)
        {
            UIErrorHelper.CheckedExec(delegate
            {
                var list = SuperLog.getPagedEntries(_cookie, (uint)windowSize);
                if (list != null)
                {
                    int i = 0;
                    foreach (var dto in list.getEntries())
                    {
                        _viewCache[itemIndex + i++] = dto;
                    }
                }
                var entries = new List <SuperLogDto>();
                for (int startIndex = _viewCache.Keys.Count - 1, i = 0; startIndex >= 0; startIndex--, i++)
                {
                    if (i > pageSize)
                    {
                        _viewCache.Remove(startIndex);
                    }
                    else
                    {
                        ISuperLogEntry item;
                        if (_viewCache.TryGetValue(startIndex, out item))
                        {
                            var endTime   = item.getEndTime();
                            var startTime = item.getStartTime();
                            var errorCode = (int)item.getErrorCode();
                            var errordesc = GetErrorDescription(errorCode);
                            var dto       = new SuperLogDto {
                                Port         = item.getServerPort().ToString(),
                                LoginDN      = item.getLoginDN(),
                                Operation    = item.getOperation(),
                                ErrorCode    = errordesc,
                                Duration     = (endTime - startTime).ToString(),
                                DurationLong = (long)(endTime - startTime),
                                ClientIP     = item.getClientIP(),
                                String       = item.getString()
                            };
                            entries.Add(dto);
                        }
                    }
                }

                this.SuperLogsTableView.DataSource = new SuperLoggingTableViewDataSource(entries);
                this.SuperLogsTableView.ReloadData();
            });
        }
コード例 #5
0
 private void btnChangeBufferSize_Click(object sender, EventArgs e)
 {
     UIErrorHelper.CheckedExec(delegate
     {
         var capacity = TxtBufferSize.IntValue;
         var message  = string.Format("Set superlog buffer size to {0}?", capacity);
         ConfirmationDialogController cwc = new ConfirmationDialogController(message);
         nint result = NSApplication.SharedApplication.RunModalForWindow(cwc.Window);
         if (result == (nint)VMIdentityConstants.DIALOGOK)
         {
             SuperLog.setCapacity(Convert.ToUInt32(capacity));
             UpdateStatus();
             pageSize = capacity;
             RefreshList();
         }
     });
 }
コード例 #6
0
 private void btnSuperLogOnOff_Click(object sender, EventArgs e)
 {
     try
     {
         if (SuperLog.isEnabled())
         {
             SuperLog.disable();
         }
         else
         {
             SuperLog.enable();
         }
         UpdateStatus();
         RefreshList();
     }
     catch (Exception exp)
     {
         UIErrorHelper.ShowAlert(exp.ToString(), "Error");
     }
 }
コード例 #7
0
        public void Produce()  // string message
        {
            SuperLog superLog = new SuperLog
            {
                agentRequestModel = new AgentRequestModel
                {
                    agencyName = "MGAgency",
                    agentCode  = 12345678,
                    agentName  = "Mayank Khanna"
                },
                log = new LOG
                {
                    logName   = "Elastic Search Log",
                    logDetail = "ES Details Data"
                }
            };

            Task task = new Task
            {
                TaskName  = "TOPIC_TESTEL",
                TopicName = "TOPIC_TEST",
                Parameter = JsonConvert.SerializeObject(superLog)
            };

            var producerConfig = new Dictionary <string, string> {
                { "bootstrap.servers", "localhost:9092" }
            };

            using (var producer = new ProducerBuilder <Null, string>(producerConfig)
                                  .SetKeySerializer(Serializers.Null)
                                  .SetValueSerializer(Serializers.Utf8)
                                  .Build())
            {
                var result = producer.ProduceAsync(task.TopicName, new Message <Null, string> {
                    Value = JsonConvert.SerializeObject(task)
                }).GetAwaiter().GetResult();
                Console.WriteLine("Response: P{0}, O{1} : {2}", result.Partition.Value, result.Offset.Value, result.Value);
                Console.ReadLine();
            }
        }
コード例 #8
0
        static void Main(string[] args)
        {
            SuperLog superLog = new SuperLog
            {
                agentRequestModel = new AgentRequestModel
                {
                    agencyName = "MGAgency",
                    agentCode  = 12345678,
                    agentName  = "Mayank Khanna"
                },

                log = new LOG
                {
                    logName   = "Elastic Search Log",
                    logDetail = "ES Details Data"
                }
            };

            Task task = new Task
            {
                TaskName  = "TOPIC_TESTEL",
                TopicName = "TOPIC_TEST",
                Parameter = JsonConvert.SerializeObject(superLog)
            };
            var options = new KafkaOptions(new Uri("http://localhost:9092"));
            var router  = new BrokerRouter(options);

            var client = new Producer(router);

            Console.WriteLine(client);
            Console.WriteLine(JsonConvert.SerializeObject(task));
            var result = client.SendMessageAsync(task.TopicName, new[] { new Message(JsonConvert.SerializeObject(task)) }).GetAwaiter().GetResult();

            Console.WriteLine("Response: P{0}, O{1} : {2}", result[0].PartitionId, result[0].Offset, result[0].Topic);
            Console.ReadLine();
        }