public PmxHeader(BinaryStream bs) { bs.ReadBytes(4); bs.ReadSingle(); bs.ReadByte(); if (bs.ReadByte() == 0) { bs.ChangeEncoding("UTF-16"); } else { bs.ChangeEncoding("UTF-8"); } AddUvCount = bs.ReadByte(); VertexIndexSize = bs.ReadByte(); TextureIndexSize = bs.ReadByte(); MaterialIndexSize = bs.ReadByte(); BoneIndexSize = bs.ReadByte(); MorphIndexSize = bs.ReadByte(); RigidIndexSize = bs.ReadByte(); }
public static List<LogData> GetCTESTWINLogList(string filePath) { List<LogData> tmp = new List<LogData>(); if(!IsCTESTWINLog(filePath)) { return null; } BinaryStream bs = new BinaryStream(); bs.ChangeEncoding("Shift-JIS"); bs.ReadOpen(filePath); try { ushort logNum = bs.GETUSHORT(); bs.GETCHAR(6); bs.GETCHAR(8); for(ushort i = 0;i < logNum;i++) { string call = bs.GETCHAR(CtestwinDefs.CallLen); string mycno = bs.GETCHAR(CtestwinDefs.NumLen); string opcno = bs.GETCHAR(CtestwinDefs.NumLen); string mode = ((ModeStr)bs.GETUSHORT()).ToString(); string freq = Freq.CnvTostr((FreqStr)bs.GETUSHORT()); bs.GETUSHORT(); bs.GETUSHORT(); DateTime date = CTimeToDate(bs.GETLONG()); string oprtr = bs.GETCHAR(CtestwinDefs.CallLen); bs.GETUSHORT(); string rem = bs.GETCHAR(CtestwinDefs.RemLen + 2); tmp.Add(new LogData { Date = date, Callsign = call, SentCn = mycno, ReceivedCn = opcno, Mode = mode, Freq = freq, Operator = oprtr, Rem = rem, Point = 1, IsSearched = false, IsFinded = true, }); } } catch(Exception e) { MessageBox.Show("ログファイル読み込みエラー\r\n" + e.Message, "通知"); return null; } return tmp; }
private static bool IsCTESTWINLog(string filePath) { BinaryStream bs = new BinaryStream(); bs.ChangeEncoding("Shift-JIS"); if(!bs.ReadOpen(filePath)) { return false; } try { bs.GETUSHORT(); bs.GETCHAR(6); if(bs.GETCHAR(8) != "CQsoData") return false; } catch { return false; } return true; }