Директива {$Description 'FileDescription'}

This commit is contained in:
Kotov 2019-04-23 21:49:27 +03:00 committed by GitHub
parent e414042e8d
commit 953a2e70a0
10 changed files with 59 additions and 8 deletions

View file

@ -1923,13 +1923,18 @@ namespace PascalABCCompiler
{ {
cdo.Title = cds[0].directive; cdo.Title = cds[0].directive;
} }
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.description_string, out cds))
{
cdo.Description = cds[0].directive;
}
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.main_resource_string, out cds)) if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.main_resource_string, out cds))
{ {
if (compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.product_string) || if (compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.product_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.version_string) || compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.version_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.company_string) || compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.company_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.trademark_string) || compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.trademark_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.title_string)) compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.title_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.description_string))
{ {
ErrorsList.Add(new MainResourceNotAllowed(cds[0].location)); ErrorsList.Add(new MainResourceNotAllowed(cds[0].location));
} }
@ -1985,6 +1990,8 @@ namespace PascalABCCompiler
cdo.Copyright = project.copyright; cdo.Copyright = project.copyright;
if (!string.IsNullOrEmpty(project.title)) if (!string.IsNullOrEmpty(project.title))
cdo.Title = project.title; cdo.Title = project.title;
if (!string.IsNullOrEmpty(project.description))
cdo.Description = project.description;
if (!string.IsNullOrEmpty(project.app_icon) && false) if (!string.IsNullOrEmpty(project.app_icon) && false)
{ {
//cdo.MainResourceFileName = project.app_icon; //cdo.MainResourceFileName = project.app_icon;
@ -2009,7 +2016,7 @@ namespace PascalABCCompiler
sw.WriteLine("VALUE \"ProductName\"," + "\"" + cdo.Product + "\""); sw.WriteLine("VALUE \"ProductName\"," + "\"" + cdo.Product + "\"");
sw.WriteLine("VALUE \"FileVersion\"," + "\"" + ver + "\""); sw.WriteLine("VALUE \"FileVersion\"," + "\"" + ver + "\"");
sw.WriteLine("VALUE \"ProductVersion\"," + "\"" + ver + "\""); sw.WriteLine("VALUE \"ProductVersion\"," + "\"" + ver + "\"");
sw.WriteLine("VALUE \"FileDescription\"," + "\"" + "" + "\""); sw.WriteLine("VALUE \"FileDescription\"," + "\"" + cdo.Description + "\"");
sw.WriteLine("VALUE \"OriginalFileName\"," + "\"" + Path.GetFileName(CompilerOptions.OutputFileName) + "\""); sw.WriteLine("VALUE \"OriginalFileName\"," + "\"" + Path.GetFileName(CompilerOptions.OutputFileName) + "\"");
sw.WriteLine("VALUE \"InternalName\"," + "\"" + Path.GetFileNameWithoutExtension(CompilerOptions.OutputFileName) + "\""); sw.WriteLine("VALUE \"InternalName\"," + "\"" + Path.GetFileNameWithoutExtension(CompilerOptions.OutputFileName) + "\"");
sw.WriteLine("VALUE \"CompanyName\"," + "\"" + cdo.Company + "\""); sw.WriteLine("VALUE \"CompanyName\"," + "\"" + cdo.Company + "\"");

View file

@ -107,6 +107,12 @@ namespace PascalABCCompiler
set; set;
} }
string Description
{
get;
set;
}
string CommandLineArguments string CommandLineArguments
{ {
get; get;

View file

@ -30,7 +30,8 @@ namespace PascalABCCompiler
private string _trademark; private string _trademark;
private string _copyright; private string _copyright;
private string _title; private string _title;
private PascalABCCompiler.ProjectType _project_type; private string _description;
private PascalABCCompiler.ProjectType _project_type;
private List<SourceCodeFileInfo> _source_files = new List<SourceCodeFileInfo>(); private List<SourceCodeFileInfo> _source_files = new List<SourceCodeFileInfo>();
private List<ReferenceInfo> _references = new List<ReferenceInfo>(); private List<ReferenceInfo> _references = new List<ReferenceInfo>();
private List<ResourceInfo> _resources = new List<ResourceInfo>(); private List<ResourceInfo> _resources = new List<ResourceInfo>();
@ -203,6 +204,18 @@ namespace PascalABCCompiler
} }
} }
public string description
{
get
{
return _description;
}
set
{
_description = value;
}
}
public string path public string path
{ {
get get
@ -481,6 +494,7 @@ namespace PascalABCCompiler
writer.WriteAttributeString("Trademark", trademark); writer.WriteAttributeString("Trademark", trademark);
writer.WriteAttributeString("Copyright", copyright); writer.WriteAttributeString("Copyright", copyright);
writer.WriteAttributeString("Title", title); writer.WriteAttributeString("Title", title);
writer.WriteAttributeString("Description", description);
writer.WriteAttributeString("MajorVersion", Convert.ToString(major_version)); writer.WriteAttributeString("MajorVersion", Convert.ToString(major_version));
writer.WriteAttributeString("MinorVersion", Convert.ToString(minor_version)); writer.WriteAttributeString("MinorVersion", Convert.ToString(minor_version));
writer.WriteAttributeString("BuildVersion", Convert.ToString(build_version)); writer.WriteAttributeString("BuildVersion", Convert.ToString(build_version));
@ -547,7 +561,7 @@ namespace PascalABCCompiler
trademark = reader.GetAttribute("Trademark"); trademark = reader.GetAttribute("Trademark");
copyright = reader.GetAttribute("Copyright"); copyright = reader.GetAttribute("Copyright");
title = reader.GetAttribute("Title"); title = reader.GetAttribute("Title");
if (title == null) title = ""; //Проверка на null, так как раньше этого атрибута не было description = reader.GetAttribute("Description");
major_version = Convert.ToInt32(reader.GetAttribute("MajorVersion")); major_version = Convert.ToInt32(reader.GetAttribute("MajorVersion"));
minor_version = Convert.ToInt32(reader.GetAttribute("MinorVersion")); minor_version = Convert.ToInt32(reader.GetAttribute("MinorVersion"));
build_version = Convert.ToInt32(reader.GetAttribute("BuildVersion")); build_version = Convert.ToInt32(reader.GetAttribute("BuildVersion"));
@ -759,6 +773,18 @@ namespace PascalABCCompiler
_title = value; _title = value;
} }
} }
public string Description
{
get
{
return _description;
}
set
{
_description = value;
}
}
} }
public class SourceCodeFileInfo : PascalABCCompiler.IFileInfo public class SourceCodeFileInfo : PascalABCCompiler.IFileInfo

