Ejemplo n.º 1
0
 public void clearData()
 {
     this.myBuff             = null;
     this.bomLength          = -1; // Unknown;
     this.initData.container = "";
     this.dCalc = new DumpParamCalculator();
     this.initData.hexDump.startIndex = 0;
 }
Ejemplo n.º 2
0
        public override void openFile()
        {
            this.readFile();
            this.dCalc = new DumpParamCalculator();
            this.initData.hexDump.startIndex = 0;

            if (myBuff.Length == 0)
            {
                this.changed = false;
                return;
            }
            string consoleFont = "Lucida Console";

            if (this.isFileBinary())
            {
                this.initData.recommendedFont = consoleFont;
                this.makeHexDump();
            }
            else
            {
                this.encoding = this.detectEncoding();
                if (this.bomLength < 0)
                {
                    this.bomLength = 0;
                }

                this.initData.container = this.curEncoding.GetString(myBuff, bomLength, myBuff.Length - bomLength);

                //if (this.initData.recommendedFont == "TITUS Cyberbit Basic") { }
                // Max. 3 bytes per symbol in the utf-8.
                if (this.detected == false && this.strlen(this.initData.container) < (myBuff.Length - this.bomLength) / 3)
                {
                    this.initData.binary          = true;
                    this.initData.recommendedFont = consoleFont;
                    this.makeHexDump();
                }
                else
                {
                    this.initData.container = this.initData.container.Replace("\0", string.Empty);
                    this.detected           = false;
                }
            }
            this.changed = true;
        }