示例#1
0
        public static bool processScripts(List <string> largs)
        {
            bool   success = true;
            string file    = largs.FirstOrDefault(x => x.Contains("/f:"));

            if (!String.IsNullOrEmpty(file))
            {
                string        filename   = file.Replace(@"/f:", "");
                Properties    properties = new Properties();
                XmlSerializer s          = new XmlSerializer(properties.GetType());
                TextReader    r          = new StreamReader(filename);
                properties = (Properties)s.Deserialize(r);
                if (!properties.VersionScriptsFolder.Contains(":") || !properties.VersionScriptsFolder.Contains(@"\\"))
                {
                    var settingPath = Path.GetDirectoryName(filename);
                    properties.VersionScriptsFolder = Path.Combine(settingPath, properties.VersionScriptsFolder);
                }
                r.Dispose();
                success = UpdateDB.Process(properties);
                if (properties.Wait)
                {
                    Console.Read();
                }
            }

            return(success);
        }
示例#2
0
        /// <summary>
        /// Process all scripts that have not been successfully run.
        /// </summary>
        /// <param name="kissPropsFile">kissprops.xml configuration file location plus filename</param>
        /// <returns></returns>
        public static bool ProcessScripts(string kissPropsFile)
        {
            Properties    properties = new Properties();
            XmlSerializer s          = new XmlSerializer(properties.GetType());

            using (TextReader r = new StreamReader(kissPropsFile))
            {
                properties = (Properties)s.Deserialize(r);

                //We just want to process files recursively at the base level, in the included kissprops.xml file we use the "Scripts" folder
                if (!properties.VersionScriptsFolder.Contains(":") ||
                    !properties.VersionScriptsFolder.Contains(@"\\"))
                {
                    var settingPath = Path.GetDirectoryName(kissPropsFile);
                    properties.VersionScriptsFolder = Path.Combine(settingPath, properties.VersionScriptsFolder);
                }
            }

            bool success = UpdateDB.Process(properties);

            if (properties.Wait)
            {
                Console.Read();
            }

            return(success);
        }