本文整理匯總了C#中ROMVault2.RvDB.RvDir.FileAdd方法的典型用法代碼示例。如果您正苦於以下問題:C# RvDir.FileAdd方法的具體用法?C# RvDir.FileAdd怎麽用?C# RvDir.FileAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ROMVault2.RvDB.RvDir
的用法示例。
在下文中一共展示了RvDir.FileAdd方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FixZip
//.........這裏部分代碼省略.........
}
#endregion
#region Process original Zip
string filename = fixZip.FullName;
if (File.Exists(filename))
{
if (!File.SetAttributes(filename, FileAttributes.Normal))
{
int error = Error.GetLastError();
ReportProgress(new bgwShowError(filename, "Error Setting File Attributes to Normal. Deleting Original Fix File. Code " + error));
}
try
{
File.Delete(filename);
}
catch (Exception)
{
int error = Error.GetLastError();
_error = "Error While trying to delete file " + filename + ". Code " + error;
if (tempZipOut != null && tempZipOut.ZipOpen != ZipOpenType.Closed)
tempZipOut.ZipFileClose();
return ReturnCode.RescanNeeded;
}
}
#endregion
bool checkDelete = false;
#region process the temp Zip rename it to the original Zip
if (tempZipOut != null && tempZipOut.ZipOpen != ZipOpenType.Closed)
{
string tempFilename = tempZipOut.ZipFilename;
tempZipOut.ZipFileClose();
if (tempZipOut.LocalFilesCount() > 0)
{
// now rename the temp fix file to the correct filename
File.Move(tempFilename, filename);
FileInfo nFile = new FileInfo(filename);
RvDir tmpZip = new RvDir(FileType.Zip)
{
Name = Path.GetFileNameWithoutExtension(filename),
TimeStamp = nFile.LastWriteTime
};
tmpZip.SetStatus(fixZip.DatStatus, GotStatus.Got);
fixZip.FileAdd(tmpZip);
fixZip.ZipStatus = tempZipOut.ZipStatus;
}
else
{
File.Delete(tempFilename);
checkDelete = true;
}
}
else
checkDelete = true;
#endregion
#region Now put the New Game Status information into the Database.
int intLoopFix = 0;
foreach (RvFile tmpZip in fixZipTemp)
{
tmpZip.CopyTo(fixZip.Child(intLoopFix));
if (fixZip.Child(intLoopFix).RepStatus == RepStatus.Deleted)
if (fixZip.Child(intLoopFix).FileRemove() == EFile.Delete)
{
fixZip.ChildRemove(intLoopFix);
continue;
}
intLoopFix++;
}
#endregion
if (checkDelete)
CheckDeleteObject(fixZip);
ReportError.LogOut("");
ReportError.LogOut("Zip File Status After Fix:");
for (int intLoop = 0; intLoop < fixZip.ChildCount; intLoop++)
ReportError.LogOut((RvFile)fixZip.Child(intLoop));
ReportError.LogOut("");
return ReturnCode.Good;
ZipOpenFailed:
if (tempZipOut != null) tempZipOut.ZipFileCloseFailed();
if (toSortZipOut != null) toSortZipOut.ZipFileCloseFailed();
if (toSortCorruptOut != null) toSortCorruptOut.ZipFileCloseFailed();
return returnCode;
}