static void parse_args(string[] args) { for(int i=0; i<args.Length; i++) { if(args[i][0]=='-') { if(args[i]=="-h"||args[i]=="--help") help(); else if((args[i][1]=='d')&&(args[i][2]=='=')) log_level=(Lib3dsLogLevel)int.Parse(args[i].Substring(3)); else if(args[i][1]=='m') flags|=Flags.LIB3DSDUMP_MATERIALS; else if(args[i][1]=='t') flags|=Flags.LIB3DSDUMP_TRIMESHES; else if(args[i][1]=='i') flags|=Flags.LIB3DSDUMP_INSTANCES; else if(args[i][1]=='c') flags|=Flags.LIB3DSDUMP_CAMERAS; else if(args[i][1]=='l') flags|=Flags.LIB3DSDUMP_LIGHTS; else if(args[i][1]=='n') flags|=Flags.LIB3DSDUMP_NODES; else if(args[i][1]=='w'&&args[i][2]=='=') output=args[i].Substring(3); else help(); } else { if(filename!=null) help(); // if filename is already given filename=args[i]; } } if(filename==null) help(); }
static void lib3ds_io_log(Lib3dsIo io, Lib3dsLogLevel level, string format, params object[] args) { Debug.Assert(io!=null); if(io==null||io.log_func==null) return; lib3ds_io_log_str(io, level, string.Format(format, args)); if(level==Lib3dsLogLevel.LIB3DS_LOG_ERROR) throw new Exception(); }
static void fileio_log_func(object self, Lib3dsLogLevel level, int indent, string msg) { if(log_level>=level) { Console.Write("{0,5} : ", level_str[(int)level]); for(int i=1; i<indent; i++) Console.Write('\t'); Console.WriteLine(msg); } }
static void lib3ds_io_log_str(Lib3dsIo io, Lib3dsLogLevel level, string str) { Debug.Assert(io != null); if (io == null || io.log_func == null) { return; } io.log_func(io.self, level, io.log_indent, str); }
static void lib3ds_io_log(Lib3dsIo io, Lib3dsLogLevel level, string format, params object[] args) { Debug.Assert(io != null); if (io == null || io.log_func == null) { return; } lib3ds_io_log_str(io, level, string.Format(format, args)); if (level == Lib3dsLogLevel.LIB3DS_LOG_ERROR) { throw new Exception(); } }
static void lib3ds_io_log_str(Lib3dsIo io, Lib3dsLogLevel level, string str) { Debug.Assert(io!=null); if(io==null||io.log_func==null) return; io.log_func(io.self, level, io.log_indent, str); }