Пример #1
0
        public clsResult Translate(int SectionNum, SectionTranslator Translator, ErrorCount ErrorCount)
        {
            clsResult ReturnResult = new clsResult("Section " + Name);

            int A = 0;
            TranslatorResult TranslatorResult = default(TranslatorResult);

            for ( A = 0; A <= Properties.Count - 1; A++ )
            {
                TranslatorResult = Translator.Translate(SectionNum, Properties[A]);
                switch ( TranslatorResult )
                {
                    case Ini.TranslatorResult.NameUnknown:
                        if ( ErrorCount.NameErrorCount < 16 )
                        {
                            ReturnResult.WarningAdd("Property name " + Convert.ToString(ControlChars.Quote) + Properties[A].Name +
                                                    Convert.ToString(ControlChars.Quote) + " is unknown.");
                        }
                        ErrorCount.NameErrorCount++;
                        break;
                    case Ini.TranslatorResult.ValueInvalid:
                        if ( ErrorCount.ValueErrorCount < 16 )
                        {
                            ReturnResult.WarningAdd("Value " + Convert.ToString(ControlChars.Quote) + Properties[A].Value +
                                                    Convert.ToString(ControlChars.Quote) + " for property name " +
                                                    Convert.ToString(ControlChars.Quote) + Properties[A].Name +
                                                    Convert.ToString(ControlChars.Quote) + " is not valid.");
                        }
                        ErrorCount.ValueErrorCount++;
                        break;
                }
            }

            return ReturnResult;
        }
Пример #2
0
        public clsResult Translate(Translator Translator)
        {
            clsResult ReturnResult = new clsResult("Section " + Name);

            int A = 0;
            TranslatorResult TranslatorResult = default(TranslatorResult);
            ErrorCount ErrorCount = new ErrorCount();

            ErrorCount.NameWarningCountMax = 16;
            ErrorCount.ValueWarningCountMax = 16;

            for ( A = 0; A <= Properties.Count - 1; A++ )
            {
                TranslatorResult = Translator.Translate(Properties[A]);
                switch ( TranslatorResult )
                {
                    case TranslatorResult.NameUnknown:
                        if ( ErrorCount.NameErrorCount < 16 )
                        {
                            ReturnResult.WarningAdd("Property name " + Convert.ToString(ControlChars.Quote) + Properties[A].Name +
                                                    Convert.ToString(ControlChars.Quote) + " is unknown.");
                        }
                        ErrorCount.NameErrorCount++;
                        break;
                    case TranslatorResult.ValueInvalid:
                        if ( ErrorCount.ValueErrorCount < 16 )
                        {
                            ReturnResult.WarningAdd("Value " + Convert.ToString(ControlChars.Quote) + Properties[A].Value +
                                                    Convert.ToString(ControlChars.Quote) + " for property name " +
                                                    Convert.ToString(ControlChars.Quote) + Properties[A].Name +
                                                    Convert.ToString(ControlChars.Quote) + " is not valid.");
                        }
                        ErrorCount.ValueErrorCount++;
                        break;
                }
            }

            if ( ErrorCount.NameErrorCount > ErrorCount.NameWarningCountMax )
            {
                ReturnResult.WarningAdd("There were " + Convert.ToString(ErrorCount.NameErrorCount) + " unknown property names that were ignored.");
            }
            if ( ErrorCount.ValueErrorCount > ErrorCount.ValueWarningCountMax )
            {
                ReturnResult.WarningAdd("There were " + Convert.ToString(ErrorCount.ValueErrorCount) + " invalid values that were ignored.");
            }

            return ReturnResult;
        }
Пример #3
0
        public clsResult Translate(SectionTranslator Translator)
        {
            clsResult ReturnResult = new clsResult("Translating INI");

            int A = 0;
            ErrorCount ErrorCount = new ErrorCount();

            ErrorCount.NameWarningCountMax = 16;
            ErrorCount.ValueWarningCountMax = 16;

            for ( A = 0; A <= Sections.Count - 1; A++ )
            {
                ReturnResult.Add(Sections[A].Translate(A, Translator, ErrorCount));
            }

            if ( ErrorCount.NameErrorCount > ErrorCount.NameWarningCountMax )
            {
                ReturnResult.WarningAdd("There were " + Convert.ToString(ErrorCount.NameErrorCount) + " unknown property names that were ignored.");
            }
            if ( ErrorCount.ValueErrorCount > ErrorCount.ValueWarningCountMax )
            {
                ReturnResult.WarningAdd("There were " + Convert.ToString(ErrorCount.ValueErrorCount) + " invalid values that were ignored.");
            }

            return ReturnResult;
        }