Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        private void _dc_Ended(IDataOpItem item)
        {
            if (item is UploadDataItem)
            {
                UploadDataItem udi = item as UploadDataItem;

                if (udi.Success)
                {
                    string source = udi.Tag as string;
                    string crc    = FileMD5.Create(udi.Source);
                    string name   = Kits.GetFilename(source);

                    string pathname = _dc.GetPathfileByRemotePathfile(udi.Target);

                    ResourceOp rop = OpFactory <ResourceOp> .Create(_ic);

                    rop.Add(pathname, name, udi.Group, 0, udi.Version, Kits.GetLastWriteTime(source), udi.Remark, "cvraddresource", crc);
                }
                else
                {
                    Notified?.Invoke(CVReSubmitResult.UploadFailed, udi.Message);
                }
            }
        }