首页新闻找找看学习计划

请教as脚本问题,移植到c#

0
悬赏园豆:20 [待解决问题]

下面的是个AS类,我看不懂,还请各位大哥帮忙解读下。
我的几大疑问:
1. format和genCode变量为什么可以重复声明?
2. genCode方法为什么也可以重复声明(倒是第一和第四个不是一样的吗)?
3. 最重要的是希望哪位大侠帮忙解读下,比如我StringTool.genCode("dsd09023jfdsjkdfs")这样调用,那执行流是怎么样的呢?

    public class StringTool extends Object
    {
        private static var format:String;
        private static var format:String;
        private static var format:String;
        private static var format:String;
        private static var format:String;
        private static var format:String;
        private static var format:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;
        private static var genCode:String;

        public function StringTool()
        {
            return;
        }// end function

        private static function format(param1:String, param2:String) : String
        {
            return String.fromCharCode(Math.floor(param1.charCodeAt(0) * param2.charCodeAt(0) / 110));
        }// end function

        public static function genCode(param1:String) : String
        {
            return StringTool.genCode.apply(StringTool, arguments);
        }// end function

        private static function genCode() : String
        {
            return NumberFormatter.format(Math.random(), "IDDDD");
        }// end function

        private static function genCode() : void
        {
            genCode = "Z";
            genCode = "g";
            genCode = "X";
            genCode = "e";
            genCode = "S";
            genCode = "c";
            genCode = "J";
            genCode = "a";
            genCode = format(genCode, genCode);
            format = format(genCode, genCode);
            format = format(genCode, genCode);
            format = format(genCode, genCode);
            format = format(genCode, genCode);
            format = format(genCode, genCode);
            format = format(genCode, genCode);
            format = format(genCode, genCode);
            genCode = genCode + format + genCode + format + genCode + format + genCode + format + genCode + format + genCode + format + genCode + format + genCode + genCode;
            return;
        }// end function

        private static function genCode(param1:String) : String
        {
            var _loc_2:String = null;
            if (!genCode)
            {
                genCode();
            }
            _loc_2 = genCode() + MD5.encrypt(param1 + genCode) + genCode();
            return _loc_2;
        }// end function

    }
$tommix的主页 $tommix | 初学一级 | 园豆:164
提问于:2012-10-10 21:19
< >
分享
所有回答(1)
0

不会吧,是不是你拿到的这个文件有问题?

向往-SONG | 园豆:4853 (老鸟四级) | 2012-10-10 21:48
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册