Beispiel #1
0
        /// <summary>Loads the file into the given project.</summary>
        /// <param name="filePath">Full pathname of the file.</param>
        /// <param name="project">[in,out] The project.</param>
        private void LoadFileFromPath(string filePath, ref ReClassNetProject project)
        {
            Contract.Requires(filePath != null);
            Contract.Requires(project != null);
            Contract.Ensures(Contract.ValueAtReturn(out project) != null);

            IReClassImport import = null;

            switch (Path.GetExtension(filePath))
            {
            case ReClassNetFile.FileExtension:
                import = new ReClassNetFile(project);
                break;

            case ReClassQtFile.FileExtension:
                import = new ReClassQtFile(project);
                break;

            case ReClassFile.FileExtension:
                import = new ReClassFile(project);
                break;

            case ReClass2007File.FileExtension:
                import = new ReClass2007File(project);
                break;

            default:
                Program.Logger.Log(LogLevel.Error, $"The file '{filePath}' has an unknown type.");
                break;
            }
            import?.Load(filePath, Program.Logger);
        }