Пример #1
0
        public AppModel(ModelInitData myFileData)
        {
            this.ch       = false;
            this.initData = myFileData;
            // this.curEncoding = Encoding.UTF8;
            this.encoding       = Encoding.UTF8;
            this.dCalc          = new DumpParamCalculator();
            this.detectEncoding = this.getEncoding;

            // For BOMs (Byte Order Mask) detecting.
            this.sigBase = new Dictionary <Encoding, byte[]>();
            Encoding utf32BE = new UTF32Encoding(true, true);
            Encoding utf32LE = new UTF32Encoding(false, true);

            sigBase[utf32BE] = new byte[4] {
                0x00, 0x00, 0xFE, 0xFF
            };                                                         // BE
            sigBase[utf32LE] = new byte[4] {
                0xFF, 0xFE, 0x00, 0x00
            };                                                         // LE

            sigBase[Encoding.Unicode] = new byte[2] {
                0xFF, 0xFE
            };
            sigBase[Encoding.BigEndianUnicode] = new byte[2] {
                0xFE, 0xFF
            };
            sigBase[Encoding.UTF7] = new byte[3] {
                0x2B, 0x2F, 0x76
            };
            sigBase[Encoding.UTF8] = new byte[3] {
                0xEF, 0xBB, 0xBF
            };

            // Detect RTL langs.
            this.sigRTL = new UInt16[, ]
            {
                { 0xD690, 0xD7BF }   // Hebrew UTF-8
                , { 0xD880, 0xDBBF } // Arabic UTF-8
                , { 0xDC80, 0xDD8F } // Syriac UTF-8
                , { 0xDE80, 0xDEBF } // Thaana UTF-8
                , { 0x0590, 0x05FF } // Hebrew Unicode
                , { 0x0600, 0x06FF } // Arabic Unicode
                , { 0x0700, 0x074F } // Syriac Unicode
                , { 0x0780, 0x07BF } // Thaana Unicode
            };

            this.SAsianLangList = new TLangAsianDetector[]
            {
                new TLangAsianDetector(0xDE80, 0xDEBF, 2, 0, "TITUS Cyberbit Basic"),
                new TLangAsianDetector(0x0780, 0x07BF, 2, 0, "TITUS Cyberbit Basic"),
                new TLangAsianDetector(0xE18080, 0xE1829F, 3, 0, "Padauk Book"),
                new TLangAsianDetector(0x1000, 0x109F, 2, 0, "Padauk Book")
            };
        }
Пример #2
0
 public static DirectoryExplorer CreateObject(ModelInitData data)
 {
     if (string.Compare(data.curFile, curFile, true) != 0)
     {
         try
         {
             obj = new DirectoryExplorer(data);
         }
         catch {}
     }
     return(obj);
 }
Пример #3
0
 private DirectoryExplorer(ModelInitData shData)
 {
     this.sharedData = shData;
     Init(this.sharedData.curFile);
 }
 public AppExtendedData()
 {
     this.basicInfo = new ModelInitData();
 }