本文整理汇总了C#中Ekona.sFile类的典型用法代码示例。如果您正苦于以下问题:C# sFile类的具体用法?C# sFile怎么用?C# sFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
sFile类属于Ekona命名空间,在下文中一共展示了sFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Unpack
public sFolder Unpack(sFile file)
{
if (file.name == "archiveDBK.dsa")
return Archive.Unpack_archiveDBK(pluginHost, file.path);
return new sFolder();
}
示例2: Show_Info
public Control Show_Info(sFile file)
{
if (file.name.ToUpper().EndsWith(".BIN"))
return new Bin(file.path, file.id, pluginHost, file.name).Get_Control();
return new Control();
}
示例3: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
if (file.name.ToUpper() == "ROMFILE.BIN")
return Format.Pack;
return Format.Unknown;
}
示例4: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
if (gameCode == "YDNJ" && file.id == 0x1)
return Format.Pack;
return Format.Unknown;
}
示例5: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
if (file.id >= 0x2F && file.id <= 0x93)
return Format.Pack;
return Format.Unknown;
}
示例6: Unpack
public sFolder Unpack(sFile file)
{
if (file.name.ToUpper().EndsWith(".DPK"))
return DPK.Unpack(file.path, pluginHost);
return new sFolder();
}
示例7: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
if (file.id == 0x461 || file.id == 0x462 || file.id == 0x45D || file.id == 0x45F)
return Format.Pack;
return Format.Unknown;
}
示例8: Unpack
public sFolder Unpack(sFile file)
{
if (file.name.ToUpper().EndsWith(".PACK"))
return PACK.Unpack(pluginHost, file.path);
return new sFolder();
}
示例9: Pack
public string Pack(ref sFolder unpacked, sFile file)
{
string fileOut = pluginHost.Get_TempFile();
PAC.Pack(file.path, fileOut, ref unpacked);
return fileOut;
}
示例10: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
string ext = new String(Encoding.ASCII.GetChars(magic));
if (ext == "sadl")
{
byte coding = pluginHost.Get_Bytes(file.path, (int)file.offset + 0x33, 1)[0];
if ((coding & 0xF0) == 0x70 || (coding & 0xF0) == 0xB0)
return Format.Sound;
}
if (file.name.ToUpper().EndsWith(".ADX"))
{
if (magic[0] != 0x80 || magic[1] != 00) // Constant
return Format.Unknown;
byte[] checkBytes = pluginHost.Get_Bytes(file.path, (int)file.offset + 4, 0xF); // Version and encoding flags
if (checkBytes[0] == 0x03 && (checkBytes[0xE] == 0x03 || checkBytes[0xE] == 0x04))
{
byte[] offset = { magic[3], magic[2] };
byte[] copyright = pluginHost.Get_Bytes(file.path, (int)file.offset + BitConverter.ToUInt16(offset, 0) - 2, 6);
if (new String(Encoding.ASCII.GetChars(copyright)) == "(c)CRI")
return Format.Sound;
}
}
return Format.Unknown;
}
示例11: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
if (file.name.EndsWith(".PACK"))
return Format.Compressed;
return Format.Unknown;
}
示例12: Decrypt
public static sFolder Decrypt(sFile item, int blockSize, IPluginHost pluginHost)
{
sFolder unpacked = new sFolder();
unpacked.files = new List<sFile>();
byte[] data = File.ReadAllBytes(item.path);
int numBlocks = data.Length / blockSize;
for (int i = 0; i < numBlocks; i++)
{
byte[] block = new byte[blockSize];
Array.Copy(data, i * blockSize, block, 0, blockSize);
Decrypt(ref block);
Array.Copy(block, 0, data, i * blockSize, blockSize);
}
string fileout = pluginHost.Get_TempFile();
File.WriteAllBytes(fileout, data);
sFile newItem = new sFile();
newItem.path = fileout;
newItem.offset = 0;
newItem.name = item.name;
newItem.size = (uint)data.Length;
unpacked.files.Add(newItem);
return unpacked;
}
示例13: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
if (Encoding.ASCII.GetString(magic) == MagicStamp)
return Format.Pack;
return Format.Unknown;
}
示例14: Unpack
public sFolder Unpack(sFile file)
{
if (file.id == 0x3F)
{
sFolder unpack = new sFolder();
unpack.files = new List<sFile>();
BinaryReader br = new BinaryReader(File.OpenRead(file.path));
uint fat_size = br.ReadUInt32();
uint num_files = fat_size / 4 - 1; // Include a ptr to the fat section
for (int i = 0; i < num_files; i++)
{
sFile cfile = new sFile();
cfile.name = "File" + i.ToString() + ".bin";
cfile.path = file.path;
br.BaseStream.Position = 8 + i * 4;
cfile.offset = br.ReadUInt32();
br.BaseStream.Position = cfile.offset;
cfile.size = br.ReadUInt32();
cfile.offset += 4;
unpack.files.Add(cfile);
}
br.Close();
br = null;
return unpack;
}
return new sFolder();
}
示例15: Get_Format
public Format Get_Format(sFile file, byte[] magic)
{
if (file.name.ToUpper().EndsWith(".DPK"))
return Format.Pack;
return Format.Unknown;
}