View file

@ -93,6 +93,13 @@ namespace PascalABCCompiler.NETGenerator
get { return _Title; } get { return _Title; }
set { _Title = value; NeedDefineVersionInfo = true; } set { _Title = value; NeedDefineVersionInfo = true; }
} }
private string _Description = "";
public string Description
{
get { return _Description; }
set { _Description = value; NeedDefineVersionInfo = true; }
}
public string MainResourceFileName = null; public string MainResourceFileName = null;
@ -905,6 +912,8 @@ namespace PascalABCCompiler.NETGenerator
ab.SetCustomAttribute(new CustomAttributeBuilder(typeof(System.Reflection.AssemblyTitleAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { options.Title })); ab.SetCustomAttribute(new CustomAttributeBuilder(typeof(System.Reflection.AssemblyTitleAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { options.Title }));
ab.SetCustomAttribute(new CustomAttributeBuilder(typeof(System.Reflection.AssemblyDescriptionAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { options.Description }));
if (RunOnly) if (RunOnly)
{ {
object main_class = ab.CreateInstance(cur_unit + ".Program"); object main_class = ab.CreateInstance(cur_unit + ".Program");

View file

@ -339,6 +339,7 @@ namespace PascalABCCompiler.TreeConverter
public static string trademark_string = "trademark"; public static string trademark_string = "trademark";
public static string main_resource_string = "mainresource"; public static string main_resource_string = "mainresource";
public static string title_string = "title"; public static string title_string = "title";
public static string description_string = "description";
public static string system_unit_marker = "__IS_SYSTEM_MODULE"; public static string system_unit_marker = "__IS_SYSTEM_MODULE";
public static string system_unit_file_name = "PABCSystem"; public static string system_unit_file_name = "PABCSystem";

View file

@ -470,6 +470,7 @@ namespace VisualPascalABC
private System.Windows.Forms.TextBox tbTradeMark; private System.Windows.Forms.TextBox tbTradeMark;
private System.Windows.Forms.TextBox tbCopyright; private System.Windows.Forms.TextBox tbCopyright;
//private System.Windows.Forms.TextBox tbTitle; //private System.Windows.Forms.TextBox tbTitle;
//private System.Windows.Forms.TextBox tbDescription;
private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label12;
private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;

View file

@ -79,7 +79,8 @@ namespace VisualPascalABC
prj.Company = this.tbCompany.Text; prj.Company = this.tbCompany.Text;
prj.Trademark = this.tbTradeMark.Text; prj.Trademark = this.tbTradeMark.Text;
prj.Copyright = this.tbCopyright.Text; prj.Copyright = this.tbCopyright.Text;
//prj.Title = this.tbTitle.Text; //if (!string.IsNullOrEmpty(prj.Title)) prj.Title = this.tbTitle.Text;
//if (!string.IsNullOrEmpty(prj.Description)) prj.Description = this.tbDescription.Text;
} }
private void ProjectProperties_FormClosing(object sender, FormClosingEventArgs e) private void ProjectProperties_FormClosing(object sender, FormClosingEventArgs e)

View file

@ -12,7 +12,7 @@ CYCLIC_UNIT_REFERENCE_WITH_UNIT_{0}=Cyclic unit reference with unit '{0}'
UNDEFINED_SEMANTIC_ERROR{0}=Undefined semantic error : {0} UNDEFINED_SEMANTIC_ERROR{0}=Undefined semantic error : {0}
RESOURCEFILE_{0}_NOT_FOUND=Resource file '{0}' not found RESOURCEFILE_{0}_NOT_FOUND=Resource file '{0}' not found
DUPLICATE_USES_UNIT{0}=Duplicate identifier '{0}' in uses section DUPLICATE_USES_UNIT{0}=Duplicate identifier '{0}' in uses section
MAINRESOURCE_NOT_ALLOWED=mainresource can not be used with the directives: product, version, company, trademark, title MAINRESOURCE_NOT_ALLOWED=mainresource can not be used with the directives: product, version, company, trademark, title, description
DUPLICATE_DIRECTIVE{0}=Duplicate directive {0} DUPLICATE_DIRECTIVE{0}=Duplicate directive {0}
FILE_{0}_NOT_FOUND=File '{0}' not found FILE_{0}_NOT_FOUND=File '{0}' not found

View file

@ -12,7 +12,7 @@ CYCLIC_UNIT_REFERENCE_WITH_UNIT_{0}=Циклическая связь с мод
UNDEFINED_SEMANTIC_ERROR{0}=Неопределенная семантическая ошибка : {0} UNDEFINED_SEMANTIC_ERROR{0}=Неопределенная семантическая ошибка : {0}
RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не найден RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не найден
DUPLICATE_USES_UNIT{0}=Повторное подключение модуля {0} в секции uses DUPLICATE_USES_UNIT{0}=Повторное подключение модуля {0} в секции uses
MAINRESOURCE_NOT_ALLOWED=Недопустимо совместное использование директивы mainresource и директив product, version, company, trademark, title MAINRESOURCE_NOT_ALLOWED=Недопустимо совместное использование директивы mainresource и директив product, version, company, trademark, title, description
DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0} DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0}
FILE_{0}_NOT_FOUND=Файл '{0}' не найден FILE_{0}_NOT_FOUND=Файл '{0}' не найден

View file

@ -12,7 +12,7 @@ CYCLIC_UNIT_REFERENCE_WITH_UNIT_{0}=Циклічний зв'язок з моду
UNDEFINED_SEMANTIC_ERROR{0}=Невизначена семантична помилка : {0} UNDEFINED_SEMANTIC_ERROR{0}=Невизначена семантична помилка : {0}
RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не знайдено RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не знайдено
DUPLICATE_USES_UNIT{0}=Повторне підключення модуля {0} в секції uses DUPLICATE_USES_UNIT{0}=Повторне підключення модуля {0} в секції uses
MAINRESOURCE_NOT_ALLOWED=Неприпустимо сумісне використання директиви mainresource і директив product, version, company, trademark, title MAINRESOURCE_NOT_ALLOWED=Неприпустимо сумісне використання директиви mainresource і директив product, version, company, trademark, title, description
DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0} DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0}
FILE_{0}_NOT_FOUND=Файл '{0}' не знайдено FILE_{0}_NOT_FOUND=Файл '{0}' не знайдено