Beispiel #1
0
        public static void Main(string[] args)
        {
            //string fileName = "C:\\Ksenia\\states.json";
            //Dictionary<string, JArray> states = JsonSerializer.Deserialize<Dictionary<string, JArray>>(fileName);

            IStateService stateService = new StateServiceImpl();
            string        s            = stateService.GetClossestStateByTweet(new Tweet(12, 11, new DateTime(), "asd"));

            //List<State> states = stateService.GetStates();
            //int count = states[1].Coordinates[0].Count();

            //double count = Double.Parse(states[0].Coordinates[0].Count);
            //ITweetService tweetService = new TweetServiceImpl();
            //List<Tweet> tweets = tweetService.GetTweets();
            //List<string[]> tweetWords = tweetService.ExtractTweetWords();
            Console.WriteLine();
        }
        public MainWindow()
        {
            InitializeComponent();
            //string fileName = "C:\\Ksenia\\states.json";
            //Dictionary<string, JArray> states = JsonSerializer.Deserialize<Dictionary<string, JArray>>(fileName);
            //Polygon polygon = new Polygon();
            //Point point1 = new Point(1, 2);
            //Point point2 = new Point(3, 4);
            //Point point3 = new Point(4, 1);

            //PointCollection points1 = new PointCollection();
            //PointCollection points2 = new PointCollection();
            //PointCollection points3 = new PointCollection();
            //points1.Add(point1);
            //points1.Add(point3);
            //points1.Add(point2);
            //points1.Add(point3);
            //points1.Add(point1);
            //points1.Add(point2);
            //points1.Add(point3);

            //polygon.Points = points1;
            IStateService stateService = new StateServiceImpl();

            SolidColorBrush[] brushes = new SolidColorBrush[] { Brushes.Gray, Brushes.Blue, Brushes.White, Brushes.Green, Brushes.Yellow,
                                                                Brushes.Orange, Brushes.AliceBlue, Brushes.Azure, Brushes.BurlyWood, Brushes.Violet };
            foreach (State state in stateService.GetStates())
            {
                Polygon polygon = DrawingUtility.DrawMapByCoordinates(state.Coordinates);
                // Stroke="Blue" StrokeThickness="1" Fill="Yellow"
                polygon.Stroke = Brushes.Black;
                polygon.Width  = 900;
                polygon.Height = 900;

                Random random = new Random();
                polygon.Fill            = brushes[random.Next(0, 10)];
                polygon.StrokeThickness = 1;


                aaa.Children.Add(polygon);
            }
            Console.WriteLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var    a = CreatePublishTokenAuth("anonymous", "anonymousRoom");
            string roomNum;
            string userId;
            int    action;

            TryVertifyTokenAuth(a, out roomNum, out userId, out action);
            Console.ReadLine();
            //var callbackInfo =
            //    "rtmp://rtmp.520zhonghua.com/live/?room=201711309601022&publisher=2ddb4253-a838-415a-8ca0-dfd1565943ff&expireTime=694054656000000000&token=aee1ecd9dadf95adac4ca30e10adae94";
            //var pairs = callbackInfo.Split("?".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            //string userId, roomnum;
            //int action;
            //TryVertifyTokenAuth(pairs[1], out userId,out roomnum,out action);
            //string host = "172.28.10.136";
            //string hostUrl = "172.28.10.136";
            //string username = "******";
            //string password = "******";

            //var dj = new DjLiveService(host, hostUrl, username, password,25512);
            //Test0427:
            //dj.UploadLogoFile("testLogo", "d:/xxxx.png");
            //Console.WriteLine("-------------------------------");

            //Console.ReadLine();
            //goto Test0427;
            //return;


            //var xxxx = JsonConvert.DeserializeObject<CallbackResponseBase>("{\"action\": \"on_connect\",\"client_id\": 1985,\"ip\": \"192.168.1.10\",\"vhost\": \"video.test.com\",\"app\": \"live\",\"tcUrl\": \"rtmp://x/x?key=xxx\",\"pageUrl\": \"http://x/x.html\"}");


            TokenManager.GetInstance().InitServicePoint("http://172.28.10.137:62000/", HttpScheme.Http);

            var xxx = TokenManager.GetInstance().UpdateToken("admin", "admin").Result;

PreTest:
            ApiManager.GetInstance().StateService.ReloadSrsConf("fdd5659abd28416d91b7711581cfa6a0");
            //var delete = ApiManager.GetInstance().StateService.CreateDefaultDomain(new DomainModel()
            //{
            //    SourceDomain = "www.huiguyuedu.com",
            //    Description = "慧谷阅读直播节点",
            //    SourceType = SourceStreamType.Rtmp_Push,
            //    StateType = StateType.Open,
            //    ServerPair = new KeyNamePair("fdd5659abd28416d91b7711581cfa6a0",""),
            //    SecurePolicyPair = new KeyNamePair("76eb7d3b40b64370939e02f04ad6b3a8", ""),
            //});
            Console.WriteLine();
            Console.ReadLine();
            goto PreTest;
            return;

            IStateServiceInterface s = new StateServiceImpl();
            var base64 = DjUtil.Tools.Cryptography.EncryptUtils.Img2Base64String(@"D:\xxxx.png");
            ILogoTemplateDaoInterface logoTemplateDao = new LogoTemplateDaoImpl();
            IAccountDaoInterface      accountDao      = new AccountDaoImpl();
            var id = Guid.NewGuid().Str();

            accountDao.AddLogoTemplate("a6697afd9d4642c0b47982e89b53867b", new LogoTemplateEntity()
            {
                Id         = id,
                FilePath   = "xxx",
                Name       = "xxxx",
                Base64Vale = "xxx",
                Option     = "xxx",
            });

            return;

            ISecurePolicyDaoInterface      securedao            = new SecurePolicyDaoImpl();
            IVhostServiceInterface         VhostService         = new VhostServiceImpl();
            IServerDaoInterface            serverDao            = new ServerDaoImpl();
            ITranscodeTemplateDaoInterface transcodeTemplateDao = new TranscodeTemplateDaoImpl();

            transcodeTemplateDao.Add2Account("ea778e85cada4de79701062e9c473c4b", new TranscodeTemplateEntity()
            {
                Id          = Guid.NewGuid().Str(),
                Name        = "TestTranscode",
                VideoOption = "{}",
                AudioOption = "{}"
            });


            Console.ReadKey();
            //string host = "172.28.10.136";
            //string hostUrl = "172.28.10.136";
            //string username = "******";
            //string password = "******";

            //var dj = new DjLiveService("172.28.59.189", "172.28.59.189","root","1qaz2wsxE");
            //dj.InstallLiveService((code, msg) =>
            //{

            //});

            // var a = UtilTools.BuildConfString(new HostOption()
            //{
            //    http_api =  new ApiOption(""),
            //    stats = new StatOption(),
            //    http_server = new List<HttpOption>()
            //    {
            //        new HttpOption("")
            //    },
            //    VHostOptions = new List<VHostOption>() { new VHostOption("")
            //    {
            //        TranscodeOptions = new List<TranscodeOption>()
            //        {
            //            new TranscodeOption()
            //            {
            //                EngineOptions = new List<EngineOption>()
            //                {
            //                    EngineOption.HdEngineOption(),
            //                    EngineOption.FastEngineOption(),
            //                    EngineOption.SdEngineOption(),
            //                }
            //            }
            //        }
            //    } },
            //});

            //var result = HttpUntil.GetAsync("http://172.28.59.189:1985/api/v1/summaries");
            //Console.WriteLine(result);
            //StringBuilder result = new StringBuilder();
            //StringBuilder commandStr = new StringBuilder();
            //commandStr.Append("/usr/local/nginx/sbin/nginx -s reload  ");
            //using (SshClient client = new SshClient("172.28.59.189", username, "1qaz2wsxE"))
            //{
            //    try
            //    {
            //        client.ErrorOccurred += (sender, eventArgs) =>
            //        {
            //            Console.WriteLine(eventArgs.Exception);
            //        };
            //        client.HostKeyReceived += (sender, eventArgs) =>
            //        {
            //            Console.WriteLine(eventArgs.HostKeyName);
            //        };
            //        client.Connect();
            //        var command = client.RunCommand(commandStr.ToString());
            //        command.Execute();

            //        if (!string.IsNullOrWhiteSpace(command.Error))
            //        {
            //            result.Append(command.Error + "\r\n");
            //        }
            //        else
            //        {
            //            result.Append(command.Result + "\r\n");
            //        }
            //        client.Disconnect();
            //    }
            //    catch (Exception e1)
            //    {
            //        result.Append(e1.Message + "\r\n");
            //    }
            //}
            //Console.WriteLine(result);
        }