public void Should_return_expected_CSIB_string() { var csibStr = _convertCoordinates.DCFileToCSIB(DCFile.GetFilePath(DCFile.DIMENSIONS_2012_DC_FILE_WITH_VERT_ADJUST)); // Due to encoding differences between Windows and Linux it's not possible to expect the two to encode to the same result. // We only check content here; validity is exercised in the base fixture where it loads a DC file from disk to get the CSIB. csibStr.Should().NotBeNullOrEmpty(); }
public string GetCSIBFromDC(string dcFilename) => _convertCoordinates.DCFileToCSIB(DCFile.GetFilePath(dcFilename));
private void RecursiveInsert(PPDataContext db, TreeNode tn, PLMPackSR.DCTreeNode wsNode, string offset, IProcessingCallback callback) { PLMPackSR.PLMPackServiceClient client = new PLMPackSR.PLMPackServiceClient(); client.ClientCredentials.UserName.UserName = UserName; client.ClientCredentials.UserName.Password = Password; PLMPackSR.DCTreeNode wsNodeChild = null; string docType = string.Empty; try { // create node thumbnail string thumbPath = tn.Thumbnail.File.PathWRepo(RepositoryPath); DCFile thFile = Upload(thumbPath, callback, client); PLMPackSR.DCThumbnail wsThumbnail = client.CreateNewThumbnailFromFile(thFile); if (tn.IsDocument) { // get document Document doc = tn.Documents(db)[0]; string docPath = doc.File.PathWRepo(RepositoryPath); // upload document PLMPackSR.DCFile wsDocFile = Upload(docPath, callback, client); if (tn.IsComponent) { docType = "COMPONENT"; Component comp = doc.Components[0]; // get majorations List <PLMPackSR.DCMajorationSet> majorationSets = new List <PLMPackSR.DCMajorationSet>(); foreach (MajorationSet majoSet in comp.MajorationSets) { DCCardboardProfile cbProfile = client.GetCardboardProfileByName(majoSet.CardboardProfile.Name); string sMajo = string.Empty; List <DCMajoration> dcMajorationList = new List <DCMajoration>(); foreach (Majoration majo in majoSet.Majorations) { sMajo += string.Format("({0}={1})", majo.Name, majo.Value); dcMajorationList.Add(new DCMajoration() { Name = majo.Name, Value = majo.Value }); } majorationSets.Add( new DCMajorationSet() { Profile = cbProfile, Majorations = dcMajorationList.ToArray() } ); if (null != callback) { callback.Info(string.Format("{0} - {1}", majoSet.CardboardProfile.Name, sMajo)); } } // get default parameter values List <PLMPackSR.DCParamDefaultValue> paramDefaultValues = new List <PLMPackSR.DCParamDefaultValue>(); foreach (ParamDefaultValue pdv in comp.ParamDefaultValues) { paramDefaultValues.Add(new DCParamDefaultValue() { Name = pdv.Name, Value = pdv.Value }); } PLMPackSR.DCTreeNode wsNodeComp = client.CreateNewNodeComponent( wsNode, tn.Name, tn.Description , wsThumbnail, wsDocFile, doc.Components[0].Guid , majorationSets.ToArray(), paramDefaultValues.ToArray()); client.ShareEveryone(wsNodeComp); } else { docType = "DOCUMENT"; PLMPackSR.DCTreeNode wsNodeDocument = client.CreateNewNodeDocument(wsNode, tn.Name, tn.Description , wsThumbnail, wsDocFile); client.ShareEveryone(wsNodeDocument); } } else { docType = "BRANCH"; wsNodeChild = client.CreateNewNodeBranch(wsNode, tn.Name, tn.Description, wsThumbnail); client.ShareEveryone(wsNodeChild); } client.Close(); } catch (Exception ex) { client.Abort(); if (null != callback) { callback.Error(ex.ToString()); } } if (null == wsNodeChild) { return; } if (null != callback) { callback.Info(string.Format("{0}-> {1} ({2})", offset, tn.Name, docType)); } offset += " "; foreach (TreeNode tnChild in tn.Childrens(db)) { RecursiveInsert(db, tnChild, wsNodeChild, offset, callback); } }
public string GetDCFileContent(string dcFilename) => File.ReadAllText(DCFile.GetFilePath(dcFilename));