Skip to content

Commit

Permalink
ツリー機能の修正
Browse files Browse the repository at this point in the history
  • Loading branch information
penguin117117 committed Aug 5, 2021
1 parent 3bb85e5 commit 999e96c
Show file tree
Hide file tree
Showing 16 changed files with 698 additions and 5,230 deletions.
9 changes: 5 additions & 4 deletions MSBT_Editor/FileSys/Calculation_System.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,11 @@ public static bool Tag06(BinaryReader br, FileStream fs, List<byte> list, byte b
break;
}
UTF16BE(tagstrs, list);
if(tagstrs.Length > 8)
Console.WriteLine("tagname "+tagstrs.Substring(1, 7));
if (tagstrs.Substring(1, 7) == "Unknown" && tagstrs.Length >8) Debugger.Unknowntagwriter(tagstrs);
if (tagstrs.Length > 8) {
Console.WriteLine("tagname " + tagstrs.Substring(1, 7));
if (tagstrs.Substring(1, 7) == "Unknown" && tagstrs.Length > 8) Debugger.Unknowntagwriter(tagstrs);
}

return true;
}
public static bool Tag07(BinaryReader br, FileStream fs, List<byte> list, byte bit5, byte bit6, byte bit7, byte bit8)
Expand Down Expand Up @@ -727,7 +729,6 @@ public static void Padding(BinaryReader br, long fs)
/// ファイルのパディング分バイナリライトを進めます<br/>
/// <remarks>Padding_Writer(進めたいバイナリライト、ファイルストリームの位置(ling型))</remarks>
/// </summary>
///
public static void Padding_Writer(BinaryWriter bw, long bw_pos)
{
int i = 0;
Expand Down
120 changes: 59 additions & 61 deletions MSBT_Editor/FileSys/Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,37 @@ public static void Open(int filenum) {
ofd.CheckPathExists = true;

if (ofd.ShowDialog() == DialogResult.OK){

FileCheck(ofd.FileName);

}



}

public static void SaveAs() {
if (Save_Path_Msbt == "None") {


private static bool SaveErrorMessage(string path) {
if (path == "None")
{
MessageBox.Show("ファイルを開くまたは保存先を指定してください", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
return true;
}
MSBT_Header msbth = new MSBT_Header();
msbth.Write(Save_Path_Msbt);
return false;
}

public static void Save(MSBT_Header MSBTH) {

var flag = SaveErrorMessage(Save_Path_Msbt);
if (flag) return;
MSBTH.Write(Save_Path_Msbt);
}

public static void SaveAs_Msbf()

public static void Save(MSBF_Header MSBFH)
{
if (Save_Path_Msbf == "None")
{
MessageBox.Show("ファイルを開くまたは保存先を指定してください", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
MSBF_Header msbfh = new MSBF_Header();
msbfh.Write(Save_Path_Msbf);
var flag = SaveErrorMessage(Save_Path_Msbf);
if (flag) return;
MSBFH.Write(Save_Path_Msbf);
}

public static void Save(int filenum)
public static void SaveAs(int filenum)
{
//SaveFileDialogクラスのインスタンスを作成
SaveFileDialog sfd = new SaveFileDialog();
Expand All @@ -90,7 +90,6 @@ public static void Save(int filenum)
MSBT_Header msbth = new MSBT_Header();
msbth.Write(sfd.FileName);
Save_Path_Msbt = sfd.FileName;
Console.WriteLine("MSBT_読み込み完了");
break;
case 2:
MSBF_Header msbfh = new MSBF_Header();
Expand Down Expand Up @@ -119,28 +118,27 @@ public static bool MSBF_Item_And_ListItem_Checker(Action action) {
MessageBox.Show("MSBFのFEN1の項目が設定されていません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
var msbf = action;
action();
return true;
}

public static bool MSBF_Item_And_ListItem_Checker(Action<int> action)
public static bool MSBT_Item_And_ListItem_Checker(Action action)
{
FLW2 flw2 = new FLW2();
FEN1 fen1 = new FEN1();

var list1_counter = list1.Items.Count == 0;
var msbt_all_item = MSBT_Data.MSBT_All_Data.Item == default;
var msbt_all_text = MSBT_Data.MSBT_All_Data.Text == default;

if (list2.Items.Count == 0 || (flw2.Item.Count == 0))
{
MessageBox.Show("MSBFのFLW2の項目が設定されていません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
if (list3.Items.Count == 0 || (fen1.Hashes.Count == 0) || (fen1.Item2.Count == 0))
{
MessageBox.Show("MSBFのFEN1の項目が設定されていません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (list1_counter|| (msbt_all_item) || msbt_all_text) {
MessageBox.Show("MSBTの項目が設定されていません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
var a =Convert.ToInt32(action.Method.GetParameters());
action(a);

var msbt = action;
action();
return true;
}

Expand All @@ -152,40 +150,40 @@ public static void FileCheck(string filepath)

var MSBF_File_Path = Path.ChangeExtension(filepath,"msbf");


if (file_flag == true)

if (file_flag == false) {
MessageBox.Show("ファイルが存在しません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
}



//拡張子の種類を判別
switch (File_Extension.ToLower())
{


//拡張子の種類を判別
switch (File_Extension.ToLower())
{
case ".msbt":
Save_Path_Msbt = filepath;
tssl2.Text = "";
MSBT_Header msbth = new MSBT_Header();
msbth.Read(filepath);
Console.WriteLine("MSBT_読み込み完了");
tssl2.Text = Path.GetFileName(filepath);
break;
case ".msbf":
Save_Path_Msbf = filepath;
tssl4.Text = "";
MSBF_Header msbfh = new MSBF_Header();
msbfh.Read(MSBF_File_Path);
Console.WriteLine("MSBF_読み込み完了");
tssl4.Text = Path.GetFileName(MSBF_File_Path);
break;
case ".msbt":
Save_Path_Msbt = filepath;
tssl2.Text = "";
MSBT_Header msbth = new MSBT_Header();
msbth.Read(filepath);
tssl2.Text = Path.GetFileName(filepath);
break;
case ".msbf":
Save_Path_Msbf = filepath;
tssl4.Text = "";
MSBF_Header msbfh = new MSBF_Header();
msbfh.Read(MSBF_File_Path);
tssl4.Text = Path.GetFileName(MSBF_File_Path);
break;

default:
MessageBox.Show("未対応のファイルです" + "\r\n" + "MSBTファイルのみ読み込めます", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
default:
MessageBox.Show("未対応のファイルです" + "\r\n" + "MSBTファイルのみ読み込めます", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;

}
}
else {
MessageBox.Show("ファイルが存在しません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
}




}
}
}
Loading

0 comments on commit 999e96c

Please sign in to comment.