Esempio n. 1
0
        public void TestLocalUrl()
        {
            VideoInfo[] vInfos = new VideoInfo[]
            {
                new VideoInfo("video1", 2, "Name1"),
                new VideoInfo("video2", 2),
            };
            IUrl   url       = new LocalUrl(@"d:\path", vInfos);
            string urlString = url.ToString();

            Console.WriteLine(urlString);
            var urlNew = LocalUrl.Parse(urlString);

            Assert.AreEqual(url.LocalPath, urlNew.LocalPath);
            Assert.AreEqual(url.VideoInfos.Length, urlNew.VideoInfos.Length);
        }
Esempio n. 2
0
 private void initSettings(string[] args)
 {
     if (args.Length > 0)
     {
         string url = args[0];
         try
         {
             IUrl ui = null;
             try
             {
                 ui = LocalUrl.Parse(url);
             }
             catch { }
             if (ui == null)
             {
                 try
                 {
                     ui = RemoteUrl.Parse(url);
                 }
                 catch { }
             }
             if (ui != null)
             {
                 return;
             }
             if (!tryToRemote(url))
             {
                 throw new ErrorMessageException("URL未能正确解析!");
             }
         }
         catch (ErrorMessageException ae)
         {
             Common.Log.Logger.Default.Error(ae);
             Util.DialogUtil.ShowError(ae.Message);
         }
     }
 }