示例#1
0
 private void UpdateAndwhoData()
 {
     try
     {
         if (File.Exists(Application.StartupPath + @"\Andwho.zip"))
         {
             UnZipClass unZip = new UnZipClass();
             string errMsg = string.Empty;
             bool success = unZip.UnZipFile(Application.StartupPath + @"\Andwho.zip", Application.StartupPath + @"\", out errMsg);
             if (success && SaveUserConfig())
             {
                 File.Delete(Application.StartupPath + @"\Data\Andwho.db");
                 File.Delete(Application.StartupPath + @"\Andwho.zip");
                 File.Move(Application.StartupPath + @"\Andwho.db", Application.StartupPath + @"\Data\Andwho.db");
             }
         }
         #region Image
         if (File.Exists(Application.StartupPath + @"\hong.png"))
         {
             File.Delete(Application.StartupPath + @"\hong.png");
         }
         if (File.Exists(Application.StartupPath + @"\huang.png"))
         {
             File.Delete(Application.StartupPath + @"\huang.png");
         }
         if (File.Exists(Application.StartupPath + @"\lv.png"))
         {
             File.Delete(Application.StartupPath + @"\lv.png");
         }
         //if (!Directory.Exists(Application.StartupPath + @"\Image"))
         //{
         //    Directory.CreateDirectory(Application.StartupPath + @"\Image");
         //}
         //if (File.Exists(Application.StartupPath + @"\green.png"))
         //{
         //    if (!File.Exists(Application.StartupPath + @"\Image\green.png"))
         //        File.Move(Application.StartupPath + @"\green.png", Application.StartupPath + @"\Image\green.png");
         //}
         //if (File.Exists(Application.StartupPath + @"\yellow.png"))
         //{
         //    if (!File.Exists(Application.StartupPath + @"\Image\yellow.png"))
         //        File.Move(Application.StartupPath + @"\yellow.png", Application.StartupPath + @"\Image\yellow.png");
         //}
         //if (File.Exists(Application.StartupPath + @"\red.png"))
         //{
         //    if (!File.Exists(Application.StartupPath + @"\Image\red.png"))
         //        File.Move(Application.StartupPath + @"\red.png", Application.StartupPath + @"\Image\red.png");
         //}
         #endregion
     }
     catch (Exception ex)
     {
         log.WriteLog(ex.ToString());
     }
 }
示例#2
0
 private void UpdateAndwhoData()
 {
     try
     {
         if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\Update\DeskHelper.xml"))
         {
             File.Delete(System.Windows.Forms.Application.StartupPath + @"\Update\DeskHelper.xml");
         }
         if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\Andwho.zip"))
         {
             UnZipClass unZip = new UnZipClass();
             string errMsg = string.Empty;
             bool success = unZip.UnZipFile(System.Windows.Forms.Application.StartupPath + @"\Andwho.zip", System.Windows.Forms.Application.StartupPath + @"\", out errMsg);
             if (success && SaveUserConfig())
             {
                 File.Delete(System.Windows.Forms.Application.StartupPath + @"\Data\Andwho.db");
                 File.Delete(System.Windows.Forms.Application.StartupPath + @"\Andwho.zip");
                 File.Move(System.Windows.Forms.Application.StartupPath + @"\Andwho.db", System.Windows.Forms.Application.StartupPath + @"\Data\Andwho.db");
             }
         }
         #region Image
         if (!Directory.Exists(System.Windows.Forms.Application.StartupPath + @"\Image"))
         {
             Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + @"\Image");
         }
         if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\lv.png"))
         {
             if (!File.Exists(System.Windows.Forms.Application.StartupPath + @"\Image\lv.png"))
                 File.Move(System.Windows.Forms.Application.StartupPath + @"\lv.png", System.Windows.Forms.Application.StartupPath + @"\Image\lv.png");
         }
         if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\huang.png"))
         {
             if (!File.Exists(System.Windows.Forms.Application.StartupPath + @"\Image\huang.png"))
                 File.Move(System.Windows.Forms.Application.StartupPath + @"\huang.png", System.Windows.Forms.Application.StartupPath + @"\Image\huang.png");
         }
         if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\hong.png"))
         {
             if (!File.Exists(System.Windows.Forms.Application.StartupPath + @"\Image\hong.png"))
                 File.Move(System.Windows.Forms.Application.StartupPath + @"\hong.png", System.Windows.Forms.Application.StartupPath + @"\Image\hong.png");
         }
         #endregion
     }
     catch
     {
     }
 }