コード例 #1
0
        private void diskSpaceCheckTimer_Tick(object sender, EventArgs e)
        {
            string drive = System.IO.Path.GetPathRoot(Properties.Settings.Default.OutputPath);

            var space = FileSystemStorage.GetFreeDiskSpaceBytes(drive);

            long diskQuota = long.Parse(Properties.Settings.Default.DiskQuota) * (1024 * 1024);

            if (space <= diskQuota && !isDeleting)
            {
                isDeleting = true;
                System.Threading.ThreadPool.QueueUserWorkItem((o) =>
                {
                    try
                    {
                        FileSystemStorage.DeleteMostOutDatedDataForDay(1);
                    }
                    catch (System.IO.IOException)
                    {
                    }
                    finally
                    {
                        isDeleting = false;
                    }
                },
                                                              null
                                                              );
            }
        }
コード例 #2
0
 private static long FreeDiskSpaceBytes()
 {
     return(FileSystemStorage.GetFreeDiskSpaceBytes(Properties.Settings.Default.OutputPath));
 }