-
Notifications
You must be signed in to change notification settings - Fork 2
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
5 changed files
with
114 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
using System.IO; | ||
|
||
namespace ModLauncher | ||
{ | ||
class LibList | ||
{ | ||
private string Filename { get; set; } | ||
|
||
public LibList(string gamePath, string modDirectory) | ||
{ | ||
this.Filename = gamePath + "\\" + modDirectory + "\\scripts\\liblist.gam"; | ||
Console.WriteLine(this.Filename); | ||
} | ||
|
||
private bool GetValue(string line, string forSearch, out string value) | ||
{ | ||
value = ""; | ||
|
||
try | ||
{ | ||
line = line.Trim(); | ||
int forSearchLength = forSearch.Length; | ||
int findMaterial = line.IndexOf(forSearch); | ||
if (findMaterial < 0) // If there's no forSearch in line | ||
return false; | ||
if (findMaterial > 0) // If forSearch is further than 0 symbol, i.e.: "name" "game" - it's just value, not parameter name | ||
return false; | ||
|
||
value = line.Substring(forSearchLength + 1).Replace('/', '\\').Trim(trimChars: '"'); | ||
|
||
return true; | ||
} | ||
catch { } | ||
|
||
return false; | ||
} | ||
|
||
public string GetGameName() | ||
{ | ||
string[] file = new string[] { }; | ||
try | ||
{ | ||
file = File.ReadAllLines(this.Filename); | ||
} | ||
catch { } | ||
|
||
foreach (string line in file) | ||
{ | ||
string value = ""; | ||
|
||
bool foundGameName = GetValue(line, "game", out value); | ||
if (foundGameName) | ||
return value; | ||
} | ||
return ""; | ||
} | ||
} | ||
} |
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 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,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace ModLauncher | ||
{ | ||
class Mod | ||
{ | ||
public string Dir { get; set; } | ||
public string Name { get; set; } | ||
} | ||
} |
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 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