private static void SetMissingStatus(RvBase dbChild) { if (dbChild.FileRemove() == EFile.Delete) { ReportError.SendAndShow("Error is Set Mssing Status in DatUpdate"); return; } FileType ft = dbChild.FileType; if (ft == FileType.Zip || ft == FileType.Dir) { RvDir dbDir = (RvDir)dbChild; for (int i = 0; i < dbDir.ChildCount; i++) SetMissingStatus(dbDir.Child(i)); } }
private static void DBFileNotFound(RvBase dbChild, RvDir dbDir, ref int dbIndex) { if (dbChild == null) { ReportError.SendAndShow(Resources.FileScanning_CheckADir_Error_in_File_Scanning_Code); return; } if (dbChild.FileRemove() == EFile.Delete) dbDir.ChildRemove(dbIndex); else { switch (dbChild.FileType) { case FileType.Zip: MarkAsMissing((RvDir)dbChild); break; case FileType.Dir: RvDir tDir = (RvDir)dbChild; if (tDir.Tree == null) MarkAsMissing(tDir); break; } dbIndex++; } }
private static void CheckDeleteObject(RvBase tBase) { if (tBase.RepStatus == RepStatus.Deleted) return; // look at the directories childrens status's to figure out if the directory should be deleted. if (tBase.FileType == FileType.Dir) { RvDir tDir = tBase as RvDir; if (tDir == null || tDir.ChildCount != 0) return; // check if we are at the root of the tree so that we do not delete RomRoot and ToSort if (tDir.Parent == DB.DirTree) return; string fullPath = tDir.FullName; try { if (Directory.Exists(fullPath)) Directory.Delete(fullPath); } catch (Exception e) { //need to report this to an error window Debug.WriteLine(e.ToString()); } } // else check if this tBase should be removed from the DB if (tBase.FileRemove() == EFile.Delete) { RvDir parent = tBase.Parent; if (parent == null) { ReportError.UnhandledExceptionHandler("Item being deleted had no parent " + tBase.FullName); return; // this never happens as UnhandledException Terminates the program } int index; if (!parent.FindChild(tBase, out index)) { ReportError.UnhandledExceptionHandler("Could not find self in delete code " + parent.FullName); } parent.ChildRemove(index); CheckDeleteObject(parent); } }