示例#1
1
 public FormIFFEditorFind(FormIFFILFWSEditor formIFFILFWSEditor)
 {
     InitializeComponent();
       this.dynamicByteProvider = new DynamicByteProvider(new Byte[0]);
       this.hexBoxFind.ByteProvider = this.dynamicByteProvider;
       this.m_FormIFFILFWSEditor = formIFFILFWSEditor;
       this.comboBoxSearchRegion.SelectedIndex = 1;
 }
示例#2
0
        private void DisplayText()
        {
            if (this.InvokeRequired)
            {
                DisplayTextDelegate d = new DisplayTextDelegate(DisplayText);
                this.Invoke(d);
            }
            else
            {
                //txtReceivedBytesASCII.Text = txtReceivedBytesASCII.Text.Insert(0, _rxString);
                //DynamicByteProvider b = new DynamicByteProvider(Encoding.ASCII.GetBytes(_rxString));
                try
                {
                    //txtReceivedBytesASCII.Text = txtReceivedBytesASCII.Text.Insert(0, Encoding.ASCII.GetString(_serialPortBuffer.ToArray()));

                    byte[] byteArray = _serialPortBuffer.ToArray();

                    DynamicByteProvider b = new DynamicByteProvider(byteArray);
                    hexReceivedBytes.ByteProvider = b;

                    string s = Common.GetString(byteArray);
                    txtReceivedBytesASCII.Text = txtReceivedBytesASCII.Text.Insert(0, s);

                    //txtReceivedBytesASCII.Text = txtReceivedBytesASCII.Text.Insert(0, System.Text.Encoding.UTF8.GetString(byteArray));
                }
                catch (Exception exc)
                {
                    WriteMessage(exc.ToString());
                }
            }
        }
示例#3
0
        private void lvProperties_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvProperties.SelectedItems.Count < 1)
            {
                return;
            }
            try
            {
                try
                {
                    PropId prop = ((IPropertyInformation)lvProperties.SelectedItems[0].Tag).PropertyId;

                    var bytes = _propertyObject.ReadProperty(prop);

                    var byteProvider = new DynamicByteProvider(bytes);
                    hexBox1.ByteProvider = byteProvider;
                }
                catch (InvalidCastException)
                {
                    var prop  = (PropId)lvProperties.SelectedItems[0].Tag;
                    var bytes = _propertyObject.ReadProperty(prop);

                    var byteProvider = new DynamicByteProvider(bytes);
                    hexBox1.ByteProvider = byteProvider;
                }
            }
            catch (Exception)
            {
            }
        }
示例#4
0
        public void SetHexBoxFile(string hexboxIdentifier, ref LoadedFile file)
        {
            HexBox targetHexBox     = HexBoxes[hexboxIdentifier];
            DynamicByteProvider dbp = new DynamicByteProvider(file.BinaryContent);

            targetHexBox.ByteProvider = dbp;
        }
示例#5
0
        private void UpdateDisplay()
        {
            if (!tkbSectors.Enabled)
            {
                return;
            }

            ibxInfo.Text = string.Format("Track - {1:X2}, Sector - {2:X2}", currentSide, currentTrack, currentSector);

            // Read current sector
            if (currentSide == 1)
            {
                currentTrack += 0x80;
            }

            byte[] byteArray = DiskInfo.ReadSector(currentTrack, currentSector);

            // Display current sector
            DynamicByteProvider dynamicByteProvider;

            dynamicByteProvider = new DynamicByteProvider(byteArray);

            hxbSectorView.ByteProvider = dynamicByteProvider;

            tkbTracks.Value  = currentTrack & 0x7F;
            tkbSectors.Value = currentSector;

            currentTrack = (byte)tkbTracks.Value;
        }
        private void btnSend_Click(object sender, EventArgs e)
        {
            DynamicByteProvider BytePro = hexBox1.ByteProvider as DynamicByteProvider;

            try
            {
                strPipeMsgOut.sockid = int.Parse(txtSockID.Text, System.Globalization.NumberStyles.HexNumber);
            }
            catch
            {
                MessageBox.Show("Invalid socket ID.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtSockID.SelectAll();
                txtSockID.Focus();
                return;
            }

            bcBytes = BytePro.Bytes;
            strPipeMsgOut.command  = Glob.CMD_INJECT;
            strPipeMsgOut.function = Glob.FUNC_SEND;
            strPipeMsgOut.datasize = bcBytes.Count;

            for (int times = int.Parse(txtTimes.Text); times > 0; times--)
            {
                pipeOut.Write(Glob.RawSerializeEx(strPipeMsgOut), 0, Marshal.SizeOf(strPipeMsgOut));
                pipeOut.Write(bcBytes.GetBytes(), 0, strPipeMsgOut.datasize);
            }
        }
示例#7
0
        public void CreateDefault()
        {
            byte[] array = new byte[] { 0x00 };
            DynamicByteProvider byteprov = new DynamicByteProvider(array);

            hexBox.ByteProvider = byteprov;
        }
        private void ViewModelOnBankChunkChanged(object sender, EventArgs e)
        {
            var provider =
                new DynamicByteProvider(((VstPluginChunkViewModel)ViewModel).ChunkBankMemoryStream.ToArray());

            PluginBankChunkControl.ByteProvider = provider;
        }
示例#9
0
        public void Disable()
        {
            this.scratchpadByteProvider = null;
            this.hexBox.ByteProvider    = scratchpadByteProvider;

            this.Enabled = false;
        }
示例#10
0
        private void btnWrite_Click(object sender, EventArgs e)
        {
            DynamicByteProvider dbp = this.hxBox.ByteProvider as DynamicByteProvider;

            dbp.ApplyChanges();

            for (int i = 0; i < dbp.Bytes.Count; i++)
            {
                this.Data[i] = dbp.Bytes[i];
            }

            string AddrStr = "";

            if (this.txtMemAdr.Text.StartsWith("0x"))
            {
                AddrStr = this.txtMemAdr.Text.Substring(2);
            }
            else
            {
                AddrStr = this.txtMemAdr.Text;
            }

            UInt64 Addr = 0;

            UInt64.TryParse(AddrStr, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out Addr);

            Commands.ps4ninja_write_kmem(Addr, (UInt64)this.Data.Length, this.Data, this.Client);
        }
示例#11
0
 public void InitInterpreter()
 {
     DynamicByteProvider db = new DynamicByteProvider(pcc.Exports[Index].Data);
     hb1.ByteProvider = db;
     memory = pcc.Exports[Index].Data;
     memsize = memory.Length;
 }
示例#12
0
 public FillBytesForm(DynamicByteProvider provider, long startPos, long length)
 {
     InitializeComponent();
     _provider = provider;
     _startPos = startPos;
     _length   = length;
 }
示例#13
0
        public HexEditor(string tagName, byte[] data, int bytesPerElem)
        {
            InitializeComponent();

            this.Text = "Editing: " + tagName;

            _bytesPerElem = bytesPerElem;
            _curPositionLabel.Text = "0x0000";
            _curElementLabel.Text = "Element 0";

            _data = new byte[data.Length];
            Array.Copy(data, _data, data.Length);

            _byteProvider = new DynamicByteProvider(_data);
            _byteProvider.Changed += (o, e) => { _modified = true; };

            hexBox1.ByteProvider = _byteProvider;

            hexBox1.HorizontalByteCountChanged += HexBox_HorizontalByteCountChanged;
            hexBox1.CurrentLineChanged += HexBox_CurrentLineChanged;
            hexBox1.CurrentPositionInLineChanged += HexBox_CurrentPositionInLineChanged;
            hexBox1.InsertActiveChanged += HexBox_InsertActiveChanged;

            hexBox1.ReadOnly = false;
        }
示例#14
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listBox1.SelectedIndex > 0)
            {
                var packet   = this.packets[this.listBox1.SelectedIndex];
                var provider = new DynamicByteProvider(packet.Data);
                this.hexBox1.ByteProvider = provider;
                this.textBox1.Text        = Encoding.Default.GetString(packet.Data);
                this.treeView1.Nodes.Clear();
                var header = this.treeView1.Nodes.Add("Header");
                header.Nodes.Add(string.Format("Length:{0}", packet.Header.Length));
                var sb = new StringBuilder();
                foreach (var b in packet.Header)
                {
                    sb.Append(b.ToString("00"));
                    sb.Append(" ");
                }

                header.Nodes.Add(string.Format("Data:{0}", sb));
                header.Nodes.Add(string.Format("Capture Length:{0}", packet.PcapHeader.CaptureLength.ToString()));
                header.Nodes.Add(string.Format("Packet Length:{0}", packet.PcapHeader.PacketLength.ToString()));
                header.Nodes.Add(string.Format("Date:{0}", packet.PcapHeader.Date.ToString()));
                header.Nodes.Add(string.Format("Microseconds:{0}", packet.PcapHeader.MicroSeconds.ToString()));
                header.Nodes.Add(string.Format("Seconds:{0}", packet.PcapHeader.Seconds.ToString()));

                this.treeView1.ExpandAll();
            }
        }
示例#15
0
            public override void SetRawData(byte[] data)
            {
                _byteProvider          = new DynamicByteProvider(data);
                _byteProvider.Changed += (o, e2) => { OnModified(); };

                _hexBox.ByteProvider = _byteProvider;
            }
示例#16
0
        public HexEditor(string tagName, byte[] data, int bytesPerElem)
        {
            InitializeComponent();

            this.Text = "Editing: " + tagName;

            _bytesPerElem          = bytesPerElem;
            _curPositionLabel.Text = "0x0000";
            _curElementLabel.Text  = "Element 0";

            _data = new byte[data.Length];
            Array.Copy(data, _data, data.Length);

            _byteProvider          = new DynamicByteProvider(_data);
            _byteProvider.Changed += (o, e) => { _modified = true; };

            hexBox1.ByteProvider = _byteProvider;

            hexBox1.HorizontalByteCountChanged   += HexBox_HorizontalByteCountChanged;
            hexBox1.CurrentLineChanged           += HexBox_CurrentLineChanged;
            hexBox1.CurrentPositionInLineChanged += HexBox_CurrentPositionInLineChanged;
            hexBox1.InsertActiveChanged          += HexBox_InsertActiveChanged;

            hexBox1.ReadOnly = false;
        }
示例#17
0
        public void InitInterpreter(BioTlkFileSet editorTalkset = null)
        {
            DynamicByteProvider db = new DynamicByteProvider(pcc.Exports[Index].Data);

            hb1.ByteProvider = db;
            memory           = pcc.Exports[Index].Data;
            memsize          = memory.Length;

            // attempt to find a TlkFileSet associated with the object, else just pick the first one and hope it's correct
            if (editorTalkset == null)
            {
                PropertyReader.Property tlkSetRef = PropertyReader.getPropList(pcc, pcc.Exports[Index].Data).FirstOrDefault(x => pcc.getNameEntry(x.Name) == "m_oTlkFileSet");
                if (tlkSetRef != null)
                {
                    tlkset = new BioTlkFileSet(pcc, tlkSetRef.Value.IntValue - 1);
                }
                else
                {
                    tlkset = new BioTlkFileSet(pcc);
                }
            }
            else
            {
                tlkset = editorTalkset;
            }
        }
示例#18
0
 public FillBytesForm(DynamicByteProvider provider, long startPos, long length)
 {
     InitializeComponent();
     _provider = provider;
     _startPos = startPos;
     _length = length;
 }
示例#19
0
        /// <summary>
        /// Set name and value to edit
        /// </summary>
        /// <param name="name">name of the value</param>
        /// <param name="value">value to edit</param>
        internal void SetArguments(string name, byte[] value)
        {
            DynamicByteProvider provider = new DynamicByteProvider(value);

            hexBox.ByteProvider = provider;
            textBoxName.Text    = name;
            hexBox.ByteProvider = provider;
        }
示例#20
0
        public void InitInterpreter()
        {
            DynamicByteProvider db = new DynamicByteProvider(pcc.Exports[Index].Data);

            hb1.ByteProvider = db;
            memory           = pcc.Exports[Index].Data;
            memsize          = memory.Length;
        }
        public void LoadData(byte[] data)
        {
            Cleanup();

            IByteProvider provider = new DynamicByteProvider(data);

            hexBox1.ByteProvider = provider;
        }
示例#22
0
        public void Enable(TheCpu CPU)
        {
            this.scratchpadByteProvider          = new DynamicByteProvider(CPU.Scratchpad);
            this.scratchpadByteProvider.Changed += new EventHandler(scratchpadByteProvider_Changed);
            this.hexBox.ByteProvider             = scratchpadByteProvider;

            this.Enabled = true;
        }
示例#23
0
        private void frmDump_Load(object sender, EventArgs e)
        {
            DynamicByteProvider dbp = new DynamicByteProvider(this.Data);

            this.hxBox.ReadOnly       = true;
            this.hxBox.ByteProvider   = dbp;
            this.hxBox.LineInfoOffset = this.LineOff;
        }
示例#24
0
 void CPU_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Scratchpad" && this.Enabled)
     {
         scratchpadByteProvider   = new DynamicByteProvider(cpu.Scratchpad);
         this.hexBox.ByteProvider = scratchpadByteProvider;
     }
 }
 public ChangeBinaryDialog(string name, byte[] value, int currentLanguageID)
 {
     InitializeComponent();
     textBoxName.Text = name;
     DynamicByteProvider provider = new DynamicByteProvider(value);
     hexBox.ByteProvider = provider;
     Translator.TranslateControls(this, "RegistryEditor.ChangeBinaryDialogMessageTable.txt", currentLanguageID);
 }
示例#26
0
        /*
         * SCardControl
         * ------------
         */
        void BtnControlClick(object sender, EventArgs e)
        {
            RCtrlClear();

            DynamicByteProvider p;

            byte[] b;

            p = (DynamicByteProvider)hexBoxCCtrl.ByteProvider;

            b = new byte[p.Length];

            for (int i = 0; i < p.Length; i++)
            {
                b[i] = p.ReadByte(i);
            }

            CardBuffer cctrl = new CardBuffer(b);

            Settings.HistoryControl.Add(cctrl.AsString());
            hist_ctrl_idx = -1;

            CardBuffer rctrl = channel.Control(cctrl);

            if (rctrl == null)
            {
                ShowError();
            }
            else
            {
                ShowSuccess();

                b = rctrl.GetBytes();

                p = new DynamicByteProvider(b);

                hexBoxRCtrl.ByteProvider = p;

                if (b.Length > 0)
                {
                    eResultByte.Text = String.Format("{0}", 0 - (int)b[0]);

                    if (b[0] == 0)
                    {
                        eResultByteExplain.Text = "Success";
                    }
                    else
                    {
                        ushort sw = (ushort)(0x6F00 | b[0]);
                        eResultByteExplain.Text = SCARD.CardStatusWordsToString(sw);
                    }
                }

                hexBoxRCtrl.BackColor        = hexBoxCApdu.BackColor;
                eResultByte.BackColor        = eCardAtr.BackColor;
                eResultByteExplain.BackColor = eCardAtr.BackColor;
            }
        }
