Skip to content

Commit

Permalink
添加 WriteToFile 公共方法
Browse files Browse the repository at this point in the history
  • Loading branch information
lc6464 committed Dec 12, 2023
1 parent fec9e11 commit 8248e56
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@ public static class Helpers {
}
return 0;
}

public static int WriteToFile<T>(Func<T, FileInfo, long> func, T input, string inputName, FileInfo output) {
Console.Write($"{inputName} -> {output.Name} ... ");
try {
func(input, output);
} catch {
Console.WriteLine("Failed.");
return 4;
}
Console.WriteLine("Done.");
return 0;
}
}

0 comments on commit 8248e56

Please sign in to comment.