private bool LoadModelFromExtractFile(Stream extract, ref ConcreteModel concreteModelResult, out string errorLog) { bool valid = false; errorLog = string.Empty; System.Globalization.CultureInfo culture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); try { Assembly assembly; LoadAssembly(".\\" + ProfileName + ".dll", out assembly); if (assembly != null) { CIMModel cimModel = new CIMModel(); CIMModelLoaderResult modelLoadResult = CIMModelLoader.LoadCIMXMLModel(extract, Namespace, out cimModel); if (modelLoadResult.Success) { concreteModelResult = new ConcreteModel(); ConcreteModelBuilder builder = new ConcreteModelBuilder(); ConcreteModelBuildingResult modelBuildResult = builder.GenerateModel(cimModel, assembly, Namespace, ref concreteModelResult); if (modelBuildResult.Success) { valid = true; } else { errorLog = modelBuildResult.Report.ToString(); } } else { errorLog = modelLoadResult.Report.ToString(); } } Thread.CurrentThread.CurrentCulture = culture; } catch (Exception e) { Thread.CurrentThread.CurrentCulture = culture; errorLog = e.Message; } return(valid); }
private bool LoadModelFromExtractFile(Stream extract, SupportedProfiles extractType, ref ConcreteModel concreteModelResult, ref Assembly assembly, out string log) { bool valid = false; log = string.Empty; System.Globalization.CultureInfo culture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); try { ProfileManager.LoadAssembly(extractType, out assembly); if (assembly != null) { CIMModel cimModel = new CIMModel(); CIMModelLoaderResult modelLoadResult = CIMModelLoader.LoadCIMXMLModel(extract, ProfileManager.Namespace, out cimModel); if (modelLoadResult.Success) { concreteModelResult = new ConcreteModel(); ConcreteModelBuilder builder = new ConcreteModelBuilder(); ConcreteModelBuildingResult modelBuildResult = builder.GenerateModel(cimModel, assembly, ProfileManager.Namespace, ref concreteModelResult); if (modelBuildResult.Success) { valid = true; } log = modelBuildResult.Report.ToString(); } else { log = modelLoadResult.Report.ToString(); } } } catch (Exception e) { log = e.Message; } finally { Thread.CurrentThread.CurrentCulture = culture; } return(valid); }