示例#27
0
 public HexElement()
 {
     this.InitializeComponent();
     this.dbytes = new DynamicByteProvider(new byte[0]);
     this.bytes  = this.dbytes.Bytes;
     this.hexBox1.ByteProvider  = this.dbytes;
     this.dbytes.LengthChanged += this.dbytes_LengthChanged;
     this.dbytes.Changed       += this.dbytes_Changed;
 }
示例#28
0
 public HexElement()
 {
     this.InitializeComponent();
     this.dbytes = new DynamicByteProvider(new byte[0]);
     this.bytes = this.dbytes.Bytes;
     this.hexBox1.ByteProvider = this.dbytes;
     this.dbytes.LengthChanged += this.dbytes_LengthChanged;
     this.dbytes.Changed += this.dbytes_Changed;
 }
示例#29
0
 public HexElement()
 {
     InitializeComponent();
     dbytes = new DynamicByteProvider(new byte[0]);
     bytes = dbytes.Bytes;
     hexBox1.ByteProvider = dbytes;
     dbytes.LengthChanged += dbytes_LengthChanged;
     dbytes.Changed += dbytes_Changed;
 }
        public override void LoadExport(IExportEntry export)
        {
            CurrentLoadedExport = export;
            DynamicByteProvider db = new DynamicByteProvider(export.Data);

            BinaryInterpreter_Hexbox.ByteProvider = db;

            StartBinaryScan();
        }
        private void peekpoke_poke_Click(object sender, EventArgs e)
        {
            uint addr = uint.Parse(peekpoke_address.Text.Replace("0x", ""), NumberStyles.HexNumber);
            DynamicByteProvider provider = (DynamicByteProvider)memory.ByteProvider;

            byte[] bytes = provider.Bytes.ToArray();

            MainForm.console.Write_Byte(addr, bytes);
        }
示例#32
0
        public ChangeBinaryDialog(string name, byte[] value, int currentLanguageID)
        {
            InitializeComponent();
            textBoxName.Text = name;
            DynamicByteProvider provider = new DynamicByteProvider(value);

            hexBox.ByteProvider = provider;
            Translator.TranslateControls(this, "RegistryEditor.ChangeBinaryDialogMessageTable.txt", currentLanguageID);
        }
示例#33
0
 public HexElement()
 {
     InitializeComponent();
     dbytes = new DynamicByteProvider(new byte[0]);
     bytes  = dbytes.Bytes;
     hexBox1.ByteProvider  = dbytes;
     dbytes.LengthChanged += dbytes_LengthChanged;
     dbytes.Changed       += dbytes_Changed;
 }
示例#34
0
        public void InitInterpreter()
        {
            memory  = export.Data;
            memsize = memory.Length;
            DynamicByteProvider db = new DynamicByteProvider(export.Data);

            hb1.ByteProvider = db;
            className        = export.ClassName;
            StartBio2DAScan();
        }
示例#35
0
        private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "PluginChunk")
            {
                var s = (NKSFViewModel)sender;

                var provider = new DynamicByteProvider(s.PluginChunk.ToArray());
                PluginChunkControl.ByteProvider = provider;
            }
        }
示例#36
0
 public FormIFFEditorReplace(FormIFFILFWSEditor formIFFILFWSEditor)
 {
     InitializeComponent();
       this.m_FormIFFILFWSEditor = formIFFILFWSEditor;
       this.dynamicByteProviderFindWhat = new DynamicByteProvider(new Byte[0]);
       this.hexBoxFindWhat.ByteProvider = this.dynamicByteProviderFindWhat;
       this.dynamicByteProviderReplaceWith = new DynamicByteProvider(new Byte[0]);
       this.hexBoxReplaceWith.ByteProvider = this.dynamicByteProviderReplaceWith;
       this.comboBoxSearchIn.SelectedIndex = 0;
 }
示例#37
0
        /// <summary>
        /// Initialize the given buffer view.
        /// </summary>
        /// <param name="hexBox"></param>
        /// <param name="size"></param>
        private void InitializeHexBox(HexBox hexBox, int size)
        {
            hexBox.ColumnInfoVisible = true;
            hexBox.VScrollBarVisible = true;
            hexBox.LineInfoVisible   = true;
            hexBox.StringViewVisible = true;
            DynamicByteProvider dbpData = new DynamicByteProvider(new byte[size]);

            hexBox.ByteProvider = dbpData;
        }
示例#38
0
 void clear_provider()
 {
     if (provider != null)
     {
         provider.Bytes.Clear();
         provider            = null;
         hexBox.ByteProvider = null;
         unKey_txtBox.Clear();
     }
 }
示例#39
0
 public HexDataEdit(string RecName, byte[] data, dFormIDLookupS formIDLookup)
 {
   InitializeComponent();
   Icon = Resources.fomm02;
   this.formIDLookup = formIDLookup;
   tbName.Text = RecName;
   var dbytes = new DynamicByteProvider(data);
   bytes = dbytes.Bytes;
   hexBox1.ByteProvider = dbytes;
   Canceled = true;
 }
        public ReplayEditor(byte[] ReplayData, int socket, NamedPipeClientStream pipe)
        {
            InitializeComponent();

            DynamicByteProvider BytePro = new DynamicByteProvider(ReplayData);

            hexBox1.ByteProvider = BytePro;
            isocket = socket;
            pipeOut = pipe;
            txtSockID.Text = socket.ToString("X4");
        }
示例#41
0
 public HexDataEdit(string RecName, byte[] data, dFormIDLookupS formIDLookup)
 {
     this.InitializeComponent();
     Icon = Resources.tesv_ico;
     this.formIDLookup = formIDLookup;
     Text += RecName;
     this.tbName.Text = RecName;
     Text += " (hex mode)";
     this.dbytes = new DynamicByteProvider(data);
     this.bytes = this.dbytes.Bytes;
     this.hexBox1.ByteProvider = this.dbytes;
     Canceled = true;
 }
示例#42
0
文件: Browser.cs 项目: Renmiri/Gaming
 public void Preview()
 {
     int n = listBox1.SelectedIndex;
     if (n == -1)
         return;
     if (ViewMode == 2)
     {
         Package.ExportEntry e = Package.exportlist[n];
         byte[] buff = new byte[e.DataSize];
         for (int i = 0; i < e.DataSize; i++)
             buff[i] = Package.memory[e.DataOffset + i];
         DynamicByteProvider db = new DynamicByteProvider(buff);
         hb1.ByteProvider = db;
         status.Text = "Class :" + Package.GetClass(e.Class);
     }
 }
