public static int CompareName(RvFile var1, RvFile var2) { FileType f1 = var1.FileType; FileType f2 = var2.FileType; if (f1 == FileType.ZipFile || f2 == FileType.ZipFile) { if (f1 != f2) { ReportError.SendAndShow("Incompatible Compare type"); } return(Math.Sign(DatSort.TrrntZipStringCompare(var1.Name, var2.Name))); } if (f1 == FileType.SevenZipFile || f2 == FileType.SevenZipFile) { if (f1 != f2) { ReportError.SendAndShow("Incompatible Compare type"); } return(Math.Sign(DatSort.Trrnt7ZipStringCompare(var1.Name, var2.Name))); } int res = DatSort.TrrntZipStringCompare(var1.Name, var2.Name); if (res != 0) { return(res); } return(f1.CompareTo(f2)); }
private int CompareName(DatBase lName, DatBase dBase) { switch (DatFileType) { case DatFileType.UnSet: { int res = Math.Sign(string.Compare(lName.Name, dBase.Name, StringComparison.Ordinal)); if (res != 0) { return(res); } break; } case DatFileType.DirRVZip: case DatFileType.Dir: case DatFileType.DirTorrentZip: { int res = Math.Sign(DatSort.TrrntZipStringCompareCase(lName.Name, dBase.Name)); if (res != 0) { return(res); } break; } case DatFileType.Dir7Zip: { int res = Math.Sign(DatSort.Trrnt7ZipStringCompare(lName.Name, dBase.Name)); if (res != 0) { return(res); } break; } default: throw new InvalidOperationException("Invalid directory compare type " + DatFileType); } return(lName.DatFileType.CompareTo(dBase.DatFileType)); }
public static int CompareName(RvFile var1, RvFile var2) { FileType f1 = var1.FileType; FileType f2 = var2.FileType; int res = 0; if (f1 == FileType.ZipFile || f2 == FileType.ZipFile) { if (f1 != f2) { ReportError.SendAndShow("Incompatible Compare type"); } res = Math.Sign(DatSort.TrrntZipStringCompare(var1.Name, var2.Name)); return(res != 0 ? res : Math.Sign(string.Compare(var1.Name, var2.Name, StringComparison.Ordinal))); } if (f1 == FileType.SevenZipFile || f2 == FileType.SevenZipFile) { if (f1 != f2) { ReportError.SendAndShow("Incompatible Compare type"); } return(Math.Sign(DatSort.Trrnt7ZipStringCompare(var1.Name, var2.Name))); } res = DatSort.TrrntZipStringCompare(var1.Name, var2.Name); if (res != 0) { return(res); } #if ZipFile if (f1 == FileType.File && f2 == FileType.Zip) { f2 = FileType.File; } #endif return(f1.CompareTo(f2)); }