/// <summary> /// Creates a .x File for all Models stored in the GMDC /// </summary> /// <param name="models">List of all P3Models you want to export</param> /// <returns>The content of the x File</returns> public MemoryStream GenerateX(GmdcGroups models) { IGmdcExporter exporter = ExporterLoader.FindExporterByExtension(".x"); if (exporter == null) { throw new Exception("No valid Direct X Exporter plugin was found!"); } exporter.Component.Sorting = ElementSorting.Preview; exporter.Process(this, models); return((MemoryStream)exporter.FileContent.BaseStream); }
/// <summary> /// Finds the Exporter that registred for the passed File Extension /// </summary> /// <param name="fileext"></param> /// <returns>An Array of all Exporters that Registred for that Extension</returns> public static int[] FindIndexByExtension(string fileext) { fileext = fileext.Trim().ToLower(); if (!fileext.StartsWith(".")) { fileext = "." + fileext; } System.Collections.ArrayList list = new System.Collections.ArrayList(); for (int i = 0; i < Exporters.Length; i++) { IGmdcExporter e = Exporters[i]; if (e.FileExtension.Trim().ToLower() == fileext) { list.Add(i); } } int[] res = new int[list.Count]; list.CopyTo(res); return(res); }