Skip to content

Commit

Permalink
added check if ini file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
erfg12 committed Nov 27, 2020
1 parent f4af851 commit e32cbb8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Memory/memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,18 +574,23 @@ public int GetProcIdFromName(string name) //new 1.0.2 function


/// <summary>
/// Get code from ini file.
/// Get code. If just the ini file name is given with no path, it will assume the file is next to the executable.
/// </summary>
/// <param name="name">label for address or code</param>
/// <param name="file">path and name of ini file</param>
/// <param name="iniFile">path and name of ini file</param>
/// <returns></returns>
public string LoadCode(string name, string file)
public string LoadCode(string name, string iniFile)
{
StringBuilder returnCode = new StringBuilder(1024);
uint read_ini_result;

if (file != "")
read_ini_result = GetPrivateProfileString("codes", name, "", returnCode, (uint)returnCode.Capacity, file);
if (iniFile != "")
{
if (File.Exists(iniFile))
read_ini_result = GetPrivateProfileString("codes", name, "", returnCode, (uint)returnCode.Capacity, iniFile);
else
Debug.WriteLine("ERROR: ini file \"" + iniFile + "\" not found!");
}
else
returnCode.Append(name);

Expand Down

0 comments on commit e32cbb8

Please sign in to comment.