示例#43
0
文件: Demo.cs 项目: engina/PLCNetLib
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     tabControl1_SelectedIndexChanged(tabControl1, EventArgs.Empty);
     LogManager.LogFired += new LogManager.LogHandler(LogManager_LogFired);
     m_finder = new Finder();
     m_finder.DeviceFound += new Finder.DeviceFoundHandler(m_finder_DeviceFound);
     rwHB.StringViewVisible = true;
     rwHB.LineInfoVisible = true;
     rwHB.UseFixedBytesPerLine = true;
     rwHB.BytesPerLine = 16;
     rwHB.VScrollBarVisible = true;
     readWriteP.Controls.Add(rwHB);
     DynamicByteProvider dbp = new DynamicByteProvider(new byte[1]);
     dbp.LengthChanged +=new EventHandler(writeRawLengthChangedHandler);
     rwHB.ByteProvider = dbp;
 }
示例#44
0
 public MemoryViewer(ulong address, uint length)
 {
     try
     {
         memoryAddress = address;
         blockLength = length;
         InitializeComponent();
         InitialiseBuffer();
         DynamicByteProvider dynamicByteProvider = new DynamicByteProvider(memoryBlock);
         hexBox.ByteProvider = dynamicByteProvider;
         BuildStringRepresentation(16);
     }
     catch
     {
         //textBoxMemory.Text = @"Can not read memory on adress: 0x" + address.ToString("X8");
     }
 }
示例#45
0
 public void InitInterpreter(Object editorTalkFile = null)
 {
     DynamicByteProvider db = new DynamicByteProvider(pcc.Exports[Index].Data);
     hb1.ByteProvider = db;
     memory = pcc.Exports[Index].Data;
     memsize = memory.Length;
     
     // Load the default TLK file into memory.
     if (editorTalkFile == null)
     {
         var tlkPath = ME3Directory.cookedPath + "BIOGame_INT.tlk";
         talkFile = new TalkFile();
         talkFile.LoadTlkData(tlkPath);
     }
     else
     {
         talkFile = (TalkFile)editorTalkFile;
     }
 }
示例#46
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="temp"></param>
        public FormPayload(Event temp)
        {
            InitializeComponent();

            // Payload Tab (HEX)
            if (temp.PayloadHex != null)
            {
                DynamicByteProvider dynamicByteProvider = new DynamicByteProvider(temp.PayloadHex);
                hexEvent.ByteProvider = dynamicByteProvider;
            }
            else
            {
                DynamicByteProvider dynamicByteProvider = new DynamicByteProvider(new byte[] { });
                hexEvent.ByteProvider = dynamicByteProvider;
            }

            // Payload Tab (ASCII)
            txtPayloadAscii.Text = temp.PayloadAscii;
        }
示例#47
0
            public override void Initialize ()
            {
                _byteProvider = new DynamicByteProvider(new byte[0]);
                _byteProvider.Changed += (o, e) => { OnModified(); };

                _hexBox = new HexBox() {
                    Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                    Font = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, 0),
                    LineInfoForeColor = Color.Empty,
                    LineInfoVisible = true,
                    Location = new Point(0, 0),
                    ShadowSelectionColor = Color.FromArgb(100, 60, 188, 255),
                    Size = new Size(500, 263),
                    TabIndex = 0,
                    VScrollBarVisible = true,
                    ByteProvider = _byteProvider,
                };

                _tabPage = new TabPage() {
                    Location = new Point(4, 22),
                    Padding = new Padding(3),
                    Size = new Size(500, 263),
                    TabIndex = 0,
                    Text = "Hex View",
                    UseVisualStyleBackColor = true,
                };

                _tabPage.Controls.Add(_hexBox);

                _hexBox.HorizontalByteCountChanged += (s, e) => { UpdatePosition(); };
                _hexBox.CurrentLineChanged += (s, e) => { UpdatePosition(); };
                _hexBox.CurrentPositionInLineChanged += (s, e) => { UpdatePosition(); };

                _hexBox.InsertActiveChanged += (s, e) => { _insertLabel.Text = (_hexBox.InsertActive) ? "Insert" : "Overwrite"; };

                InitializeStatusBar();
            }
示例#48
0
文件: FormMain.cs 项目: Epidal/Ostara
		void flvPackets_SelectedIndexChanged(object sender, EventArgs e) {
			if (flvPackets.SelectedIndex < 0) {
				ClearInspector();
				hexView.ByteProvider = null;
				tlvStructure.ClearObjects();
			}
			else {
				var pi = (PacketInfo)flvPackets.SelectedObject;
				var bytes = new DynamicByteProvider(pi.Data);
				hexView.ByteProvider = bytes;
				SetStructureObjects(ParsePacketData(pi));
				tlvStructure.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent);
			}
		}
示例#49
0
 private void SetHexBoxByteProvider(DynamicByteProvider value)
 {
     if (hexBox.InvokeRequired)
         Invoke((MethodInvoker) (() => SetHexBoxByteProvider(value)));
     else
     {
         hexBox.ByteProvider = value;
     }
 }
