コード例 #1
0
        public void Handle(DownloadableItem item)
        {
            var photo = item.Owner as TLUserProfilePhoto;

            if (photo != null)
            {
                var dialog = Items.FirstOrDefault(x => x.With is TLUserBase && ((TLUserBase)x.With).Photo == photo);
                if (dialog != null)
                {
                    dialog.NotifyOfPropertyChange(() => dialog.With);
                }
                return;
            }

            var chatPhoto = item.Owner as TLChatPhoto;

            if (chatPhoto != null)
            {
                var dialog = Items.FirstOrDefault(x => x.With is TLChat && ((TLChat)x.With).Photo == chatPhoto);
                if (dialog != null)
                {
                    dialog.NotifyOfPropertyChange(() => dialog.With);
                }
                return;
            }
        }
コード例 #2
0
    /// <summary>
    ///
    /// </summary>
    private void DoScan()
    {
        DirectoryInfo downloadsFolder = new DirectoryInfo(Server.MapPath("~/download"));

        //Dictionary<string, string> files = new Dictionary<string, string>();
        Dictionary <string, DownloadableItem> downloadsNotMapped = new Dictionary <string, DownloadableItem>();

        //Dictionary<string, string> extMimeMaps = MimeHelper.GetExtensionMimeTypeMaps();

        // first maintain a list of all our files...
        foreach (FileInfo file in downloadsFolder.GetFiles())
        {
            DownloadableItem download = new DownloadableItem();
            download.FileName = file.Name;

            string ext = Path.GetExtension(file.Name);
            ext = ext.StartsWith(".") ? ext.Substring(1) : ext;
            download.Extension     = ext;
            download.ContentType   = CachedMimeLookUp.Instance.GetMimeType(ext);
            download.ContentLength = file.Length;

            downloadsNotMapped.Add(download.FileName, download);
        }


        using (SqlConnection con = DB.NewSqlConnection())
        {
            con.Open();
            using (IDataReader reader = DB.GetRSFormat(con, "SELECT DownloadId, Extension FROM EcommerceDownload with (NOLOCK)"))
            {
                while (reader.Read())
                {
                    string mappedFileName =
                        string.Format("{0}.{1}", DB.RSField(reader, "DownloadId"), DB.RSField(reader, "Extension"));

                    // compare case in-sensitive
                    mappedFileName = mappedFileName.ToLowerInvariant();

                    if (downloadsNotMapped.ContainsKey(mappedFileName))
                    {
                        downloadsNotMapped.Remove(mappedFileName);
                    }
                }
            }
        }

        // now check
        if (downloadsNotMapped.Count > 0)
        {
            PopulateDownloadItemsNotYetMapped();

            grdUnMapped.DataSource = downloadsNotMapped.Values;
            grdUnMapped.DataBind();

            if (_downloadItemsNotYetMapped.Count > 1)
            {
                btnMap.Visible = true;
            }
        }
    }
コード例 #3
0
    /// <summary>
    /// Displays the information of the downloadable item
    /// </summary>
    /// <param name="download"></param>
    private void DisplayDownloadInfo(DownloadableItem download)
    {
        if (null != download)
        {
            lblDownloadIdCaption.Text = string.Format("Download Id : {0}", download.DownloadId);
            if (CommonLogic.FileExists(string.Format("images/icon/{0}.png", download.Extension)))
            {
                imgFileType.ImageUrl = string.Format("images/icon/{0}.png", download.Extension);
            }
            else
            {
                imgFileType.ImageUrl = "images/icon/defaultfile.png";
            }

            lblFileNameCaption.Text = string.Format("File Name: {0}", download.FileName);
            lblContentType.Text     = string.Format("Content Type: {0}", download.ContentType);
            lblDownloadCaption.Text = string.Format("This file has been downloaded {0} times", download.GetNumberOfDownloads());
            lblDownloadSize.Text    = string.Format("File size: {0} kb", download.ContentLength);
            if (download.IsPhysicalFileExisting())
            {
                lblActiveCaption.Text = string.Format("This file is {0}", download.IsActive ? "active" : "inactive");
            }
            else
            {
                lblActiveCaption.Text = "This file is missing!!!";
            }

            pnlInfo.Visible = true;
        }
        else
        {
            pnlInfo.Visible = false;
        }
    }
コード例 #4
0
        public void Handle(DownloadableItem item)
        {
            var photo = item.Owner as TLUserProfilePhoto;

            if (photo != null)
            {
                var user = CacheService.GetUser(photo);
                if (user != null)
                {
                    user.NotifyOfPropertyChange(() => user.Photo);
                }
                return;
            }

            var chatPhoto = item.Owner as TLChatPhoto;

            if (chatPhoto != null)
            {
                var chat = CacheService.GetChat(chatPhoto);
                if (chat != null)
                {
                    chat.NotifyOfPropertyChange(() => chat.Photo);
                    return;
                }

                var channel = CacheService.GetChannel(chatPhoto);
                if (channel != null)
                {
                    channel.NotifyOfPropertyChange(() => channel.Photo);
                    return;
                }
                return;
            }
        }
