本文整理匯總了C#中ROMVault2.RvDB.RvDir類的典型用法代碼示例。如果您正苦於以下問題:C# RvDir類的具體用法?C# RvDir怎麽用?C# RvDir使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RvDir類屬於ROMVault2.RvDB命名空間,在下文中一共展示了RvDir類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LoadHeaderFromDat
private static bool LoadHeaderFromDat(ref RvDir tDir, ref XmlDocument doc)
{
XmlNodeList head = doc.SelectNodes("softwarelist");
if (head == null)
return false;
if (head.Count == 0)
return false;
if (head[0].Attributes == null)
return false;
RvDat tDat = new RvDat();
tDat.AddData(RvDat.DatData.DatName, VarFix.CleanFileName(head[0].Attributes.GetNamedItem("name")));
tDat.AddData(RvDat.DatData.Description, VarFix.String(head[0].Attributes.GetNamedItem("description")));
string val = VarFix.String(head[0].Attributes.GetNamedItem("forcemerging")).ToLower();
switch (val.ToLower())
{
case "split":
tDat.AddData(RvDat.DatData.MergeType, "split");
break;
case "full":
tDat.AddData(RvDat.DatData.MergeType, "full");
break;
default:
tDat.AddData(RvDat.DatData.MergeType, "split");
break;
}
tDir.Dat = tDat;
return true;
}
示例2: ReadMameDat
public static bool ReadMameDat(ref RvDir tDat, XmlDocument doc)
{
FileType thisFileType = FileType.Unknown;
if (!LoadMameHeaderFromDat(ref tDat, ref doc, ref thisFileType))
return false;
if (doc.DocumentElement == null)
return false;
XmlNodeList dirNodeList = doc.DocumentElement.SelectNodes("dir");
if (dirNodeList != null)
{
for (int i = 0; i < dirNodeList.Count; i++)
{
LoadDirFromDat(ref tDat, dirNodeList[i], thisFileType);
}
}
XmlNodeList gameNodeList = doc.DocumentElement.SelectNodes("game");
if (gameNodeList != null)
{
for (int i = 0; i < gameNodeList.Count; i++)
{
LoadGameFromDat(ref tDat, gameNodeList[i], thisFileType);
}
}
return true;
}
示例3: ReadDat
public static bool ReadDat(ref RvDir tDat, XmlDocument doc)
{
FileType thisFileType = FileType.Unknown;
if (!LoadHeaderFromDat(ref tDat, ref doc, ref thisFileType))
return false;
if (doc.DocumentElement == null)
return false;
XmlNodeList dirNodeList = doc.DocumentElement.SelectNodes("dir");
if (dirNodeList != null)
{
foreach (XmlNode dirNode in dirNodeList)
LoadDirFromDat(ref tDat, dirNode, thisFileType);
}
XmlNodeList gameNodeList = doc.DocumentElement.SelectNodes("game");
if (gameNodeList != null)
{
foreach (XmlNode gameNode in gameNodeList)
LoadGameFromDat(ref tDat, gameNode, thisFileType);
}
XmlNodeList machineNodeList = doc.DocumentElement.SelectNodes("machine");
if (machineNodeList != null)
{
foreach (XmlNode machineNode in machineNodeList)
LoadGameFromDat(ref tDat, machineNode, thisFileType);
}
return true;
}
示例4: ProcessDir
private static void ProcessDir(RvDir dir, int depth = 1)
{
string d = new string(' ', 4 * depth);
for (int i = 0; i < dir.ChildCount; i++)
{
RvDir game = dir.Child(i) as RvDir;
if (game != null && game.FileType == FileType.Zip)
{
WriteLine(d + "<game name=\"" + clean(game.Name) + "\">");
WriteLine(d + " <description>" + clean(game.Name) + "</description>");
for (int j = 0; j < game.ChildCount; j++)
{
RvFile file = game.Child(j) as RvFile;
if (file != null)
{
WriteLine(d + " <rom name=\"" + clean(file.Name) + "\" size=\"" + file.Size + "\" crc=\"" + Utils.ArrByte.ToString(file.CRC) + "\" md5=\"" + Utils.ArrByte.ToString(file.MD5) + "\" sha1=\"" + Utils.ArrByte.ToString(file.SHA1) + "\"/>");
}
}
WriteLine(d + "</game>");
}
if (game != null && game.FileType == FileType.Dir)
{
WriteLine(d + "<dir name=\"" + clean(game.Name) + "\">");
ProcessDir(game, depth + 1);
WriteLine(d + "</dir>");
}
}
}
示例5: WriteDatFile
private static void WriteDatFile(RvDir dir)
{
WriteLine("<?xml version=\"1.0\"?>");
WriteLine("");
WriteLine("<datafile>");
WriteHeader();
/* write Games/Dirs */
ProcessDir(dir);
WriteLine("</datafile>");
}
示例6: SetupTree
private void SetupTree(RvDir pTree, string pTreeBranches)
{
int nodeDepth = pTreeBranches.Length - 1;
pTree.Tree.TreeBranches = pTreeBranches;
pTree.Tree.RTree = new Rectangle(0, _yPos - 8, 1 + nodeDepth * 18, 16);
pTree.Tree.RExpand = new Rectangle(5 + nodeDepth * 18, _yPos + 4, 9, 9);
pTree.Tree.RChecked = new Rectangle(20 + nodeDepth * 18, _yPos + 2, 13, 13);
pTree.Tree.RIcon = new Rectangle(35 + nodeDepth * 18, _yPos, 16, 16);
pTree.Tree.RText = new Rectangle(51 + nodeDepth * 18, _yPos, 500, 16);
pTreeBranches = pTreeBranches.Replace("├", "│");
pTreeBranches = pTreeBranches.Replace("└", " ");
_yPos = _yPos + 16;
bool found = false;
int last = 0;
for (int i = 0; i < pTree.ChildCount; i++)
{
RvBase t = pTree.Child(i);
if (t is RvDir)
if (((RvDir)t).Tree != null)
{
found = true;
if (pTree.Tree.TreeExpanded)
last = i;
}
}
if (!found)
pTree.Tree.RExpand = new Rectangle(0, 0, 0, 0);
for (int i = 0; i < pTree.ChildCount; i++)
{
RvBase t = pTree.Child(i);
if (t is RvDir)
if (((RvDir)t).Tree != null)
{
if (pTree.Tree.TreeExpanded)
{
if (i != last)
SetupTree((RvDir)pTree.Child(i), pTreeBranches + "├");
else
SetupTree((RvDir)pTree.Child(i), pTreeBranches + "└");
}
}
}
}
示例7: MakeDatFromDir
public static void MakeDatFromDir(RvDir startingDir)
{
_datName = startingDir.Name;
_datDir = startingDir.Name;
Console.WriteLine("Creating Dat: " + startingDir.Name + ".dat");
_sw = new StreamWriter(startingDir.Name + ".dat");
WriteDatFile(startingDir);
_sw.Close();
Console.WriteLine("Dat creation complete");
}
示例8: GetSelectedDirList
private static void GetSelectedDirList(ref List<RvDir> lstDir, RvDir thisDir)
{
for (int i = 0; i < thisDir.ChildCount; i++)
{
if (thisDir.DatStatus != DatStatus.InDatCollect) continue;
RvDir tDir = thisDir.Child(i) as RvDir;
if (tDir == null) continue;
if (tDir.Tree == null) continue;
if (tDir.Tree.Checked == RvTreeRow.TreeSelect.Selected)
lstDir.Add(tDir);
GetSelectedDirList(ref lstDir, tDir);
}
}
示例9: Read
public static void Read(object sender, DoWorkEventArgs e)
{
Bgw = sender as BackgroundWorker;
Program.SyncCont = e.Argument as SynchronizationContext;
if (!File.Exists(Settings.CacheFile))
{
OpenDefaultDB();
Bgw = null;
Program.SyncCont = null;
return;
}
DirTree = new RvDir(FileType.Dir);
FileStream fs = new FileStream(Settings.CacheFile, FileMode.Open, FileAccess.Read);
if (fs.Length < 4)
ReportError.UnhandledExceptionHandler("Cache is Corrupt, revert to Backup.");
BinaryReader br = new BinaryReader(fs);
if (Bgw != null)
Bgw.ReportProgress(0, new bgwSetRange((int)fs.Length));
DBVersion.VersionNow = br.ReadInt32();
if (DBVersion.VersionNow != DBVersion.Version)
{
ReportError.Show(Resources.DB_Read_Data_Cache_version_is_out_of_date_you_should_now_rescan_your_dat_directory_and_roms_directory_);
OpenDefaultDB();
}
else
{
DirTree.Read(br, null);
}
if (fs.Position > fs.Length - 8)
ReportError.UnhandledExceptionHandler("Cache is Corrupt, revert to Backup.");
ulong testEOF = br.ReadUInt64();
if (testEOF != EndCacheMarker)
ReportError.UnhandledExceptionHandler("Cache is Corrupt, revert to Backup.");
br.Close();
fs.Close();
fs.Dispose();
Bgw = null;
Program.SyncCont = null;
}
示例10: ReadDat
public static bool ReadDat(ref RvDir tDat, XmlDocument doc)
{
if (!LoadHeaderFromDat(ref tDat, ref doc))
return false;
if (doc.DocumentElement == null)
return false;
XmlNodeList gameNodeList = doc.DocumentElement.SelectNodes("software");
if (gameNodeList == null)
return false;
for (int i = 0; i < gameNodeList.Count; i++)
{
LoadGameFromDat(ref tDat, gameNodeList[i]);
}
return true;
}
示例11: LoadDiskFromDat
private static void LoadDiskFromDat(ref RvDir tGame, XmlNode romNode)
{
if (romNode.Attributes == null)
return;
XmlNode name = romNode.Attributes.GetNamedItem("name");
RvFile tRom = new RvFile(FileType.File)
{
Name = VarFix.CleanFullFileName(name) + ".chd",
SHA1CHD = VarFix.CleanMD5SHA1(romNode.Attributes.GetNamedItem("sha1"), 40),
Status = VarFix.ToLower(romNode.Attributes.GetNamedItem("status")),
Dat = tGame.Dat
};
if (tRom.SHA1CHD != null) tRom.FileStatusSet(FileStatus.SHA1CHDFromDAT);
tGame.ChildAdd(tRom);
}
示例12: LoadHeaderFromDat
private static bool LoadHeaderFromDat(ref RvDir tDir, ref FileType thisFileType)
{
if (DatFileLoader.Next != "(")
{
DatUpdate.SendAndShowDat(Resources.DatCmpReader_LoadHeaderFromDat_not_found_after_clrmamepro, DatFileLoader.Filename);
return false;
}
DatFileLoader.Gn();
RvDat tDat = new RvDat();
while (DatFileLoader.Next != ")")
{
string nextstr = DatFileLoader.Next.ToLower();
if (nextstr.Length > 5 && nextstr.Substring(0, 5) == "name:")
{
tDat.AddData(RvDat.DatData.DatName, VarFix.CleanFileName(DatFileLoader.Next.Substring(5) + " " + DatFileLoader.GnRest()).Trim()); DatFileLoader.Gn();
}
else
{
switch (nextstr)
{
case "name:": tDat.AddData(RvDat.DatData.DatName, VarFix.CleanFileName(DatFileLoader.GnRest())); DatFileLoader.Gn(); break;
case "description:": tDat.AddData(RvDat.DatData.Description , DatFileLoader.GnRest()); DatFileLoader.Gn(); break;
case "version:": tDat.AddData(RvDat.DatData.Version , DatFileLoader.GnRest()); DatFileLoader.Gn(); break;
case "date:": tDat.AddData(RvDat.DatData.Date , DatFileLoader.GnRest()); DatFileLoader.Gn(); break;
case "author:": tDat.AddData(RvDat.DatData.Author , DatFileLoader.GnRest()); DatFileLoader.Gn(); break;
case "homepage:": tDat.AddData(RvDat.DatData.HomePage , DatFileLoader.GnRest()); DatFileLoader.Gn(); break;
case "comment:": DatFileLoader.GnRest(); DatFileLoader.Gn(); break;
default:
DatUpdate.SendAndShowDat(Resources.DatCmpReader_ReadDat_Error_keyword + DatFileLoader.Next + Resources.DatCmpReader_LoadHeaderFromDat_not_known_in_clrmamepro, DatFileLoader.Filename);
DatFileLoader.Gn();
break;
}
}
}
thisFileType = FileType.ZipFile;
tDir.Dat = tDat;
return true;
}
示例13: SetSelected
public void SetSelected(RvDir selected)
{
bool found = false;
RvDir t = selected;
while (t != null)
{
if (t.Tree != null)
{
if (!found)
{
_lSelected = t;
found = true;
}
else
t.Tree.TreeExpanded = true;
}
t = t.Parent;
}
SetupInt();
}
示例14: ReadDat
public static bool ReadDat(ref RvDir tDat, string strFilename)
{
RvDir tNow = tDat;
FileType thisFileType = FileType.Unknown;
int errorCode = DatFileLoader.LoadDat(strFilename);
if (errorCode != 0)
{
DatUpdate.ShowDat(new Win32Exception(errorCode).Message, strFilename);
return false;
}
DatFileLoader.Gn();
while (!DatFileLoader.EndOfStream())
{
switch (DatFileLoader.Next.ToLower())
{
case "doscenter":
_cleanFileNames = true;
DatFileLoader.Gn();
if (!LoadHeaderFromDat(ref tNow, ref thisFileType))
return false;
DatFileLoader.Gn();
break;
case "game":
DatFileLoader.Gn();
if (!LoadGameFromDat(ref tNow, thisFileType))
return false;
DatFileLoader.Gn();
break;
default:
DatUpdate.SendAndShowDat(Resources.DatCmpReader_ReadDat_Error_keyword + DatFileLoader.Next + Resources.DatCmpReader_ReadDat_not_known, DatFileLoader.Filename);
DatFileLoader.Gn();
break;
}
}
DatFileLoader.Close();
return true;
}
示例15: OpenDefaultDB
private static void OpenDefaultDB()
{
DirTree = new RvDir(FileType.Dir)
{
Tree = new RvTreeRow(),
DatStatus = DatStatus.InDatCollect
};
RvDir rv = new RvDir(FileType.Dir)
{
Name = "RomVault",
Tree = new RvTreeRow(),
DatStatus = DatStatus.InDatCollect
};
DirTree.ChildAdd(rv);
RvDir ts = new RvDir(FileType.Dir)
{
Name = "ToSort",
Tree = new RvTreeRow(),
DatStatus = DatStatus.InDatCollect
};
DirTree.ChildAdd(ts);
}