static public Mpc GetMpc(string basePath, string fileName, string shdFileName) { if (string.IsNullOrEmpty(fileName)) { return(null); } try { var path = string.IsNullOrEmpty(basePath) ? fileName : Path.Combine(basePath, fileName); var pair = new KeyValuePair <string, string>(path, shdFileName); if (MpcFiles.ContainsKey(pair)) { return(MpcFiles[pair]); } else { var mpc = new Mpc(path, shdFileName); if (mpc.IsOk) { MpcFiles[pair] = mpc; return(mpc); } else { return(null); } } } catch (Exception) { return(null); } }
private void LoadMpc(byte[] buf, ref int offset) { offset = 192; for (var k = 0; k < 255; k++) { var mpcFileName = new byte[32]; var i = 0; for (; buf[offset + i] != 0; i++) { mpcFileName[i] = buf[offset + i]; } if (i == 0) { _mpcList.Add(null); } else { var mpc = new Mpc( _mpcDirPath + "\\" + Globals.LocalEncoding.GetString(mpcFileName, 0, i)); _mpcList.Add(mpc); if (buf[offset + 36] == 1) { _loopingList.Add(mpc); } } offset += 64; } offset = 16512; }