本文整理匯總了C#中ROMVault2.RvDB.RvDir.DirDatAdd方法的典型用法代碼示例。如果您正苦於以下問題:C# RvDir.DirDatAdd方法的具體用法?C# RvDir.DirDatAdd怎麽用?C# RvDir.DirDatAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ROMVault2.RvDB.RvDir
的用法示例。
在下文中一共展示了RvDir.DirDatAdd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UpdateDatFile
private static bool UpdateDatFile(RvDat file, bool autoAddDirectory, RvDir thisDirectory)
{
// Read the new Dat File into newDatFile
RvDir newDatFile = DatReader.ReadInDatFile(file, _bgw);
// If we got a valid Dat File back
if (newDatFile == null || newDatFile.Dat == null)
{
ReportError.Show("Error reading Dat " + file.GetData(RvDat.DatData.DatFullName));
return false;
}
newDatFile.Dat.AutoAddDirectory = autoAddDirectory;
if ((autoAddDirectory || !String.IsNullOrEmpty(newDatFile.Dat.GetData(RvDat.DatData.RootDir))) && newDatFile.Dat.GetData(RvDat.DatData.DirSetup)!= "noautodir")
{ // if we are auto adding extra directorys then create a new directory.
newDatFile.Name = !String.IsNullOrEmpty(newDatFile.Dat.GetData(RvDat.DatData.RootDir)) ?
newDatFile.Dat.GetData(RvDat.DatData.RootDir) : newDatFile.Dat.GetData(RvDat.DatData.DatName);
newDatFile.DatStatus = DatStatus.InDatCollect;
newDatFile.Tree = new RvTreeRow();
RvDir newDirectory = new RvDir(FileType.Dir) { Dat = newDatFile.Dat };
// add the DAT into this directory
newDirectory.ChildAdd(newDatFile);
newDatFile = newDirectory;
}
if (thisDirectory.Tree == null)
thisDirectory.Tree = new RvTreeRow();
RvDat conflictDat;
if (MergeInDat(thisDirectory, newDatFile, out conflictDat, true))
{
ReportError.Show("Dat Merge conflict occured Cache contains " + conflictDat.GetData(RvDat.DatData.DatFullName) + " new dat " + newDatFile.Dat.GetData(RvDat.DatData.DatFullName) + " is trying to use the same dirctory and so will be ignored.");
return false;
}
//SetInDat(thisDirectory);
// Add the new Dat
thisDirectory.DirDatAdd(newDatFile.Dat);
// Merge the files/directories in the Dat
MergeInDat(thisDirectory, newDatFile, out conflictDat, false);
return true;
}
示例2: RecursiveDatTree
private static bool RecursiveDatTree(RvDir tDir, out int datCount)
{
datCount = 0;
string strPath = tDir.DatFullName;
if (!Directory.Exists(strPath))
{
ReportError.Show(Resources.DatUpdate_UpdateDatList_Path + strPath + Resources.DatUpdate_UpdateDatList_Not_Found);
return false;
}
DirectoryInfo oDir = new DirectoryInfo(strPath);
FileInfo[] oFilesIn = oDir.GetFiles("*.dat", false);
datCount += oFilesIn.Length;
foreach (FileInfo file in oFilesIn)
{
RvDat tDat = new RvDat();
tDat.AddData(RvDat.DatData.DatFullName, file.FullName);
tDat.TimeStamp = file.LastWriteTime;
tDir.DirDatAdd(tDat);
}
oFilesIn = oDir.GetFiles("*.xml", false);
datCount += oFilesIn.Length;
foreach (FileInfo file in oFilesIn)
{
RvDat tDat = new RvDat();
tDat.AddData(RvDat.DatData.DatFullName, file.FullName);
tDat.TimeStamp = file.LastWriteTime;
tDir.DirDatAdd(tDat);
}
if (tDir.DirDatCount > 1)
for (int i = 0; i < tDir.DirDatCount; i++)
tDir.DirDat(i).AutoAddDirectory = true;
DirectoryInfo[] oSubDir = oDir.GetDirectories(false);
foreach (DirectoryInfo t in oSubDir)
{
RvDir cDir = new RvDir(FileType.Dir) { Name = t.Name, DatStatus = DatStatus.InDatCollect };
int index = tDir.ChildAdd(cDir);
int retDatCount;
RecursiveDatTree(cDir, out retDatCount);
datCount += retDatCount;
if (retDatCount == 0)
tDir.ChildRemove(index);
}
return true;
}