public void SendVideo(string UserName, string VideoPath) { string vMD5 = CommHelper.GetMD5HashFromFile(VideoPath); long vFileSize = CommHelper.FileSize(VideoPath); //清空原有节目 configbooChannel vClearChannel = new configbooChannel() { setSize = 0, setSizeSpecified = true }; //第一个节目 configbooChannel v1Changel = new configbooChannel(); v1Changel.action = "add"; m_ConfigbooXml.content = new configbooChannel[] { vClearChannel, v1Changel }; //第一个节目第一区域 configbooChannelArea v1Changel_Area = new configbooChannelArea() { action = "add" }; v1Changel.area = new configbooChannelArea[] { v1Changel_Area }; configbooChannelAreaRectangle v1Changel_Area_Rectangle = new configbooChannelAreaRectangle() { x = 0, y = 0, height = m_Heigth, width = m_Width }; v1Changel_Area.rectangle = v1Changel_Area_Rectangle; v1Changel_Area.materials = new configbooChannelAreaMaterials(); configbooChannelAreaMaterialsVideo vVideo1 = new configbooChannelAreaMaterialsVideo() { action = "add", }; v1Changel_Area.materials.video = new configbooChannelAreaMaterialsVideo[] { vVideo1 }; vVideo1.file = new configbooChannelAreaMaterialsVideoFile() { md5 = vMD5, size = vFileSize, path = VideoPath }; StringWriter sw = new StringWriter(); MemoryStream ms = new MemoryStream(); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); XmlSerializer serializer = new XmlSerializer(typeof(ConfigbooXml)); serializer.Serialize(ms, m_ConfigbooXml, ns); sw.Close(); ms.Close(); Console.WriteLine(sw.ToString()); HdTransmitTool t = HdTransmitTool.GetInstance(); t.Send(m_IPAddress, ms.ToArray(), true); LEDDataEFModel vLEDDataEFModel = new LEDDataEFModel() { UserName = UserName, Time = DateTime.Now, Pic = VideoPath }; m_BasicDBClass.InsertRecord(vLEDDataEFModel); }
public void SendMultiChannel(List <LEDChannelInfo> ChannelList, string[] IPList) { string vMD5 = ""; //CommHelper.GetMD5HashFromFile(ImagePath); long vFileSize = 0; // CommHelper.FileSize(ImagePath); ConfigbooXml m_ConfigbooXml = new ConfigbooXml(); //清空原有节目 configbooChannel vClearChannel = new configbooChannel() { setSize = 0, setSizeSpecified = true }; List <configbooChannel> vConfigbooChannelList = new List <configbooChannel>(); vConfigbooChannelList.Add(vClearChannel); foreach (LEDChannelInfo vTempChannel in ChannelList) { //新节目 configbooChannel vNewChannel = new configbooChannel(); vNewChannel.action = "add"; vConfigbooChannelList.Add(vNewChannel); //新节目节目第一区域 configbooChannelArea vNewChannel_Area = new configbooChannelArea() { action = "add" }; vNewChannel.area = new configbooChannelArea[] { vNewChannel_Area }; configbooChannelAreaRectangle vNewChannel_Area_Rectangle = new configbooChannelAreaRectangle() { x = 0, y = 0, height = m_Heigth, width = m_Width }; vNewChannel_Area.rectangle = vNewChannel_Area_Rectangle; vNewChannel_Area.materials = new configbooChannelAreaMaterials(); vMD5 = CommHelper.GetMD5HashFromFile(vTempChannel.Content); vFileSize = CommHelper.FileSize(vTempChannel.Content); switch (vTempChannel.ChannelType) { case LEDChanneTypeEnum.Image: configbooChannelAreaMaterialsImage vNewImage = new configbooChannelAreaMaterialsImage() { action = "add" }; vNewChannel_Area.materials.image = new configbooChannelAreaMaterialsImage[] { vNewImage }; vNewImage.effect = new configbooChannelAreaMaterialsImageEffect() { @in = vTempChannel.InEff, @out = vTempChannel.OutEff, inSpeed = 1, outSpeed = 1 //holdTime = vTempChannel.HoldTime }; if (vTempChannel.HoldTime != 0) { vNewImage.effect.holdTime = vTempChannel.HoldTime; } vNewImage.file = new configbooChannelAreaMaterialsImageFile() { md5 = vMD5, size = vFileSize, path = vTempChannel.Content }; break; case LEDChanneTypeEnum.Text: configbooChannelAreaMaterialsText vNewText = new configbooChannelAreaMaterialsText() { action = "add" }; vNewChannel_Area.materials.text = new configbooChannelAreaMaterialsText(); vNewChannel_Area.materials.text.action = "add"; vNewChannel_Area.materials.text.effect = new configbooChannelAreaMaterialsImageEffect() { @in = vTempChannel.InEff, @out = vTempChannel.OutEff, inSpeed = 1, outSpeed = 1 //holdTime = vTempChannel.HoldTime }; vNewChannel_Area.materials.text.pageCount = 1; vNewChannel_Area.materials.text.singleMode = 0; if (vTempChannel.HoldTime != 0) { vNewChannel_Area.materials.text.effect.holdTime = vTempChannel.HoldTime; } vNewChannel_Area.materials.text.file = new configbooChannelAreaMaterialsTextFile() { md5 = vMD5, size = vFileSize, path = vTempChannel.Content }; break; case LEDChanneTypeEnum.Video: configbooChannelAreaMaterialsVideo vNewVideo = new configbooChannelAreaMaterialsVideo() { action = "add" }; vNewChannel_Area.materials.video = new configbooChannelAreaMaterialsVideo[] { vNewVideo }; vNewVideo.effect = new configbooChannelAreaMaterialsVideoEffect() { @in = vTempChannel.InEff, @out = vTempChannel.OutEff, inSpeed = 1, outSpeed = 1 //holdTime = vTempChannel.HoldTime }; if (vTempChannel.HoldTime != 0) { vNewVideo.effect.holdTime = vTempChannel.HoldTime; } vNewVideo.file = new configbooChannelAreaMaterialsVideoFile() { md5 = vMD5, size = vFileSize, path = vTempChannel.Content }; break; } } m_ConfigbooXml.content = vConfigbooChannelList.ToArray(); StringWriter sw = new StringWriter(); MemoryStream ms = new MemoryStream(); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); XmlSerializer serializer = new XmlSerializer(typeof(ConfigbooXml)); serializer.Serialize(ms, m_ConfigbooXml, ns); Console.WriteLine(sw); sw.Close(); ms.Close(); //Console.WriteLine(sw.ToString()); //t.Send(m_IPAddress, ms.ToArray(), true); foreach (string vTempIP in IPList) { HdTransmitTool t = HdTransmitTool.GetInstance(); t.Send(vTempIP, ms.ToArray(), true); } }