Skip to content

Commit 79e8e09

Browse files
committed
Update Magicodes.IE.Tools
1 parent 08455fd commit 79e8e09

File tree

4 files changed

+37
-31
lines changed

4 files changed

+37
-31
lines changed

src/Magicodes.ExporterAndImporter.Tests/ExcelExporter_Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ public async Task AttrExportWithColFontColorData_Test()
10211021
}
10221022
}
10231023

1024-
[Fact(DisplayName = "Linux环境时导出JPG图片到Excel的测试", Timeout = 10000)]
1024+
[Fact(DisplayName = "Linux环境时导出JPG图片到Excel的测试", Timeout = 100000)]
10251025
public async Task ExportWithJPG_Test()
10261026
{
10271027
var imagePath = Path.Combine(Directory.GetCurrentDirectory(), "TestFiles", "Images", "zero-DPI.Jpeg");

src/Magicodes.IE.Tools/Magicodes.IE.Tools.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<PackageReference Include="Magicodes.IE.Excel" Version="2.7.4.2" />
3635
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.6" />
3736
</ItemGroup>
37+
3838
<ItemGroup>
3939
<ProjectReference Include="..\Magicodes.ExporterAndImporter.Excel\Magicodes.IE.Excel.csproj" />
4040
</ItemGroup>
41+
42+
<ItemGroup>
43+
<None Update="zero-DPI.Jpeg">
44+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
45+
</None>
46+
</ItemGroup>
4147
</Project>

src/Magicodes.IE.Tools/Program.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Magicodes.Benchmarks.Models;
99
using System.Threading.Tasks;
1010
using Magicodes.ExporterAndImporter.Excel.Utility;
11+
using System.Dynamic;
1112

1213
namespace Magicodes.IE.Tools
1314
{
@@ -16,45 +17,44 @@ internal class Program
1617
private readonly static List<ExportTestDataWithAttrs> _exportTestData = new List<ExportTestDataWithAttrs>();
1718
private static async Task Main(string[] args)
1819
{
19-
args = new string[] { "TEST" };
20-
//if (args.Length == 0)
21-
//{
22-
// var versionString = Assembly.GetEntryAssembly()
23-
// .GetCustomAttribute<AssemblyInformationalVersionAttribute>()
24-
// .InformationalVersion
25-
// .ToString();
20+
if (args.Length == 0)
21+
{
22+
var versionString = Assembly.GetEntryAssembly()
23+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
24+
.InformationalVersion
25+
.ToString();
2626

27-
// Console.WriteLine($"mie v{versionString}");
28-
// Console.WriteLine("-------------");
29-
// Console.WriteLine("\nGithub:");
30-
// Console.WriteLine(" https://github.com/dotnetcore/Magicodes.IE");
31-
// return;
32-
//}
33-
//else if (args.Any(p => "TEST".Equals(p, StringComparison.CurrentCultureIgnoreCase)))
34-
//{
35-
IExporter exporter = new ExcelExporter();
36-
var data = new List<ExportTestDataWithPicture>
27+
Console.WriteLine($"mie v{versionString}");
28+
Console.WriteLine("-------------");
29+
Console.WriteLine("\nGithub:");
30+
Console.WriteLine(" https://github.com/dotnetcore/Magicodes.IE");
31+
return;
32+
}
33+
else if (args.Any(p => "TEST".Equals(p, StringComparison.CurrentCultureIgnoreCase)))
34+
{
35+
ExcelExporter exporter = new ExcelExporter();
36+
var data = new List<ExportTestDataWithPicture>
3737
{
3838
new ExportTestDataWithPicture
3939
{
40-
Img = "C:\\Users\\hueifeng\\Pictures\\avatar.png",
41-
Text="张三"
40+
Img = Path.Combine(Directory.GetCurrentDirectory(), "zero-DPI.Jpeg"),
41+
Text ="张三"
4242
}
4343
};
4444

45-
Parallel.For(0, 100000, (i) =>
46-
{
47-
data.Add(new ExportTestDataWithPicture
45+
Parallel.For(0, 10, (i) =>
4846
{
49-
Img = "C:\\Users\\hueifeng\\Pictures\\avatar.png",
50-
Text = "张三"
47+
data.Add(new ExportTestDataWithPicture
48+
{
49+
Img = Path.Combine(Directory.GetCurrentDirectory(), "zero-DPI.Jpeg"),
50+
Text = "张三"
51+
});
5152
});
52-
});
5353

54-
var filePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "test.xlsx");
55-
var result = await exporter.Export("test.xlsx", data);
56-
Console.WriteLine($"导出成功:{filePath}!");
57-
// }
54+
var filePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "test.xlsx");
55+
var result = await exporter.Export("test.xlsx", data);
56+
Console.WriteLine($"导出成功:{filePath}!");
57+
}
5858
Console.WriteLine("完成");
5959
Console.ReadLine();
6060
}
2.18 KB
Loading

0 commit comments

Comments
 (0)