protected override JsonCommand DoExecute(string args)
        {
            string infoFilePath = "/data/logs/RadarClient/info.log";

            if (!FileUtils.IsFileExist(infoFilePath))
            {
                logger.ErrorFormat("log file#{0} do not exist", infoFilePath);
                return(null);
            }


            int    clientNo = ClientService.AssignedClientNo;
            string dt       = DateTime.Now.ToString("yyyy-MM-dd");

            string zippedLogFile = "/temp/" + dt + "-" + clientNo + "-" + KK.CurrentMills() + "-info.log.gz";

            ZipUtils.Compress(zippedLogFile, infoFilePath);

            // upload
            ScreenImageUploadResponse resp = bidActionManager.UploadFileToSaber(zippedLogFile, 10);

            // FileUtils.DeleteFile(zippedLogFile);
            logger.InfoFormat("delete file#{0}", zippedLogFile);

            return(null);
        }
Example #2
0
        static void Main(string[] args)
        {
            IList <SourceFile> list = new List <SourceFile>();

            list.Add(new SourceFile {
                Extension = "pdf",
                Name      = FileNameNormalizer.Normalize("N.CREDITO VENDITA_12/01/2018_877_VD"),
                FileBytes = File.ReadAllBytes(@"c:\Temp\EsCC.pdf")
            });
            list.Add(new SourceFile
            {
                Extension = "pdf",
                Name      = "pippo1/",
                FileBytes = File.ReadAllBytes(@"c:\Temp\EsFattura.pdf")
            });
            list.Add(new SourceFile
            {
                Extension = "pdf",
                Name      = "pippo2;",
                FileBytes = File.ReadAllBytes(@"c:\Temp\EsDocumentoI.pdf")
            });
            list.Add(new SourceFile
            {
                Extension = ".pdf",
                Name      = "pippo3",
                FileBytes = File.ReadAllBytes(@"c:\Temp\EsCC.pdf")
            });
            list.Add(new SourceFile
            {
                Extension = "pdf",
                Name      = "pippo4",
                FileBytes = File.ReadAllBytes(@"c:\Temp\EsFattura.pdf")
            });
            list.Add(new SourceFile
            {
                Extension = "pdf",
                Name      = "pippo5",
                FileBytes = File.ReadAllBytes(@"c:\Temp\EsDocumentoI.pdf")
            });

            var res = ZipUtils.Compress(list);

            File.WriteAllBytes(@"c:\Temp\Doc.zip", res);

            Console.WriteLine("Compressione avvenuta!");
            Console.ReadKey();
        }