示例#1
0
        public static string scriptLoc(RunnableScript script)
        {
            switch (script)
            {
            case RunnableScript.modifyScript:
                if (Extensions.IsLinux)
                {
                    return(pyModifyScriptLocationNix);
                }
                else
                {
                    return(pyModifyScriptLocationWin);
                }

            case RunnableScript.verifyScript:
                if (Extensions.IsLinux)
                {
                    return(pyVerifyScriptLocationNix);
                }
                else
                {
                    return(pyVerifyScriptLocationWin);
                }

            case RunnableScript.testScript:
                if (Extensions.IsLinux)
                {
                    return(pyTestScriptLocationNix);
                }
                else
                {
                    return(pyTestScriptLocationWin);
                }
            }
            return(null);
        }
示例#2
0
 /// <summary>
 /// Opens the file at the provided scriptPath and splits it into individual blocks of SQL commands to be run on the database.
 /// </summary>
 /// <param name="scriptPath">The complete file path of the SQL script file.</param>
 private List<RunnableScript> RunInstallationScript(string scriptPath)
 {
     string script = File.ReadAllText(scriptPath);
     string[] scripts = SqlDelimiterRegex.Split(script);
     List<RunnableScript> results = new List<RunnableScript>();
     foreach (string item in scripts)
     {
         RunnableScript thisScript = new RunnableScript();
         thisScript.SQLScript = item.Replace("\r\n", "<br/>");
         try
         {
             ExecuteNonQuery(CommandType.Text, item);
             thisScript.Installed = true;
         }
         catch (Exception ex)
         {
             thisScript.Installed = false;
             thisScript.FailureMessage = ex.Message.Replace("\r\n", "<br/>");
         }
         results.Add(thisScript);
     }
     return results;
 }