Пример #1
0
 public EUCJPProber()
 {
     codingSM = new CodingStateMachine(new EUCJPSMModel());
     distributionAnalyser = new EUCJPDistributionAnalyser();
     contextAnalyser = new EUCJPContextAnalyser(); 
     Reset();
 }
Пример #2
0
 public SJISProber()
 {
     codingSM = new CodingStateMachine(new SJISSMModel());
     distributionAnalyser = new SJISDistributionAnalyser();
     contextAnalyser = new SJISContextAnalyser(); 
     Reset();
 }
Пример #3
0
 public GB18030Prober()
 {
     lastChar = new byte[2];
     codingSM = new CodingStateMachine(new GB18030SMModel());
     analyser = new GB18030DistributionAnalyser();
     Reset();
 }
Пример #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();
 }
Пример #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);
        }
Пример #6
0
 public EUCTWProber()
 {
     this.codingSM = new CodingStateMachine(new EUCTWSMModel());
     this.distributionAnalyser = new EUCTWDistributionAnalyser();
     this.Reset();
 }
Пример #7
0
 public EUCKRProber()
 {
     codingSM             = new CodingStateMachine(new EUCKRSMModel());
     distributionAnalyser = new EUCKRDistributionAnalyser();
     Reset();
 }
Пример #8
0
 public Big5Prober()
 {
     this.codingSM             = new CodingStateMachine(new BIG5SMModel());
     this.distributionAnalyser = new BIG5DistributionAnalyser();
     this.Reset();
 }
Пример #9
0
 public UTF8Prober()
 {
     numOfMBChar = 0;
     codingSM = new CodingStateMachine(new UTF8SMModel());
     Reset();
 }
Пример #10
0
 public UTF8Prober()
 {
     numOfMBChar = 0;
     codingSM    = new CodingStateMachine(new UTF8SMModel());
     Reset();
 }
Пример #11
0
 public Big5Prober()
 {
     this.codingSM = new CodingStateMachine(new BIG5SMModel());
     this.distributionAnalyser = new BIG5DistributionAnalyser();
     this.Reset();        
 }
Пример #12
0
 public EUCTWProber()
 {
     this.codingSM             = new CodingStateMachine(new EUCTWSMModel());
     this.distributionAnalyser = new EUCTWDistributionAnalyser();
     this.Reset();
 }
Пример #13
0
 public EUCKRProber()
 {
     codingSM = new CodingStateMachine(new EUCKRSMModel());
     distributionAnalyser = new EUCKRDistributionAnalyser(); 
     Reset();
 }
Пример #14
0
 public UTF8Prober()
 {
     this.numOfMBChar = 0;
     this.codingSM    = new CodingStateMachine(new UTF8SMModel());
     this.Reset();
 }