Commit e414651d authored by mercury233's avatar mercury233

add no access hint

parent ab5f0191
......@@ -145,6 +145,14 @@ public static class Config
{
all += translations[i].original + "->" + translations[i].translated + "\r\n";
}
File.WriteAllText(path, all);
try
{
File.WriteAllText(path, all);
}
catch (Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
}
}
......@@ -66,7 +66,14 @@ public static class InterString
}
else if (original != "")
{
File.AppendAllText(path, original + "->" + original + "\r\n");
try
{
File.AppendAllText(path, original + "->" + original + "\r\n");
}
catch
{
Program.noAccess = true;
}
translations.Add(original, original);
return original.Replace("@n", "\r\n").Replace("@ui", "");
}
......
......@@ -86,17 +86,23 @@ public class Menu : WindowServantSP
}
}
bool outed = false;
bool msgUpdateShowed = false;
bool msgPermissionShowed = false;
public override void preFrameFunction()
{
base.preFrameFunction();
if (upurl != "" && outed == false)
Menu.checkCommend();
if (Program.noAccess && !msgPermissionShowed)
{
msgPermissionShowed = true;
Program.PrintToChat(InterString.Get("[b][FF0000]NO ACCESS!! NO ACCESS!! NO ACCESS!![-][/b]") + "\n" + InterString.Get("访问程序目录出错,保存卡组等功能无法使用。@n请将 YGOPro2 安装到其他文件夹,或以管理员身份运行。"));
}
else if (upurl != "" && !msgUpdateShowed)
{
outed = true;
msgUpdateShowed = true;
RMSshow_yesOrNo("update", InterString.Get("[b]发现更新![/b]") + "\n" + uptxt + "\n" + InterString.Get("是否打开下载页面?"),
new messageSystemValue { value = "1", hint = "yes" }, new messageSystemValue { value = "0", hint = "no" });
}
Menu.checkCommend();
}
void onClickExit()
......@@ -182,6 +188,7 @@ public class Menu : WindowServantSP
}
catch (System.Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
string all = "";
......@@ -232,6 +239,7 @@ public class Menu : WindowServantSP
}
catch (System.Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
try
......@@ -246,6 +254,7 @@ public class Menu : WindowServantSP
}
catch (System.Exception e)
{
Program.noAccess = true;
UnityEngine.Debug.Log(e);
}
}
......
......@@ -293,23 +293,34 @@ public class Program : MonoBehaviour
if (!Directory.Exists("expansions"))
{
Directory.CreateDirectory("expansions");
}
var fileInfos = (new DirectoryInfo("expansions")).GetFiles();
foreach (FileInfo file in fileInfos)
{
if (file.Name.ToLower().EndsWith(".ypk"))
try
{
GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("expansions/" + file.Name));
Directory.CreateDirectory("expansions");
}
if (file.Name.ToLower().EndsWith(".conf"))
catch
{
GameStringManager.initialize("expansions/" + file.Name);
}
if (file.Name.ToLower().EndsWith(".cdb"))
}
var fileInfos = new FileInfo[0];
if (Directory.Exists("expansions"))
{
fileInfos = (new DirectoryInfo("expansions")).GetFiles();
foreach (FileInfo file in fileInfos)
{
YGOSharp.CardsManager.initialize("expansions/" + file.Name);
if (file.Name.ToLower().EndsWith(".ypk"))
{
GameZipManager.Zips.Add(new Ionic.Zip.ZipFile("expansions/" + file.Name));
}
if (file.Name.ToLower().EndsWith(".conf"))
{
GameStringManager.initialize("expansions/" + file.Name);
}
if (file.Name.ToLower().EndsWith(".cdb"))
{
YGOSharp.CardsManager.initialize("expansions/" + file.Name);
}
}
}
......@@ -1025,6 +1036,8 @@ public class Program : MonoBehaviour
public static float fieldSize = 1;
public static bool longField = false;
public static bool noAccess = false;
void OnApplicationQuit()
{
TcpHelper.SaveRecord();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment