Exemple #1
0
        public static void CopyFolder(string strFromPath, string strToPath)
        {
            if (!System.IO.Directory.Exists(strFromPath))
            {
                System.IO.Directory.CreateDirectory(strFromPath);
            }
            string text = strFromPath.Substring(strFromPath.LastIndexOf("\\") + 1, strFromPath.Length - strFromPath.LastIndexOf("\\") - 1);

            if (!System.IO.Directory.Exists(strToPath + "\\" + text))
            {
                System.IO.Directory.CreateDirectory(strToPath + "\\" + text);
            }
            string[] files = System.IO.Directory.GetFiles(strFromPath);
            for (int i = 0; i < files.Length; i++)
            {
                string text2 = files[i].Substring(files[i].LastIndexOf("\\") + 1, files[i].Length - files[i].LastIndexOf("\\") - 1);
                System.IO.File.Copy(files[i], string.Concat(new string[]
                {
                    strToPath,
                    "\\",
                    text,
                    "\\",
                    text2
                }), true);
            }
            System.IO.DirectoryInfo   directoryInfo = new System.IO.DirectoryInfo(strFromPath);
            System.IO.DirectoryInfo[] directories   = directoryInfo.GetDirectories();
            for (int j = 0; j < directories.Length; j++)
            {
                string strFromPath2 = strFromPath + "\\" + directories[j].ToString();
                SetReset.CopyFolder(strFromPath2, strToPath + "\\" + text);
            }
        }
Exemple #2
0
 private void ExecuteScriptFile(string pathToScriptFile, out string errorMsg)
 {
     try
     {
         string arg_0D_0 = Globals.ApplicationPath;
         System.IO.StreamReader streamReader2;
         System.IO.StreamReader streamReader = streamReader2 = new System.IO.StreamReader(pathToScriptFile);
         try
         {
             while (!streamReader.EndOfStream)
             {
                 string text = SetReset.NextSqlFromStream(streamReader);
                 if (!string.IsNullOrEmpty(text))
                 {
                     System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(text);
                     this.database.ExecuteNonQuery(sqlStringCommand);
                 }
             }
             errorMsg = "";
         }
         finally
         {
             if (streamReader2 != null)
             {
                 ((System.IDisposable)streamReader2).Dispose();
             }
         }
     }
     catch (System.Data.SqlClient.SqlException ex)
     {
         errorMsg = ex.Message;
     }
 }
Exemple #3
0
 protected void btnReset_Click(object sender, System.EventArgs e)
 {
     try
     {
         SetReset.CopyFolder(base.Server.MapPath("/Storage/temp/defaultdata/"), base.Server.MapPath("/"));
         this.litMsg.Text = this.litMsg.Text + "<p>重置网站的首页模版文件以及配置文件还原成功!</p>";
     }
     catch (System.Exception ex)
     {
         this.litMsg.Text = ex.ToString();
     }
 }