void WriteAttachments(string tempDir, Data data)
{
Directory.CreateDirectory(Path.Combine(tempDir, "Attachments"));
if(data.Pipes != null)
{
foreach(PipeObject pipe in data.Pipes)
{
if(pipe.Attachments != null)
{
WriteAttachments(tempDir, pipe.Attachments);
}
if(pipe.Railcar != null && pipe.Railcar.ReleaseNote != null && pipe.Railcar.ReleaseNote.Attachments != null)
{
WriteAttachments(tempDir, pipe.Railcar.ReleaseNote.Attachments);
}
if(pipe.Spools.Count != 0)
{
foreach(SpoolObject spoolObj in pipe.Spools)
{
if(spoolObj.Attachments != null)
{
WriteAttachments(tempDir, spoolObj.Attachments);
}
}
}
}
}
if(data.Joints != null)
{
foreach(JointObject joint in data.Joints)
{
if(joint.Attachments != null)
{
WriteAttachments(tempDir, joint.Attachments);
}
}
}
if(data.Components != null)
{
foreach(ComponentObject components in data.Components)
{
if(components.Attachments != null)
{
WriteAttachments(tempDir, components.Attachments);
}
}
}
}