コード例 #5
0
        public void Handle(DownloadableItem item)
        {
            BeginOnUIThread(() =>
            {
                var photo = item.Owner as TLUserProfilePhoto;
                if (photo != null)
                {
                    var user = (TLUserBase)Items.FirstOrDefault(x => x is TLUserBase && ((TLUserBase)x).Photo == photo);
                    if (user != null)
                    {
                        user.NotifyOfPropertyChange(() => user.Photo);
                        return;
                    }

                    var dialog = Items.FirstOrDefault(x => x is TLDialogBase && ((TLDialogBase)x).With is TLUserBase && ((TLUserBase)((TLDialog)x).With).Photo == photo);
                    if (dialog != null)
                    {
                        dialog.NotifyOfPropertyChange(() => ((TLDialogBase)dialog).With);
                        return;
                    }
                }

                var chatPhoto = item.Owner as TLChatPhoto;
                if (chatPhoto != null)
                {
                    var chat = (TLChat)Items.FirstOrDefault(x => x is TLChat && ((TLChat)x).Photo == chatPhoto);
                    if (chat != null)
                    {
                        chat.NotifyOfPropertyChange(() => chat.Photo);
                        return;
                    }

                    var dialog = Items.FirstOrDefault(x => x is TLDialogBase && ((TLDialogBase)x).With is TLChat && ((TLChat)((TLDialog)x).With).Photo == chatPhoto);
                    if (dialog != null)
                    {
                        dialog.NotifyOfPropertyChange(() => ((TLDialogBase)dialog).With);
                        return;
                    }
                }

                var channelPhoto = item.Owner as TLChatPhoto;
                if (channelPhoto != null)
                {
                    var channel = (TLChannel)Items.FirstOrDefault(x => x is TLChannel && ((TLChannel)x).Photo == channelPhoto);
                    if (channel != null)
                    {
                        channel.NotifyOfPropertyChange(() => channel.Photo);
                        return;
                    }

                    var dialog = Items.FirstOrDefault(x => x is TLDialogBase && ((TLDialogBase)x).With is TLChannel && ((TLChannel)((TLDialog)x).With).Photo == channelPhoto);
                    if (dialog != null)
                    {
                        dialog.NotifyOfPropertyChange(() => ((TLDialogBase)dialog).With);
                        return;
                    }
                    return;
                }
            });
        }
コード例 #6
0
        public void Handle(DownloadableItem item)
        {
            var message = item.Owner as TLMessage;

            if (message != null && _items != null)
            {
                var messages = _items;
                foreach (var m in messages)
                {
                    var mediaDocument = m.Media as TLMessageMediaDocument45;
                    if (mediaDocument != null && m == item.Owner)
                    {
                        m.Media.IsCanceled          = false;
                        m.Media.DownloadingProgress = 0.0;
                        m.Media.IsoFileName         = item.IsoFileName;
                        //MessageBox.Show("Download video time: " + _downloadVideoStopwatch.Elapsed);
                        //media.NotifyOfPropertyChange(() => media.Video);
                        break;
                    }

                    var media = m.Media as TLMessageMediaVideo;
                    if (media != null && m == item.Owner)
                    {
                        m.Media.IsCanceled          = false;
                        m.Media.DownloadingProgress = 0.0;
                        m.Media.IsoFileName         = item.IsoFileName;
                        //MessageBox.Show("Download video time: " + _downloadVideoStopwatch.Elapsed);
                        //media.NotifyOfPropertyChange(() => media.Video);
                        break;
                    }
                }
                return;
            }
        }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnUpload_Click(object sender, EventArgs e)
 {
     if (this.fileUpload.HasFile)
     {
         DownloadableItem download = DownloadableItem.AddNew(lblItemCode.Text, fileUpload.FileName, fileUpload.PostedFile.ContentType, fileUpload.FileBytes);
         DisplayDownloadInfo(download);
     }
 }
コード例 #8
0
        public void Handle(DownloadableItem item)
        {
            var sticker = item.Owner as TLStickerItem;

            if (sticker != null)
            {
                sticker.NotifyOfPropertyChange(() => sticker.Self);
            }
        }
コード例 #9
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void GridUnmapped_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (DataControlRowType.DataRow == e.Row.RowType)
        {
            // check if the download id is null
            DownloadableItem currentRow = e.Row.DataItem as DownloadableItem;
            if (null != currentRow)
            {
                /************************************************/

                /* File Name Cell
                 * /************************************************/
                DataControlFieldCell fileNameCell = e.Row.Controls[0] as DataControlFieldCell;
                string fileNameText = string.Empty;
                if (string.IsNullOrEmpty(currentRow.FileName))
                {
                    // this should never happen
                    throw new InvalidOperationException("!!!");
                }
                else
                {
                    fileNameText = Security.HtmlEncode(currentRow.FileName);
                }

                fileNameCell.Text = fileNameText;

                /************************************************/

                /* Item Code Cell
                 * /************************************************/
                DropDownList cboItemCode = e.Row.FindControl("cboItemCode") as DropDownList;
                if (null != cboItemCode)
                {
                    if (_downloadItemsNotYetMapped.Count > 1)
                    {
                        cboItemCode.DataSource     = _downloadItemsNotYetMapped;
                        cboItemCode.DataValueField = "ItemCode";
                        cboItemCode.DataTextField  = "Description";
                        cboItemCode.DataBind();
                    }
                    else
                    {
                        cboItemCode.Visible = false;
                    }
                }

                HiddenField map = e.Row.FindControl("map") as HiddenField;
                if (null != map)
                {
                    map.Value = currentRow.FileName;
                }
            }
        }
    }
コード例 #10
0
    protected void GridMapped_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (DataControlRowType.DataRow == e.Row.RowType)
        {
            // check if the download id is null
            DownloadableItem currentRow = e.Row.DataItem as DownloadableItem;
            if (null != currentRow)
            {
                /************************************************/

                /* File Name Cell
                 * /************************************************/
                DataControlFieldCell fileNameCell = e.Row.Controls[0] as DataControlFieldCell;
                string fileNameText = string.Empty;
                if (string.IsNullOrEmpty(currentRow.FileName))
                {
                    // this should never happen
                    throw new InvalidOperationException("!!!");
                }
                else
                {
                    fileNameText = Security.HtmlEncode(currentRow.FileName);
                }

                fileNameCell.Text = fileNameText;


                /************************************************/

                /* Download Id Cell
                 * /************************************************/
                DataControlFieldCell cell = e.Row.Controls[2] as DataControlFieldCell;
                int counter = 0;


                using (SqlConnection con = DB.NewSqlConnection())
                {
                    con.Open();
                    using (IDataReader reader = DB.GetRSFormat(con, "SELECT Counter FROM InventoryItem with (NOLOCK) WHERE ItemCode = {0}", DB.SQuote(currentRow.ItemCode)))
                    {
                        if (reader.Read())
                        {
                            counter = DB.RSFieldInt(reader, "Counter");
                        }
                    }
                }

                cell.Text = string.Format("<a href=\"upload.aspx?id={0}\">{1}</a>", counter, currentRow.DownloadId);
            }
        }
    }
