Ejemplo n.º 1
0
            static IContentProvider GetContentProvider(NormalizedPath path, IExecutionContext context)
            {
                if (path.IsNull)
                {
                    throw new ExecutionException("Invalid directory");
                }
                IFile zipFile = ZipFileHelper.CreateZipFile(context, path);

                return(zipFile.GetContentProvider());
            }
Ejemplo n.º 2
0
        private static void ZipFiles(string tempDir, DateTime dateToUse, string location_name)
        {
            string    zipFile    = "EMR_" + dateToUse.ToString("MM_dd_yyyy") + ".kjzip";
            ArrayList filesToZip = new ArrayList();

            foreach (string file in Directory.GetFiles(tempDir))
            {
                FileInfo info = new FileInfo(file);
                if (info.Extension != ".kjzip")
                {
                    filesToZip.Add(file);
                    Log log = new Log(ssDataLayer)
                    {
                        FileName     = file,
                        Image        = false,
                        Action       = Actions.Zip,
                        Date_created = DateTime.Now,
                        Machine      = Environment.MachineName
                    };
                    log.Save();
                }
            }


            ZipFileHelper.CreateZipFile(tempDir + "\\" + zipFile, (string[])filesToZip.ToArray(typeof(string)));
            string message = filesToZip.Count + " were zipped for "
                             + location_name + " by " + Environment.MachineName;

            message += "<br /><a href=\"http://SSLog/log.aspx?d=" + DateTime.Now.ToString("yyyy/MM/dd") + "&a=" + (int)Actions.Zip + "&l=" + location_name + "\">Click to see which files were Zipped for " + location_name + " </>";
            string ssServer = SiteServers.MachineNameForLocation(ssDataLayer, location_name);

            if (!string.IsNullOrEmpty(ssServer) && ssServer != "Network")
            {
                message += "<br /><a href=\"http://" + ssServer + "/SSLog_root/log.aspx?d=" + DateTime.Now.ToString("yyyy/MM/dd") + "&a=" + (int)Actions.Unzip + "\">Click to see which files were unzipped by the Site Server at this location</>";
            }
            else
            {
                message += "<br /><a href=\"http://SSLog/log.aspx?d=" + DateTime.Now.ToString("yyyy/MM/dd") + "&a=" + (int)Actions.Unzip + "&l=" + location_name + "\">Click to see which files were Unzipped for " + location_name + " </>";
            }


            string subject = "Files Zipped for " + location_name + " by " + Environment.MachineName;

            SendEmail(subject, message, MailPriority.Normal);
        }
Ejemplo n.º 3
0
 protected override IEnumerable <IDocument> ExecuteConfig(IDocument input, IExecutionContext context, DirectoryPath value) =>
 context.CloneOrCreateDocument(input, ZipFileHelper.CreateZipFile(context, value).GetContentProvider()).Yield();