예제 #1
0
    public static StoreKitDownload downloadFromHashtable(Hashtable ht)
    {
        var download = new StoreKitDownload();

        if (ht.ContainsKey("downloadState"))
        {
            download.downloadState = (StoreKitDownloadState)int.Parse(ht["downloadState"].ToString());
        }

        if (ht.ContainsKey("contentLength"))
        {
            download.contentLength = double.Parse(ht["contentLength"].ToString());
        }

        if (ht.ContainsKey("contentIdentifier"))
        {
            download.contentIdentifier = ht["contentIdentifier"].ToString();
        }

        if (ht.ContainsKey("contentURL"))
        {
            download.contentURL = ht["contentURL"].ToString();
        }

        if (ht.ContainsKey("contentVersion"))
        {
            download.contentVersion = ht["contentVersion"].ToString();
        }

        if (ht.ContainsKey("error"))
        {
            download.error = ht["error"].ToString();
        }

        if (ht.ContainsKey("progress"))
        {
            download.progress = float.Parse(ht["progress"].ToString());
        }

        if (ht.ContainsKey("timeRemaining"))
        {
            download.timeRemaining = double.Parse(ht["timeRemaining"].ToString());
        }

        if (ht.ContainsKey("transaction"))
        {
            download.transaction = StoreKitTransaction.transactionFromHashtable(ht["transaction"] as Hashtable);
        }

        return(download);
    }