public override void OnLoad() { base.OnLoad(); obj = gameObject.GetComponent <PipeObject>(); UpdateShape(); chunk.blocks.UpdateBlockNeighbors(position); }
public void Start() { pipeClient = new PipeObject(Manager.configuration.connection.environment); Debug.Log("Attempting to connect to pipe..."); Debug.Log("Pipe connected"); reader = new Reader(); read = true; }
void Dump(PipeObject pipeObj, Guid portionId, string tempDir) { Conflict conflict = new Conflict(); conflict.PortionID = portionId; conflict.Pipe = pipeObj; Data conflictData = new Data(); conflictData.Pipes = new List <PipeObject>(); conflictData.Pipes.Add(pipeObj); ConflictFileName f = new ConflictFileName(pipeObj.Id.ToString(), pipeObj.Number); string fileFolder = f.FolderName; string conflictDir = Path.Combine(Directories.Conflicts, fileFolder); string fileName = f.FileName; DirectoryInfo directoryInfo = new DirectoryInfo(conflictDir); if (!Directory.Exists(conflictDir)) { Directory.CreateDirectory(conflictDir); } else { foreach (FileInfo file in directoryInfo.GetFiles()) { file.Delete(); } } string dumpFilePath = Path.Combine(conflictDir, fileName); WriteManifest(conflictDir, manifest.PortionID, manifest.PortionNumber, manifest.ExportDateTime, manifest.WorkstationType); if (System.IO.File.Exists(dumpFilePath)) { System.IO.File.Delete(dumpFilePath); } string attDir = Path.Combine(conflictDir, "Attachments"); if (pipeObj.Attachments != null && pipeObj.Attachments.Count > 0) { if (!Directory.Exists(attDir)) { Directory.CreateDirectory(attDir); foreach (var file in pipeObj.Attachments) { string attPathInTemp = Path.Combine(tempDir, "Attachments", file.NewName); string targetPath = Path.Combine(attDir, file.NewName); System.IO.File.Copy(attPathInTemp, targetPath, true); } } } WriteData <Data>(conflictDir, conflictData, fileName); }
private IEnumerator Start() { yield return(new WaitForSeconds(.1f)); pipe = Pipes.Pipes[pipeNum - 1]; if (A) { entrance = pipe.ReturnA(); } else { entrance = pipe.ReturnB(); } }
void AssertPipe(PipeObject pipe) { Assert.AreEqual(id, pipe.Id); Assert.IsTrue(pipe.IsActive); Assert.IsTrue(pipe.IsAvailableToJoint); Assert.AreEqual(NUMBER, pipe.Number); Assert.AreEqual(LENGTH, pipe.Length); Assert.AreEqual(CONSTRUCTION_STATUS, pipe.ConstructionStatus); Assert.AreEqual(INSPECTION_STATUS, pipe.InspectionStatus); Assert.AreEqual(MILL, pipe.Mill); Assert.AreEqual(DIAMETER, pipe.Diameter); Assert.AreEqual(WALL_THICKNESS, pipe.WallThickness); Assert.AreEqual(PROD_DATE, pipe.ProductionDate); Assert.AreEqual(STATUS, pipe.Status); }
public void MapSerializableEntityToPipe(string tempDir, PipeObject pipeObj, Pipe pipe) { pipe.Id = pipeObj.Id; pipe.IsActive = pipeObj.IsActive; pipe.Number = pipeObj.Number; pipe.Length = pipeObj.Length; pipe.IsAvailableToJoint = pipeObj.IsAvailableToJoint; pipe.ConstructionStatus = pipeObj.ConstructionStatus; pipe.InspectionStatus = pipeObj.InspectionStatus; pipe.Plate = ImportPlate(pipeObj.Plate); pipe.Mill = pipeObj.Mill; pipe.Diameter = pipeObj.Diameter; pipe.WallThickness = pipeObj.WallThickness; pipe.Weight = pipeObj.Weight; pipe.ProductionDate = pipeObj.ProductionDate; pipe.Type = ImportSizeType(pipeObj.Type); pipe.Railcar = ImportRailcar(pipeObj.Railcar); if (pipeObj.Railcar != null) { pipe.Railcar.ReleaseNote = ImportReleaseNote(tempDir, pipeObj.Railcar.ReleaseNote); } pipe.PurchaseOrder = ImportPurchaseOrder(pipeObj.PurchaseOrder); pipe.Status = pipeObj.Status; if (pipeObj.Spools != null) { foreach (SpoolObject so in pipeObj.Spools) { pipe.Spools.Add(ImportSpool(tempDir, so, pipe)); } } if (pipeObj.Attachments != null) { if (!Directory.Exists(Directories.TargetPath)) { Directory.CreateDirectory(Directories.TargetPath); DirectoryInfo directoryInfo = new DirectoryInfo(Directories.TargetPath); directoryInfo.Attributes |= FileAttributes.Hidden; } pipe.Attachments = new List <Prizm.Domain.Entity.File>(); foreach (var fileObject in pipeObj.Attachments) { Prizm.Domain.Entity.File f = ImportFile(fileObject, pipe.Id); CopyAttachment(tempDir, f, afterConflict); } } }
void Dump(PipeObject pipeObj, Guid portionId, string tempDir) { Conflict conflict = new Conflict(); conflict.PortionID = portionId; conflict.Pipe = pipeObj; string conflictDir = Path.Combine(System.Environment.CurrentDirectory, "Conflicts"); if (!Directory.Exists(conflictDir)) { Directory.CreateDirectory(conflictDir); } string dumpFilePath = Path.Combine(conflictDir, pipeObj.Id + ".xml"); if (System.IO.File.Exists(dumpFilePath)) { System.IO.File.Delete(dumpFilePath); } string attDir = Path.Combine(conflictDir, pipeObj.Id + "_Attachments"); if (pipeObj.Attachments != null && pipeObj.Attachments.Count > 0) { if (Directory.Exists(attDir)) { Directory.Delete(attDir, true); } Directory.CreateDirectory(attDir); foreach (var file in pipeObj.Attachments) { string attPathInTemp = Path.Combine(tempDir, "Attachments", file.NewName); string targetPath = Path.Combine(attDir, file.NewName); System.IO.File.Copy(attPathInTemp, targetPath, true); } } XmlSerializer serializer = new XmlSerializer(typeof(Conflict)); using (FileStream fs = new FileStream(dumpFilePath, FileMode.Create)) { serializer.Serialize(fs, conflict); } }
PipeObject FindPipeById(Data data, Guid id) { PipeObject result = null; if (data.Pipes != null) { foreach (PipeObject po in data.Pipes) { if (po.Id == id) { result = po; break; } } } return(result); }
private PartData ImportPartData(PartDataObject partDataObj, Data data, string tempDir, Joint joint) { if (partDataObj == null) { return(null); } PartType type = partDataObj.PartType; Guid partId = partDataObj.Id; switch (type) { case PartType.Pipe: Pipe pipe = importRepo.PipeRepo.Get(partId); bool newPipe = false; if (pipe == null) { PipeObject pipeObj = FindPipeById(data, partId); if (pipeObj != null) { pipe = new Pipe(); MapSerializableEntityToPipe(tempDir, pipeObj, pipe); newPipe = true; } } if (pipe != null) { if (newPipe) { importRepo.PipeRepo.Save(pipe); } else { importRepo.PipeRepo.SaveOrUpdate(pipe); } } break; case PartType.Spool: Spool spool = importRepo.SpoolRepo.Get(partId); bool isNewSpool = false; if (spool == null) { SpoolObject spoolObj = FindSpoolById(data, partId); if (spoolObj != null) { spool = new Spool(); MapSerializableEntityToSpool(tempDir, spoolObj, spool); isNewSpool = true; } } if (spool != null) { if (isNewSpool) { importRepo.SpoolRepo.Save(spool); } else { importRepo.SpoolRepo.SaveOrUpdate(spool); } } break; case PartType.Component: Component component = importRepo.ComponentRepo.Get(partId); bool isNewComponent = false; if (component == null) { ComponentObject compObj = FindComponentById(data, partId); if (compObj != null) { component = new Component(); MapSerializableEntityToComponent(tempDir, compObj, component, joint); isNewComponent = true; } } if (component != null) { if (isNewComponent) { importRepo.ComponentRepo.Save(component); } else { importRepo.ComponentRepo.SaveOrUpdate(component); } } break; } PartData pd = new PartData(); pd.Id = partId; pd.PartType = type; return(pd); }
public void TestPipeObjectCasting() { PipeObject pipe = SetupMock(); AssertPipe(pipe); }
public void TestPipeObjectCopyConstructor() { PipeObject pipe = new PipeObject(SetupMock()); AssertPipe(pipe); }
void CreateNotification(PipeObject pipeObj) { //TODO: Notification should be created here. }