示例#1
0
        public void SaveToXMLFile(FileInfo configFile)
        {
            if (configFile == null)
            {
                throw new ArgumentNullException("configFile");
            }
            XMLConfigFile xMLConfigFile = new XMLConfigFile();

            this.SaveToConfig(xMLConfigFile);
            xMLConfigFile.Save(configFile);
        }
        /// <summary>
        /// Save the configuration to a XML file
        /// </summary>
        /// <param name="configFile">The file to save</param>
        public void SaveToXMLFile(FileInfo configFile)
        {
            if (configFile == null)
            {
                throw new ArgumentNullException("configFile");
            }

            XMLConfigFile config = new XMLConfigFile();

            SaveToConfig(config);
            config.Save(configFile);
        }
示例#3
0
        public void OnClick(object sender, EventArgs e)
        {
            Control    Con  = (sender as Button);
            MethodInfo Info = GetType().GetMethod(Con.Tag as string);

            Log.Info("Function", "Name=" + (string)Con.Tag);

            if (Info == null)
            {
                Log.Error("Function", "Function not find : " + (string)Con.Tag);
                return;
            }

            Config = EasyServer.GetConf("Config");

            List <string> Params = new List <string>();
            ConfigElement Button = null;;

            foreach (ConfigElement Element in Config.Children.Values)
            {
                if (Element["Tag"].GetString() == Con.Tag as string)
                {
                    Button = Element;
                    break;
                }
            }

            foreach (ConfigElement Element in Button.Children["OnClick"].Children.Values)
            {
                string TagToFind = Element.GetString();
                string TagValue  = GetTag(TagToFind);

                Log.Info("OnClick", TagToFind + " Add value : " + TagValue);

                if (TagValue.Length > 0)
                {
                    Params.Add(TagValue);
                }
            }


            if (Info.GetParameters().Length != Params.Count)
            {
                Log.Error("OnClick", "Function :" + Con.Tag + ", Invalid Params Count : Function=" + Info.GetParameters().Length + ",Xml=" + Params.Count);
                return;
            }

            if (Info != null)
            {
                Info.Invoke(this, Params.ToArray());
            }
        }
示例#4
0
    private static void CreateCBRContext(ICBRContext ctx, string engineName,
                                         string env)
    {
        XMLConfigFile f      = new XMLConfigFile(env);
        ConfigInfo    config = f.GetConfigInfo();

        if (config != null)
        {
            ManagerHelper helper = new ManagerHelper();
            helper.SetEnv(engineName);
            helper.CreateCBRContext(config, ctx);
        }
    }
示例#5
0
        ///#################################################################################
        /// <summary>
        /// 所指定的config文件是否存在
        /// Coder:Ryo wu 2007-07-12
        /// </summary>
        /// <param name="xmlConfigFile">xml文件</param>
        /// <returns>true:存在 false:不存在</returns>
        ///#################################################################################
        public bool ExistXMLConfigFile(XMLConfigFile xmlConfigFile)
        {
            bool bExist = false;

            switch (xmlConfigFile)
            {
            case XMLConfigFile.SystemEnvironment:
            {
                bExist = File.Exists(Application.StartupPath + "\\config\\" + SYSTEM_ENVIRONMENT_FILENAME);
                break;
            }
            }
            return(bExist);
        }
示例#6
0
        ///#################################################################################
        /// <summary>
        /// 读取config文件
        /// </summary>
        /// <param name="sFilePath">xml config文件</param>
        ///#################################################################################
        public void LoadConfig(XMLConfigFile xmlConfigFile)
        {
            string FilePath = "";

            switch (xmlConfigFile)
            {
            case XMLConfigFile.SystemEnvironment:
            {
                FilePath = Application.StartupPath + "\\config\\" + SYSTEM_ENVIRONMENT_FILENAME;
                break;
            }
            }
            this.sFilePath = FilePath;
            dsConfigData.ReadXml(this.sFilePath, XmlReadMode.Auto);
        }
