Skip to content

Commit

Permalink
readme and debug symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverAbraham committed Nov 11, 2023
1 parent e732719 commit 80d8fcf
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 15 deletions.
3 changes: 3 additions & 0 deletions AutoRecovery.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoRecoverySupervisor", "A
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9B4EA8AC-F0D5-47AB-BD41-5EB9724299A5}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
LICENSE.txt = LICENSE.txt
README.md = README.md
EndProjectSection
EndProject
Expand Down
9 changes: 6 additions & 3 deletions AutoRecovery/Abraham.AutoRecovery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
and a supervisor process to automatically restart your app after a crash.</Description>
<Copyright>Oliver Abraham</Copyright>
<PackageIcon>Ciridata.png</PackageIcon>
<IncludeSymbols>False</IncludeSymbols>
<Version>1.0.1</Version>
<PackageReleaseNotes>Changed license to Apache 2.0 and added an icon</PackageReleaseNotes>
<PackageReleaseNotes>Included debug symbols</PackageReleaseNotes>
<IncludeSymbols>True</IncludeSymbols>
<!-- Include symbol files (*.pdb) in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<Version>1.0.2</Version>
<Authors>Oliver Abraham</Authors>
</PropertyGroup>

<ItemGroup>
Expand Down
45 changes: 33 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# Abraham.AutoRecovery

![](https://img.shields.io/github/downloads/oliverabraham/AutoRecovery/total) ![](https://img.shields.io/github/license/oliverabraham/AutoRecovery) ![](https://img.shields.io/github/languages/count/oliverabraham/AutoRecovery) ![GitHub Repo stars](https://img.shields.io/github/stars/oliverabraham/AutoRecovery?label=repo%20stars) ![GitHub Repo stars](https://img.shields.io/github/stars/oliverabraham?label=user%20stars)


## OVERVIEW

## Abstract

This library provides a scheduler for automatically saving user data
and a supervisor process to automatically restart your app after a crash.


## License
## LICENSE

Licensed under Apache licence.
https://www.apache.org/licenses/LICENSE-2.0


## Compatibility

The nuget package was build with DotNET 6.
The nuget package was build with DotNET standard 2.0.


## Source code

The source code is available on GitHub:
https://github.com/OliverAbraham/AutoRecovery

The nuget package is available on nuget.org:
https://www.nuget.org/packages/Abraham.AutoRecovery/



## Example
Expand Down Expand Up @@ -83,20 +96,20 @@ At startup of your app, add the following code.
(You'll want to change startVisible to false after verifying it's working):

```C#
private void Window_Loaded(object sender, RoutedEventArgs e)
{
_autoRecovery.EnableAutoRestart(startVisible: true); // restart this app after crash, start visible for Demo only!
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
_autoRecovery.EnableAutoRestart(startVisible: true); // restart this app after crash, start visible for Demo only!
}
```


At shutdown, add the following code:

```C#
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_autoRecovery.NormalShutdown();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_autoRecovery.NormalShutdown();
}
```

This call will end the hidden supervisor process.
Expand All @@ -123,7 +136,7 @@ This is very simple:

or from NuGet Command-Line:

Install-Package Abraham.ProgramSettingsManager
Install-Package Abraham.AutoRecovery



Expand All @@ -137,3 +150,11 @@ Please feel free to comment and suggest improvements!





# MAKE A DONATION !

If you find this application useful, buy me a coffee!
I would appreciate a small donation on https://www.buymeacoffee.com/oliverabraham

<a href="https://www.buymeacoffee.com/app/oliverabraham" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
139 changes: 139 additions & 0 deletions README.md.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Abraham.AutoRecovery


## Abstract

This library provides a scheduler for automatically saving user data
and a supervisor process to automatically restart your app after a crash.


## License

Licensed under Apache licence.
https://www.apache.org/licenses/LICENSE-2.0


## Compatibility

The nuget package was build with DotNET 6.


## Example

For an example refer to project "AutoRecoveryDemoWPF". It demonstrates both features:
1. The scheduler that triggers a given function periodically to save the user's data.
2. When you app starts, a separate (hidden) process is started to monitor your app.
In case you app crashes and its process ends, the hidden process will restart
your app. If your process ends normally, the hidden process will also end.


## Getting started

Add the Nuget package "Abraham.AutoRecovery" to your project.

Add a field to your project:

```C#
IAutoRecovery _autoRecovery = new AutoRecovery();
```



### Adding AutoSave to your project

At startup of your app, add the following code:

```C#
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if (_autoRecovery.AppHasCrashed)
LoadDataFromAutoSaveFile();
else
LoadData();
_autoRecovery.EnableAutoSave(10, SaveDataForAutoSave); // save every 10 seconds
}
```

This method will be called periodically to save the user's data:

```C#
private void SaveDataForAutoSave()
{
Dispatcher.Invoke(() => { SaveDataToAutoSaveFile(); });
}
```

At shutdown, add the following code:

```C#
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
SaveData();
DeleteAutoSaveFile(); // optional
}
```

After saving user's data as usual, you can add a method that deletes the file
containing the autosave data.


### Adding AutoRestart to your project

At startup of your app, add the following code.
(You'll want to change startVisible to false after verifying it's working):

```C#
private void Window_Loaded(object sender, RoutedEventArgs e)
{
_autoRecovery.EnableAutoRestart(startVisible: true); // restart this app after crash, start visible for Demo only!
}
```


At shutdown, add the following code:

```C#
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_autoRecovery.NormalShutdown();
}
```

This call will end the hidden supervisor process.

### Testing AutoRestart

- Start the demo app 'AutoRecoveryDemoWPF.exe' by doubleclicking.
- The go to task manager and end this process.
- Don't kill process tree! Only kill the single process.
- After a few seconds the supervisor process will recognize that and restart your process.




## HOW TO INSTALL A NUGET PACKAGE
This is very simple:
- Start Visual Studio (with NuGet installed)
- Right-click on your project's References and choose "Manage NuGet Packages..."
- Choose Online category from the left
- Enter the name of the nuget package to the top right search and hit enter
- Choose your package from search results and hit install
- Done!


or from NuGet Command-Line:

Install-Package Abraham.ProgramSettingsManager





## AUTHOR

Oliver Abraham, [email protected], https://www.oliver-abraham.de

Please feel free to comment and suggest improvements!



0 comments on commit 80d8fcf

Please sign in to comment.