public void EnumerableStringToSringSuccedes() { const string value0 = @"Aa"; const string value1 = @"Bb"; var testStrings = new [] { @"\", @",", @"\,", @"", @"Ciao, bella.", @",," , @"\\", @"\,", @",\" } ; foreach (var str in testStrings) { var t = new List<String> {value0, str, value1}; Test(t); } var l0 = new List<String>() { value0, value1 }; Test(l0); Test(testStrings); }
static void Main(string[] args) { var files = new[] { //@"C:\Users\mxfm2\Downloads\Bad Cobie\Ext01.fixed.xlsx", @"C:\Users\mxfm2\Downloads\Bad Cobie\Ext01.xlsx", //@"C:\Users\mxfm2\Downloads\Bad Cobie\Ext01.xls", //@"C:\Users\mxfm2\Downloads\Bad Cobie\Struc.xls", //@"C:\Users\mxfm2\Downloads\Bad Cobie\Site.xls", //@"C:\Users\mxfm2\Downloads\Bad Cobie\INT02.xls", //@"C:\Users\mxfm2\Downloads\Bad Cobie\Int01.xls" }; foreach (var file in files) { var dir = Path.GetDirectoryName(file); var name = Path.GetFileNameWithoutExtension(file); var newFile = Path.Combine(dir ?? "", name + ".fixed.xlsx"); Debug.WriteLine(name ?? ""); using (var log = File.CreateText(Path.Combine(dir ?? "", name + ".fixed.txt"))) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string msg; var facility = Facility.ReadCobie(file, out msg); stopWatch.Stop(); if (!String.IsNullOrEmpty(msg)) log.WriteLine(msg); Debug.WriteLine("Reading COBie: " + stopWatch.ElapsedMilliseconds); stopWatch.Reset(); stopWatch.Start(); //facility.ValidateUK2012(log, true); stopWatch.Stop(); Debug.WriteLine("Validating COBie: " + stopWatch.ElapsedMilliseconds); stopWatch.Reset(); stopWatch.Start(); //Debug.Write(msg); //Debug.Write(log.ToString()); facility.WriteCobie(newFile, out msg); stopWatch.Stop(); if (!String.IsNullOrEmpty(msg)) log.WriteLine(msg); Debug.WriteLine("Writing COBie: " + stopWatch.ElapsedMilliseconds); log.Close(); } } }
protected override Xbim.COBieLiteUK.System Mapping(IfcPropertySet pSet, Xbim.COBieLiteUK.System target) { var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper; //Add Assets var systemAssignments = helper.GetSystemAssignments(pSet); var ifcObjectDefinitions = systemAssignments as IList <IfcObjectDefinition> ?? systemAssignments.ToList(); string name = string.Empty; if (ifcObjectDefinitions.Any()) { name = GetSystemName(helper, ifcObjectDefinitions); target.Components = new List <AssetKey>(); foreach (var ifcObjectDefinition in ifcObjectDefinitions) { var assetKey = new AssetKey { Name = ifcObjectDefinition.Name }; if (!target.Components.Contains(assetKey)) { target.Components.Add(assetKey); } } } target.ExternalEntity = helper.ExternalEntityName(pSet); target.ExternalId = helper.ExternalEntityIdentity(pSet); target.ExternalSystem = helper.ExternalSystemName(pSet); target.Name = string.IsNullOrEmpty(name) ? "Unknown" : name; target.Description = string.IsNullOrEmpty(pSet.Description) ? name : pSet.Description.ToString(); target.CreatedBy = helper.GetCreatedBy(pSet); target.CreatedOn = helper.GetCreatedOn(pSet); target.Categories = helper.GetCategories(pSet); //Attributes, no attributes from PSet as Pset is the attributes, assume that component attributes are extracted by each component anyway //target.Attributes = helper.GetAttributes(pSet); //Documents var docsMappings = Exchanger.GetOrCreateMappings <MappingIfcDocumentSelectToDocument>(); helper.AddDocuments(docsMappings, target, pSet); //TODO: //System Issues return(target); }
protected override Xbim.COBieLiteUK.System Mapping(IfcSystem ifcSystem, Xbim.COBieLiteUK.System target) { var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper; target.ExternalEntity = helper.ExternalEntityName(ifcSystem); target.ExternalId = helper.ExternalEntityIdentity(ifcSystem); target.AltExternalId = ifcSystem.GlobalId; target.ExternalSystem = helper.ExternalSystemName(ifcSystem); target.Name = ifcSystem.Name; target.Description = ifcSystem.Description; target.CreatedBy = helper.GetCreatedBy(ifcSystem); target.CreatedOn = helper.GetCreatedOn(ifcSystem); target.Categories = helper.GetCategories(ifcSystem); //Add Assets var systemAssignments = helper.GetSystemAssignments(ifcSystem); var ifcObjectDefinitions = systemAssignments as IList <IfcObjectDefinition> ?? systemAssignments.ToList(); if (ifcObjectDefinitions.Any()) { target.Components = new List <AssetKey>(); foreach (var ifcObjectDefinition in ifcObjectDefinitions) { var assetKey = new AssetKey { Name = ifcObjectDefinition.Name }; target.Components.Add(assetKey); } } //Attributes target.Attributes = helper.GetAttributes(ifcSystem); //Documents var docsMappings = Exchanger.GetOrCreateMappings <MappingIfcDocumentSelectToDocument>(); helper.AddDocuments(docsMappings, target, ifcSystem); //TODO: //System Issues return(target); }
// xml navigation sample at http://support.microsoft.com/kb/308333 private void OpenFile(object sender, RoutedEventArgs e) { var supportedFiles = new [] { "All supprted files|*.xlsx;*.xls;*.xml;*.json", "Validation requirement Excel|*.xlsx;*.xls", "Validation requirement XML|*.xml", "Validation requirement json|*.json" }; var openFile = new OpenFileDialog {Filter = string.Join("|", supportedFiles)}; var res = openFile.ShowDialog(); if (res.HasValue && res.Value) { var r = new FacilityReader(); ReqFacility = r.LoadFacility(openFile.FileName); TestValidation(); } }