Пример #1
0
        /// <summary>
        /// Add the current folder to the list and move on to the next.
        /// </summary>
        private void AddCurrentFolder()
        {
            if (currentFolder != null)
            {
                // check required options:
                if (currentFolder.Name == null)
                {
                    throw ReadError("Folder without name.");
                }

                if (currentFolder.Path == null)
                {
                    throw ReadError("Expected 'path = value' option for folder: " + currentFolder.Name);
                }

                if (currentFolder.Executable == null)
                {
                    throw ReadError("Expected 'executable = value' option for folder: " + currentFolder.Name);
                }

                // create and add the new folder:
                Folder folder = new Folder(
                    currentFolder.Name,
                    currentFolder.Path,
                    currentFolder.Executable,
                    currentFolder.Extensions,
                    currentFolder.Parameters,
                    currentFolder.WorkingDirectory
                    );

                folders.Add(folder);
                currentFolder = null;
            }
        }
Пример #2
0
        /// <summary>
        /// An INIReader that reads lines from a folders file
        /// adding sections and key=value pairs to a collection
        /// as folder names/options.
        /// </summary>
        public FoldersFileReader()
        {
            filepath = null;
            folders  = null;

            seenFolderNames = new HashSet <String>();
            currentFolder   = null;

            currentLineNumber = 0;
            currentLine       = String.Empty;
        }
Пример #3
0
        /// <summary>
        /// Clear internal state.
        /// </summary>
        private void ResetState()
        {
            filepath = null;
            folders  = null;

            seenFolderNames.Clear();
            currentFolder = null;

            currentLineNumber = 0;
            currentLine       = String.Empty;
        }
Пример #4
0
        /// <summary>
        /// An INIReader that reads lines from a folders file
        /// adding sections and key=value pairs to a collection
        /// as folder names/options.
        /// </summary>
        public FoldersFileReader()
        {
            filepath = null;
            folders = null;

            seenFolderNames = new HashSet<String>();
            currentFolder = null;

            currentLineNumber = 0;
            currentLine = String.Empty;
        }
Пример #5
0
        /// <summary>
        /// On a new section, add the current folder to the collection
        /// and create the next one.
        /// </summary>
        protected override void OnSection(String section)
        {
            AddCurrentFolder();

            // folder names must be unique:
            String name = section;

            if (seenFolderNames.Contains(name))
            {
                throw ReadError("Duplicate folder name: " + name);
            }

            seenFolderNames.Add(name);
            currentFolder      = new FoldersFileReaderFolder();
            currentFolder.Name = name;
        }
Пример #6
0
        /// <summary>
        /// Clear internal state.
        /// </summary>
        private void ResetState()
        {
            filepath = null;
            folders = null;

            seenFolderNames.Clear();
            currentFolder = null;

            currentLineNumber = 0;
            currentLine = String.Empty;
        }
Пример #7
0
        /// <summary>
        /// Add the current folder to the list and move on to the next.
        /// </summary>
        private void AddCurrentFolder()
        {
            if (currentFolder != null)
            {
                // check required options:
                if (currentFolder.Name == null)
                {
                    throw ReadError("Folder without name.");
                }

                if (currentFolder.Path == null)
                {
                    throw ReadError("Expected 'path = value' option for folder: " + currentFolder.Name);
                }

                if (currentFolder.Executable == null)
                {
                    throw ReadError("Expected 'executable = value' option for folder: " + currentFolder.Name);
                }

                // create and add the new folder:
                Folder folder = new Folder(
                    currentFolder.Name,
                    currentFolder.Path,
                    currentFolder.Executable,
                    currentFolder.Extensions,
                    currentFolder.Parameters,
                    currentFolder.WorkingDirectory
                );

                folders.Add(folder);
                currentFolder = null;
            }
        }
Пример #8
0
        /// <summary>
        /// On a new section, add the current folder to the collection
        /// and create the next one.
        /// </summary>
        protected override void OnSection(String section)
        {
            AddCurrentFolder();

            // folder names must be unique:
            String name = section;

            if (seenFolderNames.Contains(name))
            {
                throw ReadError("Duplicate folder name: " + name);
            }

            seenFolderNames.Add(name);
            currentFolder = new FoldersFileReaderFolder();
            currentFolder.Name = name;
        }