home *** CD-ROM | disk | FTP | other *** search
Wrap
class com.neodelight.flanix.Bin { function Bin() { if(!_global.bin) { _global.bin = new Object(); _global.bin.dump = com.neodelight.std.XString.dump; _global.bin.ls = function() { var _loc13_ = _global.console; var _loc14_ = _loc13_.parameters; var _loc4_ = _loc13_.flags; var _loc8_ = ""; var _loc11_ = ""; var _loc6_ = 0; while(_loc6_ < arguments.length) { if(String(arguments[_loc6_]).charAt(0) != "-") { _loc11_ = arguments[_loc6_]; break; } _loc6_ = _loc6_ + 1; } var _loc7_ = _loc13_.getObjectAtPath(_loc11_); if(_loc4_.help) { _loc8_ += "Usage: ls [OPTIONS]\n"; _loc8_ += "List information about the current object\n"; _loc8_ += " -a display all items\n"; _loc8_ += " -d dump values of non-objects\n"; _loc8_ += " -l long format\n"; _loc8_ += " -1 display only one item per line\n"; return _loc8_; } if(_loc4_.a) { _global.ASSetPropFlags(_loc7_.__proto__,null,6,true); _global.ASSetPropFlags(_loc7_,null,6,true); } var _loc3_ = new Array(); for(_loc6_ in _loc7_) { switch(typeof _loc7_[_loc6_]) { case "movieclip": _loc3_.push("/" + _loc6_ + (!_loc4_.l ? " " : " [m] ")); break; case "object": _loc3_.push("/" + _loc6_ + (!_loc4_.l ? " " : " [o] ")); break; case "function": _loc3_.push(_loc6_ + (!_loc4_.l ? " " : " [f] ")); break; case "string": _loc3_.push(_loc6_ + (!_loc4_.l ? " " : " [s] ") + (!_loc4_.d ? "" : "=\"" + _loc7_[_loc6_] + "\" ")); break; case "undefined": _loc3_.push(_loc6_ + (!_loc4_.l ? " " : " [u] ") + (!_loc4_.d ? "" : "=undefined ")); break; case "null": _loc3_.push(_loc6_ + (!_loc4_.l ? " " : " [0] ") + (!_loc4_.d ? "" : "=null ")); break; case "boolean": _loc3_.push(_loc6_ + (!_loc4_.l ? " " : " [b] ") + (!_loc4_.d ? "" : "=" + _loc7_[_loc6_] + " ")); break; case "number": _loc3_.push(_loc6_ + (!_loc4_.l ? " " : " [n] ") + (!_loc4_.d ? "" : "=" + _loc7_[_loc6_] + " ")); break; default: _loc3_.push(_loc6_ + "_" + typeof _loc7_[_loc6_] + "_"); } } var _loc9_ = 0; _loc6_ = 0; while(_loc6_ < _loc3_.length) { _loc9_ = Math.max(_loc3_[_loc6_].length,_loc9_); _loc6_ = _loc6_ + 1; } _loc3_.sort(); var _loc12_ = !(_loc4_["1"] || _loc4_.d) ? Math.floor(_loc13_.cols / (_loc9_ + 2)) : 1; var _loc10_ = 0; _loc8_ = ""; _loc6_ = 0; while(_loc6_ < _loc3_.length) { _loc8_ += _loc3_[_loc6_]; var _loc5_ = 0; while(_loc5_ < _loc9_ - _loc3_[_loc6_].length + 2) { _loc8_ += " "; _loc5_ = _loc5_ + 1; } _loc10_ = _loc10_ + 1; _loc10_ %= _loc12_; if(_loc10_ == 0) { _loc8_ += "\n"; } _loc6_ = _loc6_ + 1; } return _loc8_; }; _global.bin.cat = function() { var _loc3_ = ""; if(arguments.length == 0 || _global.console.flags.help) { _loc3_ = "Usage: cat [FILE]\nPrint contents of FILE or standard input"; _global.console.setExitCode(0); return _loc3_; } var _loc5_ = _global.console.parameters; var _loc6_ = _global.console; if(!_loc5_[0] || _loc5_[0] == "/") { _loc6_.ram.CWD = ""; _loc5_[0] = ""; } var _loc7_ = (_loc5_[0].substr(0,1) != "/" ? _loc6_.ram.CWD + "/" : "") + _loc5_[0]; var _loc4_ = _loc6_.getObjectAtPath(_loc7_); if(_loc4_) { switch(typeof _loc4_) { case "string": case "number": case "boolean": _loc3_ += String(_loc4_); break; case "object": case "function": _loc3_ += _global.bin.dump(_loc4_); break; default: _global.console.setExitCode(1); _loc3_ += "cat: bad type (" + typeof _loc4_ + ")"; } } else { _global.console.setExitCode(3); _loc3_ = "cat: file not found"; } return _loc3_; }; _global.bin.clipcp = function() { var _loc2_ = ""; if(_global.console.flags.help) { _loc2_ = "Usage: clipcp ARG\nConverts ARG to a String and copies it to the clipboard."; } _global.console.setExitCode(0); return _loc2_; }; _global.bin.cls = function() { var _loc2_ = ""; if(_global.console.flags.help) { _loc2_ = "Usage: cls\nClear the console output window."; } else { _global.console.cls(); } _global.console.setExitCode(0); return _loc2_; }; _global.bin.cd = function() { var _loc2_ = _global.console.parameters; var _loc3_ = _global.console; var _loc5_ = ""; if(_loc2_[0] == undefined || _loc2_[0] == "/") { _loc3_.ram.CWD = ""; _loc2_[0] = ""; } var _loc6_ = (_loc2_[0].substr(0,1) != "/" ? _loc3_.ram.CWD + "/" : "") + _loc2_[0]; var _loc4_ = _loc3_.getObjectAtPath(_loc6_); if(_loc4_) { switch(typeof _loc4_) { case "object": case "array": case "movieclip": case "function": _global.console.setExitCode(0); _loc3_.ram.CWD = _loc6_; break; default: _global.console.setExitCode(1); _loc5_ += "not an object (" + typeof _loc4_ + ")"; } } else { _global.console.setExitCode(3); _loc5_ += "path not found"; } return _loc5_; }; _global.bin.echo = function() { var _loc4_ = ""; var _loc3_ = 0; while(_loc3_ < arguments.length) { if(_loc4_ != "") { _loc4_ += " "; } _loc4_ += String(arguments[_loc3_]); _loc3_ = _loc3_ + 1; } _global.console.setExitCode(0); return _loc4_; }; _global.bin.exit = function() { fscommand("quit"); _global.mdm.exit(); }; _global.bin["false"] = function() { return false; }; _global.bin.fscommand = function() { getURL("FSCommand:" add arguments[0],arguments[1]); }; _global.bin["get"] = function(path) { return _global.console.getObjectAtPath(path); }; _global.bin.grep = function(needle, haystack) { var _loc4_ = ""; if(arguments.length < 1 || _global.console.flags.help) { _loc4_ = "Usage: grep [OPTION] .. PATTERN [FILE] ..\nSearch each line FILE or the standard input and output only lines containing PATTERN"; _global.console.setExitCode(0); return _loc4_; } var _loc5_ = haystack.split("\n"); var _loc3_ = 0; while(_loc3_ < _loc5_.length) { if(_loc5_[_loc3_].indexOf(needle) != -1) { if(_loc4_ != "") { _loc4_ += "\n"; } _loc4_ += _loc5_[_loc3_]; } _loc3_ = _loc3_ + 1; } _global.console.setExitCode(0); return _loc4_; }; _global.bin.load = function(url, loadPoint) { var _loc7_ = ""; if(arguments.length != 2 && arguments.length != 1 || _global.console.flags.help) { _loc7_ += "Usage: load SOURCE [TARGET]\nLoads the external swf file SOURCE into TARGET.\nIf TARGET is not specified, a new movie clip will be created in the _root and used as TARGET."; _global.console.setExitCode(0); return _loc7_; } var _loc5_ = undefined; if(loadPoint) { var _loc4_ = _global.console.getObjectAtPath(loadPoint); if(!_loc4_) { _global.console.stderr("load: object not found: " + loadPoint); _global.console.setExitCode(3); return undefined; } if(typeof _loc4_ != "movieclip") { _global.console.stderr("load: target is not a movieclip (" + typeof _loc4_ + ")"); _global.console.setExitCode(1); return undefined; } _loc5_ = MovieClip(_loc4_); } else { _loc5_ = _root.createEmptyMovieClip(com.neodelight.std.Unique.getKey(),_root.getNextHighestDepth()); loadPoint = "/_root" + _loc5_._target; } loadMovie(url,_loc5_); _loc7_ += "load: loading " + url + " to " + loadPoint; _global.console.setExitCode(0); }; _global.bin.number = function() { return Number(arguments[0]); }; _global.bin["set"] = function() { var _loc3_ = ""; if(_global.console.flags.help) { _loc3_ = "Usage: set [VAR = VALUE]\nWithout parameters: shows list of Flash-Console system variables. With parameters: set the value of a system variable."; _global.console.setExitCode(0); return _loc3_; } if(arguments.length == 0) { for(var _loc4_ in _global.console.ram) { if(_loc3_ != "") { _loc3_ += "\n"; } _loc3_ += _loc4_ + "=" + _global.console.ram[_loc4_]; } return _loc3_; } if(arguments.length < 2 || arguments[1] != "=") { _global.console.stderr("set: syntax error\n"); _global.console.setExitCode(1); return undefined; } _loc4_ = 2; while(_loc4_ < arguments.length) { if(_loc3_ != "") { _loc3_ += " "; } _loc3_ += String(arguments[_loc4_]); _loc4_ = _loc4_ + 1; } var _loc5_ = String(arguments[0]); _global.console.ram[_loc5_] = _loc3_; return undefined; }; _global.bin.sh = function(file) { if(!file) { return ""; } var _loc2_ = _global.console.getObjectAtPath(file); if(typeof _loc2_ != "string") { return "sh: not a script: " + file; } return _global.console.executeCommand(_loc2_); }; _global.bin.syslog = function(id, log, errlvl) { var _loc5_ = ""; if(arguments.length == 0 || _global.console.flags.help) { _global.console.setExitCode(0); _loc5_ = "Usage: syslog FACILITY MESSAGE [ERRORLEVEL]\nSend a message to the system logger. Messages are stored in /var/log/FACILITY.\nErrorlevels:\n1 - Normal log entry\n2 - Warning\n3 - Critical Error"; return _loc5_; } if(!_global["var"].log[id]) { _global["var"].log[id] = log + "\n"; } else { _global["var"].log[id] += log + "\n"; } switch(errlvl) { case 1: _global.console.stdout("#INFO:" + id + ":" + log); break; case 2: _global.bin.syslog("WARNING",id + ": " + log); _global.console.stderr("#WARNING:" + id + ":" + log); break; case 3: _global.bin.syslog("ERROR",id + ": " + log); _global.console.stderr("#ERROR:" + id + ":" + log); } _global.console.setExitCode(0); return _loc5_; }; _global.bin.test = function() { trace("detect: " + _global.id + " / " + _root.id + " / " + _level0.id + " / " + _level1.id); }; _global.bin["true"] = function() { return true; }; } } static function mtascTrace(msg, cls, fil, lin) { var _loc4_ = 0; if(msg.substr(0,3) == "!!!") { _loc4_ = 3; } else if(msg.substr(0,2) == "!!") { _loc4_ = 2; } else if(msg.substr(0,1) == "!") { _loc4_ = 1; } else if(msg.substr(0,1) == "&") { _global.console.stdout(msg); return undefined; } var _loc2_ = String(cls.split("::")[0]).split("."); while(_loc2_.length > 2) { _loc2_.shift(); } var _loc5_ = getTimer(); _global.bin.syslog(_loc2_.join("."),"[" + _loc5_ + ":" + cls.split("::")[1] + ":" + lin + "] " + msg,_loc4_); } }