Example #1
0
        /// <summary>
        /// 下载
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="sizeData"></param>
        /// <param name="finishCallBack"></param>
        public void BeginDownLoadAsset(DownLoadType type, AssetUpdateMgr parent, DownloadAssetSizeCaculate sizeData, FinishDelegate finishCallBack)
        {
            mDownloadType = type;
            mParent       = parent;
            mCurrentDownloadAssetSizeCaculate = sizeData;
            mFinishCallBack = finishCallBack;

            if (null == sizeData.mVersionDataConfig || 0 == sizeData.mVersionDataConfig.Count)
            {
                CallBackDownLoadSucess();

                return;
            }

            mNewVersionDataConfig = sizeData.mVersionDataConfig;
            mAllVersionDataDic.Clear();

            if (mDownloadType == DownLoadType.FIRST_PHASE && null != mParent)
            {
                mParent.UpdateProgress("开始下载更新资源文件", 0);
            }

            mMaxDownLoadCount = mDownloadType == DownLoadType.FIRST_PHASE ? 8 : 3;
            DownLoadAsset();
            mDownLoadAssetCount = mNewVersionDataConfig.Count;
        }
Example #2
0
 public int DeleteDownLoadtype(int id)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         DownLoadType originalDownLoad = context.DownLoadType.Find(id);
         if (originalDownLoad != null)
         {
             originalDownLoad.Isdelete = 1;
             List <DownLoadType> list = context.DownLoadType.Where(c => c.fatherID == id).ToList();
             if (list.Count() > 0)
             {
                 foreach (var item in list)
                 {
                     item.Isdelete = 1;
                 }
             }
             context.SaveChanges();
             return(1);
         }
         else
         {
             return(0);
         }
     }
 }
Example #3
0
        public string GetDownloadtitle(int lookupcode, int firstid, int secondid)
        {
            string name       = "";
            string firstname  = "";
            string secondname = "";

            using (AIYunNetContext context = new AIYunNetContext())
            {
                try
                {
                    WebCommonService comser     = new WebCommonService();
                    string           lookupname = comser.GetLookupDesc("DownLoad_type", lookupcode.ToString());
                    if (firstid != 0)
                    {
                        firstname = "--" + context.DownLoadType.Find(firstid).name;
                    }
                    if (secondid != 0)
                    {
                        DownLoadType type = context.DownLoadType.Find(secondid);
                        secondname = "--" + type.name;
                        firstname  = "--" + context.DownLoadType.Find(type.fatherID).name;
                    }
                    name = lookupname + firstname + secondname;
                    return(name);
                }
                catch (Exception e)
                {
                    return(name);
                }
            }
        }
        public bool SetDownLoadType(DownLoadType type)
        {
            mCurrentType = type;
            mVersionDataConfig.Clear();
            long size = 0;

            if (type == DownLoadType.FIRST_PHASE)
            {
                CurBuild = 0;
            }
            else
            {
                CurBuild += 1;
            }
            SG.LogMgr.UnityLog("DownloadAssetSizeCaculate: SetDownLoadType CurrBuild " + CurBuild);
            if (null != mAllDataConfig)
            {
                for (int i = 0; i < mAllDataConfig.Count; i++)
                {
                    if (mAllDataConfig[i].Build == CurBuild && ABFileMgr.Instance.GetABFileState(mAllDataConfig[i].RelativePath) == ABFileState.NONE)
                    {
                        mVersionDataConfig.Add(mAllDataConfig[i]);
                    }
                }
                mVersionDataConfig.ApplyAllItem(C => size += C.FileSize);
            }
            MaxSize             = size / 1024f / 1024f;
            CurrentDownloadSize = 0;

            return(CurBuild <= MaxBuild);
        }
Example #5
0
 public int addDownLoadtype(DownLoadType downloadtype)
 {
     using (AIYunNetContext context = new AIYunNetContext())
     {
         context.DownLoadType.Add(downloadtype);
         context.SaveChanges();
         return(1);
     }
 }
        public ActionResult addDownloadtype(string name, int fatherid, int looupid)
        {
            DownLoadType type = new DownLoadType();

            type.fatherID = fatherid;
            type.LookupID = looupid;
            type.name     = name;
            int ret = downloadSer.addDownLoadtype(type);

            return(Json(new { retCode = ret }, JsonRequestBehavior.AllowGet));
        }
 public static IDownLoadFile CreateDownLoadFile(DownLoadType DLT, string URL)
 {
     IDownLoadFile _file;
     switch (DLT)
     {
         case DownLoadType.HttpDownLoad:
             _file = new HttpDownLoadFile(URL);
             break;
         default:
             _file = new HttpDownLoadFile(URL);
             break;
     }
     return _file;
 }
        public static IDownLoadFile CreateDownLoadFile(DownLoadType DLT, string URL)
        {
            IDownLoadFile _file;

            switch (DLT)
            {
            case DownLoadType.HttpDownLoad:
                _file = new HttpDownLoadFile(URL);
                break;

            default:
                _file = new HttpDownLoadFile(URL);
                break;
            }
            return(_file);
        }