private VsFileURL getFileUrlOfMotion(string motionID, DateTime motionDateTime) { string tableName = VsTableName.getMonthTableName("data", motionDateTime); MySqlConnection conn = this.connecting(ConnString); MySqlCommand comm = conn.CreateCommand(); comm.CommandText = String.Format("SELECT `m_file_name` , `m_date_start` FROM `{0}` WHERE `m_id` = '{1}' ;", tableName, motionID); try { MySqlDataReader aReader = comm.ExecuteReader(); string fileName = ""; VsFileURL fUrl = new VsFileURL(); while (aReader.Read()) { fileName = aReader["m_file_name"].ToString(); fUrl.FilesName = aReader["m_date_start"].ToString(); } string ftpUser = ""; string ftpPass = ""; fUrl.FilesID = motionID; string s = fileName.Split(':')[1].Replace("\\", "/"); fUrl.FilesURL = "http://" + ftpUser + ftpPass + hostIP + s; return(fUrl); } catch { return(null); } finally { conn.Close(); } }
public void add(string name, string url) { VsFileURL files = new VsFileURL(); files.FilesName = name; files.FilesURL = url; list.Add(files); }
public void motionSelected() { try { int index = selectedIndex; VsMotion m = motions[index]; url = service.getMjpegProxyUrlOfMotionParameter(m.MotionID.ToString(), m.timeBegin, height, width, fps, quanlity); Live(); // textBox3.Text = "" + m.timeBegin + " To " + m.timeEnd; // vlCplayer1.playFileUrl(url.FilesURL); } catch (Exception err) { //logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace); ; } }
public void motionSelected() { try { radioButtonVideo_CheckedChanged(null, null); int index = listEvents.SelectedIndex; VsMotion m = motions[index]; VsFileURL url = engine.getFileUrlOfMotion(m.MotionID.ToString(), m.timeBegin); textBox3.Text = "" + m.timeBegin + " To " + m.timeEnd; vlCplayer1.playFileUrl(url.FilesURL); } catch (Exception err) { logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);; } }
public void checkVideoLine(int time) { for (int i = 0; i < data.Length; i++) { var v = data[i]; if (v != null && v.ContainsKey(time)) { timer1.Stop(); VsFileURL url = engine.getFileUrlOfMotion(v[time].MotionID.ToString(), v[time].timeBegin); try { //int leng = (int)( v[time].timeEnd - v[time].timeBegin).TotalSeconds; players[i].playFileUrl(url.FilesURL); timer1.Interval = 1000; } catch (Exception ex) { MessageBox.Show(ex.Message + " " + DateTime.Now.ToString()); } timer1.Start(); } } }
private VsFileURL getFileUrlOfMotion(string motionID, DateTime motionDateTime) { string tableName = VsTableName.getMonthTableName("data", motionDateTime); MySqlConnection conn = this.connecting(ConnString); MySqlCommand comm = conn.CreateCommand(); comm.CommandText = String.Format("SELECT `m_file_name` , `m_date_start` FROM `{0}` WHERE `m_id` = '{1}' ;", tableName, motionID); try { MySqlDataReader aReader = comm.ExecuteReader(); string fileName = ""; VsFileURL fUrl = new VsFileURL(); while (aReader.Read()) { fileName = aReader["m_file_name"].ToString(); fUrl.FilesName = aReader["m_date_start"].ToString(); } string ftpUser = ""; string ftpPass = ""; fUrl.FilesID = motionID; string s = fileName.Split(':')[1].Replace("\\", "/"); fUrl.FilesURL = "http://" + ftpUser + ftpPass + hostIP + s; return fUrl; } catch { return null; } finally { conn.Close(); } }