示例#7
0
        ///#################################################################################
        /// <summary>
        /// 初始化XMLConfig文件,恢复到刚安装软件后的状态(config文件都在 \config\文件夹中)
        /// Coder:Ryo wu 2007-07-12
        /// </summary>
        /// <param name="xmlConfigFile">配置文件的名字</param>
        /// <param name="bCheckExist">true:检查如果存在则跳过  false:直接覆盖</param>
        /// <returns>true:成功 false:失败</returns>
        ///#################################################################################
        public void InitXMLConfigFile(XMLConfigFile xmlConfigFile, bool bCheckExist)
        {
            if (!Directory.Exists(Application.StartupPath + "\\config"))
            {
                Directory.CreateDirectory(Application.StartupPath + "\\config");
            }
            dsConfigData.Clear();
            dsConfigData.Reset();
            switch (xmlConfigFile)
            {
            case XMLConfigFile.SystemEnvironment:
            {
                dsConfigData.Tables.Add(BuildConfigTable("Connection"));
                this.sFilePath = Application.StartupPath + "\\config\\" + SYSTEM_ENVIRONMENT_FILENAME;
                break;
            }
            }

            //this.SaveConfig();
        }
示例#8
0
        void saveConfig(SaveConfigOptions saveConfigOptions)
        {
            if (saveConfigOptions.FileName != null)
            {
                Configuration config = new Configuration();

                if (saveConfigOptions.ExportConnection.IsChecked == true)
                {
                    config.Connection = this.vm.CurrentConnection;
                }

                if (saveConfigOptions.ExportRules.IsChecked == true)
                {
                    config.AllRules   = this.dblint.AllExecutables.Where(ex => ex.IsRule());
                    config.RulesToRun = this.getRulesToRun();
                }
                else
                {
                    config.AllRules   = this.dblint.AllExecutables.Where(ex => ex.IsSQLRule() == true);
                    config.RulesToRun = this.getRulesToRun().Where(r => r.IsSQLRule() == true);
                }

                if (saveConfigOptions.ExportSQLRules.IsChecked == false)
                {
                    config.AllRules   = config.AllRules.Where(r => r.IsSQLRule() == false);
                    config.RulesToRun = config.RulesToRun.Where(r => r.IsSQLRule() == false);
                }

                if (saveConfigOptions.ExportTables.IsChecked == true)
                {
                    config.TablesToCheck = this.getTablesToCheck();
                }

                IConfigFile file = new XMLConfigFile(saveConfigOptions.FileName);
                file.Save(config);
            }
        }
示例#9
0
 ///#################################################################################
 /// <summary>
 /// 初始化XMLConfig文件,恢复到刚安装软件后的状态(config文件都在 \config\文件夹中)
 /// Coder:Ryo wu 2007-07-12
 /// </summary>
 /// <param name="xmlConfigFile">配置文件的名字</param>
 /// <returns>true:成功 false:失败</returns>
 ///#################################################################################
 public void InitXMLConfigFile(XMLConfigFile xmlConfigFile)
 {
     InitXMLConfigFile(xmlConfigFile, false);
 }
示例#10
0
        public void LoadFromXMLFile(FileInfo configFile)
        {
            XMLConfigFile root = XMLConfigFile.ParseXMLFile(configFile);

            this.LoadFromConfig(root);
        }
