From 2bec9c838d2d688025698de8ec1de401ffd7dd1f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 11 八月 2020 14:13:55 +0800
Subject: [PATCH] 20200811

---
 HDL_ON/UI/UI2/FuntionControlView/Music/A31MyList.cs |  176 +++-------------------------------------------------------
 1 files changed, 11 insertions(+), 165 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyList.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyList.cs
index 4cc95ef..f871783 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyList.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MyList.cs
@@ -13,7 +13,7 @@
         VerticalScrolViewLayout middViewLayout;
         public void Show()
         {
-            this.BackgroundColor = Color.ViewColor;
+            this.BackgroundColor = MusicColor.ViewColor;
             var topView = new TopView();
             this.AddChidren(topView.TopFLayoutView());
             topView.topNameBtn.TextID = StringId.myList;
@@ -36,7 +36,7 @@
             };
 
            
-            Button addIconBtn = new Button
+            var addIconBtn = new Button
             {
                 X = Application.GetRealWidth(336),
                 Y = Application.GetRealHeight(30),
@@ -65,7 +65,7 @@
 
             middViewLayout = new VerticalScrolViewLayout
             {
-                BackgroundColor = Color.WhiteColor,
+                BackgroundColor = MusicColor.WhiteColor,
                 Y = topView.fLayout.Bottom,
                 Height = Application.GetRealHeight(H_W.H - H_W.T_Height),
             };
@@ -87,7 +87,7 @@
                 RowLayout addFlieRow = new RowLayout
                 {
                     Height = Application.GetRealHeight(104),
-                    LineColor = Color.WhiteColor,
+                    LineColor = MusicColor.WhiteColor,
                     SubViewWidth = Application.GetRealWidth(90),//鏀瑰彉缂栬緫鎺т欢瀹藉害澶氬皯锛�
                 };
                 middViewLayout.AddChidren(addFlieRow);
@@ -157,7 +157,7 @@
                                     //绉婚櫎鐣岄潰
                                     System.Threading.Tasks.Task.Run(() =>
                                     {
-                                        PushList(songs, list.ListName, list.MusicInfoList);
+                                       SendMethod.PushList(songs, list.ListName, list.MusicInfoList,A31MusicModel.Current, "鎴戠殑鍒楄〃");
                                     });
                                 });
                             });
@@ -173,7 +173,7 @@
                     Y = Application.GetRealHeight(42),
                     Width = Application.GetRealWidth(217),
                     Height = Application.GetRealHeight(20),
-                    TextColor = Color.TextColor,
+                    TextColor = MusicColor.TextColor,
                     TextSize = TextSize.Text14,
                     TextAlignment = TextAlignment.CenterLeft,
                     Text= list.ListName,
@@ -182,9 +182,9 @@
                 ///缂栬緫鎺т欢
                 var editBtn = new Button
                 {
-                    BackgroundColor = Color.MusicEditColor,
+                    BackgroundColor = MusicColor.MusicEditColor,
                     Text = Language.StringByID(StringId.editMusic),
-                    TextColor = Color.WhiteColor,
+                    TextColor = MusicColor.WhiteColor,
                     TextSize = TextSize.Text16,
                 };
                 addFlieRow.AddRightView(editBtn);
@@ -212,9 +212,9 @@
                 ///鍒犻櫎鎺т欢
                 var delBtn = new Button
                 {
-                    BackgroundColor = Color.MusicDelColor,
+                    BackgroundColor = MusicColor.MusicDelColor,
                     Text = Language.StringByID(StringId.delMusic),
-                    TextColor = Color.WhiteColor,
+                    TextColor = MusicColor.WhiteColor,
                     TextSize = TextSize.Text16,
                 };
                 addFlieRow.AddRightView(delBtn);
@@ -286,160 +286,6 @@
             { IsBackground = true };
             updateSelectedMusicThread.Start();
         }
