-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
656 additions
and
725 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30002.166 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hazel", "hazel\hazel.csproj", "{B094D55F-EC79-49EF-A993-25722347129A}" | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hazel", "Hazel\Hazel.csproj", "{F5563AA2-EB04-4250-A9FB-CC0B19D9413D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{B094D55F-EC79-49EF-A993-25722347129A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B094D55F-EC79-49EF-A993-25722347129A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B094D55F-EC79-49EF-A993-25722347129A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B094D55F-EC79-49EF-A993-25722347129A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {2C1EFADF-9FDD-4F51-8F35-739985C88052} | ||
{F5563AA2-EB04-4250-A9FB-CC0B19D9413D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F5563AA2-EB04-4250-A9FB-CC0B19D9413D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F5563AA2-EB04-4250-A9FB-CC0B19D9413D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F5563AA2-EB04-4250-A9FB-CC0B19D9413D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.IO; | ||
|
||
namespace Hazel.Modules; | ||
|
||
public class Activity | ||
{ | ||
public void DisplayActivity(string directory, List<string> characters, List<string> logs) | ||
{ | ||
bool isOutputDecided = false; | ||
bool isOutput = false; | ||
Int32 charResults, charDaysActive; | ||
bool isCharActive; | ||
List<string> results = new List<string>(); | ||
string outputFile = string.Empty; | ||
|
||
while (!isOutputDecided) | ||
{ | ||
Console.Write("Output to text file? [Y/N]: "); | ||
string keyInput = Console.ReadKey().Key.ToString(); | ||
Console.WriteLine(); | ||
if (keyInput == "Y") | ||
{ | ||
isOutput = true; | ||
isOutputDecided = true; | ||
} | ||
else if (keyInput == "N") | ||
{ | ||
isOutput = false; | ||
isOutputDecided = true; | ||
} | ||
else | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine("\nIncorrect value."); | ||
Console.ResetColor(); | ||
} | ||
} | ||
|
||
if (isOutput) | ||
{ | ||
string outputDir = Path.Combine(directory, "output"); | ||
|
||
if (!Directory.Exists(outputDir)) | ||
{ | ||
Directory.CreateDirectory(outputDir); | ||
} | ||
|
||
Console.Write("\nOutput file name: "); | ||
string outputFileName = Console.ReadLine(); | ||
|
||
if (outputFileName == string.Empty) | ||
{ | ||
outputFileName = "output"; | ||
} | ||
|
||
outputFile = outputDir + "\\" + outputFileName + ".txt"; | ||
FileStream fs = File.Create(outputFile); | ||
fs.Close(); | ||
} | ||
|
||
foreach (string character in characters) | ||
{ | ||
charResults = 0; | ||
charDaysActive = 0; | ||
isCharActive = false; | ||
foreach (string logFile in logs) | ||
{ | ||
string line; | ||
System.IO.StreamReader log = new System.IO.StreamReader(logFile); | ||
|
||
while ((line = log.ReadLine()) != null) | ||
{ | ||
if (line.Contains(character)) | ||
{ | ||
charResults += 1; | ||
isCharActive = true; | ||
} | ||
} | ||
|
||
if (isCharActive) | ||
{ | ||
charDaysActive += 1; | ||
isCharActive = false; | ||
} | ||
} | ||
|
||
results.Add(String.Format("{0}: {1} | {2}", character, charResults, charDaysActive)); | ||
} | ||
|
||
if (isOutput) | ||
{ | ||
System.IO.File.WriteAllLines(outputFile, results); | ||
} | ||
|
||
foreach (string result in results) | ||
{ | ||
Console.WriteLine(result); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.IO; | ||
|
||
namespace Hazel.Modules; | ||
|
||
public class Character | ||
{ | ||
public List<string> GetAllCharacters(string directory) | ||
{ | ||
List<string> characters = new List<string>(); | ||
string currentLine = string.Empty; | ||
string charDirectory = Path.Combine(directory, "characters"); | ||
string charTextFile = Path.Combine(charDirectory, "characters.txt"); | ||
|
||
// We need to create the directory first if it doesn't exist. | ||
if (!Directory.Exists(charDirectory)) | ||
{ | ||
Directory.CreateDirectory(charDirectory); | ||
} | ||
|
||
// We'll do a separate check encase the .txt was deleted | ||
if (!File.Exists(charTextFile)) | ||
{ | ||
var characterFile = File.Create(charTextFile); | ||
characterFile.Close(); // Allows the user to edit the file | ||
Console.WriteLine("Enter characters (one per line) into /characters/characters.txt then press any key."); | ||
Console.ReadKey(); | ||
} | ||
|
||
System.IO.StreamReader charFile = new System.IO.StreamReader(charTextFile); | ||
while ((currentLine = charFile.ReadLine()) != null) | ||
{ | ||
characters.Add(currentLine); | ||
} | ||
|
||
return characters; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.IO; | ||
|
||
namespace Hazel.Modules; | ||
|
||
public class Container | ||
{ | ||
|
||
public void ReturnAllContainers(List<string> logs) | ||
{ | ||
|
||
List<string> uniqueContainers = new List<string>(); | ||
Int32 containerIDPattern; | ||
|
||
// Search from newest -> oldest logs, for up to date container names. | ||
logs.Reverse(); | ||
|
||
foreach (string logFile in logs) | ||
{ | ||
string currentLine; | ||
System.IO.StreamReader log = new System.IO.StreamReader(logFile); | ||
|
||
while ((currentLine = log.ReadLine()) != null) | ||
{ | ||
if (currentLine.Contains("opened the '") && !(currentLine.Contains("vault."))) | ||
{ | ||
// Check to see if container is unique | ||
containerIDPattern = currentLine.IndexOf("#"); | ||
string[] sectionedLog = currentLine.Split("' #"); | ||
string ContainerID = sectionedLog[1].Substring(0, 5); | ||
|
||
if (uniqueContainers.Contains(ContainerID)) | ||
{ | ||
// check if name has been updated | ||
} | ||
else | ||
{ | ||
string[] ContainerName = sectionedLog[0].Split("opened the '"); | ||
if (ContainerName[1].Length == 0 || ContainerName[1] == " ") | ||
{ | ||
ContainerName[1] = "null"; | ||
} | ||
|
||
Console.WriteLine("#{0} - {1}", ContainerID, ContainerName[1]); | ||
uniqueContainers.Add(ContainerID); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Octokit; | ||
|
||
namespace Hazel.Modules; | ||
|
||
public class Display | ||
{ | ||
public void DisplayMenu(string[] options, List<string> logs, List<string> chars) | ||
{ | ||
|
||
Console.WriteLine("Files Loaded: {0} || Characters Loaded: {1}", logs.Count, chars.Count); | ||
for (int i = 0; i < options.Length; i++) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.Write("[{0}] ", i + 1); | ||
Console.ForegroundColor = ConsoleColor.Yellow; | ||
Console.WriteLine(options[i]); | ||
} | ||
|
||
Console.ResetColor(); | ||
|
||
} | ||
|
||
public async void NotifyRelease(string appVersion) | ||
{ | ||
// Github Release Check | ||
var client = new GitHubClient(new ProductHeaderValue("hazel")); | ||
var releases = await client.Repository.Release.GetAll("garytate", "hazel"); | ||
var latest = releases[0]; | ||
|
||
if (appVersion != latest.TagName) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine("There is a new update at https://github.com/garytate/hazel/releases"); | ||
Console.ResetColor(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.IO; | ||
|
||
namespace Hazel.Modules; | ||
|
||
public class FileManager | ||
{ | ||
public List<string> GetAllLogs(string directory) | ||
{ | ||
List<string> logFiles = new List<string>(); | ||
string logDirectory = Path.Combine(directory, "logs"); | ||
|
||
// Create log folder if not existant. | ||
if (!Directory.Exists(logDirectory)) | ||
{ | ||
Directory.CreateDirectory(logDirectory); | ||
Console.WriteLine("Copy your log files into the /logs folder then press any key."); | ||
Console.ReadKey(); | ||
} | ||
|
||
// Collect all log files into a List<string> | ||
foreach (string file in Directory.EnumerateFiles((logDirectory), "*.txt")) | ||
{ | ||
logFiles.Add(file); | ||
} | ||
|
||
// List<string> - file paths of all log files. | ||
return logFiles; | ||
|
||
} | ||
} |
Oops, something went wrong.