private static MegFileNameTable BuildFileNameTable(MegFileAttribute megFileAttribute) { List <string> actualFiles = new List <string>(); List <MegFileNameTableRecord> megFileNameList = new List <MegFileNameTableRecord>(); foreach (string file in megFileAttribute.ContentFiles) { try { string fileName = MegFileContentUtility.ExtractFileNameForMegFile(file); MegFileNameTableRecord megFileNameTableRecord = new MegFileNameTableRecord(fileName); megFileNameList.Add(megFileNameTableRecord); actualFiles.Add(file); } catch (Exception e) { Console.Error.WriteLine($"File {file} is invalid. {e}"); } } megFileAttribute.ContentFiles = actualFiles; return(new MegFileNameTable(megFileNameList)); }
private IEnumerable <MegFileDataEntry> CollectSortedMegFileDataEntries(MegFileHolder holder, MegFileNameTableRecord megFileNameTableRecord) { return(holder.Content.Where(megFileDataEntry => megFileNameTableRecord.FileName.Equals( megFileDataEntry.RelativeFilePath.Replace("\\", "/").Replace("\0", string.Empty), StringComparison.InvariantCultureIgnoreCase))); }
public void Ctor_Test__ThrowsOverflowException() { string fn = TestUtility.GetRandomStringOfLength(ushort.MaxValue + 5); MegFileNameTableRecord _ = new MegFileNameTableRecord(fn); }
public void Ctor_Test__ThrowsArgumentException(string fileName) { MegFileNameTableRecord _ = new MegFileNameTableRecord(fileName); }