public override HandleCaseResult HandleCase(DBObject theObject,
                                                    List <DBCaseResource> resourceList,
                                                    string root, string targetType, string targetID, bool overwrite)
        {
            DBCaseResource   cr  = GetSourceResource(resourceList);
            HandleCaseResult hcr = new HandleCaseResult();

            hcr.Succeed = false;
            if (cr == null)
            {
                return(hcr);
            }

            string resObj = string.Format(@"{0}\{1}\{2}\{3}.{4}",
                                          root, targetType, targetID, ResourceKeyword, "skp");

            if (File.Exists(resObj) && !overwrite)
            {
                hcr.Succeed = false;
                return(hcr);
            }

            string source = DownloadSourceTemp(cr, resObj);

            hcr.Succeed = true;

            return(hcr);
        }
Exemple #2
0
        public override HandleCaseResult HandleCase(DBObject theObject, List <DBCaseResource> resourceList, string root,
                                                    string targetType, string targetID, bool overwrite)
        {
            DBCaseResource   cr  = GetSourceResource(resourceList);
            HandleCaseResult hcr = new HandleCaseResult();

            hcr.Succeed = false;
            if (cr == null)
            {
                return(hcr);
            }

            string resObj = string.Format(@"{0}\{1}\{2}\{3}.{4}",
                                          root, targetType, targetID, ResourceKeyword, ResourceExtension);

            if (File.Exists(resObj) && !overwrite)
            {
                hcr.Succeed = false;
                return(hcr);
            }

            string toDown = Elements.WebServer + cr._PathWeb;

            if (File.Exists(resObj))
            {
                File.Delete(resObj);
            }

            Directory.CreateDirectory(Path.GetDirectoryName(resObj));

            using (WebClient wc = new WebClient())
            {
                wc.DownloadFile(toDown, resObj);
            }

            hcr.AcceptedSource  = Elements.WebServer + cr._PathWeb;
            hcr.ResultFile      = resObj;
            hcr.SourceTimestamp = WebHelper.LastModifiedDate(hcr.AcceptedSource);
            hcr.Succeed         = true;

            return(hcr);
        }
 protected virtual bool PostScriptProcessing(DBObject theObject, HandleCaseResult hcr)
 {
     return(true);
 }