Exemple #1
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            CompileError.Type err = (CompileError.Type)values[0];
            //int lang = (int) values[1];
            switch (err)
            {
            case CompileError.Type.Type0:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type0) ? _localString.Dict["Err_0_full"] : _localString.Dict["Err_0_short"]);

            case CompileError.Type.Type1:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type1) ? _localString.Dict["Err_1_full"] : _localString.Dict["Err_1_short"]);

            case CompileError.Type.Type2:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type2) ? _localString.Dict["Err_2_full"] : _localString.Dict["Err_2_short"]);

            case CompileError.Type.Type3:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type3) ? _localString.Dict["Err_3_full"] : _localString.Dict["Err_3_short"]);

            case CompileError.Type.Type4:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type4) ? _localString.Dict["Err_4_full"] : _localString.Dict["Err_4_short"]);

            case CompileError.Type.Type5:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type5) ? _localString.Dict["Err_5_full"] : _localString.Dict["Err_5_short"]);

            case CompileError.Type.Type6:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type6) ? _localString.Dict["Err_6_full"] : _localString.Dict["Err_6_short"]);

            case CompileError.Type.Type7:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type7) ? _localString.Dict["Err_7_full"] : _localString.Dict["Err_7_short"]);

            case CompileError.Type.Type8:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type8) ? _localString.Dict["Err_8_full"] : _localString.Dict["Err_8_short"]);

            case CompileError.Type.Type9:
                return(CompileError.NeedFullDiagnostic(CompileError.Type.Type9) ? _localString.Dict["Err_9_full"] : _localString.Dict["Err_9_short"]);

            default:
                return("");
            }
        }
 public void UnSetAnotherErrorColor(CompileError.Type type)
 {
     _colorizeErrors.SpecialErrors.Remove(type);
     _specialErrors.Remove(type);
     Redraw();
 }
 public bool GetIfAnotherErrorColor(CompileError.Type type)
 {
     return(_colorizeErrors.SpecialErrors.Contains(type));
 }
Exemple #4
0
        public List <CompileError> Compile(CodeFile file)
        {
            // что есть сейчас
            //_recent.Clear();

            string text   = file.Text;
            var    errors = new List <CompileError>();

            for (int i = 0; i < text.Length; i++)
            {
                Char c = text[i];

                if (Char.IsDigit(c))
                {
                    CompileError.Type type = CompileError.Type.Type0;

                    if (c == '0')
                    {
                        type = CompileError.Type.Type0;
                    }
                    else if (c == '1')
                    {
                        type = CompileError.Type.Type1;
                    }
                    else if (c == '2')
                    {
                        type = CompileError.Type.Type2;
                    }
                    else if (c == '3')
                    {
                        type = CompileError.Type.Type3;
                    }
                    else if (c == '4')
                    {
                        type = CompileError.Type.Type4;
                    }
                    else if (c == '5')
                    {
                        type = CompileError.Type.Type5;
                    }
                    else if (c == '6')
                    {
                        type = CompileError.Type.Type6;
                    }
                    else if (c == '7')
                    {
                        type = CompileError.Type.Type7;
                    }
                    else if (c == '8')
                    {
                        type = CompileError.Type.Type8;
                    }
                    else if (c == '9')
                    {
                        type = CompileError.Type.Type9;
                    }

                    errors.Add(new CompileError(type, file, i, i + 1));

                    if (_recent.ContainsKey(type))
                    {
                        _recent[type] += 1;
                    }
                    else
                    {
                        _recent[type] = 1;
                    }
                }
                else
                {
                    // No error
                }
            }

            OnCompiled();

            return(errors);
        }