Skip to content
This repository was archived by the owner on May 21, 2022. It is now read-only.

Commit 1f03952

Browse files
committed
feat: filepath from cmd line
1 parent 547ec4f commit 1f03952

File tree

3 files changed

+52
-9
lines changed

3 files changed

+52
-9
lines changed

md2docx/TextTemplate.ico

42.4 KB
Binary file not shown.

md2docx/md2docx.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,20 @@ class Md2Docx
3737

3838
private static void Main(string[] args)
3939
{
40-
string md = System.IO.File.ReadAllText("test.md");
41-
string filePath = ("test.docx");
42-
Console.WriteLine(md);
43-
40+
string mdPath = "test.md";
41+
string filePath = "";
42+
if (args.Length > 0)
43+
{
44+
mdPath = args[0];
45+
}
46+
if (args.Length > 1)
47+
{
48+
filename = args[1];
49+
}
50+
string md = System.IO.File.ReadAllText(mdPath);
4451
MarkdownDocument mddoc = new MarkdownDocument();
4552
mddoc.Parse(md);
4653

47-
4854
foreach (var element in mddoc.Blocks)
4955
{
5056
if (element is YamlHeaderBlock yaml)
@@ -55,7 +61,10 @@ private static void Main(string[] args)
5561
department = yaml.Children["department"];
5662
filename = yaml.Children["filename"];
5763
clas = yaml.Children["class"];
58-
filePath = id + name + filename + ".docx";
64+
if (filePath == "")
65+
{
66+
filePath = id + name + filename + ".docx";
67+
}
5968

6069
if (yaml.Children.ContainsKey("e_abs"))
6170
{

md2docx/md2docx.csproj

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<Deterministic>true</Deterministic>
15+
<PublishUrl>publish\</PublishUrl>
16+
<Install>true</Install>
17+
<InstallFrom>Disk</InstallFrom>
18+
<UpdateEnabled>false</UpdateEnabled>
19+
<UpdateMode>Foreground</UpdateMode>
20+
<UpdateInterval>7</UpdateInterval>
21+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
22+
<UpdatePeriodically>false</UpdatePeriodically>
23+
<UpdateRequired>false</UpdateRequired>
24+
<MapFileExtensions>true</MapFileExtensions>
25+
<ApplicationRevision>0</ApplicationRevision>
26+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
27+
<IsWebBootstrapper>false</IsWebBootstrapper>
28+
<UseApplicationTrust>false</UseApplicationTrust>
29+
<BootstrapperEnabled>true</BootstrapperEnabled>
30+
<NuGetPackageImportStamp>
31+
</NuGetPackageImportStamp>
1532
</PropertyGroup>
1633
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1734
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -25,12 +42,15 @@
2542
</PropertyGroup>
2643
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2744
<PlatformTarget>AnyCPU</PlatformTarget>
28-
<DebugType>pdbonly</DebugType>
45+
<DebugType>none</DebugType>
2946
<Optimize>true</Optimize>
3047
<OutputPath>bin\Release\</OutputPath>
3148
<DefineConstants>TRACE</DefineConstants>
3249
<ErrorReport>prompt</ErrorReport>
33-
<WarningLevel>4</WarningLevel>
50+
<WarningLevel>1</WarningLevel>
51+
</PropertyGroup>
52+
<PropertyGroup>
53+
<ApplicationIcon>TextTemplate.ico</ApplicationIcon>
3454
</PropertyGroup>
3555
<ItemGroup>
3656
<None Include="App.config" />
@@ -44,11 +64,25 @@
4464
<Reference Include="Microsoft.Toolkit.Parsers, Version=5.1.0.0, Culture=neutral, PublicKeyToken=4aff67a105548ee2, processorArchitecture=MSIL">
4565
<HintPath>..\packages\Microsoft.Toolkit.Parsers.5.1.1\lib\netstandard2.0\Microsoft.Toolkit.Parsers.dll</HintPath>
4666
</Reference>
47-
<Reference Include="System.Xml" />
4867
<Reference Include="WindowsBase" />
4968
</ItemGroup>
5069
<ItemGroup>
5170
<Compile Include="md2docx.cs" />
5271
</ItemGroup>
72+
<ItemGroup>
73+
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
74+
<Visible>False</Visible>
75+
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
76+
<Install>true</Install>
77+
</BootstrapperPackage>
78+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
79+
<Visible>False</Visible>
80+
<ProductName>.NET Framework 3.5 SP1</ProductName>
81+
<Install>false</Install>
82+
</BootstrapperPackage>
83+
</ItemGroup>
84+
<ItemGroup>
85+
<Content Include="TextTemplate.ico" />
86+
</ItemGroup>
5387
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
5488
</Project>

0 commit comments

Comments
 (0)