代码修改-各位大神求解,小弟跪求解,代码问题如下

问题描述

各位大神求解,小弟跪求解,代码问题如下

virtual public byte[] Decode (string data) {
var outStream = new List ();

        int length = data.Length;
        while (length > 0) {
            if (!this.Ignore (data[length - 1])) break;
            length--;
        }

        int i = 0;
        int finish = length - 8;
        for (i = this.NextI (data, i, finish); i < finish; i = this.NextI (data, i, finish)) {
            byte b1 = dTable[data[i++]];
            i = this.NextI (data, i, finish);
            byte b2 = dTable[data[i++]];
            i = this.NextI (data, i, finish);
            byte b3 = dTable[data[i++]];
            i = this.NextI (data, i, finish);
            byte b4 = dTable[data[i++]];
            i = this.NextI (data, i, finish);
            byte b5 = dTable[data[i++]];
            i = this.NextI (data, i, finish);
            byte b6 = dTable[data[i++]];
            i = this.NextI (data, i, finish);
            byte b7 = dTable[data[i++]];
            i = this.NextI (data, i, finish);
            byte b8 = dTable[data[i++]];

            outStream.Add ((byte)((b1 << 3) | (b2 >> 2)));
            outStream.Add ((byte)((b2 << 6) | (b3 << 1) | (b4 >> 4)));
            outStream.Add ((byte)((b4 << 4) | (b5 >> 1)));
            outStream.Add ((byte)((b5 << 7) | (b6 << 2) | (b7 >> 3)));
            outStream.Add ((byte)((b7 << 5) | b8));
        }
        this.DecodeLastBlock (outStream,
            data[length - 8], data[length - 7], data[length - 6], data[length - 5],
            data[length - 4], data[length - 3], data[length - 2], data[length - 1]);

        return outStream.ToArray ();
    }

    virtual protected int DecodeLastBlock (ICollection<byte> outStream, char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8) {
        if (c3 == padding) {
            byte b1 = dTable[c1];
            byte b2 = dTable[c2];
            outStream.Add ((byte)((b1 << 3) | (b2 >> 2)));
            return 1;
        }

        if (c5 == padding) {
            byte b1 = dTable[c1];
            byte b2 = dTable[c2];
            byte b3 = dTable[c3];
            byte b4 = dTable[c4];
            outStream.Add ((byte)((b1 << 3) | (b2 >> 2)));
            outStream.Add ((byte)((b2 << 6) | (b3 << 1) | (b4 >> 4)));
            return 2;
        }

        if (c6 == padding) {
            byte b1 = dTable[c1];
            byte b2 = dTable[c2];
            byte b3 = dTable[c3];
            byte b4 = dTable[c4];
            byte b5 = dTable[c5];

            outStream.Add ((byte)((b1 << 3) | (b2 >> 2)));
            outStream.Add ((byte)((b2 << 6) | (b3 << 1) | (b4 >> 4)));
            outStream.Add ((byte)((b4 << 4) | (b5 >> 1)));
            return 3;
        }

        if (c8 == padding) {
            byte b1 = dTable[c1];
            byte b2 = dTable[c2];
            byte b3 = dTable[c3];
            byte b4 = dTable[c4];
            byte b5 = dTable[c5];
            byte b6 = dTable[c6];
            byte b7 = dTable[c7];

            outStream.Add ((byte)((b1 << 3) | (b2 >> 2)));
            outStream.Add ((byte)((b2 << 6) | (b3 << 1) | (b4 >> 4)));
            outStream.Add ((byte)((b4 << 4) | (b5 >> 1)));
            outStream.Add ((byte)((b5 << 7) | (b6 << 2) | (b7 >> 3)));
            return 4;
        }

        else {
            byte b1 = dTable[c1];
            byte b2 = dTable[c2];
            byte b3 = dTable[c3];
            byte b4 = dTable[c4];
            byte b5 = dTable[c5];
            byte b6 = dTable[c6];
            byte b7 = dTable[c7];
            byte b8 = dTable[c8];
            outStream.Add ((byte)((b1 << 3) | (b2 >> 2)));
            outStream.Add ((byte)((b2 << 6) | (b3 << 1) | (b4 >> 4)));
            outStream.Add ((byte)((b4 << 4) | (b5 >> 1)));
            outStream.Add ((byte)((b5 << 7) | (b6 << 2) | (b7 >> 3)));
            outStream.Add ((byte)((b7 << 5) | b8));
            return 5;
        }
    }

    protected int NextI (string data, int i, int finish) {
        while ((i < finish) && this.Ignore (data[i])) i++;

        return i;
    }

    protected bool Ignore (char c) {
        return (c == 'n') || (c == 'r') || (c == 't') || (c == ' ') || (c == '-');
    }

    protected void InitialiseDecodingTable () {
        for (int i = 0; i < eTable.Length; i++) {
            dTable[eTable[i]] = (byte)i;
        }
    }

