private void Button_Click(object sender, RoutedEventArgs e) { //加载avm Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); ofd.Title = "open [TXID].Avm that builded by neondebug."; ofd.Filter = "*.avm|*.avm"; if (ofd.ShowDialog() == true) { this.buildResult = new Result(); var path = System.IO.Path.GetDirectoryName(ofd.FileName); var hash = System.IO.Path.GetFileNameWithoutExtension(ofd.FileName); this.buildResult.script_hash = hash; this.buildResult.avm = System.IO.File.ReadAllBytes(ofd.FileName); var debuginfopath = System.IO.Path.Combine(path, hash + ".map.json"); if (System.IO.File.Exists(debuginfopath) == false) { MessageBox.Show("cannot find:" + debuginfopath); return; } this.buildResult.debuginfo = System.IO.File.ReadAllText(debuginfopath); var srcpath = System.IO.Path.Combine(path, hash + ".cs"); if (System.IO.File.Exists(srcpath) == false) { MessageBox.Show("cannot find:" + srcpath); return; } this.buildResult.source = System.IO.File.ReadAllText(srcpath); this.debugInfo = ThinNeo.Debug.Helper.AddrMap.FromJsonStr(this.buildResult.debuginfo); this.codeEdit.Text = this.buildResult.source; this.textHexScript.Text = Bytes2HexString(this.buildResult.avm); updateASM(this.buildResult.avm); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { MyJson.JsonNode_Object result = ApiHelper.downloadScript(textAPI.Text, "tempScript", textHash.Text); if (result == null) { MessageBox.Show("下载错误"); return; } var hash = result["hash"].AsString(); string path = "tempScript"; this.buildResult = new Result(); this.buildResult.script_hash = hash; var avmpath = System.IO.Path.Combine("tempScript", hash + ".avm"); this.buildResult.avm = System.IO.File.ReadAllBytes(avmpath); var debuginfopath = System.IO.Path.Combine(path, hash + ".map.json"); if (System.IO.File.Exists(debuginfopath) == false) { MessageBox.Show("cannot find:" + debuginfopath); return; } this.buildResult.debuginfo = System.IO.File.ReadAllText(debuginfopath); var srcpath = System.IO.Path.Combine(path, hash + ".cs"); if (System.IO.File.Exists(srcpath) == false) { MessageBox.Show("cannot find:" + srcpath); return; } this.buildResult.source = System.IO.File.ReadAllText(srcpath); this.debugInfo = ThinNeo.Debug.Helper.AddrMap.FromJsonStr(this.buildResult.debuginfo); this.codeEdit.Text = this.buildResult.source; this.textHexScript.Text = Bytes2HexString(this.buildResult.avm); updateASM(this.buildResult.avm); }