|
@@ -159,24 +159,32 @@ public class EditMod : MonoBehaviour
|
|
|
value = array2[1];
|
|
|
string text5 = Path.GetDirectoryName(f_strModMenu) + "\\";
|
|
|
text5 += array2[1];
|
|
|
- FileStream fileStream2 = new FileStream(text5, FileMode.Open);
|
|
|
- if (fileStream2 == null)
|
|
|
+ try
|
|
|
{
|
|
|
- NUty.WinMessageBox(NUty.GetWindowHandle(), "アイコンファイルが開けません。\n" + text5, "MOD Compile Error", 0);
|
|
|
- return false;
|
|
|
+ FileStream fileStream2 = new FileStream(text5, FileMode.Open);
|
|
|
+ if (fileStream2 == null)
|
|
|
+ {
|
|
|
+ NUty.WinMessageBox(NUty.GetWindowHandle(), "アイコンファイルが開けません。\n" + text5, "MOD Compile Error", 0);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ byte[] array3 = new byte[fileStream2.Length];
|
|
|
+ fileStream2.Read(array3, 0, (int)fileStream2.Length);
|
|
|
+ if (!dictionary.ContainsKey(array2[1].ToLower()))
|
|
|
+ {
|
|
|
+ dictionary.Add(array2[1].ToLower(), new EditMod.TexSet
|
|
|
+ {
|
|
|
+ nSize = (int)fileStream2.Length,
|
|
|
+ byData = array3
|
|
|
+ });
|
|
|
+ }
|
|
|
+ fileStream2.Close();
|
|
|
+ fileStream2.Dispose();
|
|
|
}
|
|
|
- byte[] array3 = new byte[fileStream2.Length];
|
|
|
- fileStream2.Read(array3, 0, (int)fileStream2.Length);
|
|
|
- if (!dictionary.ContainsKey(array2[1].ToLower()))
|
|
|
+ catch (Exception ex2)
|
|
|
{
|
|
|
- dictionary.Add(array2[1].ToLower(), new EditMod.TexSet
|
|
|
- {
|
|
|
- nSize = (int)fileStream2.Length,
|
|
|
- byData = array3
|
|
|
- });
|
|
|
+ NDebug.MessageBox("指定のアイコンファイルが見つかりませんでした。\n" + array2[1], "MOD Compile Error");
|
|
|
+ return false;
|
|
|
}
|
|
|
- fileStream2.Close();
|
|
|
- fileStream2.Dispose();
|
|
|
}
|
|
|
else if (array2[0] == "色セット")
|
|
|
{
|
|
@@ -191,66 +199,96 @@ public class EditMod : MonoBehaviour
|
|
|
array2[2] = array2[2].ToLower();
|
|
|
string text6 = Path.GetDirectoryName(f_strModMenu) + "\\";
|
|
|
text6 += array2[2];
|
|
|
- FileStream fileStream3 = new FileStream(text6, FileMode.Open);
|
|
|
- if (fileStream3 == null)
|
|
|
+ try
|
|
|
{
|
|
|
- NUty.WinMessageBox(NUty.GetWindowHandle(), "テクスチャが開けません。\n" + text6, "MOD Compile Error", 0);
|
|
|
- return false;
|
|
|
+ FileStream fileStream3 = new FileStream(text6, FileMode.Open);
|
|
|
+ if (fileStream3 == null)
|
|
|
+ {
|
|
|
+ NUty.WinMessageBox(NUty.GetWindowHandle(), "テクスチャが開けません。\n" + text6, "MOD Compile Error", 0);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ byte[] array4 = new byte[fileStream3.Length];
|
|
|
+ fileStream3.Read(array4, 0, (int)fileStream3.Length);
|
|
|
+ if (!dictionary.ContainsKey(array2[2].ToLower()))
|
|
|
+ {
|
|
|
+ dictionary.Add(array2[2].ToLower(), new EditMod.TexSet
|
|
|
+ {
|
|
|
+ nSize = (int)fileStream3.Length,
|
|
|
+ byData = array4
|
|
|
+ });
|
|
|
+ }
|
|
|
+ fileStream3.Close();
|
|
|
+ fileStream3.Dispose();
|
|
|
}
|
|
|
- byte[] array4 = new byte[fileStream3.Length];
|
|
|
- fileStream3.Read(array4, 0, (int)fileStream3.Length);
|
|
|
- if (!dictionary.ContainsKey(array2[2].ToLower()))
|
|
|
+ catch (Exception ex3)
|
|
|
{
|
|
|
- dictionary.Add(array2[2].ToLower(), new EditMod.TexSet
|
|
|
+ array2[2] = Path.ChangeExtension(array2[2], ".tex");
|
|
|
+ string text7 = array2[2].ToLower();
|
|
|
+ if (!dictionary.ContainsKey(text7))
|
|
|
{
|
|
|
- nSize = (int)fileStream3.Length,
|
|
|
- byData = array4
|
|
|
- });
|
|
|
+ dictionary.Add(text7, new EditMod.TexSet
|
|
|
+ {
|
|
|
+ nSize = EditMod.dummyImg.Length,
|
|
|
+ byData = EditMod.dummyImg
|
|
|
+ });
|
|
|
+ Debug.Log("画像ファイルが付近に見つからなかったので、内部のファイルシステムから呼び出すことにします。" + text7);
|
|
|
+ }
|
|
|
}
|
|
|
- fileStream3.Close();
|
|
|
- fileStream3.Dispose();
|
|
|
}
|
|
|
else if (array2[0] == "テクスチャ変更")
|
|
|
{
|
|
|
- string text7 = array2[4].ToLower();
|
|
|
- string text8 = Path.GetDirectoryName(f_strModMenu) + "\\";
|
|
|
+ string text8 = array2[4].ToLower();
|
|
|
+ string text9 = Path.GetDirectoryName(f_strModMenu) + "\\";
|
|
|
string[] array5;
|
|
|
- if (text7.Contains("*"))
|
|
|
+ if (text8.Contains("*"))
|
|
|
{
|
|
|
- array5 = Directory.GetFiles(text8, text7, SearchOption.AllDirectories);
|
|
|
+ array5 = Directory.GetFiles(text9, text8, SearchOption.AllDirectories);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
array5 = new string[]
|
|
|
{
|
|
|
- text8 + text7
|
|
|
+ text9 + text8
|
|
|
};
|
|
|
}
|
|
|
- foreach (string text9 in array5)
|
|
|
+ foreach (string text10 in array5)
|
|
|
{
|
|
|
- if (!File.Exists(text9))
|
|
|
+ try
|
|
|
{
|
|
|
- NUty.WinMessageBox(NUty.GetWindowHandle(), "テクスチャが見つかりません。\n" + text9, "MOD Compile Error", 0);
|
|
|
- return false;
|
|
|
- }
|
|
|
- FileStream fileStream4 = new FileStream(text9, FileMode.Open);
|
|
|
- if (fileStream4 == null)
|
|
|
- {
|
|
|
- NUty.WinMessageBox(NUty.GetWindowHandle(), "テクスチャが開けません。\n" + text9, "MOD Compile Error", 0);
|
|
|
- return false;
|
|
|
+ FileStream fileStream4 = new FileStream(text10, FileMode.Open);
|
|
|
+ if (fileStream4 == null)
|
|
|
+ {
|
|
|
+ NUty.WinMessageBox(NUty.GetWindowHandle(), "テクスチャが開けません。\n" + text10, "MOD Compile Error", 0);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ byte[] array7 = new byte[fileStream4.Length];
|
|
|
+ fileStream4.Read(array7, 0, (int)fileStream4.Length);
|
|
|
+ if (!dictionary.ContainsKey(Path.GetFileName(text10).ToLower()))
|
|
|
+ {
|
|
|
+ dictionary.Add(Path.GetFileName(text10).ToLower(), new EditMod.TexSet
|
|
|
+ {
|
|
|
+ nSize = (int)fileStream4.Length,
|
|
|
+ byData = array7
|
|
|
+ });
|
|
|
+ }
|
|
|
+ fileStream4.Close();
|
|
|
+ fileStream4.Dispose();
|
|
|
}
|
|
|
- byte[] array7 = new byte[fileStream4.Length];
|
|
|
- fileStream4.Read(array7, 0, (int)fileStream4.Length);
|
|
|
- if (!dictionary.ContainsKey(Path.GetFileName(text9).ToLower()))
|
|
|
+ catch (Exception ex4)
|
|
|
{
|
|
|
- dictionary.Add(Path.GetFileName(text9).ToLower(), new EditMod.TexSet
|
|
|
+ string path = Path.GetFileName(text10);
|
|
|
+ path = Path.ChangeExtension(path, ".tex");
|
|
|
+ string text11 = text8.ToLower();
|
|
|
+ if (!dictionary.ContainsKey(text11))
|
|
|
{
|
|
|
- nSize = (int)fileStream4.Length,
|
|
|
- byData = array7
|
|
|
- });
|
|
|
+ dictionary.Add(text11, new EditMod.TexSet
|
|
|
+ {
|
|
|
+ nSize = EditMod.dummyImg.Length,
|
|
|
+ byData = EditMod.dummyImg
|
|
|
+ });
|
|
|
+ Debug.Log("画像ファイルが付近に見つからなかったので、内部のファイルシステムから呼び出すことにします。" + text11);
|
|
|
+ }
|
|
|
}
|
|
|
- fileStream4.Close();
|
|
|
- fileStream4.Dispose();
|
|
|
}
|
|
|
}
|
|
|
foreach (string str in array2)
|
|
@@ -288,15 +326,15 @@ public class EditMod : MonoBehaviour
|
|
|
binaryWriter.Write(keyValuePair.Value.byData.Length);
|
|
|
binaryWriter.Write(keyValuePair.Value.byData);
|
|
|
}
|
|
|
- string text10 = Path.GetDirectoryName(f_strModMenu) + "\\_compiled\\";
|
|
|
- Directory.CreateDirectory(text10);
|
|
|
- text10 += Path.GetFileNameWithoutExtension(f_strModMenu);
|
|
|
- text10 += ".mod";
|
|
|
- File.WriteAllBytes(text10, memoryStream.ToArray());
|
|
|
+ string text12 = Path.GetDirectoryName(f_strModMenu) + "\\_compiled\\";
|
|
|
+ Directory.CreateDirectory(text12);
|
|
|
+ text12 += Path.GetFileNameWithoutExtension(f_strModMenu);
|
|
|
+ text12 += ".mod";
|
|
|
+ File.WriteAllBytes(text12, memoryStream.ToArray());
|
|
|
memoryStream.Close();
|
|
|
memoryStream.Dispose();
|
|
|
memoryStream = null;
|
|
|
- NUty.WinMessageBox(NUty.GetWindowHandle(), "MODコンパイル完了\n" + text10, "MOD Compile Completed", 0);
|
|
|
+ NUty.WinMessageBox(NUty.GetWindowHandle(), "MODコンパイル完了\n" + text12, "MOD Compile Completed", 0);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -340,6 +378,82 @@ public class EditMod : MonoBehaviour
|
|
|
|
|
|
private string m_strOutFileName = string.Empty;
|
|
|
|
|
|
+ public static readonly byte[] dummyImg = new byte[]
|
|
|
+ {
|
|
|
+ 137,
|
|
|
+ 80,
|
|
|
+ 78,
|
|
|
+ 71,
|
|
|
+ 13,
|
|
|
+ 10,
|
|
|
+ 26,
|
|
|
+ 10,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 13,
|
|
|
+ 73,
|
|
|
+ 72,
|
|
|
+ 68,
|
|
|
+ 82,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ 8,
|
|
|
+ 2,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 144,
|
|
|
+ 119,
|
|
|
+ 83,
|
|
|
+ 222,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 12,
|
|
|
+ 73,
|
|
|
+ 68,
|
|
|
+ 65,
|
|
|
+ 84,
|
|
|
+ 8,
|
|
|
+ 153,
|
|
|
+ 99,
|
|
|
+ 248,
|
|
|
+ byte.MaxValue,
|
|
|
+ byte.MaxValue,
|
|
|
+ 63,
|
|
|
+ 0,
|
|
|
+ 5,
|
|
|
+ 254,
|
|
|
+ 2,
|
|
|
+ 254,
|
|
|
+ 88,
|
|
|
+ 242,
|
|
|
+ 107,
|
|
|
+ 14,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 73,
|
|
|
+ 69,
|
|
|
+ 78,
|
|
|
+ 68,
|
|
|
+ 174,
|
|
|
+ 66,
|
|
|
+ 96,
|
|
|
+ 130,
|
|
|
+ 110,
|
|
|
+ 101,
|
|
|
+ 105
|
|
|
+ };
|
|
|
+
|
|
|
private bool bPush;
|
|
|
|
|
|
private enum MOD_MODE
|