コード例 #11
0
        public void Handle(DownloadableItem item)
        {
            var document = item.Owner as TLDocument;

            if (document != null)
            {
                BeginOnUIThread(() =>
                {
                    var messages = Items;
                    foreach (var m in messages)
                    {
                        var media = m.Media as TLMessageMediaDocument;
                        if (media != null && TLDocumentBase.DocumentEquals(media.Document, document))
                        {
                            media.NotifyOfPropertyChange(() => media.Document);
                            break;
                        }
                    }
                });
            }

            var message = item.Owner as TLMessage;

            if (message != null)
            {
                var mediaDocument1 = message.Media as TLMessageMediaDocument;
                if (mediaDocument1 == null)
                {
                    return;
                }

                BeginOnUIThread(() =>
                {
                    foreach (var m in Items)
                    {
                        var mediaDocument2 = m.Media as TLMessageMediaDocument;
                        if (mediaDocument2 != null && TLDocumentBase.DocumentEquals(mediaDocument1.Document, mediaDocument2.Document))
                        {
                            m.Media.IsCanceled          = false;
                            m.Media.LastProgress        = 0.0;
                            m.Media.DownloadingProgress = 0.0;
                            m.Media.NotifyOfPropertyChange(() => m.Media.Self); // update download icon for documents
                            m.NotifyOfPropertyChange(() => m.Self);
                            m.Media.IsoFileName = item.IsoFileName;
                        }
                    }
                });
            }
        }
コード例 #12
0
        private DownloadableItem GetDownloadableItem(string sourceUri, string destFileName, TLObject owner, Action <DownloadableItem> callback, Action <DownloadableItem> faultCallback)
        {
            var item = new DownloadableItem
            {
                SourceUri     = sourceUri,
                DestFileName  = destFileName,
                Owner         = owner,
                Callback      = callback,
                FaultCallback = faultCallback,
                Timeout       = 4.0
            };

            item.Parts = GetItemParts(item);

            return(item);
        }
コード例 #13
0
 public void Handle(DownloadableItem item)
 {
     BeginOnUIThread(() =>
     {
         var photo = item.Owner as TLUserProfilePhoto;
         if (photo != null)
         {
             var user = (TLUserBase)Items.FirstOrDefault(x => x is TLUserBase && ((TLUserBase)x).Photo == photo);
             if (user != null)
             {
                 user.NotifyOfPropertyChange(() => user.Photo);
             }
             return;
         }
     });
 }
コード例 #14
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnUpload_Click(object sender, EventArgs e)
 {
     if (this.fileUpload.HasFile)
     {
         try
         {
             if (null != cboItemCode.SelectedItem)
             {
                 DownloadableItem download = DownloadableItem.AddNew(cboItemCode.SelectedItem.Value, fileUpload.FileName, fileUpload.PostedFile.ContentType, fileUpload.FileBytes);
                 DisplayDownloadInfo(download);
             }
         }
         catch (ElectronicDownloadException ex)
         {
             lblDownloadIdCaption.Text = ex.Message;
         }
     }
 }
コード例 #15
0
    /// <summary>
    /// Displays the information of the downloadable item
    /// </summary>
    /// <param name="download"></param>
    private void DisplayDownloadInfo(DownloadableItem download)
    {
        if (null != download)
        {
            lblDownloadIdCaption.Text = string.Format("Download Id : {0}", download.DownloadId);
            lblFileNameCaption.Text   = string.Format("File Name: {0}", download.FileName);
            lblContentType.Text       = string.Format("Content Type: {0}", download.ContentType);
            lblDownloadCaption.Text   = string.Format("This file has been downloaded {0} times", download.GetNumberOfDownloads());
            lblDownloadSize.Text      = string.Format("File size: {0} kb", download.ContentLength);
            lblActiveCaption.Text     = string.Format("This file is {0}", download.IsActive ? "active" : "inactive");

            pnlInfo.Visible = true;
        }
        else
        {
            pnlInfo.Visible = false;
        }
    }
コード例 #16
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    protected override void OnInit(EventArgs e)
    {
        lblAllowableSize.Text = string.Format("You can upload a maximum size of {0} KB", GetMaxRequestLength());

        // reverse lookup the item code by the id, if specified
        int counter = CommonLogic.QueryStringUSInt("id");

        string itemCode = string.Empty;
        string itemName = string.Empty;

        if (counter > 0)
        {
            using (SqlConnection con = DB.NewSqlConnection())
            {
                con.Open();
                using (IDataReader reader = DB.GetRSFormat(con, "SELECT ItemCode, ItemName FROM InventoryItem with (NOLOCK) WHERE Counter = {0}", counter))
                {
                    if (reader.Read())
                    {
                        itemCode = DB.RSField(reader, "ItemCode");
                        itemName = DB.RSField(reader, "ItemName");
                    }
                }
            }
        }

        lblItemCode.Text = itemCode;
        lblItemName.Text = itemName;
        Title            = string.Format("Upload file for {0}", itemName);

        // info
        if (counter > 0)
        {
            DownloadableItem download = DownloadableItem.FindByItemCode(itemCode);
            DisplayDownloadInfo(download);
        }
        else
        {
            pnlInfo.Visible = false;
        }

        base.OnInit(e);
    }
コード例 #17
0
        public void Handle(DownloadableItem item)
        {
            var webPage = item.Owner as TLWebPage;

            if (webPage != null)
            {
                var messages = Items;
                foreach (var m in messages)
                {
                    var media = m.Media as TLMessageMediaWebPage;
                    if (media != null && media.WebPage == webPage)
                    {
                        media.NotifyOfPropertyChange(() => media.Photo);
                        media.NotifyOfPropertyChange(() => media.Self);
                        break;
                    }
                }
            }
        }
コード例 #18
0
 public void Handle(DownloadableItem item)
 {
 }
コード例 #19
0
 public void Handle(DownloadableItem message)
 {
 }
コード例 #20
0
    /// <summary>
    ///
    /// </summary>
    private void DoMap()
    {
        try
        {
            Dictionary <string, string> itemFileMap = new Dictionary <string, string>();

            // first let's retrieve all the files that have been set which item code to map to
            foreach (string key in Request.Form.AllKeys)
            {
                if (key.EndsWith("cboItemCode"))
                {
                    //
                    string itemCode = Request.Form[key];
                    if (!string.IsNullOrEmpty(itemCode))
                    {
                        if (itemFileMap.ContainsKey(itemCode))
                        {
                            throw new DownloadMappingException("Duplicate mapping exists! please remove the duplicate");
                        }
                        else
                        {
                            // retrieve the file name for this mapping file
                            // since were assuming the id in this format _ctl0:pnlMain:grdList:_ctl18:cboItemCode
                            // we will find our map(which is just a supporting field) through the item code combo box
                            string mapKey = key.Replace("cboItemCode", "map");

                            string mapFile = Request.Form[mapKey];
                            if (string.IsNullOrEmpty(mapFile))
                            {
                                throw new InvalidOperationException("Map file not found!!!");
                            }
                            else
                            {
                                itemFileMap.Add(itemCode, mapFile);
                            }
                        }
                    }
                }
            }

            List <DownloadableItem> mappedDownloads = new List <DownloadableItem>();

            foreach (string itemCode in itemFileMap.Keys)
            {
                string           fileName = itemFileMap[itemCode];
                DownloadableItem item     = DownloadableItem.MapNew(itemCode, fileName);
                mappedDownloads.Add(item);
            }

            if (mappedDownloads.Count > 0)
            {
                grdMapped.Visible    = true;
                grdMapped.DataSource = mappedDownloads;
                grdMapped.DataBind();

                lblError.Text = string.Empty;
            }
            else
            {
                grdMapped.Visible = true;
                lblError.Text     = "Please map one(1) or more files";
            }
        }
        catch (DownloadMappingException dmap)
        {
            lblError.Text = dmap.Message;
        }
    }
コード例 #21
0
 public DownloadingCanceledEventArgs(DownloadableItem item)
 {
     Item = item;
 }
コード例 #22
0
 public DownloadProgressChangedEventArgs(DownloadableItem item, double progress)
 {
     Item     = item;
     Progress = progress;
 }
コード例 #23
0
    protected void Grid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (DataControlRowType.DataRow == e.Row.RowType)
        {
            // check if the download id is null
            DbDataRecord currentRow = e.Row.DataItem as DbDataRecord;
            if (null != currentRow)
            {
                int    counter  = (int)currentRow["Counter"];
                string itemCode = (string)currentRow["ItemCode"];


                // File Name Cell
                DataControlFieldCell fileNameCell = e.Row.Controls[0] as DataControlFieldCell;
                string fileNameText = string.Empty;
                if (currentRow["FileName"] == DBNull.Value ||
                    currentRow["FileName"] is string &&
                    string.IsNullOrEmpty((string)currentRow["FileName"]))
                {
                    fileNameText = "[UnAssigned]";
                }
                else
                {
                    fileNameText = Security.HtmlEncode((string)currentRow["FileName"]);
                }

                fileNameCell.Text = fileNameText;


                //Description
                DataControlFieldCell descriptionCell = e.Row.Controls[3] as DataControlFieldCell;
                string descriptionText = string.Empty;
                if (currentRow["WebDescription"] == DBNull.Value ||
                    currentRow["WebDescription"] is string &&
                    string.IsNullOrEmpty((string)currentRow["WebDescription"]))
                {
                    descriptionText = (string)currentRow["ItemDescription"];
                }
                else
                {
                    descriptionText = (string)currentRow["WebDescription"];
                }
                descriptionCell.Text = Security.HtmlEncode(descriptionText);

                // DownloadId Cell
                DataControlFieldCell downloadCell = e.Row.Controls[4] as DataControlFieldCell;

                string downloadText = string.Empty;
                if (currentRow["DownloadId"] == DBNull.Value ||
                    currentRow["DownloadId"] is string &&
                    string.IsNullOrEmpty((string)currentRow["DownloadId"]))
                {
                    downloadText = "Upload file";
                }
                else
                {
                    downloadText = (string)currentRow["DownloadId"];
                }

                downloadCell.Text = string.Format("<a href=\"DownloadableItem.aspx?id={0}\">{1}</a>", counter, Security.HtmlEncode(downloadText));


                // Status Cell
                DataControlFieldCell statusCell = e.Row.Controls[6] as DataControlFieldCell;
                DownloadableItem     download   = DownloadableItem.FindByItemCode(itemCode);

                string statusText = string.Empty;

                if (null == download)
                {
                    statusText = "N/A";
                }
                else if (download.IsPhysicalFileExisting())
                {
                    if (currentRow["IsActive"] == DBNull.Value)
                    {
                        statusText = "N/A";
                    }
                    else if (currentRow["IsActive"] is bool)
                    {
                        statusText = CommonLogic.IIF((bool)currentRow["IsActive"], "A", "I");
                    }
                    else
                    {
                        statusText = "?";
                    }
                }
                else
                {
                    statusText = "?";
                }

                statusCell.Text = Security.HtmlEncode(statusText);
            }
        }
    }
コード例 #24
0
        public void Handle(DownloadableItem item)
        {
            var webPage = item.Owner as TLWebPage;

            if (webPage != null)
            {
                Execute.BeginOnUIThread(() =>
                {
                    var messages = UngroupEnumerator(Items).OfType <TLDecryptedMessage>();
                    foreach (var m in messages)
                    {
                        var media = m.Media as TLDecryptedMessageMediaWebPage;
                        if (media != null && media.WebPage == webPage)
                        {
                            media.NotifyOfPropertyChange(() => media.Photo);
                            media.NotifyOfPropertyChange(() => media.Self);
                            break;
                        }
                    }
                });
            }

            var decryptedMessage = item.Owner as TLDecryptedMessage;

            if (decryptedMessage != null)
            {
                var mediaExternalDocument = decryptedMessage.Media as TLDecryptedMessageMediaExternalDocument;
                if (mediaExternalDocument != null)
                {
                    decryptedMessage.NotifyOfPropertyChange(() => decryptedMessage.Self);
                }
            }

            var decryptedMedia = item.Owner as TLDecryptedMessageMediaBase;

            if (decryptedMedia != null)
            {
                decryptedMessage = UngroupEnumerator(Items).OfType <TLDecryptedMessage>().FirstOrDefault(x => x.Media == decryptedMedia);
                if (decryptedMessage != null)
                {
                    var mediaPhoto = decryptedMessage.Media as TLDecryptedMessageMediaPhoto;
                    if (mediaPhoto != null)
                    {
                        mediaPhoto.DownloadingProgress = 1.0;
                        var fileName = item.IsoFileName;
                        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            byte[] buffer;
                            using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                            {
                                buffer = new byte[file.Length];
                                file.Read(buffer, 0, buffer.Length);
                            }
                            var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                            if (fileLocation == null)
                            {
                                return;
                            }
                            var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaPhoto.Key.Data,
                                                                                    mediaPhoto.IV.Data, false);

                            var newFileName = String.Format("{0}_{1}_{2}.jpg",
                                                            fileLocation.Id,
                                                            fileLocation.DCId,
                                                            fileLocation.AccessHash);

                            using (var file = store.OpenFile(newFileName, FileMode.OpenOrCreate, FileAccess.Write))
                            {
                                file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                            }

                            store.DeleteFile(fileName);
                        }

                        if (!decryptedMedia.IsCanceled)
                        {
                            decryptedMedia.NotifyOfPropertyChange(() => decryptedMedia.Self);
                        }
                    }

                    var mediaVideo = decryptedMessage.Media as TLDecryptedMessageMediaVideo;
                    if (mediaVideo != null)
                    {
                        mediaVideo.DownloadingProgress = 1.0;
                        var fileName = item.IsoFileName;
                        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            byte[] buffer;
                            using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                            {
                                buffer = new byte[file.Length];
                                file.Read(buffer, 0, buffer.Length);
                            }
                            var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                            if (fileLocation == null)
                            {
                                return;
                            }
                            var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaVideo.Key.Data, mediaVideo.IV.Data, false);

                            var newFileName = String.Format("{0}_{1}_{2}.mp4",
                                                            fileLocation.Id,
                                                            fileLocation.DCId,
                                                            fileLocation.AccessHash);

                            using (var file = store.OpenFile(newFileName, FileMode.OpenOrCreate, FileAccess.Write))
                            {
                                file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                            }

                            store.DeleteFile(fileName);
                        }
                    }

                    var mediaDocument = decryptedMessage.Media as TLDecryptedMessageMediaDocument;
                    if (mediaDocument != null)
                    {
                        if (decryptedMessage.IsVoice())
                        {
                            var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                            if (fileLocation == null)
                            {
                                return;
                            }

                            var fileName          = item.IsoFileName;
                            var decryptedFileName = String.Format("audio{0}_{1}.mp3",
                                                                  fileLocation.Id,
                                                                  fileLocation.AccessHash);
                            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                            {
                                byte[] buffer;
                                using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                                {
                                    buffer = new byte[file.Length];
                                    file.Read(buffer, 0, buffer.Length);
                                }
                                var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaDocument.Key.Data, mediaDocument.IV.Data, false);

                                using (var file = store.OpenFile(decryptedFileName, FileMode.OpenOrCreate, FileAccess.Write))
                                {
                                    file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                                }

                                store.DeleteFile(fileName);
                            }

                            Telegram.Api.Helpers.Execute.BeginOnUIThread(() =>
                            {
                                MessagePlayerControl.ConvertAndSaveOpusToWav(mediaDocument);

                                mediaDocument.DownloadingProgress = 1.0;
                            });
                        }
                        else if (decryptedMessage.IsVideo())
                        {
                            mediaDocument.DownloadingProgress = 1.0;
                            var fileName = item.IsoFileName;
                            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                            {
                                byte[] buffer;
                                using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                                {
                                    buffer = new byte[file.Length];
                                    file.Read(buffer, 0, buffer.Length);
                                }
                                var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                                if (fileLocation == null)
                                {
                                    return;
                                }
                                var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaDocument.Key.Data, mediaDocument.IV.Data, false);

                                var newFileName = String.Format("{0}_{1}_{2}.mp4",
                                                                fileLocation.Id,
                                                                fileLocation.DCId,
                                                                fileLocation.AccessHash);

                                using (var file = store.OpenFile(newFileName, FileMode.OpenOrCreate, FileAccess.Write))
                                {
                                    file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                                }

                                store.DeleteFile(fileName);
                            }
                        }
                        else
                        {
                            mediaDocument.DownloadingProgress = 1.0;
                            var fileName = item.IsoFileName;
                            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                            {
                                byte[] buffer;
                                using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                                {
                                    buffer = new byte[file.Length];
                                    file.Read(buffer, 0, buffer.Length);
                                }
                                var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                                if (fileLocation == null)
                                {
                                    return;
                                }
                                var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaDocument.Key.Data, mediaDocument.IV.Data, false);

                                var newFileName = String.Format("{0}_{1}_{2}.{3}",
                                                                fileLocation.Id,
                                                                fileLocation.DCId,
                                                                fileLocation.AccessHash,
                                                                fileLocation.FileExt ?? mediaDocument.FileExt);

                                using (var file = store.OpenFile(newFileName, FileMode.OpenOrCreate, FileAccess.Write))
                                {
                                    file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                                }

                                store.DeleteFile(fileName);
                            }
                        }
                    }

                    var mediaAudio = decryptedMessage.Media as TLDecryptedMessageMediaAudio;
                    if (mediaAudio != null)
                    {
                        var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                        if (fileLocation == null)
                        {
                            return;
                        }

                        var fileName          = item.IsoFileName;
                        var decryptedFileName = String.Format("audio{0}_{1}.mp3",
                                                              fileLocation.Id,
                                                              fileLocation.AccessHash);
                        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            byte[] buffer;
                            using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                            {
                                buffer = new byte[file.Length];
                                file.Read(buffer, 0, buffer.Length);
                            }
                            var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaAudio.Key.Data, mediaAudio.IV.Data, false);

                            using (var file = store.OpenFile(decryptedFileName, FileMode.OpenOrCreate, FileAccess.Write))
                            {
                                file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                            }

                            store.DeleteFile(fileName);
                        }

                        Telegram.Api.Helpers.Execute.BeginOnUIThread(() =>
                        {
                            MessagePlayerControl.ConvertAndSaveOpusToWav(mediaAudio);

                            mediaAudio.DownloadingProgress = 1.0;
                        });
                    }
                }
            }
        }
