Exemplo n.º 1
0
        void FixFile(string file)
        {
            string code;

            try
            {
                code = File.ReadAllText(file);
            }
            catch (Exception)
            {
                return;
            }
            try
            {
                var fileName = Path.GetFileNameWithoutExtension(file);
                switch (Path.GetExtension(file).ToUpper())
                {
                case ".LUA":
                {
                    var newCode = _lua.FixCode(code, fileName);
                    if (newCode != code)
                    {
                        File.WriteAllText(file, newCode);
                    }
                }
                break;

                case ".MQ4":
                {
                    var newCode = MQL4Lint.FixCode(code, fileName);
                    if (newCode != code)
                    {
                        File.WriteAllText(file, newCode);
                    }
                }
                break;
                }
            }
            catch (Exception)
            {
                Console.WriteLine(file);
                throw;
            }
        }
Exemplo n.º 2
0
        private string[] GetWarnings(string file)
        {
            string code;

            try
            {
                code = File.ReadAllText(file);
            }
            catch (Exception ex)
            {
                return(new string[] { ex.Message });
            }
            var fileName = Path.GetFileNameWithoutExtension(file);

            switch (Path.GetExtension(file).ToUpper())
            {
            case ".LUA":
                return(_lua.GetWarnings(code, fileName));

            case ".MQ4":
                return(MQL4Lint.GetWarnings(code, fileName));
            }
            return(new string[0]);
        }