public static void XFile(string arg)
        {
            using (FileStream stream = new FileStream(arg, FileMode.Open))
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    XFile file = new XFile(reader);

                    string modelFormat = Config.GetValueOrDefault("Models", "Format", "DAE");
                    if (modelFormat == "OBJ")
                    {
                        bool splitMaterials = Config.GetValueOrDefault("OBJ", "SplitByMaterial", "False").ToLower() == "true";
                        Console.WriteLine("    Writing OBJ file...");
                        XUtils.ExportOBJ(file.Objects[0][1].Object, Path.ChangeExtension(arg, ".obj"), SharpDX.Matrix.RotationX(-SharpDX.MathUtil.PiOverTwo), true, ".dds", splitMaterials);
                    }
                    else if (modelFormat == "DAE")
                    {
                        BHDFile bhd = null;
                        if (File.Exists(Path.ChangeExtension(arg, ".bhd")))
                        {
                            Console.WriteLine("    Reading BHD...");
                            bhd = new BHDFile(Path.ChangeExtension(arg, ".bhd"));
                        }

                        /*if (bhd == null)
                         * {
                         *  Console.WriteLine("[ERROR]: No BHD file with matching name! Aborting.");
                         *  throw new Exception();
                         * }*/
                        Console.WriteLine("    Writing DAE file...");
                        bool stripUnusedMaterials = Config.GetValueOrDefault("DAE", "StripUnusedMaterials", "False").ToLower() == "true";
                        Collada.Utils.ExportCOLLADA(file, bhd, Path.ChangeExtension(arg, ".dae"), SharpDX.Matrix.RotationX(-SharpDX.MathUtil.PiOverTwo), true, ".dds", stripUnusedMaterials);
                    }
                    else if (modelFormat == "TXT")
                    {
                        Console.WriteLine("    Dumping X tokens...");
                        stream.Position = 0;
                        XHeader          header    = new XHeader(reader);
                        List <XTemplate> templates = new List <XTemplate>();
                        List <XObject>   objects   = new List <XObject>();
                        XReader          xreader   = new XReader(reader, header, templates, objects);

                        using (StreamWriter writer = new StreamWriter(Path.ChangeExtension(arg, ".txt")))
                        {
                            foreach (XToken token in xreader.Tokens)
                            {
                                writer.WriteLine(token.ToString());
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("    [ERROR]: Invalid model format specified in LOMNTool.ini! (LOMNTool.ini:[Models].Format)");
                    }
                }
        }
        public static void BHDFile(string arg)
        {
            BHDFile file = new BHDFile(arg);

            using (System.IO.StreamWriter writer = new StreamWriter(arg + ".txt"))
            {
                writer.WriteLine("[WARNING]: Assuming Biped bone names.");
                foreach (BHDFile.Bone bone in file.Bones)
                {
                    writer.WriteLine("Bone " + bone.Index + " (" + LOMNTool.BHDFile.BipedBoneNames[bone.Index] + ") (parent: " + bone.ParentIndex + "):");
                    writer.WriteLine("  " + bone.Transform.Row1);
                    writer.WriteLine("  " + bone.Transform.Row2);
                    writer.WriteLine("  " + bone.Transform.Row3);
                    writer.WriteLine("  " + bone.Transform.Row4);
                }
            }
        }
        public static void BHDDAEFile(string arg)
        {
            BHDFile file = Collada.Utils.ImportCOLLADASkeleton(arg, SharpDX.Matrix.RotationY(-SharpDX.MathUtil.PiOverTwo));

            file.Write(arg.Replace(".dae", ""));
        }