コード例 #25
0
        public void Handle(DownloadableItem item)
        {
            var decryptedMessage = item.Owner as TLDecryptedMessage;

            if (decryptedMessage != null)
            {
                var mediaExternalDocument = decryptedMessage.Media as TLDecryptedMessageMediaExternalDocument;
                if (mediaExternalDocument != null)
                {
                    decryptedMessage.NotifyOfPropertyChange(() => decryptedMessage.Self);
                }
            }

            var decryptedMedia = item.Owner as TLDecryptedMessageMediaBase;

            if (decryptedMedia != null)
            {
                decryptedMessage = Items.OfType <TLDecryptedMessage>().FirstOrDefault(x => x.Media == decryptedMedia);
                if (decryptedMessage != null)
                {
                    var mediaPhoto = decryptedMessage.Media as TLDecryptedMessageMediaPhoto;
                    if (mediaPhoto != null)
                    {
                        var fileName = item.IsoFileName;
                        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            byte[] buffer;
                            using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                            {
                                buffer = new byte[file.Length];
                                file.Read(buffer, 0, buffer.Length);
                            }
                            var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                            if (fileLocation == null)
                            {
                                return;
                            }
                            var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaPhoto.Key.Data,
                                                                                    mediaPhoto.IV.Data, false);

                            var newFileName = String.Format("{0}_{1}_{2}.jpg",
                                                            fileLocation.Id,
                                                            fileLocation.DCId,
                                                            fileLocation.AccessHash);

                            using (var file = store.OpenFile(newFileName, FileMode.OpenOrCreate, FileAccess.Write))
                            {
                                file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                            }

                            store.DeleteFile(fileName);
                        }

                        decryptedMedia.NotifyOfPropertyChange("Self");
                    }

                    var mediaVideo = decryptedMessage.Media as TLDecryptedMessageMediaVideo;
                    if (mediaVideo != null)
                    {
                        mediaVideo.DownloadingProgress = 0.0;
                        var fileName = item.IsoFileName;
                        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            byte[] buffer;
                            using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                            {
                                buffer = new byte[file.Length];
                                file.Read(buffer, 0, buffer.Length);
                            }
                            var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                            if (fileLocation == null)
                            {
                                return;
                            }
                            var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaVideo.Key.Data, mediaVideo.IV.Data, false);

                            var newFileName = String.Format("{0}_{1}_{2}.mp4",
                                                            fileLocation.Id,
                                                            fileLocation.DCId,
                                                            fileLocation.AccessHash);

                            using (var file = store.OpenFile(newFileName, FileMode.OpenOrCreate, FileAccess.Write))
                            {
                                file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                            }

                            store.DeleteFile(fileName);
                        }
                    }

                    var mediaAudio = decryptedMessage.Media as TLDecryptedMessageMediaAudio;
                    if (mediaAudio != null)
                    {
                        mediaAudio.DownloadingProgress = 0.0;

                        var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                        if (fileLocation == null)
                        {
                            return;
                        }

                        var fileName          = item.IsoFileName;
                        var decryptedFileName = String.Format("audio{0}_{1}.mp3",
                                                              fileLocation.Id,
                                                              fileLocation.AccessHash);
                        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            byte[] buffer;
                            using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                            {
                                buffer = new byte[file.Length];
                                file.Read(buffer, 0, buffer.Length);
                            }
                            var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaAudio.Key.Data, mediaAudio.IV.Data, false);

                            using (var file = store.OpenFile(decryptedFileName, FileMode.OpenOrCreate, FileAccess.Write))
                            {
                                file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                            }

                            store.DeleteFile(fileName);
                        }

                        var wavFileName = Path.GetFileNameWithoutExtension(decryptedFileName) + ".wav";