示例#11
0
        /// <summary>
        /// Compiles the scripts into an assembly
        /// </summary>
        /// <param name="compileVB">True if the source files will be in VB.NET</param>
        /// <param name="scriptFolder">Path to the source files</param>
        /// <param name="outputPath">Name of the assembly to be generated</param>
        /// <param name="asm_names">References to other assemblies</param>
        /// <returns>True if succeeded</returns>
        public static bool CompileScripts(bool compileVB, string scriptFolder, string outputPath, string[] asm_names)
        {
            var outputFile = new FileInfo(outputPath);

            if (!scriptFolder.EndsWith(@"\") && !scriptFolder.EndsWith(@"/"))
            {
                scriptFolder = scriptFolder + "/";
            }

            //Reset the assemblies
            m_compiledScripts.Clear();

            //Check if there are any scripts, if no scripts exist, that is fine as well
            IList <FileInfo> files = ParseDirectory(new DirectoryInfo(scriptFolder), compileVB ? "*.vb" : "*.cs", true);

            if (files.Count == 0)
            {
                return(true);
            }

            //Recompile is required as standard
            bool recompileRequired = true;

            //This file should hold the script infos
            var configFile = new FileInfo(outputFile.FullName + ".xml");

            //If the script assembly is missing, recompile is required
            if (!outputFile.Exists)
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug("Script assembly missing, recompile required!");
                }
            }
            else
            {
                //Script assembly found, check if we have a file modify info
                if (configFile.Exists)
                {
                    //Ok, we have a config file containing the script file sizes and dates
                    //let's check if any script was modified since last compiling them
                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Found script info file");
                    }

                    try
                    {
                        XMLConfigFile config = XMLConfigFile.ParseXMLFile(configFile);

                        //Assume no scripts changed
                        recompileRequired = false;

                        Dictionary <string, ConfigElement> precompiledScripts = new Dictionary <string, ConfigElement>(config.Children);

                        //Now test the files
                        foreach (FileInfo finfo in files)
                        {
                            if (config[finfo.FullName]["size"].GetInt(0) != finfo.Length ||
                                config[finfo.FullName]["lastmodified"].GetLong(0) != finfo.LastWriteTime.ToFileTime())
                            {
                                //Recompile required
                                recompileRequired = true;
                                break;
                            }
                            precompiledScripts.Remove(finfo.FullName);
                        }

                        recompileRequired |= precompiledScripts.Count > 0;                         // some compiled script was removed

                        if (recompileRequired && log.IsDebugEnabled)
                        {
                            log.Debug("At least one file was modified, recompile required!");
                        }
                    }
                    catch (Exception e)
                    {
                        if (log.IsErrorEnabled)
                        {
                            log.Error("Error during script info file to scripts compare", e);
                        }
                    }
                }
                else
                {
                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Script info file missing, recompile required!");
                    }
                }
            }

            //If we need no compiling, we load the existing assembly!
            if (!recompileRequired)
            {
                recompileRequired = !LoadAssembly(outputFile.FullName);

                if (!recompileRequired)
                {
                    //Return success!
                    return(true);
                }
            }

            //We need a recompile, if the dll exists, delete it firsthand
            if (outputFile.Exists)
            {
                outputFile.Delete();
            }

            var compilationSuccessful = false;

            try
            {
                var compiler = new DOLScriptCompiler();
                if (compileVB)
                {
                    compiler.SetToVisualBasicNet();
                }

                var compiledAssembly = compiler.Compile(outputFile, files);
                compilationSuccessful = true;

                AddOrReplaceAssembly(compiledAssembly);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("CompileScripts", e);
                }
                m_compiledScripts.Clear();
            }
            //now notify our callbacks
            if (!compilationSuccessful)
            {
                return(false);
            }

            var newconfig = new XMLConfigFile();

            foreach (var finfo in files)
            {
                newconfig[finfo.FullName]["size"].Set(finfo.Length);
                newconfig[finfo.FullName]["lastmodified"].Set(finfo.LastWriteTime.ToFileTime());
            }
            if (log.IsDebugEnabled)
            {
                log.Debug("Writing script info file");
            }

            newconfig.Save(configFile);

            return(true);
        }
