Skip to content

Commit

Permalink
Merge pull request #1 from Akutra/main
Browse files Browse the repository at this point in the history
Adding v1.4.3.6-console codebase
  • Loading branch information
Akutra authored May 8, 2021
2 parents b1af297 + 26b5633 commit 6adb364
Show file tree
Hide file tree
Showing 15 changed files with 1,160 additions and 0 deletions.
31 changes: 31 additions & 0 deletions hypersync.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31129.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hypersync", "hypersync\hypersync.csproj", "{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Debug|x64.ActiveCfg = Debug|x64
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Debug|x64.Build.0 = Debug|x64
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Debug|x86.ActiveCfg = Debug|x86
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Debug|x86.Build.0 = Debug|x86
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Release|x64.ActiveCfg = Release|x64
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Release|x64.Build.0 = Release|x64
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Release|x86.ActiveCfg = Release|x86
{41CD9276-B718-4EC3-AB21-C52D8AA7D30A}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DD844196-63C4-4B72-BA8C-66055AACA3E6}
EndGlobalSection
EndGlobal
13 changes: 13 additions & 0 deletions hypersync/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hypersync
{
public static partial class Constants
{

}
}
9 changes: 9 additions & 0 deletions hypersync/Constants.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace hypersync
{
public static partial class Constants
{
public static DateTime CompilationTimestampUtc { get { return new DateTime(637560563236627981L, DateTimeKind.Utc); } }
}
}
13 changes: 13 additions & 0 deletions hypersync/Constants.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System" #>
<#@ output extension=".g.cs" #>
using System;

namespace hypersync
{
public static partial class Constants
{
public static DateTime CompilationTimestampUtc { get { return new DateTime(<# Write(DateTime.UtcNow.Ticks.ToString()); #>L, DateTimeKind.Utc); } }
}
}
116 changes: 116 additions & 0 deletions hypersync/DisplayManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hypersync
{
public class cpoint
{
public int hLeft { get; set; }
public int hTop { get; set; }
public int printed { get; set; }
public string printedtext { get; set; }

public cpoint(int spot)
{
hLeft = 0;
hTop = Console.CursorTop + spot;
printed = 0;
printedtext = "";
}
}

public class DisplayManager
{
cpoint[] positions = new[] { new cpoint(0), new cpoint(1), new cpoint(2), new cpoint(4) }; // Fourth row is error/warning output

public void WriteToConsole(string Text, int row, ConsoleColor? consoleColor = null)
{
// FYI, If this method is used more will need add clear extra
Console.SetCursorPosition(positions[row].printed, this.positions[row].hTop);
positions[row].printed += Text.Length;
positions[row].printedtext += Text;
if (!object.ReferenceEquals(null, consoleColor)) { Console.ForegroundColor = consoleColor.Value; }
Console.Write(Text);
Console.ResetColor();
}
public void AppendToConsole(string Text, ConsoleColor? consoleColor = null)
{
if (!object.ReferenceEquals(null, consoleColor)) { Console.ForegroundColor = consoleColor.Value; }
Console.Write(Text);
Console.ResetColor();
}

public void AppendLineToConsole(string Text, ConsoleColor? consoleColor = null)
{
if (!object.ReferenceEquals(null, consoleColor)) { Console.ForegroundColor = consoleColor.Value; }
Console.WriteLine(Text);
Console.ResetColor();
}

public void hWriteToConsole(string Text, int row, ConsoleColor? consoleColor = null)
{
if (Text == positions[row].printedtext)
return;

this.ClearExtra(positions[row].printed, Text.Length, row);
this.GoTopLeft(row);

positions[row].printed = 0;
positions[row].printedtext = "";
this.WriteToConsole(Text, row, consoleColor);
}

public void ClearExtra(int lenOld, int lenNew, int row)
{
if (lenOld > lenNew)
{
int pLeft = lenNew;
int pTop = this.positions[row].hTop;
int lines;

string pad = new String(' ', lenOld-lenNew);

if( lenNew >= Console.BufferWidth)
{
lines = (int)(lenNew / Console.BufferWidth);
pTop += lines;
pLeft = lenNew - (lines * Console.BufferWidth);
}

Console.SetCursorPosition(pLeft, pTop);
Console.Write(pad);
}
}

public void GoTopLeft(int row)
{
Console.SetCursorPosition(this.positions[row].hLeft, this.positions[row].hTop);
}

public void Clear(int row)
{
this.GoTopLeft(row);
if (this.positions[row].printed > 0) {
Console.WriteLine(new String(' ', this.positions[row].printed));
this.positions[row].printed = 0;
this.GoTopLeft(row);
}
}

public void WriteError(string Text)
{
Console.BackgroundColor = ConsoleColor.DarkRed;
this.hWriteToConsole(Text, 3, ConsoleColor.White);
}

public void WriteWarning(string Text)
{
Console.BackgroundColor = ConsoleColor.DarkYellow;
this.hWriteToConsole(Text, 3, ConsoleColor.White);
}

}
}
34 changes: 34 additions & 0 deletions hypersync/FolderPath.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace hypersync
{
public enum ptype { normal = 0 };
public class FolderPath
{
public string src_folder;
public string dest_folder;
public ptype thisType;
}

public class reportdata
{
public long total_items = 0;
public long total_updated = 0;
public long total_older = 0;
public long total_newer = 0;
public long total_missingdest = 0;
public long total_missingsrc = 0;
public long total_invalid = 0;
public long total_removed = 0;
public long total_zerosize = 0;

public void reset()
{
total_items = 0; total_invalid = 0; total_missingdest = 0; total_missingsrc = 0; total_newer = 0; total_older = 0; total_updated = 0; total_removed = 0; total_zerosize = 0;
}
}
}

Loading

0 comments on commit 6adb364

Please sign in to comment.