Example #1
0
        /// <summary>
        /// Constructor, with parameters.
        /// </summary>
        public TorXakisConnector(FileInfo model)
        {
            // Sanity checks.
            if (model == null || !model.Exists)
            {
                throw new ArgumentException(nameof(model) + ": " + model);
            }

            Model = new TorXakisModel(model);
            ParseModel();

            Log.Info(this, "Created: " + this);
        }
        /// <summary>
        /// Constructor, with parameters.
        /// </summary>
        public TorXakisModelCollection(DirectoryInfo directory)
        {
            // Sanity checks.
            if (directory == null || !directory.Exists)
            {
                throw new ArgumentException("Invalid directory: " + directory, nameof(directory));
            }

            Directory = directory;

            // Find model files inside directory (recursive).
            foreach (FileInfo file in Directory.GetFiles("*" + TorXakisModel.FileExtension, SearchOption.AllDirectories))
            {
                TorXakisModel model = new TorXakisModel(file);
                Models.Add(model);
            }
        }