Skip to content

Commit

Permalink
Replaced Doxygen with DocFX
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Jan 13, 2022
1 parent c2dd5d8 commit 62fc912
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 57 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
/src/_ReSharper.*/
/src/*/obj/
/src/*/bin/
/doc/*.tag
/doc/obj/
/doc/api/

# Output
/artifacts/
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ pushd $PSScriptRoot

src\build.ps1 $Version
src\test.ps1
doc\build.ps1 $Version
doc\build.ps1

popd
25 changes: 0 additions & 25 deletions doc/Doxyfile

This file was deleted.

13 changes: 2 additions & 11 deletions doc/build.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
Param ($Version = "1.0-dev")
$ErrorActionPreference = "Stop"
$ErrorActionPreference = "Stop"
pushd $PSScriptRoot

echo "Downloading references to other documentation..."
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls11,Tls12'
Invoke-WebRequest https://common.nano-byte.net/nanobyte-common.tag -OutFile nanobyte-common.tag

if (Test-Path ..\artifacts\Documentation) {rm -Recurse -Force ..\artifacts\Documentation}
mkdir ..\artifacts\Documentation | Out-Null

$env:VERSION = $Version
..\0install.ps1 run --batch https://apps.0install.net/devel/doxygen.xml
..\0install.ps1 run --batch https://apps.0install.net/dotnet/docfx.xml --loglevel=warning --warningsAsErrors docfx.json
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}

popd
55 changes: 55 additions & 0 deletions doc/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"metadata": [
{
"src": [
{
"src": "../artifacts/Release/net6.0-windows",
"files": [
"NanoByte.StructureEditor*.dll"
]
}
],
"dest": "api"
}
],
"build": {
"globalMetadata": {
"_baseUrl": "https://structure-editor.nano-byte.net/",
"_appTitle": "NanoByte Structure Editor",
"_appFooter": "Copyright Bastian Eicher",
"_disableBreadcrumb": true,
"_enableNewTab": true
},
"content": [
{
"files": [
"*.md",
"toc.yml",
"api/*.yml"
]
}
],
"resource": [
{
"files": [
"*.png"
]
}
],
"overwrite": [
{
"src": "../src/",
"files": [
"**/*.md"
]
}
],
"xref": [
"https://common.nano-byte.net/xrefmap.yml"
],
"xrefService": [
"https://xref.docs.microsoft.com/query?uid={uid}"
],
"dest": "../artifacts/Documentation"
}
}
34 changes: 19 additions & 15 deletions doc/main.md → doc/index.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
---
title: Home
---

# NanoByte Structure Editor

NanoByte Structure Editor is a WinForms library that helps you build split-screen editors for your data structures, consisting of:

