private static string GetFileLoaderIDFromModule(File3DLoaderModule loaderModule, File3DLoaderModule[] known) { for (int i = 0, loopTo = known.Count() - 1; i <= loopTo; i++) { if (known[i] == loaderModule) { return("#" + Conversions.ToString(i)); } } return(loaderModule.Name); }
public static void ExportModel(Object3D model, File3DLoaderModule modul) { var sfd = new SaveFileDialog(); string strFilter = General.GetExtensionFilter(modul); sfd.Filter = strFilter.Substring(strFilter.IndexOf("|", strFilter.IndexOf("|") + 1) + 1); // If modul <> LoaderModule.SimpleFileParser Then // MessageBoxEx.Show("Assimp and Aspose probably crashes at exporting.<br/>Please switch to SimpleFileParser in <b>Settings --> File Parser</b>.<br/>Assimp and Aspose will be working soon.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning) // End If if (sfd.ShowDialog() == DialogResult.OK) { // Await model.ToFileAsync(sfd.FileName, modul) modul.Invoke(model, sfd.FileName); } }
public static string GetExtensionFilter(File3DLoaderModule modul) { string combiFormats = ""; string splittedFormats = ""; foreach (var kvp in modul.SupportedFormats) { if (!string.IsNullOrEmpty(combiFormats)) { combiFormats += ";"; } combiFormats += "*." + kvp.Key; if (!string.IsNullOrEmpty(splittedFormats)) { splittedFormats += "|"; } splittedFormats += $"{kvp.Value} (*.{kvp.Key})|*.{kvp.Key}"; } return($"All supported files|{combiFormats}|{splittedFormats}"); }
public static string GetExporterIDFromModule(File3DLoaderModule loaderModule) { var known = File3DLoaderModule.ExporterModules; return(GetFileLoaderIDFromModule(loaderModule, known)); }