예제 #1
0
        private void PatchForm_Load(object sender, EventArgs e)
        {
            if (!File.Exists(Cache))
            {
                this.Text += " (无缓存)";
                return;
            }
            string[] lines = CacheUtil.GetAllLines(Cache);
            if (lines.Length == 0)
            {
                this.Text += " (空缓存)";
                return;
            }
            string lastLine = lines[lines.Length - 1];

            if (lastLine.StartsWith("INSERT", true, System.Globalization.CultureInfo.CurrentCulture))
            {
                this.Text += " (需关机)";
            }
            else if (lastLine.StartsWith("UPDATE", true, System.Globalization.CultureInfo.CurrentCulture))
            {
                this.Text += " (需开机)";
            }
            else
            {
                MessageBox.Show("请手动检查缓存文件格式", "读取格式异常!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }