本文整理汇总了C#中ME3Explorer.Unreal.PCCObject.saveToFile方法的典型用法代码示例。如果您正苦于以下问题:C# PCCObject.saveToFile方法的具体用法?C# PCCObject.saveToFile怎么用?C# PCCObject.saveToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ME3Explorer.Unreal.PCCObject
的用法示例。
在下文中一共展示了PCCObject.saveToFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: autoDecompressPcc
/*
* This method is called when using the -decompresspcc command line argument
*/
private int autoDecompressPcc(string sourceFile, string outputFile)
{
if (!File.Exists(sourceFile)){
MessageBox.Show("PCC to decompress does not exist:\n" + sourceFile, "Auto Decompression Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return 1;
}
System.Console.WriteLine("Automating Pcc Decompressor: " + sourceFile + " => " + outputFile);
PCCObject pccObj = new PCCObject(sourceFile);
pccObj.saveToFile(outputFile,false);
return 0;
}
示例2: buttonCompressPCC_Click
private void buttonCompressPCC_Click(object sender, EventArgs e)
{
if (openPccDialog.ShowDialog() == DialogResult.OK)
{
string fileName = openPccDialog.FileName;
string backupFile = fileName + ".bak";
if (File.Exists(fileName))
{
DialogResult dialogResult = MessageBox.Show("Do you want to make a backup file?", "Make Backup", MessageBoxButtons.YesNo);
try
{
if (dialogResult == DialogResult.Yes)
{
File.Copy(fileName, backupFile);
}
PCCObject pccObj = new PCCObject(fileName);
pccObj.saveToFile(true);
//PCCObject pccFile = new PCCObject();
//pccFile.LoadFile(fileName);
/*main function that compress the file
PCCHandler.CompressAndSave(pccFile.SaveFile(),fileName);*/
/*byte[] buffer;
using (FileStream inputStream = File.OpenRead(fileName))
{
buffer = new byte[inputStream.Length];
inputStream.Read(buffer, 0, buffer.Length);
}
if (dialogResult == DialogResult.Yes)
{
File.Copy(fileName, backupFile);
}
//main function that compress the file
PCCHandler.CompressAndSave(buffer,fileName);*/
MessageBox.Show("File " + Path.GetFileName(fileName) + " was successfully compressed.", "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception exc)
{
MessageBox.Show("An error occurred while compressing " + Path.GetFileName(fileName) + ":\n" + exc.Message, "Exception Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
//recovering backup file
if (File.Exists(backupFile))
{
File.Delete(fileName);
File.Move(backupFile, fileName);
}
}
}
}
}
示例3: buttonDecompressPCC_Click
private void buttonDecompressPCC_Click(object sender, EventArgs e)
{
if (openPccDialog.ShowDialog() == DialogResult.OK)
{
string fileName = openPccDialog.FileName;
string backupFile = fileName + ".bak";
if (File.Exists(fileName))
{
DialogResult dialogResult = MessageBox.Show("Do you want to make a backup file?", "Make Backup", MessageBoxButtons.YesNo);
try
{
if (dialogResult == DialogResult.Yes)
{
File.Copy(fileName, backupFile);
}
/*PCCObject pccObj = new PCCObject();
pccObj.LoadFile(fileName);
pccObj.SaveFile(fileName);*/
//main function that compress the file
/*byte[] buffer = PCCHandler.Decompress(fileName);
FileStream outputStream = new FileStream(fileName, FileMode.Create, FileAccess.Write);
outputStream.Write(buffer, 0, buffer.Length);
outputStream.Dispose();*/
PCCObject pccObj = new PCCObject(fileName);
pccObj.saveToFile(false);
MessageBox.Show("File " + Path.GetFileName(fileName) + " was successfully decompressed.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception exc)
{
MessageBox.Show("An error occurred while compressing " + Path.GetFileName(fileName) + ":\n" + exc.Message, "Exception Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
//recovering backup file
if (File.Exists(backupFile))
{
File.Delete(fileName);
File.Move(backupFile, fileName);
}
}
}
}
}