コード例 #1
0
ファイル: FoldersFileReader.cs プロジェクト: heradon/Yava
        /// <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
ファイル: FoldersFileReader.cs プロジェクト: heradon/Yava
        /// <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
ファイル: FoldersFileReader.cs プロジェクト: heradon/Yava
        /// <summary>
        /// Clear internal state.
        /// </summary>
        private void ResetState()
        {
            filepath = null;
            folders  = null;

            seenFolderNames.Clear();
            currentFolder = null;

            currentLineNumber = 0;
            currentLine       = String.Empty;
        }
コード例 #4
0
ファイル: FoldersFileReader.cs プロジェクト: Beluki/Yava
        /// <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
ファイル: FoldersFileReader.cs プロジェクト: heradon/Yava
        /// <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
ファイル: FoldersFileReader.cs プロジェクト: Beluki/Yava
        /// <summary>
        /// Clear internal state.
        /// </summary>
        private void ResetState()
        {
            filepath = null;
            folders = null;

            seenFolderNames.Clear();
            currentFolder = null;

            currentLineNumber = 0;
            currentLine = String.Empty;
        }
コード例 #7
0
ファイル: FoldersFileReader.cs プロジェクト: Beluki/Yava
        /// <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
ファイル: FoldersFileReader.cs プロジェクト: Beluki/Yava
        /// <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;
        }