-        /// <summary>
-        /// 鎺ㄩ�佹挱鏀惧懡浠�
-        /// </summary>
-        /// <param name="musicInfo">鎾斁闊充箰</param>
-        /// <param name="listName">鍒楄〃鍚嶇О</param>
-        /// <param name="musicList">鎺ㄩ�佸垪琛�(榛樿鎺�50棣�)</param>
-        public void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList)
-        {
-
-            //鏈�澶у彂閫佺殑鏉℃暟
-            int maxCount = 50;
-            //鎵惧嚭褰撳墠鐐瑰嚮闊充箰鐨勭储寮�
-            int statIndex = musicList.FindIndex((obj) => { return obj == musicInfo; });
-            //鐐瑰嚮鍚庨潰杩樻湁澶氬皯鏉¢煶涔�
-            int count = musicList.Count - statIndex;
-            int endIndex = 0;
-            if (maxCount < count)
-            {
-                //濡傛灉鍚庨潰鐨勯煶涔愬ぇ浜庢渶澶ф暟锛岃缃悗闈㈡暟鎹殑鏈�澶х储寮� 
-                endIndex = statIndex + maxCount - 1;
-            }
-            else
-            {
-                //濡傛灉鍚庨潰鏁版嵁涓嶅锛屽氨鐢ㄦ�绘暟鍑忓幓鏈�澶ф潯鏁帮紝寰楀埌寮�濮嬬储寮�
-                statIndex = musicList.Count - maxCount - 1;
-                endIndex = musicList.Count - 1;
-            }
-            //濡傛灉寮�濮嬬储寮曞皬浜�0锛岄偅灏辫缃负绗竴鏉¢煶涔�
-            if (statIndex < 0)
-            {
-                statIndex = 0;
-            }
-
-            StringBuilder sb = new StringBuilder();
-            sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
-            sb.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
-            sb.AppendLine("<s:Body>");
-            sb.AppendLine("<u:CreateQueue xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
-            sb.AppendLine("<QueueContext>&lt;?xml version=\"1.0\"?&gt;");
-            sb.AppendLine("&lt;PlayList&gt;");
-            sb.AppendLine("&lt;ListName&gt;DLNA" + listName + "&lt;/ListName&gt;");
-            sb.AppendLine("&lt;ListInfo&gt;");
-            sb.AppendLine("&lt;Radio&gt;0&lt;/Radio&gt;");//
-            sb.AppendLine("&lt;SourceName&gt;UPnPServer&lt;/SourceName&gt;");//          
-            sb.AppendLine("&lt;MarkSearch&gt;0&lt;/MarkSearch&gt;");
-            sb.AppendLine("&lt;TrackNumber&gt;" + (endIndex - statIndex + 1) + "&lt;/TrackNumber&gt;");
-            sb.AppendLine("&lt;Quality&gt;0&lt;/Quality&gt;");
-            sb.AppendLine("&lt;UpdateTime&gt;5367&lt;/UpdateTime&gt;");
-            sb.AppendLine("&lt;LastPlayIndex&gt;2&lt;/LastPlayIndex&gt;");
-            sb.AppendLine("&lt;SwitchPageMode&gt;0&lt;/SwitchPageMode&gt;");
-            sb.AppendLine("&lt;CurrentPage&gt;0&lt;/CurrentPage&gt;");
-            sb.AppendLine("&lt;TotalPages&gt;0&lt;/TotalPages&gt;");
-            sb.AppendLine("&lt;/ListInfo&gt;");
-            sb.AppendLine("&lt;Tracks&gt;");
-
-            int number = 1;
-
-            for (int i = statIndex, Tracknumber = 1; i <= endIndex; i++, Tracknumber++)
-            {
-                var tempMusicInfo = musicList[i];
-
-                if (musicInfo == tempMusicInfo)
-                {
-                    number = Tracknumber;
-                }
-
-                if (tempMusicInfo.SourceType == "Local")
-                {
-                    tempMusicInfo.URL = "http://" + new Shared.Net.NetWiFi().IpAddress + ":" + com.hdl.on.Server.Port + "/" + tempMusicInfo.ID;
-                }
-
-
-                sb.AppendLine("&lt;Track" + Tracknumber + "&gt;");
-                sb.AppendLine("&lt;URL&gt;" + tempMusicInfo.URL + "&lt;/URL&gt;");
-                sb.AppendLine("&lt;Metadata&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;");
-                sb.AppendLine("&amp;lt;DIDL-Lite xmlns:dc=&amp;quot;http://purl.org/dc/elements/1.1/&amp;quot; xmlns:upnp=&amp;quot;urn:schemas-upnp-org:metadata-1-0/upnp/&amp;quot; xmlns:song=&amp;quot;www.wiimu.com/song/&amp;quot; xmlns=&amp;quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&amp;quot;&amp;gt;");
-                sb.AppendLine("&amp;lt;upnp:class&amp;gt;object.item.audioItem.musicTrack&amp;lt;/upnp:class&amp;gt;");
-                sb.AppendLine("&amp;lt;item id=&amp;quot;0&amp;quot;&amp;gt;");
-                sb.AppendLine("&amp;lt;song:subid&amp;gt;&amp;lt;/song:subid&amp;gt;");
-                sb.AppendLine("&amp;lt;song:description&amp;gt;unknown&amp;lt;/song:description&amp;gt;");
-                sb.AppendLine("&amp;lt;song:skiplimit&amp;gt;6&amp;lt;/song:skiplimit&amp;gt;");
-                sb.AppendLine("&amp;lt;song:id&amp;gt;" + tempMusicInfo.ID + "&amp;lt;/song:id&amp;gt;");
-                sb.AppendLine("&amp;lt;song:like&amp;gt;0&amp;lt;/song:like&amp;gt;");
-                sb.AppendLine("&amp;lt;song:singerid&amp;gt;0&amp;lt;/song:singerid&amp;gt;");
-                sb.AppendLine("&amp;lt;song:albumid&amp;gt;" + tempMusicInfo.AlbumId + "&amp;lt;/song:albumid&amp;gt;");
-
-                sb.AppendLine("&amp;lt;res protocolInfo=&amp;quot;http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;&amp;quot; duration=&amp;quot;" + "0:0:0.0" + "&amp;quot;&amp;gt;" + tempMusicInfo.URL + "&amp;lt;/res&amp;gt;");
-
-                sb.AppendLine("&amp;lt;dc:title&amp;gt;" + tempMusicInfo.Title + "&amp;lt;/dc:title&amp;gt;");
-                sb.AppendLine("&amp;lt;dc:creator&amp;gt;DJ Sanny J&amp;lt;/dc:creator&amp;gt;");
-                sb.AppendLine("&amp;lt;upnp:artist&amp;gt;" + listName + "&amp;lt;/upnp:artist&amp;gt;");
-                sb.AppendLine("&amp;lt;upnp:album&amp;gt;" + tempMusicInfo.Album + "&amp;lt;/upnp:album&amp;gt;");
-                sb.AppendLine("&amp;lt;upnp:albumArtURI&amp;gt;unknown&amp;lt;/upnp:albumArtURI&amp;gt;");
-                sb.AppendLine("&amp;lt;/item&amp;gt;");
-                sb.AppendLine("&amp;lt;/DIDL-Lite&amp;gt;");
-                sb.AppendLine("&lt;/Metadata&gt;");
-                sb.AppendLine("&lt;Id&gt;" + tempMusicInfo.ID + "&lt;/Id&gt;");
-                sb.AppendLine("&lt;Source&gt;STATION-NETWORK&lt;/Source&gt;");//UPnPServer
-                sb.AppendLine("&lt;Key&gt;" + tempMusicInfo.URL + "&lt;/Key&gt;");
-                sb.AppendLine("&lt;/Track" + Tracknumber + "&gt;");
-            }
-            sb.AppendLine("&lt;/Tracks&gt;");
-            sb.AppendLine("&lt;/PlayList&gt;");
-            sb.AppendLine("</QueueContext>");
-            sb.AppendLine("</u:CreateQueue>");
-            sb.AppendLine("</s:Body>");
-            sb.AppendLine("</s:Envelope>");
-
-            SendMusicLists(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, "CreateQueue", sb.ToString());
-
-            StringBuilder playString = new StringBuilder();
-            playString.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
-            playString.AppendLine("<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">");
-            playString.AppendLine("<s:Body>");
-            playString.AppendLine("<u:PlayQueueWithIndex xmlns:u=\"urn:schemas-wiimu-com:service:PlayQueue:1\">");
-            playString.AppendLine("<QueueName>DLNA" + listName + "</QueueName>");
-            playString.AppendLine("<Index>" + number + "</Index>");
-            playString.AppendLine("</u:PlayQueueWithIndex>");
-            playString.AppendLine("</s:Body>");
-            playString.AppendLine("</s:Envelope>");
-
-            Play(A31MusicModel.Current.IPAddress, A31MusicModel.Current.Port, playString.ToString());
-        }
-
-        void SendMusicLists(string ip, int port, string soapAction, string listInfo)
-        {
-            System.Net.WebClient webClient = new System.Net.WebClient();
-            webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\"");
-            webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
-            try
-            {
-                byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo));
-                var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
-            }
-            catch
-            {
-
-            }
-        }
-
-        void Play(string ip, int port, string info)
-        {
-            System.Net.WebClient webClient = new System.Net.WebClient();
-            webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
-            webClient.Headers.Add("CONTENT-TYPE", "text/xml; charset=\"utf-8\"");
-            try
-            {
-                byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(info));
-                var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
-            }
-            catch
-            {
-
-            }
-        }
+       
     }
 }

--
Gitblit v1.8.0