Пример #1
0
        /// <summary>
        /// Loads global options information from text reader instance.
        /// </summary>
        /// <param name="rewinder">The rewindable text reader to load data from.</param>
        private void LoadGlobalOptions(RewindableTextReader rewinder)
        {
            Helper.ThrowIfNull(rewinder);

            foreach (string line in rewinder.ReadLines(new string[] { MacroName.Indicator }, false))
            {
                string[] items = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (items.Length <= 1)
                {
                    throw new InvalidDataException(Helper.NeutralFormat(
                        "The information in global options should be with (<tag> <value>+), but it is [{0}]", line));
                }

                switch (items[0])
                {
                    case "<STREAMINFO>":
                        StreamInfo = ParseSizedArray(ParseIntArray(items.Skip(1)));
                        break;
                    case "<MSDINFO>":
                        MsdInfo = ParseSizedArray(ParseIntArray(items.Skip(1)));
                        break;
                    case "<VECSIZE>":
                        LoadVecSize(items.Skip(1));
                        break;
                    default:
                        throw new InvalidDataException(Helper.NeutralFormat(
                            "The line [{0}] of global options is not supported.", line));
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Reads one transition instance from text reader instance.
        /// </summary>
        /// <param name="rewinder">The text reader to read double matrix from.</param>
        /// <returns>Transition instance loaded.</returns>
        private static double[,] ReadTransition(RewindableTextReader rewinder)
        {
            Helper.ThrowIfNull(rewinder);
            int size = ParseTagValue(rewinder.ReadLine(), "<TRANSP>");

            double[,] values = ParseDoubleMatrix(
                rewinder.ReadLines(new string[] { "<", MacroName.Indicator }, false).ToArray(), size);

            return values;
        }