| 1 | 
 using System; | 
 
 
 
 
 
 | 2 | 
 using System.IO; | 
 
 
 
 
 
 | 3 | 
  | 
 
 
 
 
 
 | 4 | 
 namespace Oni.Totoro | 
 
 
 
 
 
 | 5 | 
 { | 
 
 
 
 
 
 | 6 | 
     internal class BodySetImporter : Importer | 
 
 
 
 
 
 | 7 | 
     { | 
 
 
 
 
 
 | 8 | 
         private BodyDaeImporter bodyImporter; | 
 
 
 
 
 
 | 9 | 
  | 
 
 
 
 
 
 | 10 | 
         public BodySetImporter(string[] args) | 
 
 
 
 
 
 | 11 | 
         { | 
 
 
 
 
 
 | 12 | 
             bodyImporter = new BodyDaeImporter(args); | 
 
 
 
 
 
 | 13 | 
         } | 
 
 
 
 
 
 | 14 | 
  | 
 
 
 
 
 
 | 15 | 
         public override void Import(string filePath, string outputDirPath) | 
 
 
 
 
 
 | 16 | 
         { | 
 
 
 
 
 
 | 17 | 
             var name = Path.GetFileNameWithoutExtension(filePath); | 
 
 
 
 
 
 | 18 | 
  | 
 
 
 
 
 
 | 19 | 
             if (name.StartsWith("ONCC", StringComparison.Ordinal)) | 
 
 
 
 
 
 | 20 | 
                 name = name.Substring(4); | 
 
 
 
 
 
 | 21 | 
  | 
 
 
 
 
 
 | 22 | 
             BeginImport(); | 
 
 
 
 
 
 | 23 | 
  | 
 
 
 
 
 
 | 24 | 
             var trbs = CreateInstance(TemplateTag.TRBS, name); | 
 
 
 
 
 
 | 25 | 
             var trcm = bodyImporter.Import(filePath, ImporterFile); | 
 
 
 
 
 
 | 26 | 
  | 
 
 
 
 
 
 | 27 | 
             WriteTRBS(trbs, trcm); | 
 
 
 
 
 
 | 28 | 
  | 
 
 
 
 
 
 | 29 | 
             Write(outputDirPath); | 
 
 
 
 
 
 | 30 | 
         } | 
 
 
 
 
 
 | 31 | 
  | 
 
 
 
 
 
 | 32 | 
         private void WriteTRBS(ImporterDescriptor trbs, ImporterDescriptor trcm) | 
 
 
 
 
 
 | 33 | 
         { | 
 
 
 
 
 
 | 34 | 
             using (var writer = trbs.OpenWrite()) | 
 
 
 
 
 
 | 35 | 
             { | 
 
 
 
 
 
 | 36 | 
                 for (int i = 0; i < 5; i++) | 
 
 
 
 
 
 | 37 | 
                     writer.Write(trcm); | 
 
 
 
 
 
 | 38 | 
             } | 
 
 
 
 
 
 | 39 | 
         } | 
 
 
 
 
 
 | 40 | 
     } | 
 
 
 
 
 
 | 41 | 
 } |