Skip to content

Commit

Permalink
Merge pull request #165 from simplitech/hotfix-blackscreen
Browse files Browse the repository at this point in the history
Hotfix blackscreen
  • Loading branch information
Relfos authored Feb 28, 2019
2 parents b69bb8f + c157b3b commit 5c6407d
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 29 deletions.
12 changes: 6 additions & 6 deletions Neo-Development-Tools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo-Debugger-UI-UnitTests",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo-Compiler-UnitTests", "Neo-Compiler-UnitTests\Neo-Compiler-UnitTests.csproj", "{7DF48471-B900-421A-8ECF-F48274C5F8C4}"
EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "neo-gui-development", "Neo-GUI-Developer\neo-gui-development.csproj", "{8EEDDBC9-EF27-487C-9EAA-650C624307C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo-Compiler-Lib", "Neo-Compiler-Lib\Neo-Compiler-Lib.csproj", "{5DF60A44-42C0-4E64-9290-58F997E609B2}"
EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "neo-gui-development", "Neo-GUI-Developer\neo-gui-development.csproj", "{58D3AD7F-32E0-42FE-B6AE-2CD64F3F2BF4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -96,14 +96,14 @@ Global
{7DF48471-B900-421A-8ECF-F48274C5F8C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DF48471-B900-421A-8ECF-F48274C5F8C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DF48471-B900-421A-8ECF-F48274C5F8C4}.Release|Any CPU.Build.0 = Release|Any CPU
{8EEDDBC9-EF27-487C-9EAA-650C624307C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8EEDDBC9-EF27-487C-9EAA-650C624307C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EEDDBC9-EF27-487C-9EAA-650C624307C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EEDDBC9-EF27-487C-9EAA-650C624307C0}.Release|Any CPU.Build.0 = Release|Any CPU
{5DF60A44-42C0-4E64-9290-58F997E609B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DF60A44-42C0-4E64-9290-58F997E609B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DF60A44-42C0-4E64-9290-58F997E609B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DF60A44-42C0-4E64-9290-58F997E609B2}.Release|Any CPU.Build.0 = Release|Any CPU
{58D3AD7F-32E0-42FE-B6AE-2CD64F3F2BF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58D3AD7F-32E0-42FE-B6AE-2CD64F3F2BF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58D3AD7F-32E0-42FE-B6AE-2CD64F3F2BF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58D3AD7F-32E0-42FE-B6AE-2CD64F3F2BF4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 4 additions & 3 deletions NeoDebuggerUI/NeoDebuggerUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
<EmbeddedResource Include="Assets\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.7.0" />
<PackageReference Include="Avalonia" Version="0.7.1-cibuild0001534-beta" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="0.7.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.7.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.7.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.7.1-cibuild0001534-beta" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.7.1-cibuild0001534-beta" />
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
<PackageReference Include="System.Reactive" Version="4.1.2" />
<PackageReference Include="System.Reactive.Interfaces" Version="4.1.2" />
<PackageReference Include="Avalonia.Native" Version="0.7.1-cibuild0001534-beta" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
Expand Down
5 changes: 3 additions & 2 deletions NeoDebuggerUI/ViewModels/InvokeWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading.Tasks;
using Neo.VM;
using System.Collections.Generic;
using Avalonia.Controls;

namespace NeoDebuggerUI.ViewModels
{
Expand Down Expand Up @@ -71,11 +72,11 @@ public void Run()

if (result != null)
{
OpenGenericSampleDialog("Execution finished.\nGAS cost: " + DebuggerStore.instance.UsedGasCost + "\nResult: " + result.GetString(), "OK", "", false);
OpenGenericSampleDialog("Execution finished.\nGAS cost: " + DebuggerStore.instance.UsedGasCost + "\nResult: " + result.GetString(), "OK", "", false, new Window());
}
else
{
OpenGenericSampleDialog(errorMessage, "Error", "", false);
OpenGenericSampleDialog(errorMessage, "Error", "", false, new Window());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions NeoDebuggerUI/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public async Task Open()
dialog.Filters = filters;
dialog.AllowMultiple = false;

var result = await dialog.ShowAsync();
var result = await dialog.ShowAsync(new Window());

if (result != null && result.Length > 0)
{
Expand All @@ -161,7 +161,7 @@ public async Task OpenRunDialog()
{
CompileCurrentFile();
var modalWindow = new InvokeWindow();
var task = modalWindow.ShowDialog();
var task = modalWindow.ShowDialog(new Window());
await Task.Run(()=> task.Wait());

ConsumedGas = DebuggerStore.instance.UsedGasCost;
Expand Down
5 changes: 3 additions & 2 deletions NeoDebuggerUI/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using Avalonia.Controls;
using NeoDebuggerUI.Views;
using ReactiveUI;

namespace NeoDebuggerUI.ViewModels
{
public class ViewModelBase : ReactiveObject
{
public async void OpenGenericSampleDialog(String text, String okText, String cancelText, bool showCancel)
public async void OpenGenericSampleDialog(String text, String okText, String cancelText, bool showCancel, Window owner)
{
var clickedOk = await new GenericConfirmationWindow()
.SetText(text)
.SetOkText(okText)
.SetCancelText(cancelText)
.ShowCancel(showCancel)
.Open();
.Open(owner);

var wasOk = clickedOk;
}
Expand Down
5 changes: 3 additions & 2 deletions NeoDebuggerUI/Views/GenericConfirmationWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using NeoDebuggerUI.ViewModels;

Expand Down Expand Up @@ -45,9 +46,9 @@ public GenericConfirmationWindow ShowCancel(bool show)
return this;
}

public async Task<bool> Open()
public async Task<bool> Open(Window owner)
{
var task = ShowDialog();
var task = ShowDialog(owner);
await Task.Run(()=> task.Wait());
return ViewModel.ClickedOk == true;
}
Expand Down
3 changes: 2 additions & 1 deletion NeoDebuggerUI/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public MainWindow()

this.ViewModel.EvtFileChanged += (fileName) => LoadFile(fileName);
this.ViewModel.EvtFileToCompileChanged += () => ViewModel.SaveCurrentFileWithContent(_textEditor.Text);
this.Activated += (o, e) => { ReloadCurrentFile(); };
this.Activated += (o, e) => { ReloadCurrentFile(); };

}

public async Task NewCSharpFile()
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<img
src="http://res.cloudinary.com/vidsy/image/upload/v1503160820/CoZ_Icon_DARKBLUE_200x178px_oq0gxm.png"
<img
src="http://res.cloudinary.com/vidsy/image/upload/v1503160820/CoZ_Icon_DARKBLUE_200x178px_oq0gxm.png"
width="125px"
>
</p>
Expand All @@ -23,6 +23,9 @@
A suite of development tools for NEO smart contracts.
Includes a cli disassembler and a GUI debugger. A helper library that helps loading `.avm` files and create and load `.neomap` files is also included, and can be used to create other dev tools.

#### Migration in progress
We are adding cross platform support to this project. You need to add Avalonia NuGet repository in order to use this project: https://github.com/AvaloniaUI/Avalonia/wiki/Using-nightly-build-feed

(click picture to view video)

[![IntroductionVideo](images/debugger.png)](https://youtu.be/KnPHIaEsgtA "Introduction video")
Expand All @@ -34,10 +37,10 @@ Includes a cli disassembler and a GUI debugger. A helper library that helps load
3. The debugger IDE can also run or step through either the assembly code or the original source (if the `.debug.json` file is present in same directory as the `.avm`)
4. The debugger will also emulate the smart contracts' API that interacts with the Blockchain (like Storage, Transactions, Blocks)

### Setup
### Setup
1. Get this code and open the solution in Visual Studio.
2. Compile the solution and find the compiled NEON.exe path (should be in $(SolutionPath)\NEO-Compiler\bin\Debug).
3. Replace the path of your old NEON compiler to the new compiler path.
3. Replace the path of your old NEON compiler to the new compiler path.
4. When you compile a smart contract, it will accordingly use the debugger compiler and produce (next to the`.avm`) the map file which you need to step through the code.

### Current Features
Expand Down Expand Up @@ -76,7 +79,7 @@ Currently the only way to generate a `.neomap` file is to compile the smart cont

A single smart contract can have different results and behaviours, depending on the inputs passed to it.

So, when debugging a contract, it is necessary to be able to know what methods are supported and specify the inputs for them.
So, when debugging a contract, it is necessary to be able to know what methods are supported and specify the inputs for them.

Currently this is done via a `.abi.json` file that resides in the same folder as the debugger executable (should generated automatically by the compiler, but can also be hand-written if necessary).

Expand Down Expand Up @@ -166,7 +169,7 @@ Here's a example of how to specify test cases.

### Storage Emulation

The debugger supports emulation of the Storage API, meaning Storage.Put and Storage.Get work fine when debugging.
The debugger supports emulation of the Storage API, meaning Storage.Put and Storage.Get work fine when debugging.

The actual data is stored in a file with extension `.store`, in same folder as the `.avm`. If required to reset the smart contract storage, it's fine to delete this file.

Expand All @@ -181,7 +184,7 @@ The current version does support sending virtual NEO and GAS to the smart contra
## Supported Programming Languages

NEO smart contracts can be coded in many different languages, and in theory, this compiler already supports any language as long as a `.neomap` file exists in the same directory as the `.avm` file.
However, in order to be able to debug an compiled `.avm` file, the compiler used must be able to emit those map files during compilation.
However, in order to be able to debug an compiled `.avm` file, the compiler used must be able to emit those map files during compilation.
The table below lists the current supported languages / compilers.

| Language | Compiler | Comments |
Expand Down Expand Up @@ -240,7 +243,7 @@ The `.neomap` file format is `json` and consists of a `compiler` section that in

### Developer Shell

A developer shell is also included and can be used to emulate and debug NEO smart contracts from the terminal.
A developer shell is also included and can be used to emulate and debug NEO smart contracts from the terminal.

The smart contract inputs should also be passed as a JSON string, same as in the debugger GUI.

Expand All @@ -250,7 +253,7 @@ If using Linux or OSX, [Mono](http://www.mono-project.com/) is required.

## Unit testing

The NEO emulator library makes it easy to create your own unit tests for smart contracts.
The NEO emulator library makes it easy to create your own unit tests for smart contracts.

### Install

Expand All @@ -270,7 +273,7 @@ using NUnit.Framework;
[TestFixture]
public class ContractTests
{
private static NeoEmulator emulator;
private static NeoEmulator emulator;

// load the .avm file before tests run
[OneTimeSetUp]
Expand Down Expand Up @@ -308,7 +311,7 @@ public class ContractTests

## Demo Project

In the folder ICO Template you can find an example of a complex `.json` input file.
In the folder ICO Template you can find an example of a complex `.json` input file.

Included is also a small project to demonstrate unit tests of the demo project.

Expand Down

0 comments on commit 5c6407d

Please sign in to comment.