1. a collapsible tree-view of the data structure,
2. a graphical editor for the currently selected node in the tree (`PropertyGrid` or custom) and
2. a graphical editor for the currently selected node in the tree (<xref:System.Windows.Forms.PropertyGrid> or custom) and
3. a text editor (based on [ICSharpCode.TextEditor](https://github.com/nano-byte/ICSharpCode.TextEditor)) with a serialized (XML) representation of the currently selected node.

This allows you to create an IDE-like experience for your users when editing complex domain specific languages, configuration files, etc..

\image html screenshot.png

[**GitHub repository**](https://github.com/nano-byte/structure-editor)
![](screenshot.png)

## Usage

Add a reference to the [NanoByte.StructureEditor.WinForms](https://www.nuget.org/packages/NanoByte.StructureEditor.WinForms/) NuGet package to your project. It is available for .NET Framework 2.0+.

### Initialization

Create an instance of \ref NanoByte.StructureEditor.WinForms.StructureEditor "StructureEditor<T>" and add it to your Form:
```{.cs}
Create an instance of <xref:NanoByte.StructureEditor.WinForms.StructureEditor`1> and add it to your Form:
```csharp
var editor = new StructureEditor<MyData>();
Controls.Add(editor);
```

Alternatively, you may want to derive your own class from \ref NanoByte.StructureEditor.WinForms.StructureEditor "StructureEditor<T>". This will allow you to use the graphical WinForms designer in Visual Studio (which does not support generic types) to place the Editor on your Form.
```{.cs}
Alternatively, you may want to derive your own class from <xref:NanoByte.StructureEditor.WinForms.StructureEditor`1>. This will allow you to use the graphical WinForms designer in Visual Studio (which does not support generic types) to place the Editor on your Form.
```csharp
public class MyDataEditor : StructureEditor<MyData>
{}
```

You need to "describe" your data structure to the Editor. You can do this directly after instantiating the editor or in the constructor of your derived class.
- Call \ref NanoByte.StructureEditor.IStructureEditor.DescribeRoot "DescribeRoot()" and then use the fluent API provided as a return value to describe the properties on your main data type.
- Call \ref NanoByte.StructureEditor.IStructureEditor.Describe<TContainer> "Describe<TContainer>()" to describe the properties on a data type `TContainer` exposed by another property. You can use multiple calls with different type parameters to describe arbitrarily deep hierarchies.
- Call [DescribeRoot()](xref:NanoByte.StructureEditor.IStructureEditor`1#NanoByte_StructureEditor_IStructureEditor_1_DescribeRoot_System_String_) and then use the fluent API provided as a return value to describe the properties on your main data type.
- Call [Describe<TContainer>()](xref:NanoByte.StructureEditor.IStructureEditor`1#NanoByte_StructureEditor_IStructureEditor_1_Describe__1) to describe the properties on a data type `TContainer` exposed by another property. You can use multiple calls with different type parameters to describe arbitrarily deep hierarchies.

The fluent API provides the following methods:
- `.AddProperty()` describes a simple value property.
Expand All @@ -39,7 +43,7 @@ The fluent API provides the following methods:

There are numerous overloads for each of these methods, e.g., allowing you to specify a custom editor control for a data type or to keep the auto-generated one.

```{.cs}
```csharp
editor.DescribeRoot("Address Book")
.AddPlainList("Group", x => x.Groups);
editor.Describe<IContactContainer>()
Expand All @@ -54,13 +58,13 @@ editor.Describe<Contact>()

### Storage

Use the \ref NanoByte.StructureEditor.WinForms.StructureEditor.Open "Open()" method to load an XML file into the editor:
```{.cs}
Use the [Open()](xref:NanoByte.StructureEditor.WinForms.StructureEditor`1#NanoByte_StructureEditor_WinForms_StructureEditor_1_Open_NanoByte_Common_Undo_ICommandManager__0__) method to load an XML file into the editor:
```csharp
editor.Open(CommandManager<AddressBook>.Load(path));
```

Use the \ref NanoByte.Common.Undo.ICommandManager.Save "Save()" method on the \ref NanoByte.StructureEditor.WinForms.StructureEditor.CommandManager "CommandManager" property to save the editor's content as an XML file:
```{.cs}
Use the [Save()](xref:NanoByte.Common.Undo.ICommandManager`1#NanoByte_Common_Undo_ICommandManager_1_Save_System_String_) method on the [CommandManager](xref:NanoByte.StructureEditor.WinForms.StructureEditor`1#NanoByte_StructureEditor_WinForms_StructureEditor_1_CommandManager) property to save the editor's content as an XML file:
```csharp
editor.CommandManager.Save(path);
```

Expand Down
6 changes: 6 additions & 0 deletions doc/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: Home
href: index.md
- name: API
href: api/
- name: GitHub
href: https://github.com/nano-byte/structure-editor
2 changes: 0 additions & 2 deletions src/StructureEditor.WinForms/_Namespace.cs

This file was deleted.

5 changes: 5 additions & 0 deletions src/StructureEditor.WinForms/_Namespace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
uid: NanoByte.StructureEditor.WinForms
summary: *content
---
WinForms controls for building split-screen editors for data structures.
2 changes: 0 additions & 2 deletions src/StructureEditor/_Namespace.cs

This file was deleted.

5 changes: 5 additions & 0 deletions src/StructureEditor/_Namespace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
uid: NanoByte.StructureEditor
summary: *content
---
UI-agnostic base logic for building split-screen editors for data structures.

0 comments on commit 62fc912

Please sign in to comment.