예제 #1
0
        private void _ic_Notified(CVResult result, object obj)
        {
            if (result == CVResult.ResourceOperationResponded)
            {
                if (obj is ResourcePt)
                {
                    ResourcePt r = obj as ResourcePt;

                    if (r.service == 4)
                    {
                        if (r.success == 0)
                        {
                            string tempPathfile = Kits.GetTempPathfile(r.name);

                            string           pathfile = _dc.GetFtpPathfileWithoutRemoteDirectory(r.pathfile);
                            DownloadDataItem ddi      = new DownloadDataItem()
                            {
                                Source = pathfile,
                                Target = tempPathfile,
                                Id     = r.objectid,
                                Crc    = r.crc
                            };
                            _dc.Add(ddi);
                        }
                        else
                        {
                            Notified?.Invoke(CVResRequestResult.SourceNotFound, r.msg);
                        }
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 上传
        /// </summary>
        /// <param name="localPathfile">本地全路径文件名</param>
        /// <param name="version"></param>
        /// <param name="group"></param>
        /// <param name="remark"></param>
        public void Upload(string localPathfile, string version = "", int group = 0, string remark = "")
        {
            try
            {
                string tempPathfile = Kits.GetTempPathfile(Kits.GetFilename(localPathfile));
                ResourcePackage.Package(localPathfile, tempPathfile);

                UploadDataItem ud = new UploadDataItem()
                {
                    Source  = tempPathfile,
                    Target  = _dc.GetRemotePathfile(localPathfile),
                    Version = version,
                    Group   = group,
                    Remark  = remark,
                    Tag     = localPathfile
                };
                _dc.Add(ud);
            }
            catch (IOException ioe)
            {
                Notified?.Invoke(CVReSubmitResult.SourceNotFound, ioe.Message);
            }
        }