Beispiel #1
0
        public MediaFileInfo(StorageFile file)
        {
            name = file.Name;
            type = (file.FileType == ".mp3" ? mediaType.mp3 : mediaType.mp4);

            mediaFile = file;
        }
Beispiel #2
0
 public Audio(string path)
 {
     this._pathName = path;
     Dictionary<int, KeyValuePair<string, string>> fileProps = GetFileProps(path);
     /*foreach (KeyValuePair<int, KeyValuePair<string, string>> kv in fileProps)
     {
         Console.WriteLine(kv.ToString());
     }*/
     this._lengthString = fileProps[27].Value;
     this._title = fileProps[21].Value;
     if (String.IsNullOrEmpty(this._title))
         this._title = fileProps[0].Value;
     this._fileSize = fileProps[1].Value;
     this._artist = fileProps[20].Value;
     this._year = fileProps[15].Value;
     this._genre = fileProps[16].Value;
     this._album = fileProps[14].Value;
     long[] multipliers = new long[] { 3600, 60, 1 };
     int i = 0;
     this._lengthLong = this._lengthString.Split(':').Aggregate(0, (long total, string part) => total += Int64.Parse(part) * multipliers[i++]);
     this._type = mediaType.AUDIO;
     this._icon = new BitmapImage(new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "/../../Images/openFileCommu.ico"));
     if (this._fileSize != null && this._fileSize != "")
         this._size = getSizeFromString(this._fileSize);
 }
Beispiel #3
0
        /// <summary>
        /// 添加永久素材
        /// https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE
        /// </summary>
        /// <returns></returns>
        public async Task <string> AddFile(string token, mediaType Type, string fileName, byte[] bytes)
        {
            //https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE
            Uri uri  = new Uri($"https://api.weixin.qq.com/cgi-bin/material/add_material?access_token={token}&type=TYPE{Type.ToString()}");
            var data = await HttpClientHelper.HttpUploadFile(uri.ToString(), fileName, bytes);

            return("");
        }
Beispiel #4
0
        public Image(string path)
        {
            this.PathName = path;

            Dictionary<int, KeyValuePair<string, string>> fileProps = GetFileProps(path);
            /*foreach (KeyValuePair<int, KeyValuePair<string, string>> kv in fileProps)
            {
                Console.WriteLine(kv.ToString());
            }*/
            this._lengthString = null;
            this._lengthLong = 0;
            this._title = fileProps[0].Value;
            this._fileSize = fileProps[1].Value;
            this._genre = null;
            this._type = mediaType.IMAGE;
            this._icon = new BitmapImage(new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "/../../Images/imageFileCommu.ico"));
            if (this._fileSize != null && this._fileSize != "")
                this._size = getSizeFromString(this._fileSize);
        }
Beispiel #5
0
 await _mediaRepo.GetMediasAsync(mediaType, pageNumber, pageSize);
Beispiel #6
0
        /// <summary>
        /// 添加永久素材
        /// </summary>
        /// <returns></returns>
        public async Task <string> AddFile(mediaType mediaType, string FileName, byte[] bytes)
        {
            var token = await GetAccess_token();

            return(await WeiXinApi.AddFile(token, mediaType, FileName, bytes));
        }