«前の日記(2008-01-22) 最新 次の日記(2008-01-24)» 編集

ToDo:

  • 99 深呼吸して、おちけつ (~12/31 あと287日)
  • 98 毎日アウトプットを重きにおいた目標をたてる (~12/31 あと287日)
  • 97 買物は行動を変えるもの・ことに限る (~12/31 あと287日)
  • 96 合理的な行動はときに我慢を強いる(~12/31 あと287日)

ɥozɐʞıɥ


2008-01-23 えーヲレもPCも絶不調 [長年日記]

_ [PC][C#] Cacheを消してしまえ。

ついでにTempも消してみました。 本当は各ディレクトリやフォルダー毎にinstanceを作ってあげれば綺麗にできそうなのだが、まぁいいだろう。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
 
namespace DeleteCache
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private string dbCash = "C:\\Documents and Settings\\hikazoh\\Local Settings\\Application Data\\IconCache.db";
        private string gdiCash = "C:\\Documents and Settings\\hikazoh\\Local Settings\\Application Data\\GDIPFONTCACHEV1.DAT";
        private string fusionCash = "C:\\Documents and Settings\\hikazoh\\Local Settings\\Application Data\\fusioncache.dat";
        private string tempDir = "C:\\Documents and Settings\\hikazoh\\Local Settings\\Temp";
        private string fntCash = "C:\\WINDOWS\\system32\\FNTCACHE.DAT";
        private void button1_Click(object sender, EventArgs e)
        {
            if (File.Exists(this.dbCash))
            {
                try
                {
                    File.Delete(this.dbCash);
                }
                catch (Exception exp)
                {
                    MessageBox.Show("IconCache Delete Failre:" + exp.Message);
                }
            }
            if (File.Exists(this.fntCash))
            {
                try
                {
                    File.Delete(this.fntCash);
                }
                catch (Exception exp)
                {
                    MessageBox.Show("FontCache Delete Failre:" + exp.Message);
                }
            }
            if (File.Exists(this.gdiCash))
            {
                try
                {
                    File.Delete(this.gdiCash);
                }
                catch (Exception exp)
                {
                    MessageBox.Show("GdiCache Delete Failre:" + exp.Message);
                }
            }
            if (File.Exists(this.fusionCash))
            {
                try
                {
                    File.Delete(this.fusionCash);
                }
                catch (Exception exp)
                {
                    MessageBox.Show("FusionCache Delete Failre:" + exp.Message);
                }
            }
            foreach (string dirs in Directory.GetDirectories(this.tempDir))
            {
                if (Directory.Exists(dirs))
                {
                    try
                    {
                        Directory.Delete(dirs);
                    }
                    catch (Exception exp)
                    {
                        MessageBox.Show("FusionCache Delete Failre:" + exp.Message);
                    }
                }
            }
            foreach (string files in Directory.GetFiles(this.tempDir))
            {
                if (File.Exists(files))
                {
                    try
                    {
                        File.Delete(files);
                    }
                    catch (Exception exp)
                    {
                        MessageBox.Show("FusionCache Delete Failre:" + exp.Message);
                    }
                }
            }
            MessageBox.Show("Delete Complete");
        }
    }
}

すいません、バグがありました。01/28 2008修正。ほんとは、delegateでちゃんと綺麗に書きたいのだが。


2002|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|
«前の日記(2008-01-22) 最新 次の日記(2008-01-24)» 編集