小弟新晋码农,不是很懂flash的as语言,请问这段c#代码中(byte)i如何在as3.0中实现,还有在as3.0中如何用byte数据类型,我查了很多资料,但是还是不会,例如byte b1,求大神用as3.0帮我编写一个byte类。其中dTable是ByteArray。,小弟在此跪谢。

时间: 2024-11-05 12:19:22

代码修改-各位大神求解,小弟跪求解,代码问题如下的相关文章

servlet-java关于Servlet里面跳转jsp页面出现找不到页面的问题,急求,大神,小弟跪求了!!

问题描述 java关于Servlet里面跳转jsp页面出现找不到页面的问题,急求,大神,小弟跪求了!! 问题:通过form表单跳转到servlet中处理事物完后,需要再跳转到另外一个jsp页面.我是用了很多种方法:都是页面找不到错误.使用过的方法: 1.response.sendRedirect("excelInport.jsp"); 2.request.getRequestDispatcher("excelInport.jsp").forward(request,

这串代码麻烦求大神解释,跪求详细

问题描述 selectsi.count,ti1.teamName,ti2.teamName,si.pastScore,si.competitionTime,si.hostTeamScore,si.awayTeamScorefromScheduleInfosi,TeamInfoti1,TeamInfoti2wheresi.hostTeamId=ti1.idandsi.awayTeamId=ti2.id 解决方案 解决方案二:selectsi.count,ti1.teamName,ti2.teamN

html5- 求一个 计算器的 源代码求一个 计算器 的代码 谢谢各位大神

问题描述 求一个 计算器的 源代码求一个 计算器 的代码 谢谢各位大神 求一个 计算器 的代码 谢谢各位大神 求一个 计算器 的代码 谢谢各位大神 解决方案 html的 https://www.baidu.com/link?url=szrkXmxu37Ulv-6gand7apF8D2-v7y4-IHNQJ-lS8z-RpqIS7OGCiFJbUNEql_9MDGosqa5Yqw72QYx-X6Jv6K&wd=&eqid=a9ff47db000079ff0000000555b47cebhtt

string-求大神帮小弟看看这份JAVA代码究竟哪里出问题了 如何修改

问题描述 求大神帮小弟看看这份JAVA代码究竟哪里出问题了 如何修改 public class Person { String name; public Person(String personName) { name = personName; } public String greet(String yourName) { return String.format("Hi %s, my name is %s", yourName,name); } } 解决方案 代码没有编译上的错误

android-Android 自己写的一个全局事件管理器,感觉还有点儿问题,提上代码,希望大神们修改修改!!!

问题描述 Android 自己写的一个全局事件管理器,感觉还有点儿问题,提上代码,希望大神们修改修改!!! import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import android.os

求大神帮忙看看这段代码的问题在哪,求修改一下

问题描述 求大神帮忙看看这段代码的问题在哪,求修改一下 10C 这是题目,代码如下: #include#includeusing namespace std; class People{public: People(const string&NOconst string&nameconst string&sexconst string&IDNOconst string&Birthday); virtual void show()=0;protected: strin

求大神将下面这个c代码改成c#的。。。跪谢

问题描述 求大神将下面这个c代码改成c#的...跪谢 const WORD wCRCTalbeAbs[] = {0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401, 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400, }; WORD CRC16_2(BYTE* pchMsg, WORD wDataLen) { WORD wCRC = 0xFFFF;

ava基础 代码错误-Java新手,求大神帮小弟看看这段代码哪里错了,多谢!!!

问题描述 Java新手,求大神帮小弟看看这段代码哪里错了,多谢!!! class Student { //姓名 private String name; //年龄 private int age; //构造方法 public Student(){ } public Student(String name, int age){ this.name = name; this.age = age; } public String getName(){ return name; } public voi

index-关于文字扫描录入功能的代码,求大神帮忙修改

问题描述 关于文字扫描录入功能的代码,求大神帮忙修改 /** 取得每个字符的边界***/ void CPOCRNuberDlg::GetCharRect(HBITMAP bit, RECT rect,int type, CDC* pDC ) { CString strTemp2; CBitmap bitmap; bitmap.m_hObject = CopyImage(bit,IMAGE_BITMAP,0,0,LR_MONOCHROME); //CDC *pDC = GetDC(); CDC m