#if WP8
                        var component = new WindowsPhoneRuntimeComponent();
                        var result    = component.InitPlayer(ApplicationData.Current.LocalFolder.Path + "\\" + decryptedFileName);
                        if (result == 1)
                        {
                            var buffer    = new byte[16 * 1024];
                            var args      = new int[3];
                            var pcmStream = new MemoryStream();
                            while (true)
                            {
                                component.FillBuffer(buffer, buffer.Length, args);
                                var count       = args[0];
                                var offset      = args[1];
                                var endOfStream = args[2] == 1;

                                pcmStream.Write(buffer, 0, count);
                                if (endOfStream)
                                {
                                    break;
                                }
                            }

                            var wavStream = Wav.GetWavAsMemoryStream(pcmStream, 48000, 1, 16);
                            using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                            {
                                using (var file = new IsolatedStorageFileStream(wavFileName, FileMode.OpenOrCreate, store))
                                {
                                    wavStream.Seek(0, SeekOrigin.Begin);
                                    wavStream.CopyTo(file);
                                    file.Flush();
                                }
                            }
                        }
#endif
                    }

                    var mediaDocument = decryptedMessage.Media as TLDecryptedMessageMediaDocument;
                    if (mediaDocument != null)
                    {
                        mediaDocument.DownloadingProgress = 0.0;
                        var fileName = item.IsoFileName;
                        using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            byte[] buffer;
                            using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read))
                            {
                                buffer = new byte[file.Length];
                                file.Read(buffer, 0, buffer.Length);
                            }
                            var fileLocation = decryptedMessage.Media.File as TLEncryptedFile;
                            if (fileLocation == null)
                            {
                                return;
                            }
                            var decryptedBuffer = Telegram.Api.Helpers.Utils.AesIge(buffer, mediaDocument.Key.Data, mediaDocument.IV.Data, false);

                            var newFileName = String.Format("{0}_{1}_{2}.{3}",
                                                            fileLocation.Id,
                                                            fileLocation.DCId,
                                                            fileLocation.AccessHash,
                                                            fileLocation.FileExt);

                            using (var file = store.OpenFile(newFileName, FileMode.OpenOrCreate, FileAccess.Write))
                            {
                                file.Write(decryptedBuffer, 0, decryptedBuffer.Length);
                            }

                            store.DeleteFile(fileName);
                        }
                    }
                }
            }
        }
コード例 #26
0
        public void Handle(DownloadableItem item)
        {
            Execute.BeginOnUIThread(() =>
            {
                var chatPhoto = item.Owner as TLChatPhoto;
                if (chatPhoto != null)
                {
                    var channel = With as TLChannel;
                    if (channel != null)
                    {
                        channel.NotifyOfPropertyChange(() => channel.Photo);
                        //channel.NotifyOfPropertyChange(() => channel.ChatPhoto);
                    }

                    var serviceMessages = Items.OfType <TLMessageService>();
                    foreach (var serviceMessage in serviceMessages)
                    {
                        var editPhoto = serviceMessage.Action as TLMessageActionChatEditPhoto;
                        if (editPhoto != null && editPhoto.Photo == chatPhoto)
                        {
                            editPhoto.NotifyOfPropertyChange(() => editPhoto.Photo);
                            break;
                        }
                    }
                }

                var message = item.Owner as TLMessage;
                if (message != null)
                {
                    var messages = Items.OfType <TLMessage>();
                    foreach (var m in messages)
                    {
                        var media = m.Media as TLMessageMediaVideo;
                        if (media != null && m == item.Owner)
                        {
                            m.Media.IsCanceled          = false;
                            m.Media.LastProgress        = 0.0;
                            m.Media.DownloadingProgress = 0.0;
                            m.NotifyOfPropertyChange(() => m.Self);
                            m.Media.IsoFileName = item.IsoFileName;
                            break;
                        }

                        var doc = m.Media as TLMessageMediaDocument;
                        if (doc != null && m == item.Owner)
                        {
                            m.Media.IsCanceled          = false;
                            m.Media.LastProgress        = 0.0;
                            m.Media.DownloadingProgress = 0.0;
                            m.Media.NotifyOfPropertyChange(() => m.Media.Self); // update download icon for documents
                            m.NotifyOfPropertyChange(() => m.Self);
                            m.Media.IsoFileName = item.IsoFileName;
                            break;
                        }

                        var audioMedia = m.Media as TLMessageMediaAudio;
                        if (audioMedia != null && m == item.Owner)
                        {
                            m.Media.IsCanceled          = false;
                            m.Media.LastProgress        = 0.0;
                            m.Media.DownloadingProgress = 0.0;
                            m.Media.IsoFileName         = item.IsoFileName;

                            var a = audioMedia.Audio as TLAudio;
                            if (a != null)
                            {
                                var fileName    = a.GetFileName();
                                var wavFileName = Path.GetFileNameWithoutExtension(fileName) + ".wav";
#if WP8
                                var component = new WindowsPhoneRuntimeComponent();
                                var result    = component.InitPlayer(ApplicationData.Current.LocalFolder.Path + "\\" + fileName);
                                if (result == 1)
                                {
                                    var buffer    = new byte[16 * 1024];
                                    var args      = new int[3];
                                    var pcmStream = new MemoryStream();
                                    while (true)
                                    {
                                        component.FillBuffer(buffer, buffer.Length, args);
                                        var count       = args[0];
                                        var offset      = args[1];
                                        var endOfStream = args[2] == 1;

                                        pcmStream.Write(buffer, 0, count);
                                        if (endOfStream)
                                        {
                                            break;
                                        }
                                    }

                                    var wavStream = Wav.GetWavAsMemoryStream(pcmStream, 48000, 1, 16);
                                    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                                    {
                                        using (var file = new IsolatedStorageFileStream(wavFileName, FileMode.OpenOrCreate, store))
                                        {
                                            wavStream.Seek(0, SeekOrigin.Begin);
                                            wavStream.CopyTo(file);
                                            file.Flush();
                                        }
                                    }
                                }
#endif
                            }

                            break;
                        }
                    }
                    return;
                }

                var photo = item.Owner as TLPhoto;
                if (photo != null)
                {
                    var isUpdated = false;
                    var messages  = Items.OfType <TLMessage>();
                    foreach (var m in messages)
                    {
                        var mediaPhoto = m.Media as TLMessageMediaPhoto;
                        if (mediaPhoto != null && mediaPhoto.Photo == photo)
                        {
                            mediaPhoto.NotifyOfPropertyChange(() => mediaPhoto.Photo);
                            mediaPhoto.NotifyOfPropertyChange(() => mediaPhoto.Self);
                            isUpdated = true;
                            break;
                        }

                        var mediaWebPage = m.Media as TLMessageMediaWebPage;
                        if (mediaWebPage != null && mediaWebPage.Photo == photo)
                        {
                            mediaWebPage.NotifyOfPropertyChange(() => mediaWebPage.Photo);
                            mediaWebPage.NotifyOfPropertyChange(() => mediaWebPage.Self);
                            isUpdated = false;
                            break;
                        }
                    }

                    if (isUpdated)
                    {
                        return;
                    }

                    var serviceMessages = Items.OfType <TLMessageService>();
                    foreach (var serviceMessage in serviceMessages)
                    {
                        var editPhoto = serviceMessage.Action as TLMessageActionChatEditPhoto;
                        if (editPhoto != null && editPhoto.Photo == photo)
                        {
                            editPhoto.NotifyOfPropertyChange(() => editPhoto.Photo);
                            isUpdated = true;
                            break;
                        }
                    }
                }

                var document = item.Owner as TLDocument;
                if (document != null)
                {
                    var messages = Items.OfType <TLMessage>();
                    foreach (var m in messages)
                    {
                        var media = m.Media as TLMessageMediaDocument;
                        if (media != null && TLDocumentBase.DocumentEquals(media.Document, document))
                        {
                            media.NotifyOfPropertyChange(() => media.Document);
                            break;
                        }
                    }
                }

                var video = item.Owner as TLVideo;
                if (video != null)
                {
                    var messages = Items.OfType <TLMessage>();
                    foreach (var m in messages)
                    {
                        var media = m.Media as TLMessageMediaVideo;
                        if (media != null && media.Video == video)
                        {
                            media.NotifyOfPropertyChange(() => media.Video);
                            break;
                        }
                    }
                }

                var audio = item.Owner as TLAudio;
                if (audio != null)
                {
                    var messages = Items.OfType <TLMessage>();
                    foreach (var m in messages)
                    {
                        var media = m.Media as TLMessageMediaAudio;
                        if (media != null && media.Audio == audio)
                        {
                            media.NotifyOfPropertyChange(() => media.Audio);
                            break;
                        }
                    }
                }

                var webPage = item.Owner as TLWebPage;
                if (webPage != null)
                {
                    var messages = Items.OfType <TLMessage>();
                    foreach (var m in messages)
                    {
                        var media = m.Media as TLMessageMediaWebPage;
                        if (media != null && media.WebPage == webPage)
                        {
                            media.NotifyOfPropertyChange(() => media.Photo);
                            media.NotifyOfPropertyChange(() => media.Self);
                            break;
                        }
                    }
                }
            });
        }