示例#12
0
        public static bool Init()
        {
            XMLConfigFile xmlConfig = new XMLConfigFile();
            FileInfo      file      = new FileInfo("./config/MailConfig.xml");

            try
            {
                if (file.Exists)
                {
                    xmlConfig = XMLConfigFile.ParseXMLFile(file);
                    m_enable  = xmlConfig["Enable"].GetBoolean(false);
                    if (m_enable)
                    {
                        m_username     = xmlConfig["Username"].GetString("");
                        m_password     = xmlConfig["Password"].GetString("");
                        m_emailAddress = xmlConfig["EmailAddress"].GetString("");
                        m_smtpServer   = xmlConfig["SMTPServer"].GetString("");
                        m_ssl          = xmlConfig["SSL"].GetBoolean(false);
                        Logger.Info("Mail enabled");
                    }
                    else
                    {
                        Logger.Info("Mail disabled");
                    }
                }
                else
                {
                    //create and add default values
                    xmlConfig["Username"].Set("");
                    xmlConfig["Password"].Set("");
                    xmlConfig["EmailAddress"].Set("");
                    xmlConfig["SMTPServer"].Set("");
                    xmlConfig["SSL"].Set(false);
                    xmlConfig["Enable"].Set(false);
                    file.Refresh();
                    xmlConfig.Save(file);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(false);
            }

            SmtpClient = new SmtpClient(m_smtpServer);
            SmtpClient.UseDefaultCredentials = false;
            SmtpClient.EnableSsl             = m_ssl;
            SmtpClient.Credentials           = new NetworkCredential(m_username, m_password);

            if (DOL.GS.ServerProperties.Properties.LOG_EMAIL_ADDRESSES != "")
            {
                SendLogs(DOL.GS.ServerProperties.Properties.LOG_EMAIL_ADDRESSES);
            }

            if (m_enable)
            {
                //create callback thread for the send mail queue
                m_timer = new Timer(new TimerCallback(RunTask), null, m_mailFrequency, 0);
            }

            return(true);
        }
        /// <summary>
        /// Load the configuration from a XML source file
        /// </summary>
        /// <param name="configFile">The file to load from</param>
        public void LoadFromXMLFile(FileInfo configFile)
        {
            XMLConfigFile xmlConfig = XMLConfigFile.ParseXMLFile(configFile);

            LoadFromConfig(xmlConfig);
        }
示例#14
0
        public void LoadConfig()
        {
            if (!EasyServer.InitConfig("Configs/Conf.xml", "Config"))
            {
                return;
            }

            Config = EasyServer.GetConf("Config");

            foreach (KeyValuePair <string, ConfigElement> Elements in Config.Children)
            {
                ConfigElement Element = Elements.Value;

                Log.Info("Control", "New control : " + Elements.Key);

                if (Elements.Key == "Master")
                {
                    string Name   = Element["Name"].GetString("Launcher");
                    int    W      = Element["Width"].GetInt(100);
                    int    H      = Element["Height"].GetInt(100);
                    int    Resize = Element["Resize"].GetInt(100);

                    Log.Info("Scale", "X=" + W + ",Y=" + H);

                    this.Name = Name;
                    this.Text = Name;

                    this.AutoScaleDimensions = new SizeF(W, H);
                    this.AutoScaleMode       = AutoScaleMode.Font;
                    this.FormBorderStyle     = Resize <= 0 ? FormBorderStyle.FixedToolWindow : FormBorderStyle.Sizable;
                    this.ClientSize          = new Size(Width, Height);
                    this.Size = new System.Drawing.Size(W, H);
                }
                else
                {
                    string   Type         = Element["Type"].GetString("label");
                    string   Name         = Element["Name"].GetString("Unknown");
                    string   Text         = Element["Text"].GetString("");
                    int      W            = Element["Width"].GetInt(100);
                    int      H            = Element["Height"].GetInt(20);
                    int      X            = Element["X"].GetInt(0);
                    int      Y            = Element["Y"].GetInt(0);
                    int      Transparency = Element["Tranparency"].GetInt(0);
                    string   Tag          = Element["Tag"].GetString("");
                    string[] BackColor    = Element["BackColor"].GetString("1,1,1").Split(',');
                    string[] ForeColor    = Element["ForeColor"].GetString("255,255,255").Split(',');

                    Log.Info("Tag", "Tag=" + Tag);

                    Control Con;
                    switch (Type)
                    {
                    case "textArea":
                        int Masked = Element["Masked"].GetInt(0);

                        if (Masked == 0)
                        {
                            Con = new TextBox();
                        }
                        else
                        {
                            Con = new MaskedTextBox();
                        }

                        if (Transparency > 0)
                        {
                            (Con as TextBoxBase).BorderStyle = BorderStyle.None;
                        }

                        break;

                    case "Label":
                        Con = new Label();
                        break;

                    case "button":
                        Con        = new Button();
                        Con.Click += new EventHandler(this.OnClick);
                        break;

                    case "picture":

                        Con = new PictureBox();
                        (Con as PictureBox).ImageLocation = Element["Image"].GetString();
                        (Con as PictureBox).InitialImage  = null;
                        break;

                    default:
                        Con = new Label();
                        break;
                    }

                    Con.Name     = Name;
                    Con.Text     = Text;
                    Con.Location = new System.Drawing.Point(X, Y);
                    Con.Size     = new System.Drawing.Size(W, H);

                    if (Con is Label)
                    {
                        (Con as Label).AutoSize = true;
                    }

                    Con.Tag = Tag;

                    if (BackColor.Length >= 3)
                    {
                        Con.BackColor = Color.FromArgb(int.Parse(BackColor[0]), int.Parse(BackColor[1]), int.Parse(BackColor[2]));
                    }

                    if (ForeColor.Length >= 3)
                    {
                        Con.ForeColor = Color.FromArgb(int.Parse(ForeColor[0]), int.Parse(ForeColor[1]), int.Parse(ForeColor[2]));
                    }

                    _Controls.Add(Con);
                }
            }
        }
示例#15
0
 [SetUp] public void Init()
 {
     file = new XMLConfigFile(path);
 }
示例#16
0
        private void loadConfig(string filename)
        {
            IConfigFile configFile = new XMLConfigFile(filename);

            if (!configFile.IsValid())
            {
                MessageBox.Show("Configuration file is not valid");
                return;
            }

            //Connection
            var connection = configFile.GetConnection();

            if (connection != null)
            {
                //Only add loaded connection if a similar connection doesnt already exist
                var existingConn = this.SelectConnection.ConnectionConfiguration.Connections.Where(c => c.Equals(connection)).FirstOrDefault();
                if (existingConn == null)
                {
                    this.SelectConnection.ConnectionConfiguration.Connections.Insert(0, connection);
                    DBLint.DBLintGui.ConnectionSerializer.SaveConnectionConfiguration(this.SelectConnection.ConnectionConfiguration);
                }
                else
                {
                    connection = existingConn;
                }


                this.SelectConnection.comboConnections.SelectedItem = connection;
                this.SelectConnection_ConnectionChanged(this, connection);

                foreach (var schema in this.performSelection.Schemas)
                {
                    schema.Include = false;
                    this.performSelection.schemaSelection.SelectedValue = schema;

                    var tables = schema.Tables.Value;
                    this.performSelection.tableSelection.DataContext = tables.Any() ? tables : null;
                }
                this.performSelection.ValidState = true;
            }

            //Configure rules
            foreach (var e in this.dblint.AllExecutables)
            {
                configFile.ConfigureRule(e);
            }

            //Rule selection
            if (configFile.GetRulesToRun().Count() > 0)
            {
                this.initializeSelectRules();

                var rulesets = this.selectRules.RuleConf.RuleSets;

                foreach (var ruleset in rulesets)
                {
                    ruleset.Include = false;
                    foreach (var rule in ruleset.Rules)
                    {
                        bool include = configFile.RunRule(rule.Executable);
                        if (include == true)
                        {
                            rule.Include    = true;
                            ruleset.Include = true;
                        }
                        else
                        {
                            rule.Include = false;
                        }
                    }
                }
                this.selectRules.rulesSetsView.SelectedIndex = 0;
            }

            //Table selection
            if (configFile.GetTablesToCheck().Count() > 0)
            {
                foreach (var schema in this.vm.MetadataSelection.Schemas)
                {
                    foreach (var table in schema.Tables.Value)
                    {
                        if (configFile.CheckTable(table.Name, schema.Name))
                        {
                            table.Include = true;
                        }
                        else
                        {
                            table.Include = false;
                        }
                    }
                    if (schema.Tables.IsValueCreated && schema.Tables.Value.Any(t => t.Include == true))
                    {
                        schema.Include = true;
                    }
                }
            }
        }
示例#17
0
        /// <summary>
        /// Compiles the scripts into an assembly
        /// </summary>
        /// <param name="compileVB">True if the source files will be in VB.NET</param>
        /// <param name="path">Path to the source files</param>
        /// <param name="dllName">Name of the assembly to be generated</param>
        /// <param name="asm_names">References to other assemblies</param>
        /// <returns>True if succeeded</returns>
        public static bool CompileScripts(bool compileVB, string path, string dllName, string[] asm_names)
        {
            if (!path.EndsWith(@"\") && !path.EndsWith(@"/"))
            {
                path = path + "/";
            }

            //Reset the assemblies
            m_compiledScripts.Clear();

            //Check if there are any scripts, if no scripts exist, that is fine as well
            IList <FileInfo> files = ParseDirectory(new DirectoryInfo(path), compileVB ? "*.vb" : "*.cs", true);

            if (files.Count == 0)
            {
                return(true);
            }

            //Recompile is required as standard
            bool recompileRequired = true;

            //This file should hold the script infos
            FileInfo configFile = new FileInfo(dllName + ".xml");

            //If the script assembly is missing, recompile is required
            if (!File.Exists(dllName))
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug("Script assembly missing, recompile required!");
                }
            }
            else
            {
                //Script assembly found, check if we have a file modify info
                if (configFile.Exists)
                {
                    //Ok, we have a config file containing the script file sizes and dates
                    //let's check if any script was modified since last compiling them
                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Found script info file");
                    }

                    try
                    {
                        XMLConfigFile config = XMLConfigFile.ParseXMLFile(configFile);

                        //Assume no scripts changed
                        recompileRequired = false;

                        Dictionary <string, ConfigElement> precompiledScripts = new Dictionary <string, ConfigElement>(config.Children);

                        //Now test the files
                        foreach (FileInfo finfo in files)
                        {
                            if (config[finfo.FullName]["size"].GetInt(0) != finfo.Length ||
                                config[finfo.FullName]["lastmodified"].GetLong(0) != finfo.LastWriteTime.ToFileTime())
                            {
                                //Recompile required
                                recompileRequired = true;
                                break;
                            }
                            precompiledScripts.Remove(finfo.FullName);
                        }

                        recompileRequired |= precompiledScripts.Count > 0;                         // some compiled script was removed

                        if (recompileRequired && log.IsDebugEnabled)
                        {
                            log.Debug("At least one file was modified, recompile required!");
                        }
                    }
                    catch (Exception e)
                    {
                        if (log.IsErrorEnabled)
                        {
                            log.Error("Error during script info file to scripts compare", e);
                        }
                    }
                }
                else
                {
                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Script info file missing, recompile required!");
                    }
                }
            }

            //If we need no compiling, we load the existing assembly!
            if (!recompileRequired)
            {
                try
                {
                    Assembly asm = Assembly.LoadFrom(dllName);
                    AddOrReplaceAssembly(asm);

                    if (log.IsDebugEnabled)
                    {
                        log.Debug("Precompiled script assembly loaded: " + asm.FullName);
                    }
                }
                catch (Exception e)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Error loading precompiled script assembly, recompile required!", e);
                    }

                    recompileRequired = true;
                }

                if (!recompileRequired)
                {
                    //Return success!
                    return(true);
                }
            }

            //We need a recompile, if the dll exists, delete it firsthand
            if (File.Exists(dllName))
            {
                File.Delete(dllName);
            }

            CompilerResults res = null;

            try
            {
                CodeDomProvider compiler;

                if (compileVB)
                {
                    compiler = new VBCodeProvider();
                }
                else
                {
                    compiler = new CSharpCodeProvider(new Dictionary <string, string> {
                        { "CompilerVersion", "v4.0" }
                    });
                }

                // Graveen: allow script compilation in debug or release mode
                                #if DEBUG
                CompilerParameters param = new CompilerParameters(asm_names, dllName, true);
                                #else
                CompilerParameters param = new CompilerParameters(asm_names, dllName, false);
                                #endif
                param.GenerateExecutable = false;
                param.GenerateInMemory   = false;
                param.WarningLevel       = 2;
                param.CompilerOptions    = string.Format("/optimize /lib:.{0}lib", Path.DirectorySeparatorChar);
                param.ReferencedAssemblies.Add("System.Core.dll");

                string[] filepaths = new string[files.Count];
                for (int i = 0; i < files.Count; i++)
                {
                    filepaths[i] = ((FileInfo)files[i]).FullName;
                }

                res = compiler.CompileAssemblyFromFile(param, filepaths);

                //After compiling, collect
                GC.Collect();

                if (res.Errors.HasErrors)
                {
                    foreach (CompilerError err in res.Errors)
                    {
                        if (err.IsWarning)
                        {
                            continue;
                        }

                        StringBuilder builder = new StringBuilder();
                        builder.Append("   ");
                        builder.Append(err.FileName);
                        builder.Append(" Line:");
                        builder.Append(err.Line);
                        builder.Append(" Col:");
                        builder.Append(err.Column);
                        if (log.IsErrorEnabled)
                        {
                            log.Error("Script compilation failed because: ");
                            log.Error(err.ErrorText);
                            log.Error(builder.ToString());
                        }
                    }

                    return(false);
                }

                AddOrReplaceAssembly(res.CompiledAssembly);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("CompileScripts", e);
                }
                m_compiledScripts.Clear();
            }
            //now notify our callbacks
            bool ret = false;
            if (res != null)
            {
                ret = !res.Errors.HasErrors;
            }
            if (ret == false)
            {
                return(ret);
            }

            XMLConfigFile newconfig = new XMLConfigFile();
            foreach (FileInfo finfo in files)
            {
                newconfig[finfo.FullName]["size"].Set(finfo.Length);
                newconfig[finfo.FullName]["lastmodified"].Set(finfo.LastWriteTime.ToFileTime());
            }
            if (log.IsDebugEnabled)
            {
                log.Debug("Writing script info file");
            }

            newconfig.Save(configFile);

            return(true);
        }