Skip to content

Commit

Permalink
Fixed an issue where the username was hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
nickc01 committed Nov 20, 2021
1 parent 1f80d07 commit 0020e64
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,6 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd
.vscode/launch.json
.vscode/tasks.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ For Other Platforms: [Download Here](https://dotnet.microsoft.com/download/dotne

```
Usage:
"Wiki Page Generator.exe" [REPO-NAME] [DESTINATION DIRECTORY] [CS Script File 1] [CS Script File 2] [CS Script File 2] [etc...]
"Wiki Page Generator.exe" [USERNAME OF REPO OWNER] [REPO-NAME] [DESTINATION DIRECTORY] [CS Script File 1] [CS Script File 2] [CS Script File 2] [etc...]
```
34 changes: 24 additions & 10 deletions Wiki Page Generator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,51 @@ class Program
/// </summary>
static string repoLink;

static void PrintCommandError(string msg)
{
Console.WriteLine(msg);
Console.WriteLine();
Console.WriteLine("USAGE: [USERNAME OF REPO OWNER] [REPO-NAME] [DESTINATION DIRECTORY] [CS Script File 1] [CS Script File 2] [CS Script File 2] [etc...]");
}

/// <summary>
/// Main part of the program.
/// USAGE:
/// "Wiki Page Generator.exe" [REPO NAME] [DESTINATION DIRECTORY] [CS Script File 1] [CS Script File 2] [CS Script File 2] [etc...]
/// "Wiki Page Generator.exe" [USERNAME OF REPO OWNER] [REPO NAME] [DESTINATION DIRECTORY] [CS Script File 1] [CS Script File 2] [CS Script File 2] [etc...]
/// </summary>
static void Main(string[] args)
{
if (args.GetLength(0) == 0)
{
Console.WriteLine("ERROR : NO ARGUMENTS PASSED");
PrintCommandError("ERROR : NO ARGUMENTS PASSED");
return;
}

if (args.GetLength(0) == 1)
{
Console.WriteLine("ERROR : NO DESTINATION DIRECTORY SPECIFIED");
PrintCommandError("ERROR : NO REPO NAME ENTERED");
return;
}

if (args.GetLength(0) == 2)
{
Console.WriteLine("ERROR : NO CS FILES SPECIFIED");
PrintCommandError("ERROR : NO DESTINATION DIRECTORY SPECIFIED");
return;
}

if (args.GetLength(0) == 3)
{
PrintCommandError("ERROR : NO CS FILES SPECIFIED");
return;
}
var watch = Stopwatch.StartNew();
totalPages.Clear();

repoLink = $"https://github.com/nickc01/{args[0]}/wiki/";
repoLink = $"https://github.com/{args[0]}/{args[1]}/wiki/";

var dumpLocation = new DirectoryInfo(args[1]);
var dumpLocation = new DirectoryInfo(args[2]);

Parallel.For(2, args.Length, i =>
Parallel.For(3, args.Length, i =>
{
var extraction = ExtractAllInfo(args[i]);

Expand Down Expand Up @@ -158,7 +171,8 @@ static void CreatePagesForMethods(DirectoryInfo outputDir, AllExtractedInfo info
builder.Replace("*RIGHT*",param.Value);
}
}
File.WriteAllText(outputDir.FullName + "\\" + info.Class.ClassName + "-" + largestMethod.MethodName + "-(Method).md", builder.ToString());

File.WriteAllText(outputDir.FullName + Path.DirectorySeparatorChar + info.Class.ClassName + "-" + largestMethod.MethodName + "-(Method).md", builder.ToString());

addedPagesList.Add($"Page : {repoLink}{info.Class.ClassName}-{largestMethod.MethodName}-(Method)");
}
Expand Down Expand Up @@ -195,7 +209,7 @@ static void CreateEnumWikiPage(DirectoryInfo outputDir, AllExtractedInfo info, L
}
}

File.WriteAllText(outputDir.FullName + "\\" + info.Enum.EnumName + "-(Script).md", builder.ToString());
File.WriteAllText(outputDir.FullName + Path.DirectorySeparatorChar + info.Enum.EnumName + "-(Script).md", builder.ToString());

addedPagesList.Add($"Page : {repoLink}{info.Enum.EnumName}-(Script)");
}
Expand Down Expand Up @@ -321,7 +335,7 @@ static void CreateClassWikiPage(DirectoryInfo outputDir, AllExtractedInfo info,
}
}

File.WriteAllText(outputDir.FullName + "\\" + info.Class.ClassName + "-(Script).md", builder.ToString());
File.WriteAllText(outputDir.FullName + Path.DirectorySeparatorChar + info.Class.ClassName + "-(Script).md", builder.ToString());

addedPagesList.Add($"Page : {repoLink}{info.Class.ClassName}-(Script)");
}
Expand Down

0 comments on commit 0020e64

Please sign in to comment.