| | |
| | | foreach (var fileName in ReadRegionFiles(path)) |
| | | { |
| | | File.Delete(Path.Combine(path, fileName)); |
| | | MainPage.Log("删除文件名为:" + fileName); |
| | | } |
| | | } |
| | | |
| | |
| | | foreach (FileInfo NextFile in thFolders) |
| | | { |
| | | index++; |
| | | if (NextFile.Name == "headImage.png") |
| | | if (NextFile.Name.Contains(ImageUtlis.HEADIMAGE)) |
| | | { |
| | | continue; |
| | | } |
| | | if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB") |
| | | if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB" || NextFile.Name == OnAppConfig.ConfigFile) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | fileInfo.MoveTo(Application.RootPath + newFilePath); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void ReNameFoler(string srcFolderPath, string destFolderPath) |
| | | { |
| | |
| | | /// <param name="fileName">File name.</param> |
| | | public static void DeleteFile(string fileName) |
| | | { |
| | | if (fileName == null || fileName == "Language.ini" || fileName == "AccountListDB") |
| | | if (fileName == null || fileName == "Language.ini" || fileName == "AccountListDB" || fileName == OnAppConfig.ConfigFile) |
| | | { |
| | | return; |
| | | } |
| | |
| | | for (int j = 0; j < filesList.Count; j++) |
| | | { |
| | | var f = filesList[j]; |
| | | if (f == "linphonerc" || f == "AccountListDB" || f == "UserInfo_File") |
| | | if (f == "linphonerc" || f == "AccountListDB" || f == "UserInfo_File" || f == OnAppConfig.ConfigFile) |
| | | continue; |
| | | DeleteFile(f); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 下载电台、音乐、DLNA等等网络图片 |
| | | ///// </summary> |
| | | ///// <param name="fileName"></param> |
| | | ///// <param name="url"></param> |
| | | //public static void DownLoadImage(string fileName, string url) |
| | | //{ |
| | | // #region 如果当前目录不存在,就初始化 |
| | | // string directioryPath = null; |
| | | // if (Shared.Application.IsPad) |
| | | // { |
| | | // directioryPath = "Pad/" + "MusicImage"; |
| | | // } |
| | | // else |
| | | // { |
| | | // directioryPath = "Phone/" + "MusicImage"; |
| | | // } |
| | | // directioryPath = Path.Combine(RootPath, directioryPath); |
| | | // if (!Directory.Exists(directioryPath)) |
| | | // { |
| | | // Directory.CreateDirectory(directioryPath); |
| | | // } |
| | | // #endregion |
| | | |
| | | // if (!File.Exists(fileName)) |
| | | // { |
| | | // System.Threading.Tasks.Task.Run(() => |
| | | // { |
| | | // FileStream fs = null; |
| | | // try |
| | | // { |
| | | // MyWebClient webClient = new MyWebClient(); |
| | | // byte[] recevieBytes = webClient.DownloadData(new Uri(url)); |
| | | // fs = new FileStream(fileName, FileMode.Create, FileAccess.Write); |
| | | // fs.Write(recevieBytes, 0, recevieBytes.Length); |
| | | // fs.Flush(); |
| | | // } |
| | | // catch { } |
| | | // finally |
| | | // { |
| | | // if (fs != null) |
| | | // { |
| | | // fs.Close(); |
| | | // } |
| | | // } |
| | | // }); |
| | | // } |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 下载电台、音乐、DLNA等等网络图片 |
| | | ///// </summary> |
| | | ///// <param name="fileName"></param> |
| | | ///// <param name="url"></param> |
| | | //public static string DownLoadImageFormBaidu(string album, string artist) |
| | | //{ |
| | | // var url = "http://tingapi.ting.baidu.com/v1/restserver/ting?from=qianqian&version=2.1.0&method=baidu.ting.search.catalogSug&format=json&query=" + artist; |
| | | // string directioryPath = "MusicImage"; |
| | | // directioryPath = Path.Combine(RootPath, directioryPath); |
| | | // if (!Directory.Exists(directioryPath)) |
| | | // { |
| | | // Directory.CreateDirectory(directioryPath); |
| | | // } |
| | | // try |
| | | // { |
| | | // var song = Newtonsoft.Json.JsonConvert.DeserializeObject<Song>(new HDL_ON.DAL.Net.MyWebClient().DownloadString(new Uri(url))); |
| | | // if (song == null) |
| | | // { |
| | | // return null; |
| | | // } |
| | | // foreach (var tempAlbum in song.album) |
| | | // { |
| | | // if (tempAlbum.albumname == album && artist == tempAlbum.artistname) |
| | | // { |
| | | // var bytes = new HDL_ON.DAL.Net.MyWebClient().DownloadData(new Uri(tempAlbum.artistpic.Split('@')[0] + "@s_1,w_160,h_160")); |
| | | // var filePath = Path.Combine(directioryPath, "AlbumArtistImage_" + album); |
| | | // var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); |
| | | // fs.Write(bytes, 0, bytes.Length); |
| | | // fs.Flush(); |
| | | // fs.Close(); |
| | | // return filePath; |
| | | // } |
| | | // } |
| | | |
| | | // foreach (var tempArtist in song.artist) |
| | | // { |
| | | // if (artist == tempArtist.artistname) |
| | | // { |
| | | // var bytes = new HDL_ON.DAL.Net.MyWebClient().DownloadData(new Uri(tempArtist.artistpic.Split('@')[0] + "@s_1,w_160,h_160")); |
| | | // var filePath = Path.Combine(directioryPath, "AlbumArtistImage_" + artist); |
| | | // var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); |
| | | // fs.Write(bytes, 0, bytes.Length); |
| | | // fs.Flush(); |
| | | // fs.Close(); |
| | | // return filePath; |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | // catch { } |
| | | // return null; |
| | | //} |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="fileName"></param> |
| | | /// <param name="imagePath"></param> |
| | | public static void FileCopyToRootPath(string oldPath, string fileName) |
| | | { |
| | | System.IO.FileInfo fileInfo = new System.IO.FileInfo(oldPath); |
| | | if (fileInfo.Exists) |
| | | { |
| | | fileInfo.CopyTo(Path.Combine(RootPath, fileName), true); |
| | | //Utlis.WriteLine("FileCopyToRootPath : " + Path.Combine(RootPath, fileName)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | [System.Serializable] |
| | | class Song |
| | | { |
| | | //string [] ss = new string [] { }; |
| | | public List<Album> album = new List<Album>(); |
| | | public List<Artist> artist = new List<Artist>(); |
| | | public string sss; |
| | | } |
| | | [System.Serializable] |
| | | class Album |
| | | { |
| | | public string albumname; |
| | | public string artistname; |
| | | public string artistpic; |
| | | } |
| | | [System.Serializable] |
| | | class Artist |
| | | { |
| | | public string artistname; |
| | | public string artistpic; |
| | | } |
| | | //[System.Serializable] |
| | | //class Song |
| | | //{ |
| | | // //string [] ss = new string [] { }; |
| | | // public List<Album> album = new List<Album>(); |
| | | // public List<Artist> artist = new List<Artist>(); |
| | | // public string sss; |
| | | //} |
| | | //[System.Serializable] |
| | | //class Album |
| | | //{ |
| | | // public string albumname; |
| | | // public string artistname; |
| | | // public string artistpic; |
| | | //} |
| | | //[System.Serializable] |
| | | //class Artist |
| | | //{ |
| | | // public string artistname; |
| | | // public string artistpic; |
| | | //} |
| | | |
| | | |
| | | } |