コード例 #27
0
 private List <DownloadablePart> GetItemParts(DownloadableItem item)
 {
     return(new List <DownloadablePart> {
         new DownloadablePart(item, new TLInt(0), new TLInt(0), 0)
     });
 }
コード例 #28
0
        public void Handle(DownloadableItem item)
        {
            var photo = item.Owner as TLPhoto;

            if (photo != null)
            {
                var isUpdated = false;
                var messages  = _items;
                foreach (var m in messages)
                {
                    var media = m.Media as TLMessageMediaPhoto;
                    if (media != null && media.Photo == photo)
                    {
                        media.NotifyOfPropertyChange(() => media.Photo);
                        media.NotifyOfPropertyChange(() => media.Self);
                        isUpdated = true;
                        break;
                    }
                }

                if (isUpdated)
                {
                    return;
                }

                var serviceMessages = Items.OfType <TLMessageService>();
                foreach (var serviceMessage in serviceMessages)
                {
                    var editPhoto = serviceMessage.Action as TLMessageActionChatEditPhoto;
                    if (editPhoto != null && editPhoto.Photo == photo)
                    {
                        editPhoto.NotifyOfPropertyChange(() => editPhoto.Photo);
                        isUpdated = true;
                        break;
                    }
                }
            }

            var document = item.Owner as TLDocument22;

            if (document != null)
            {
                var messages = _items;
                foreach (var m in messages)
                {
                    var media = m.Media as TLMessageMediaDocument45;
                    if (media != null && media.Video == document)
                    {
                        media.NotifyOfPropertyChange(() => media.Video);
                        break;
                    }
                }
            }

            var video = item.Owner as TLVideo;

            if (video != null)
            {
                var messages = _items;
                foreach (var m in messages)
                {
                    var media = m.Media as TLMessageMediaVideo;
                    if (media != null && media.Video == video)
                    {
                        media.NotifyOfPropertyChange(() => media.Video);
                        break;
                    }
                }
            }

            var message = item.Owner as TLMessage;

            if (message != null)
            {
                var messages = _items;
                foreach (var m in messages)
                {
                    var mediaDocument = m.Media as TLMessageMediaDocument45;
                    if (mediaDocument != null && m == item.Owner)
                    {
                        m.Media.LastProgress        = 0.0;
                        m.Media.DownloadingProgress = 0.0;
                        m.Media.IsoFileName         = item.IsoFileName;
                        break;
                    }

                    var media = m.Media as TLMessageMediaVideo;
                    if (media != null && m == item.Owner)
                    {
                        m.Media.LastProgress        = 0.0;
                        m.Media.DownloadingProgress = 0.0;
                        m.Media.IsoFileName         = item.IsoFileName;
                        break;
                    }
                }
                return;
            }
        }