Exemplo n.º 1
0
 public EUCJPProber()
 {
     codingSM = new CodingStateMachine(new EUCJPSMModel());
     distributionAnalyser = new EUCJPDistributionAnalyser();
     contextAnalyser = new EUCJPContextAnalyser(); 
     Reset();
 }
Exemplo n.º 2
0
 public SJISProber()
 {
     codingSM = new CodingStateMachine(new SJISSMModel());
     distributionAnalyser = new SJISDistributionAnalyser();
     contextAnalyser = new SJISContextAnalyser(); 
     Reset();
 }
Exemplo n.º 3
0
 public GB18030Prober()
 {
     lastChar = new byte[2];
     codingSM = new CodingStateMachine(new GB18030SMModel());
     analyser = new GB18030DistributionAnalyser();
     Reset();
 }
Exemplo n.º 4
0
 public EscCharsetProber()
 {
     codingSM = new CodingStateMachine[CHARSETS_NUM]; 
     codingSM[0] = new CodingStateMachine(new HZSMModel());
     codingSM[1] = new CodingStateMachine(new ISO2022CNSMModel());
     codingSM[2] = new CodingStateMachine(new ISO2022JPSMModel());
     codingSM[3] = new CodingStateMachine(new ISO2022KRSMModel());
     Reset();
 }
Exemplo n.º 5
0
        public override ProbingState HandleData(byte[] buf, int offset, int len)
        {
            int max = offset + len;

            for (int i = offset; i < max && state == ProbingState.Detecting; i++)
            {
                for (int j = activeSM - 1; j >= 0; j--)
                {
                    // byte is feed to all active state machine
                    int codingState = codingSM[j].NextState(buf[i]);
                    if (codingState == SMModel.ERROR)
                    {
                        // got negative answer for this state machine, make it inactive
                        activeSM--;
                        if (activeSM == 0)
                        {
                            state = ProbingState.NotMe;
                            return(state);
                        }
                        else if (j != activeSM)
                        {
                            CodingStateMachine t = codingSM[activeSM];
                            codingSM[activeSM] = codingSM[j];
                            codingSM[j]        = t;
                        }
                    }
                    else if (codingState == SMModel.ITSME)
                    {
                        state           = ProbingState.FoundIt;
                        detectedCharset = codingSM[j].ModelName;
                        return(state);
                    }
                }
            }
            return(state);
        }
Exemplo n.º 6
0
 public EUCTWProber()
 {
     this.codingSM = new CodingStateMachine(new EUCTWSMModel());
     this.distributionAnalyser = new EUCTWDistributionAnalyser();
     this.Reset();
 }
Exemplo n.º 7
0
 public EUCKRProber()
 {
     codingSM             = new CodingStateMachine(new EUCKRSMModel());
     distributionAnalyser = new EUCKRDistributionAnalyser();
     Reset();
 }
Exemplo n.º 8
0
 public Big5Prober()
 {
     this.codingSM             = new CodingStateMachine(new BIG5SMModel());
     this.distributionAnalyser = new BIG5DistributionAnalyser();
     this.Reset();
 }
Exemplo n.º 9
0
 public UTF8Prober()
 {
     numOfMBChar = 0;
     codingSM = new CodingStateMachine(new UTF8SMModel());
     Reset();
 }
Exemplo n.º 10
0
 public UTF8Prober()
 {
     numOfMBChar = 0;
     codingSM    = new CodingStateMachine(new UTF8SMModel());
     Reset();
 }
Exemplo n.º 11
0
 public Big5Prober()
 {
     this.codingSM = new CodingStateMachine(new BIG5SMModel());
     this.distributionAnalyser = new BIG5DistributionAnalyser();
     this.Reset();        
 }
Exemplo n.º 12
0
 public EUCTWProber()
 {
     this.codingSM             = new CodingStateMachine(new EUCTWSMModel());
     this.distributionAnalyser = new EUCTWDistributionAnalyser();
     this.Reset();
 }
Exemplo n.º 13
0
 public EUCKRProber()
 {
     codingSM = new CodingStateMachine(new EUCKRSMModel());
     distributionAnalyser = new EUCKRDistributionAnalyser(); 
     Reset();
 }
Exemplo n.º 14
0
 public UTF8Prober()
 {
     this.numOfMBChar = 0;
     this.codingSM    = new CodingStateMachine(new UTF8SMModel());
     this.Reset();
 }