public ClientOnly(string input_ip, ref media_info mi)
        {
            media                  = mi;
            conn_search            = new List <Connector>();
            conn_search_resp       = new List <Connector>();
            conn_pmm_ask           = new List <Connector>();
            conn_pmm_resp          = new List <Connector>();
            conn_user_exit         = new List <Connector>();
            conn_danmu_client      = new List <Connector>();
            conn_danmu_server      = new List <Connector>();
            thread_check_record    = new List <ThreadWithPort>();
            video_stream_fractions = new List <byte[]>(NUM_FRACTION);
            clients                = new List <List <String> >();
            conn_audio_data        = new List <Connector>();
            conn_audio_header      = new List <Connector>();
            conn_video_data        = new List <Connector>();
            conn_video_header      = new List <Connector>();
            video_client           = new List <string>();

            server_ip = input_ip;

            //receive 新的list之后才true
            ip_list      = new List <string>();
            Enabled      = false;
            thread_check = new List <bool>();

            self_ip = GetLocalIPAddress();

            conn_server        = new Connector(server_ip, 9999, 10000);
            conn_server_listen = new Connector(self_ip, -1, 9999);
        }
示例#2
0
        /// <summary>
        /// add result to list
        /// </summary>
        /// <param name="item">single item. May iterate through the whole result set</param>
        /// <param name="mediaInfo">mediaInfo object</param>
        /// <param name="mybox">the ListBox component. In our program, pass in "selector in MainWindow class"</param>
        static void update_search_result(video_info item, media_info mediaInfo, ListBox mybox)
        {
            mediaInfo.name_to_list.Add(item.fileName, item);
            mybox.Items.Clear();
            HashSet <String> play_list = mediaInfo.print();

            general_add(play_list, mybox);
        }
示例#3
0
 public static String search_addr_from_list(string key, media_info list)
 {
     if (list == null || list.name_to_list == null)
     {
         return("");
     }
     foreach (video_info tmp in list.name_to_list.Values)
     {
         if (tmp.fileName == key)
         {
             return(tmp.path);
         }
     }
     return("");
 }
示例#4
0
        public static List <video_info> search_list(string key, media_info list)
        {
            List <video_info> result = new List <video_info>();

            //while result
            if (list == null || list.name_to_list == null)
            {
                return(result);
            }
            foreach (video_info tmp in list.name_to_list.Values)
            {
                if (search(key, tmp))
                {
                    result.Add(tmp);
                }
            }
            return(result);
        }
        private void Load_Click(object sender, RoutedEventArgs e)
        {
            string         path;
            OpenFileDialog file = new OpenFileDialog();

            file.Filter = "Database File |*.xml";
            Nullable <bool> result = file.ShowDialog();

            if (result == true)
            {
                path      = file.FileName;
                mediaInfo = new media_info(path);
                HashSet <String> plat_list = mediaInfo.print();
                Utils.general_add(plat_list, selector);
                selector.SelectedIndex = -1;

                ((Button)sender).Visibility = Visibility.Hidden;
            }
        }
        public ClientServer(ref media_info mi)
        {
            media                  = mi;
            conn_search            = new List <Connector>();
            conn_search_resp       = new List <Connector>();
            conn_pmm_ask           = new List <Connector>();
            conn_pmm_resp          = new List <Connector>();
            thread_check_record    = new List <ThreadWithPort>();
            conn_user_exit         = new List <Connector>();
            video_stream_fractions = new List <byte[]>(NUM_FRACTION);
            isServer               = 1;
            client_ip_list_port    = 9998;
            video_client           = new List <string>();
            clients                = new List <List <String> >();
            playList               = new List <List <string> >();
            ip_list                = new List <String>();
            ip_port                = new List <int>();
            conn_ip_list           = new List <Connector>();


            conn_audio_data   = new List <Connector>();
            conn_audio_header = new List <Connector>();
            conn_video_data   = new List <Connector>();
            conn_video_header = new List <Connector>();
            conn_danmu_client = new List <Connector>();
            conn_danmu_server = new List <Connector>();

            conn_server = new Connector("", -1, 9999);
            ip_port.Add(10001);
            Enabled = false;

            self_ip   = GetLocalIPAddress();
            server_ip = GetLocalIPAddress();
            ip_list.Add(self_ip);

            thread_check = new List <bool>();
        }