Exemplo n.º 1
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (IsPostBack && Validators.Count == 0)
     {
         Response.Redirect(Request.Url.ToString());
     }
     try
     {
         BackupList.DataSource = from f in C1Directory.GetFiles(BackupDirectory, "*.zip")
                                 orderby f
                                 select new
         {
             Filename    = Path.GetFileName(f),
             DateCreated = C1File.GetCreationTime(f),
             Filepath    = string.Format("?{0}={1}", BackupFilename, Path.GetFileName(f)),
             Filesize    = ((int)((new C1FileInfo(f).Length) / 1000)).ToString("N0")
         };
         BackupList.DataBind();
     }
     catch
     {
     }
 }
        private static void ClearOldTempFiles()
        {
            DateTime yesterday = DateTime.Now.AddDays(-1);
            var      oldFiles  = C1Directory.GetFiles(TempAssemblyFolderPath, "*.*").Where(filePath => C1File.GetCreationTime(filePath) < yesterday).ToArray();

            foreach (var file in oldFiles)
            {
                try
                {
                    C1File.Delete(file);
                }
                catch
                {
                    // Silent
                }
            }
        }