Skip to content

Commit

Permalink
1.5.6: Fixed stream error
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrix25633 committed Oct 5, 2022
1 parent c089a8b commit 88cb853
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 58 deletions.
13 changes: 13 additions & 0 deletions Files.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public bool ToCopy(ref DirectoryEntry[] destinationList, bool allExtensions, str
return false;
}
}
/// <summary>
/// Function to know of a file has to be removed
/// (<paramref name="sourceList"/>)
/// </summary>
/// <param name="sourceList">The list of files in the source folder</param>
/// <returns>Returns true if the file has to be removed</returns>
public bool ToRemove(DirectoryEntry[] sourceList) {
bool toRemove = !IsInList(sourceList, out _);
if(toRemove) reason = Reason.Remove;
Expand All @@ -74,6 +80,13 @@ private bool IsInList(DirectoryEntry[] list, out Int32 pos) {
}
return false;
}
/// <summary>
/// Function to search remove an item from a DirectoryEntry array
/// (<paramref name="source"/>, <paramref name="index"/>)
/// </summary>
/// <param name="source">The source DirectoryEntry array</param>
/// <param name="index">The index of the item to remove</param>
/// <returns>Returns the source array without the item to remove</returns>
public static DirectoryEntry[] RemoveAt(DirectoryEntry[] source, Int32 index) {
Int32 lenght = source.Length;
DirectoryEntry[] dest = new DirectoryEntry[lenght - 1];
Expand Down
14 changes: 9 additions & 5 deletions Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class Logger {
private static string barFull = "█", barEmpty = " ";
private static string? logfilename;
private static StreamWriter? logstream;
private static Task? logTask;
/// <summary>
/// Function to initialize the file logging
/// (<paramref name="log"/>)
Expand All @@ -27,8 +28,11 @@ public static void ReinitializeLogging() {
/// <summary>
/// Function to close the log stream
/// </summary>
public static void TerminateLogging() {
if(logstream != null) logstream.Close();
public static async void TerminateLogging() {
if(logstream != null) {
if(logTask != null) await logTask;
logstream.Close();
}
}
/// <summary>
/// Function to output a success message
Expand All @@ -44,7 +48,7 @@ public static void Success(string message) {
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(message);
Console.ResetColor();
if(logstream != null) logstream.WriteLineAsync(time + "(Success) " + message);
if(logstream != null) logTask = logstream.WriteLineAsync(time + "(Success) " + message);
}
/// <summary>
/// Function to output an info message
Expand Down Expand Up @@ -74,7 +78,7 @@ public static void Warning(string message) {
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(message);
Console.ResetColor();
if(logstream != null) logstream.WriteLineAsync(time + "(Warning) " + message);
if(logstream != null) logTask = logstream.WriteLineAsync(time + "(Warning) " + message);
}
/// <summary>
/// Function to output an error message
Expand All @@ -90,7 +94,7 @@ public static void Error(string message) {
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(message);
Console.ResetColor();
if(logstream != null) logstream.WriteLineAsync(time + "(Error) " + message);
if(logstream != null) logTask = logstream.WriteLineAsync(time + "(Error) " + message);
}
/// <summary>
/// Function to clear the last console line
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.RECIPEPREFIX=>
VERSION=1.5.5
VERSION=1.5.6

default:
> clear
Expand Down
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
public class Program {
static void Main(string[] args) {
// Version
string version = "1.5.5";
string version = "1.5.6";
// Lists
string[] sourceList = new string[0], destinationList = new string[0], extensionList = new string[0];
DirectoryEntry[] sourceInfoList = new DirectoryEntry[0], destinationInfoList = new DirectoryEntry[0],
Expand Down
100 changes: 50 additions & 50 deletions github-updater.backup-utility-cs.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
{
"latest": "1.5.5",
"keep": [],
"releases": [
{
"tag": "1.4.0",
"linux": "backup-utility-1.4.0-linux-x64.tar.gz",
"win": "backup-utility-1.4.0-win-x64.zip"
},
{
"tag": "1.4.1",
"linux": "backup-utility-1.4.1-linux-x64.tar.gz",
"win": "backup-utility-1.4.1-win-x64.zip"
},
{
"tag": "1.5.0",
"linux": "backup-utility-1.5.0-linux-x64.tar.gz",
"win": "backup-utility-1.5.0-win-x64.zip"
}
,
{
"tag": "1.5.1",
"linux": "backup-utility-1.5.1-linux-x64.tar.gz",
"win": "backup-utility-1.5.1-win-x64.zip"
}
,
{
"tag": "1.5.2",
"linux": "backup-utility-1.5.2-linux-x64.tar.gz",
"win": "backup-utility-1.5.2-win-x64.zip"
}
,
{
"tag": "1.5.3",
"linux": "backup-utility-1.5.3-linux-x64.tar.gz",
"win": "backup-utility-1.5.3-win-x64.zip"
}
,
{
"tag": "1.5.4",
"linux": "backup-utility-1.5.4-linux-x64.tar.gz",
"win": "backup-utility-1.5.4-win-x64.zip"
}
,
{
"tag": "1.5.5",
"linux": "backup-utility-1.5.5-linux-x64.tar.gz",
"win": "backup-utility-1.5.5-win-x64.zip"
}
]
}
"latest": "1.5.6",
"keep": [],
"releases": [
{
"tag": "1.5.6",
"linux": "backup-utility-1.5.6-linux-x64.tar.gz",
"win": "backup-utility-1.5.6-win-x64.zip"
},
{
"tag": "1.5.5",
"linux": "backup-utility-1.5.5-linux-x64.tar.gz",
"win": "backup-utility-1.5.5-win-x64.zip"
},
{
"tag": "1.5.4",
"linux": "backup-utility-1.5.4-linux-x64.tar.gz",
"win": "backup-utility-1.5.4-win-x64.zip"
},
{
"tag": "1.5.3",
"linux": "backup-utility-1.5.3-linux-x64.tar.gz",
"win": "backup-utility-1.5.3-win-x64.zip"
},
{
"tag": "1.5.2",
"linux": "backup-utility-1.5.2-linux-x64.tar.gz",
"win": "backup-utility-1.5.2-win-x64.zip"
},
{
"tag": "1.5.1",
"linux": "backup-utility-1.5.1-linux-x64.tar.gz",
"win": "backup-utility-1.5.1-win-x64.zip"
},
{
"tag": "1.5.0",
"linux": "backup-utility-1.5.0-linux-x64.tar.gz",
"win": "backup-utility-1.5.0-win-x64.zip"
},
{
"tag": "1.4.1",
"linux": "backup-utility-1.4.1-linux-x64.tar.gz",
"win": "backup-utility-1.4.1-win-x64.zip"
},
{
"tag": "1.4.0",
"linux": "backup-utility-1.4.0-linux-x64.tar.gz",
"win": "backup-utility-1.4.0-win-x64.zip"
}
]
}
2 changes: 1 addition & 1 deletion transfer/local/options.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
VERSION=1.5.5
VERSION=1.5.6
DEBUG=0
RELEASE=1

0 comments on commit 88cb853

Please sign in to comment.