示例#50
0
        private void Peek(object a)
        {
            try
            {
                EnableControl(peekButton, false);
                if (string.IsNullOrEmpty(GetTextBoxText(peekLengthTextBox)) ||
                    Convert.ToUInt32(GetTextBoxText(peekLengthTextBox), 16) == 0)
                    throw new Exception("Invalid peek length!");
                if (string.IsNullOrEmpty(GetTextBoxText(peekPokeAddressTextBox)) ||
                    Convert.ToUInt32(GetTextBoxText(peekPokeAddressTextBox), 16) == 0)
                    throw new Exception("Address cannot be 0 or null");
                //convert peek result string values to byte

                byte[] retValue =
                    Functions.StringToByteArray(_rtm.Peek(GetTextBoxText(peekPokeAddressTextBox),
                                                          GetTextBoxText(peekLengthTextBox),
                                                          GetTextBoxText(peekPokeAddressTextBox),
                                                          GetTextBoxText(peekLengthTextBox)));
                var buffer = new DynamicByteProvider(retValue) {IsWriteByte = true}; //object initilizer

                _old = new byte[buffer.Bytes.Count];
                buffer.Bytes.CopyTo(_old);

                SetHexBoxByteProvider(buffer);
                SetHexBoxRefresh();
                EnableControl(peekButton, true);

                SetTextBoxText(peekPokeFeedBackTextBox, "Peek Success!");
                UpdateProgressbar(0, 100, 0);
            }
            catch (Exception ex)
            {
                ShowMessageBox(ex.Message, String.Format("Peek Poker"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                EnableControl(peekButton, true);
                UpdateProgressbar(0, 100, 0);
            }
        }
示例#51
0
 private DynamicByteProvider GetHexBoxByteProvider()
 {
     //recursion
     var returnVal = new DynamicByteProvider(new byte[] {0, 0, 0, 0});
     if (hexBox.InvokeRequired)
         hexBox.Invoke((MethodInvoker)
                       delegate { returnVal = GetHexBoxByteProvider(); });
     else
         return (DynamicByteProvider) hexBox.ByteProvider;
     return returnVal;
 }
        /// <summary>
        /// Bind a ressource.
        /// </summary>
        /// <param name="resource">resource to bind</param>
        public void Bind(EmbeddedResource resource)
        {
            CleanUp();
            
            if (resource != null)
            {
                IByteProvider provider = new DynamicByteProvider(resource.Data);
                provider.Changed += new EventHandler(byteProvider_Changed);
                provider.LengthChanged += new EventHandler(byteProvider_LengthChanged);

                hexBox.ByteProvider = provider;
                _resource = resource;
                hexBox.ReadOnly = false;
            } else
            {
                hexBox.ReadOnly = true;
            }

            UpdateSizeStatus();
            ManageAbility();
        }
示例#53
0
        /// <summary>
        /// 
        /// </summary>
        public void ClearControls()
        {
            MethodInvoker methodInvoker = delegate
            {
                using (new HourGlass(this))
                {
                    // IP Tab
                    ipSource.Text = string.Empty;
                    ipDest.Text = string.Empty;
                    txtIpCsum.Text = string.Empty;
                    txtIpFlags.Text = string.Empty;
                    txtIpHlen.Text = string.Empty;
                    txtIpId.Text = string.Empty;
                    txtIpLen.Text = string.Empty;
                    txtIpOff.Text = string.Empty;
                    txtIpProto.Text = string.Empty;
                    txtIpTos.Text = string.Empty;
                    txtIpTtl.Text = string.Empty;
                    txtIpVer.Text = string.Empty;

                    // Signature Tab
                    txtSigCategory.Text = string.Empty;
                    txtSigGenId.Text = string.Empty;
                    txtSigSigRev.Text = string.Empty;
                    txtSigSigId.Text = string.Empty;
                    txtRule.Text = string.Empty;

                    // TCP Tab
                    txtTcpAck.Text = string.Empty;
                    txtTcpCsum.Text = string.Empty;
                    txtTcpDstPort.Text = string.Empty;
                    txtTcpFlags.Text = string.Empty;
                    txtTcpOff.Text = string.Empty;
                    txtTcpRes.Text = string.Empty;
                    txtTcpSeq.Text = string.Empty;
                    txtTcpSrcPrt.Text = string.Empty;
                    txtTcpUrp.Text = string.Empty;
                    txtTcpWin.Text = string.Empty;

                    // UDP Tab
                    txtUdpSrcPort.Text = string.Empty;
                    txtUdpDstPort.Text = string.Empty;
                    txtUdpLen.Text = string.Empty;
                    txtUdpCsum.Text = string.Empty;

                    // References Tab
                    listReferences.ClearObjects();
                    ResizeReferenceListColumns();

                    // Payload Tab (HEX)
                    DynamicByteProvider dynamicByteProvider = new DynamicByteProvider(new byte[] { });
                    hexEvent.ByteProvider = dynamicByteProvider;

                    // Payload Tab (ASCII)
                    txtPayloadAscii.Text = string.Empty;

                    // Acknowledgement Tab
                    txtAckInitials.Text = string.Empty;
                    txtAckClassification.Text = string.Empty;
                    txtAckNotes.Text = string.Empty;
                    txtAckTimestamp.Text = string.Empty;
                    chkAckSuccessful.Checked = false;

                    // Misc Tab
                    txtEventSid.Text = string.Empty;
                    txtEventCid.Text = string.Empty;
                    txtSensor.Text = string.Empty;
                    txtPriority.Text = string.Empty;

                    // DNS Tab
                    txtDns.Text = string.Empty;
                }
            };

            if (this.InvokeRequired == true)
            {
                this.BeginInvoke(methodInvoker);
            }
            else
            {
                methodInvoker.Invoke();
            }
        }
示例#54
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        public void DisplaySelectedEventDetails(Event temp)
        {
            using (new HourGlass(this))
            {
                if (temp.IpProto == (int)Global.Protocols.Tcp)
                {
                    if (tabEvent.TabPages.Contains(tabPageTcpHeader) == false)
                    {
                        tabEvent.TabPages.Insert(2, tabPageTcpHeader);
                    }

                    if (tabEvent.TabPages.Contains(tabPageUdpHeader) == true)
                    {
                        tabEvent.TabPages.Remove(tabPageUdpHeader);
                    }
                }
                else if (temp.IpProto == (int)Global.Protocols.Udp)
                {
                    if (tabEvent.TabPages.Contains(tabPageUdpHeader) == false)
                    {
                        tabEvent.TabPages.Insert(2, tabPageUdpHeader);
                    }

                    if (tabEvent.TabPages.Contains(tabPageTcpHeader) == true)
                    {
                        tabEvent.TabPages.Remove(tabPageTcpHeader);
                    }
                }
                else
                {
                    tabEvent.TabPages.Remove(tabPageTcpHeader);
                    tabEvent.TabPages.Remove(tabPageUdpHeader);
                }

                // DNS Tab
                if (temp.TcpDstPort == 53 || temp.TcpSrcPort == 53 || temp.UdpDstPort == 53 || temp.UdpSrcPort == 53)
                {
                    if (tabEvent.TabPages.Contains(tabPageDns) == false)
                    {
                        tabEvent.TabPages.Insert(tabEvent.TabPages.Count - 2, tabPageDns);
                    }
                } else {
                     tabEvent.TabPages.Remove(tabPageDns);
                }

                // IP Tab
                ipSource.Text = temp.IpSrcTxt.ToString();
                ipDest.Text = temp.IpDstTxt.ToString();
                txtIpCsum.Text = temp.IpCsum.ToString();
                txtIpFlags.Text = temp.IpFlags.ToString();
                txtIpHlen.Text = temp.IpHlen.ToString();
                txtIpId.Text = temp.IpId.ToString();
                txtIpLen.Text = temp.IpLen.ToString();
                txtIpOff.Text = temp.IpOff.ToString();
                txtIpProto.Text = temp.IpProto.ToString();
                txtIpTos.Text = temp.IpTos.ToString();
                txtIpTtl.Text = temp.IpTtl.ToString();
                txtIpVer.Text = temp.IpVer.ToString();

                // Signature Tab
                txtSigCategory.Text = temp.SigClassName;
                txtSigGenId.Text = temp.SigGid.ToString();
                txtSigSigRev.Text = temp.SigRev.ToString();
                txtSigSigId.Text = temp.SigSid.ToString();

                txtRule.Text = temp.Rule;
                if (txtRule.Text.IndexOf("flowbits:isset,", StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    btnLinkedRules.Enabled = true;
                }
                else
                {
                    btnLinkedRules.Enabled = false;
                }

                // TCP Tab
                txtTcpAck.Text = temp.TcpAck.ToString();
                txtTcpCsum.Text = temp.TcpCsum.ToString();
                txtTcpDstPort.Text = temp.TcpDstPort.ToString();
                txtTcpFlags.Text = temp.TcpFlags.ToString();
                txtTcpOff.Text = temp.TcpOff.ToString();
                txtTcpRes.Text = temp.TcpRes.ToString();
                txtTcpSeq.Text = temp.TcpSeq.ToString();
                txtTcpSrcPrt.Text = temp.TcpSrcPort.ToString();
                txtTcpUrp.Text = temp.TcpUrp.ToString();
                txtTcpWin.Text = temp.TcpWin.ToString();

                // UDP Tab
                txtUdpSrcPort.Text = temp.UdpSrcPort.ToString();
                txtUdpDstPort.Text = temp.TcpDstPort.ToString();
                txtUdpLen.Text = temp.UdpLen.ToString();
                txtUdpCsum.Text = temp.UdpCsum.ToString();

                // References Tab
                using (NPoco.Database dbMySql = new NPoco.Database(Db.GetOpenMySqlConnection()))
                {
                    List<Reference> references = dbMySql.Fetch<Reference>(_sql.GetQuery(snorbert.Configs.Sql.Query.SQL_REFERENCES), new object[] { temp.SigId });
                    listReferences.SetObjects(references);
                }

                ResizeReferenceListColumns();

                txtDns.Text = string.Empty;

                // Payload Tab (HEX)
                if (temp.PayloadHex != null)
                {
                    DynamicByteProvider dynamicByteProvider = new DynamicByteProvider(temp.PayloadHex);
                    hexEvent.ByteProvider = dynamicByteProvider;

                    if (temp.TcpDstPort == 53 || temp.TcpSrcPort == 53 || temp.UdpDstPort == 53 || temp.UdpSrcPort == 53)
                    {
                        try
                        {
                            DnsMessage dm = ARSoft.Tools.Net.Dns.DnsMessage.Parse(temp.PayloadHex);
                            if (dm.Questions.Count > 0)
                            {
                                txtDns.Text = "Questions:" + Environment.NewLine;
                                foreach (ARSoft.Tools.Net.Dns.DnsQuestion q in dm.Questions)
                                {
                                    txtDns.Text += q.ToString() + Environment.NewLine;
                                }

                                txtDns.Text += Environment.NewLine;
                            }

                            if (dm.AnswerRecords.Count > 0)
                            {
                                txtDns.Text += "Answers:" + Environment.NewLine;
                                foreach (ARSoft.Tools.Net.Dns.DnsRecordBase r in dm.AnswerRecords)
                                {
                                    txtDns.Text += r.ToString() + Environment.NewLine;
                                }

                                txtDns.Text += Environment.NewLine;
                            }

                            if (dm.AuthorityRecords.Count > 0)
                            {
                                txtDns.Text += "Authority Records:" + Environment.NewLine;
                                foreach (ARSoft.Tools.Net.Dns.DnsRecordBase r in dm.AuthorityRecords)
                                {
                                    txtDns.Text += r.ToString() + Environment.NewLine;
                                }

                                txtDns.Text += Environment.NewLine;
                            }

                            if (dm.AdditionalRecords.Count > 0)
                            {
                                txtDns.Text += "AdditionalRecords:" + Environment.NewLine;
                                foreach (ARSoft.Tools.Net.Dns.DnsRecordBase r in dm.AdditionalRecords)
                                {
                                    txtDns.Text += r.ToString() + Environment.NewLine;
                                }
                            }
                        }
                        catch (Exception ex){}
                    }
                }
                else
                {
                    DynamicByteProvider dynamicByteProvider = new DynamicByteProvider(new byte[] { });
                    hexEvent.ByteProvider = dynamicByteProvider;
                }

                // Payload Tab (ASCII)
                txtPayloadAscii.Text = temp.PayloadAscii;

                // Misc Tab
                txtEventSid.Text = temp.Sid.ToString();
                txtEventCid.Text = temp.Cid.ToString();
                txtSensor.Text = temp.SensorName;
                txtPriority.Text = temp.SigPriority.ToString();

                // Acknowledgement Tab
                using (NPoco.Database dbMySql = new NPoco.Database(Db.GetOpenMySqlConnection()))
                {
                    string query = _sql.GetQuery(snorbert.Configs.Sql.Query.SQL_ACKNOWLEDGEMENT_DETAILS);
                    query = query.Replace("#WHERE#", @"WHERE acknowledgment.id = @0");

                    List<Acknowledgment> acknowledgment = dbMySql.Fetch<Acknowledgment>(query, new object[] { temp.AcknowledgmentId });
                    if (acknowledgment.Any())
                    {
                        txtAckInitials.Text = acknowledgment.First().Initials;
                        txtAckClassification.Text = acknowledgment.First().Description;
                        txtAckNotes.Text = acknowledgment.First().Notes;
                        txtAckTimestamp.Text = acknowledgment.First().Timestamp.ToString();
                        chkAckSuccessful.Checked = acknowledgment.First().Successful;
                    }
                }
            }
        }
示例#55
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="session"></param>
        private void LoadSession(Session session)
        {
            (new Thread(() =>
            {
                MethodInvoker methodInvoker = delegate
                {
                    try
                    {
                        using (new HourGlass(this))
                        {
                            if (session == null)
                            {
                                UserInterface.DisplayErrorMessageBox(this, "Unable to locate session");
                                return;
                            }

                            string filePath = System.IO.Path.Combine(this.dataDirectory, session.Guid.Substring(0, 2), session.Guid + ".bin");

                            if (File.Exists(filePath) == false)
                            {
                                UserInterface.DisplayErrorMessageBox(this, "Session data file does not exist: " + filePath);
                                return;
                            }

                            byte[] temp = File.ReadAllBytes(filePath);
                            DynamicByteProvider dynamicByteProvider = new DynamicByteProvider(temp);
                            hexBox.ByteProvider = dynamicByteProvider;

                            temp = woanware.Text.ReplaceNulls(temp);

                            FileInfo fileInfo = new FileInfo(filePath);

                            // Colourised (HTML)
                            if (fileInfo.AlternateDataStreamExists("html") == true)
                            {
                                AlternateDataStreamInfo ads = fileInfo.GetAlternateDataStream("html", FileMode.Open);
                                using (TextReader reader = ads.OpenText())
                                {
                                    webControl.DocumentText = reader.ReadToEnd();
                                }
                            }
                            else
                            {
                                webControl.DocumentText = string.Empty;
                            }

                            // ASCII
                            if (fileInfo.AlternateDataStreamExists("txt") == true)
                            {
                                AlternateDataStreamInfo ads = fileInfo.GetAlternateDataStream("txt", FileMode.Open);
                                using (TextReader reader = ads.OpenText())
                                {
                                    txtSession.Text = reader.ReadToEnd();
                                    txtSession.ScrollToTop();
                                }
                            }
                            else
                            {
                                txtSession.Text = ASCIIEncoding.ASCII.GetString(temp);
                                txtSession.ScrollToTop();
                            }

                            // Info
                            if (fileInfo.AlternateDataStreamExists("info") == true)
                            {
                                AlternateDataStreamInfo ads = fileInfo.GetAlternateDataStream("info", FileMode.Open);
                                using (TextReader reader = ads.OpenText())
                                {
                                    txtInfo.Text = reader.ReadToEnd();
                                    txtInfo.ScrollToTop();
                                }
                            }
                            else
                            {
                                txtInfo.Text = string.Empty;
                                txtInfo.ScrollToTop();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        this.Log().Error(ex.ToString());
                    }
                };

                if (this.InvokeRequired == true)
                {
                    this.BeginInvoke(methodInvoker);
                }
                else
                {
                    methodInvoker.Invoke();
                }

            })).Start();
        }
示例#56
0
        private void FormIFFEditorReplace_Shown(object sender, EventArgs e)
        {
            if (this.tabControl.SelectedTab == this.tabPageString) {
            this.textBoxFindWhat.Focus();
            if (this.m_FormIFFILFWSEditor.hexBoxIff.SelectionLength > 0) {
              Byte[] tempBytes = new Byte[this.m_FormIFFILFWSEditor.hexBoxIff.SelectionLength];
              for (Int32 counter = 0; counter < this.m_FormIFFILFWSEditor.hexBoxIff.SelectionLength; counter++) {
            tempBytes[counter] = this.m_FormIFFILFWSEditor.m_DynamicByteProviderIFF.Bytes[(Int32)(this.m_FormIFFILFWSEditor.hexBoxIff.SelectionStart + counter)];
              }
              this.dynamicByteProviderFindWhat = new DynamicByteProvider(tempBytes);
              this.hexBoxFindWhat.ByteProvider = this.dynamicByteProviderFindWhat;
              this.textBoxFindWhat.Text = new String(Encoding.ASCII.GetChars(tempBytes));

              this.hexBoxFindWhat.Select(0, this.dynamicByteProviderFindWhat.Length);
              this.textBoxFindWhat.Select(0, this.textBoxFindWhat.Text.Length);
            } else {
              if ((this.dynamicByteProviderFindWhat != null) && (this.dynamicByteProviderFindWhat.Length > 0)) {
            this.hexBoxFindWhat.Select(0, this.dynamicByteProviderFindWhat.Length);
              }
              if ((this.textBoxFindWhat.Text != String.Empty) && (this.textBoxFindWhat.Text.Length > 0)) {
            this.textBoxFindWhat.Select(0, this.textBoxFindWhat.Text.Length);
              }
            }
              } else if (this.tabControl.SelectedTab == this.tabPageHexadecimal) {
            this.hexBoxFindWhat.Focus();
            if (this.m_FormIFFILFWSEditor.hexBoxIff.SelectionLength > 0) {
              Byte[] tempBytes = new Byte[this.m_FormIFFILFWSEditor.hexBoxIff.SelectionLength];
              for (Int32 counter = 0; counter < this.m_FormIFFILFWSEditor.hexBoxIff.SelectionLength; counter++) {
            tempBytes[counter] = this.m_FormIFFILFWSEditor.m_DynamicByteProviderIFF.Bytes[(Int32)(this.m_FormIFFILFWSEditor.hexBoxIff.SelectionStart + counter)];
              }
              this.dynamicByteProviderFindWhat = new DynamicByteProvider(tempBytes);
              this.hexBoxFindWhat.ByteProvider = this.dynamicByteProviderFindWhat;
              this.textBoxFindWhat.Text = new String(Encoding.ASCII.GetChars(tempBytes));

              this.hexBoxFindWhat.Select(0, this.dynamicByteProviderFindWhat.Length);
              this.textBoxFindWhat.Select(0, this.textBoxFindWhat.Text.Length);
            } else {
              if ((this.dynamicByteProviderFindWhat != null) && (this.dynamicByteProviderFindWhat.Length > 0)) {
            this.hexBoxFindWhat.Select(0, this.dynamicByteProviderFindWhat.Length);
              }
              if ((this.textBoxFindWhat.Text != String.Empty) && (this.textBoxFindWhat.Text.Length > 0)) {
            this.textBoxFindWhat.Select(0, this.textBoxFindWhat.Text.Length);
              }
            }
              }
              this.m_FormIFFILFWSEditor.m_SearchAllNodes = (this.comboBoxSearchIn.Text == "All Nodes");
              this.m_FormIFFILFWSEditor.m_CaseInsensitive = ((this.tabControl.SelectedTab == this.tabPageString) ? !this.checkBoxMatchCase.Checked : false);
        }
示例#57
0
            public override void SetRawData (byte[] data)
            {
                _byteProvider = new DynamicByteProvider(data);
                _byteProvider.Changed += (o, e2) => { OnModified(); };

                _hexBox.ByteProvider = _byteProvider;
            }
示例#58
0
        private void treeViewIff_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (this.m_ILFFile != null) {
            if (e.Node.Tag != null) {
              ILFFile.ILFNode ilfChunk = this.m_ILFFile.Nodes[e.Node.Index];

              this.labelIlfCell.Visible = true;
              this.labelIlfObject.Visible = true;
              this.groupBoxIlfCoordinates.Visible = true;
              this.groupBoxIlfRotation.Visible = true;
              this.textBoxIlfCell.Visible = true;
              this.textBoxIlfObject.Visible = true;

              this.textBoxIlfObject.Text = ilfChunk.Object;
              this.textBoxIlfCell.Text = ilfChunk.Cell;
              this.numericUpDownIlfM11.Value = (Decimal)ilfChunk.RotationMatrix[0][0];
              this.numericUpDownIlfM12.Value = (Decimal)ilfChunk.RotationMatrix[0][1];
              this.numericUpDownIlfM13.Value = (Decimal)ilfChunk.RotationMatrix[0][2];
              this.numericUpDownIlfW1.Value = (Decimal)ilfChunk.W1;
              this.numericUpDownIlfM21.Value = (Decimal)ilfChunk.RotationMatrix[1][0];
              this.numericUpDownIlfM22.Value = (Decimal)ilfChunk.RotationMatrix[1][1];
              this.numericUpDownIlfM23.Value = (Decimal)ilfChunk.RotationMatrix[1][2];
              this.numericUpDownIlfW2.Value = (Decimal)ilfChunk.W2;
              this.numericUpDownIlfM31.Value = (Decimal)ilfChunk.RotationMatrix[2][0];
              this.numericUpDownIlfM32.Value = (Decimal)ilfChunk.RotationMatrix[2][1];
              this.numericUpDownIlfM33.Value = (Decimal)ilfChunk.RotationMatrix[2][2];
              this.numericUpDownIlfW3.Value = (Decimal)ilfChunk.W3;

              UpdateIlfAngles(ilfChunk.RotationMatrix);
            } else {
              this.labelIlfCell.Visible = false;
              this.labelIlfObject.Visible = false;
              this.groupBoxIlfCoordinates.Visible = false;
              this.groupBoxIlfRotation.Visible = false;
              this.textBoxIlfCell.Visible = false;
              this.textBoxIlfObject.Visible = false;
            }
              } else if (this.m_WSFile != null) {
            if ((e.Node != null) && (e.Node.Name != "WSNPFORM") && (e.Node.Name != String.Empty) && (e.Node.Name != null)) {
              WSFile.WSNode wsNode = this.m_WSFile.FindNodeByID(Int32.Parse(e.Node.Name));
              this.labelWsID.Visible = true;
              this.labelWsObject.Visible = true;
              this.labelWsoW.Visible = true;
              this.labelWsoX.Visible = true;
              this.labelWsoY.Visible = true;
              this.labelWsoZ.Visible = true;
              this.labelWsParent.Visible = true;
              this.labelWsScale.Visible = true;
              this.labelWsType.Visible = true;
              this.labelWsPOBCRC.Visible = true;
              this.labelWsX.Visible = true;
              this.labelWsY.Visible = true;
              this.labelWsZ.Visible = true;
              this.numericUpDownWsID.Visible = true;
              this.comboBoxWsObject.Visible = true;
              this.numericUpDownWsoW.Visible = true;
              this.numericUpDownWsoX.Visible = true;
              this.numericUpDownWsoY.Visible = true;
              this.numericUpDownWsoZ.Visible = true;
              this.numericUpDownWsParent.Visible = true;
              this.numericUpDownWsScale.Visible = true;
              this.numericUpDownWsType.Visible = true;
              this.hexBoxWsPOBCRC.Visible = true;
              this.numericUpDownWsX.Visible = true;
              this.numericUpDownWsY.Visible = true;
              this.numericUpDownWsZ.Visible = true;

              this.numericUpDownWsID.Value = wsNode.ID;
              this.comboBoxWsObject.SelectedIndex = wsNode.ObjectIndex;
              this.numericUpDownWsoW.Value = (Decimal)wsNode.oW;
              this.numericUpDownWsoX.Value = (Decimal)wsNode.oX;
              this.numericUpDownWsoY.Value = (Decimal)wsNode.oY;
              this.numericUpDownWsoZ.Value = (Decimal)wsNode.oZ;
              this.numericUpDownWsParent.Value = wsNode.ParentID;
              this.numericUpDownWsScale.Value = (Decimal)wsNode.Scale;
              this.numericUpDownWsType.Value = (Decimal)wsNode.Type;
              this.numericUpDownWsX.Value = (Decimal)wsNode.X;
              this.numericUpDownWsY.Value = (Decimal)wsNode.Y;
              this.numericUpDownWsZ.Value = (Decimal)wsNode.Z;
              try {
            this.m_DynamicByteProviderWS.Changed -= new EventHandler(m_DynamicByteProviderWS_Changed);
              } catch {
              }
              this.m_DynamicByteProviderWS = new DynamicByteProvider(wsNode.POBCRC);
              this.m_DynamicByteProviderWS.Changed += new EventHandler(m_DynamicByteProviderWS_Changed);
              this.hexBoxWsPOBCRC.ByteProvider = this.m_DynamicByteProviderWS;
            } else {
              this.labelWsID.Visible = false;
              this.labelWsObject.Visible = false;
              this.labelWsoW.Visible = false;
              this.labelWsoX.Visible = false;
              this.labelWsoY.Visible = false;
              this.labelWsoZ.Visible = false;
              this.labelWsParent.Visible = false;
              this.labelWsScale.Visible = false;
              this.labelWsType.Visible = false;
              this.labelWsPOBCRC.Visible = false;
              this.labelWsX.Visible = false;
              this.labelWsY.Visible = false;
              this.labelWsZ.Visible = false;
              this.numericUpDownWsID.Visible = false;
              this.comboBoxWsObject.Visible = false;
              this.numericUpDownWsoW.Visible = false;
              this.numericUpDownWsoX.Visible = false;
              this.numericUpDownWsoY.Visible = false;
              this.numericUpDownWsoZ.Visible = false;
              this.numericUpDownWsParent.Visible = false;
              this.numericUpDownWsScale.Visible = false;
              this.numericUpDownWsType.Visible = false;
              this.hexBoxWsPOBCRC.Visible = false;
              this.numericUpDownWsX.Visible = false;
              this.numericUpDownWsY.Visible = false;
              this.numericUpDownWsZ.Visible = false;
            }
              } else if (this.m_IFFFile != null) {
            IFFFile.IFFNode iffNode = FindIFFNode(e.Node);
            if ((!iffNode.ID.Contains("FORM")) && (iffNode.Data != null)) {
              try {
            this.m_DynamicByteProviderIFF.Changed -= new EventHandler(m_DynamicByteProviderIFF_Changed);
              } catch {
              }

              this.m_DynamicByteProviderIFF = new DynamicByteProvider(iffNode.Data);
              this.m_DynamicByteProviderIFF.Changed += new EventHandler(m_DynamicByteProviderIFF_Changed);
              this.hexBoxIff.ByteProvider = this.m_DynamicByteProviderIFF;

            } else {
              this.hexBoxIff.ByteProvider = null;
              this.m_DynamicByteProviderIFF = null;
            }
              }
        }
示例#59
0
        internal void IFFLoadFile(String filename)
        {
            this.treeViewIff.ContextMenuStrip = null;

              if (filename.ToLower().EndsWith(".ilf")) {
            this.ILFLoadFile(filename);
            return;
              }

              if (filename.ToLower().EndsWith(".ws")) {
            this.WSLoadFile(filename);
            return;
              }

              this.m_ILFFile = null;
              this.m_WSFile = null;

              try {
            try {
              this.m_IFFFile = new IFFFile(filename);
            } catch (Exception exception) {
              MessageBox.Show(exception.Message, "TRE Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error);
              this.Visible = false;
              return;
            }

            try {
              this.HasChangesChanged -= new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged);
            } catch {
            }

            if ((this.m_IFFFile != null) && (this.m_IFFFile.Filename != null) && (this.m_IFFFile.Filename != String.Empty)) {
              if (!this.m_IFFFile.Filename.Contains("\\")) {
            this.m_IFFFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_IFFFile.Filename);
              } else if (this.m_IFFFile.Filename.StartsWith(Path.GetTempPath())) {
            this.m_IFFFile.Filename = Path.Combine(this.m_FormNotifyIcon.saveFileDialog.InitialDirectory, this.m_IFFFile.Filename.Substring(Path.GetTempPath().Length));
              }
            }

            this.splitContainerIff.Visible = false;
            this.dataGridViewIff.Visible = false;
            this.panelIlf.Visible = false;
            this.panelWs.Visible = false;
            this.hexBoxIff.Visible = false;
            this.m_ILFFile = null;
            this.hexBoxIff.ByteProvider = null;
            this.m_DynamicByteProviderIFF = null;
            this.toolStripSeparator3.Visible = false;
            this.toolStripTextBoxSearch.Visible = false;
            this.toolStripButtonSearch.Visible = false;

            if (this.m_IFFFile.IsDataTable) {
              this.dataGridViewIff.DataSource = this.m_IFFFile.DataTable;
              this.dataGridViewIff.Visible = true;
            } else {
              this.treeViewIff.ContextMenuStrip = this.contextMenuStripTreeViewIFF;

              this.treeViewIff.Nodes.Clear();
              IFFRecurseNode(this.m_IFFFile.Node, CreateIFFNode(this.m_IFFFile.Node));

              this.splitContainerIff.Visible = true;
              this.hexBoxIff.Visible = true;

              this.treeViewIff.SelectedNode = this.treeViewIff.Nodes[0];
            }

            this.toolStripButtonIffSaveAs.Enabled = true;

            this.HasChanges = false;
            this.HasChangesChanged += new HasChangesChangedEvent(FormIFFILFWSEditor_HasChangesChanged);

            this.Focus();
              } catch (Exception exception) {
            MessageBox.Show(exception.Message, "TRE Explorer", MessageBoxButtons.OK, MessageBoxIcon.Error);
            this.Visible = false;
              }
        }
示例#60
0
        protected override void OnVisibleChanged(EventArgs e)
        {
            base.OnVisibleChanged(e);

              if (!this.Visible) {
            this.m_IFFFile = null;
            this.dataGridViewIff.DataSource = null;
            this.m_ILFFile = null;
            this.m_WSFile = null;
            if (this.m_DynamicByteProviderWS != null) {
              this.m_DynamicByteProviderWS = null;
            }
            if (this.m_DynamicByteProviderIFF != null) {
              this.m_DynamicByteProviderIFF = null;
            }
            this.treeViewIff.Nodes.Clear();
            this.toolStripButtonIffSave.Enabled = false;
            this.toolStripButtonIffSaveAs.Enabled = false;
              } else {
            this.hexBoxIff_Resize(this.hexBoxIff, new EventArgs());
              }
        }