123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <#@ template debug="true" hostspecific="true" language="C#" #>
- <#@ assembly name="System.Core" #>
- <#@ assembly name="System.Data" #>
- <#@ import namespace="System.Linq" #>
- <#@ import namespace="System.Text" #>
- <#@ import namespace="System.Data" #>
- <#@ import namespace="System.Collections.Generic" #>
- <#@ assembly name="$(SolutionDir)\Lib\NPOI.dll" #>
- <#@ assembly name="$(SolutionDir)\Lib\ICSharpCode.SharpZipLib.dll" #>
- <#@ assembly name="$(SolutionDir)\Lib\SCADA.CommonCtrl.dll" #>
- <#@ import namespace="Microsoft.VisualStudio.TextTemplating"#>
- <#@include file="Manager.ttinclude"#>
- <# var manager = Manager.Create(Host, GenerationEnvironment);
- string solutionsPath = Host.ResolveAssemblyReference("$(SolutionDir)");
- string projectPath = Host.ResolveAssemblyReference("$(ProjectDir)");
- var dt=SCADA.CommonCtrl.ExcelHelper.GetImportDataTable(@$"{projectPath}语言文件.xlsx","语言文件",3); #>
- namespace SCADA_DAQ.Language
- {
- public class LanguageKeys
- {
- <#
- for(int j=0;j<dt.Rows.Count;j++){
- var key=dt.Rows[j][0]?.ToString();
- if(!string.IsNullOrEmpty(key))
- {
- var content=dt.Rows[j][1]?.ToString();
- if(!string.IsNullOrEmpty(content))
- {
- #>
- ///<summary><#=content#>
- ///</summary>
- public const string <#=key#> ="<#=key#>";
- <# }
- else
- {
- #>
- <# }
- }
- else
- {
- var ann=dt.Rows[j][1]?.ToString();
- if(!string.IsNullOrEmpty(ann))
- {
- #>
- <# }
- else
- {
- #>
- <#
- }
- }
- }
- #>
- }
- }
- <#
- for(int i=1;i<dt.Columns.Count;i++){
- string filename = dt.Columns[i].ColumnName.ToString()+".xaml";
- manager.StartNewFile(filename);
- #>
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:s="clr-namespace:System;assembly=mscorlib">
- <# for(int j=0;j<dt.Rows.Count;j++){
- var key=dt.Rows[j][0]?.ToString();
- if(!string.IsNullOrEmpty(key))
- {
- var content=dt.Rows[j][i]?.ToString();
- if(!string.IsNullOrEmpty(content))
- {
- #>
- <s:String x:Key="<#=key#>"><#=dt.Rows[j][i]#></s:String>
- <# }
- else
- {
- #>
- <# }
- }
- else
- {
- var ann=dt.Rows[j][1]?.ToString();
- if(!string.IsNullOrEmpty(ann))
- {
- #>
- <!--<#=ann#>-->
- <# }
- else
- {
- #>
- <#
- }
- }
- }#>
- </ResourceDictionary>
- <#
- manager.EndBlock();
- #>
- <#
- }
- #>
-
- <# manager.Process(true); #>
|