* Make standardModules Dictionary instead of LanguageId usage * Create new common string constants for pascal language * Add LanguagesData class template * Move some compiler directive string constants to Compiler project * Extract LanguagesData class to separate file Also extracted RuntimeServiceModule (IO-modules) management to new functions. * Fix pabcnetc crashing (KeyNotFoundException) * Make similar change in pabcnetc_clear * Return PABCExtensions in DomConverter.cs * Return compiler string constants to Tree Converter * Rename MoveSystemUnitForward method * Rename system unit variable * Add new parser load error (localized versions) * Fix pascal language name constant * Add system units property to parsers * Add LanguageKits directory with a test file * Implement language integrator Был реализован загрузчик комплектов дополнительных языков (всех кроме Pascal). Был пересмотрен подход к реализации ParsersController и этот класс сделан синглтоном. Добавлена загрузка стандартных модулей языков в CompilerOptions. * Squashed commit of the following: commit8f9dc7e5a0Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Mon Mar 11 20:33:13 2024 +0300 fix #3050 commit90363ced45Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sun Mar 3 21:37:25 2024 +0300 Недобитки при сортировке строк commitc9d7ba7758Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Sat Mar 2 13:32:14 2024 +0300 Order и OrderDescending для строк с Ordinal commit6fbc0200bfAuthor: AlexanderZemlyak <92867056+AlexanderZemlyak@users.noreply.github.com> Date: Tue Feb 27 23:21:26 2024 +0300 Fix interface loop dependency check (#3047) Tests for problematic case were added commite4d63bfef9Author: bormant <bormant@mail.ru> Date: Tue Feb 27 23:18:25 2024 +0300 Fix typo: C (ru) -> C (en) (#3042) commit0d37232d21Author: Mikhalkovich Stanislav <miks@math.sfedu.ru> Date: Tue Feb 27 19:15:08 2024 +0300 School - исправление пустого диапазона простых и IP-адресов commit9fd4c7f338Merge:3cca2a896027083bAuthor: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:57:10 2024 +0100 Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet commit3cca2a8949Author: Ivan Bondarev <ibond84@googlemail.com> Date: Wed Feb 21 20:56:49 2024 +0100 fix in formatter
115 lines
4.2 KiB
C#
115 lines
4.2 KiB
C#
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
using Microsoft.Win32;
|
|
using PascalABCCompiler;
|
|
using PascalABCCompiler.TreeConverter;
|
|
|
|
namespace VisualPascalABC
|
|
{
|
|
public class Tools
|
|
{
|
|
public static string GetTextFromClipboard()
|
|
{
|
|
IDataObject dataObject = Clipboard.GetDataObject();
|
|
if (dataObject.GetDataPresent(DataFormats.Text))
|
|
{
|
|
// Yes it is, so display it in a text box.
|
|
return (string)dataObject.GetData(DataFormats.Text);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public static bool CopyTextToClipboard(string stringToCopy)
|
|
{
|
|
if (stringToCopy.Length > 0)
|
|
{
|
|
DataObject dataObject = new DataObject();
|
|
dataObject.SetData(DataFormats.UnicodeText, true, stringToCopy);
|
|
// Work around ExternalException bug. (SD2-426)
|
|
// Best reproducable inside Virtual PC.
|
|
try
|
|
{
|
|
Clipboard.SetDataObject(dataObject, true, 10, 50);
|
|
}
|
|
catch (ExternalException)
|
|
{
|
|
Application.DoEvents();
|
|
try
|
|
{
|
|
Clipboard.SetDataObject(dataObject, true, 10, 50);
|
|
}
|
|
catch (ExternalException) { }
|
|
}
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static string MakeFilter(string Filter, string Name, string[] Extensions)
|
|
{
|
|
string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";");
|
|
sf = string.Format(VECStringResources.Get("DIALOGS_FILTER_PART_{0}{1}|{1}|"), Name, sf);
|
|
if (sf.IndexOf(compiler_string_consts.pascalSourceFileExtension) >= 0)
|
|
return sf + Filter;
|
|
else
|
|
return Filter + sf;
|
|
|
|
}
|
|
|
|
public static string MakeProjectFilter(string Filter, string Name, string[] Extensions)
|
|
{
|
|
string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";");
|
|
sf = string.Format(VECStringResources.Get("DIALOGS_PROJECT_FILTER_PART_{0}{1}|{1}|"), Name, sf);
|
|
if (sf.IndexOf(".pabcproj") >= 0)
|
|
return sf + Filter;
|
|
else
|
|
return Filter + sf;
|
|
|
|
}
|
|
|
|
public static string MakeAllFilter(string AllFilter, string Name, string[] Extensions)
|
|
{
|
|
string sf = PascalABCCompiler.FormatTools.ExtensionsToString(Extensions, "*", ";");
|
|
sf += ";";
|
|
if (sf.IndexOf(".pas;") >= 0)
|
|
return sf + AllFilter;
|
|
else
|
|
return AllFilter + sf;
|
|
}
|
|
public static string FinishMakeFilter(string Filter, string AllFilter)
|
|
{
|
|
if (AllFilter != "")
|
|
AllFilter = AllFilter.Substring(0, AllFilter.Length - 1);
|
|
if (Filter != "")
|
|
Filter = string.Format(VECStringResources.Get("DIALOGS_FILTER_PARTALL_{0}|{0}|{1}"), AllFilter, Filter);
|
|
return Filter + VECStringResources.Get("DIALOGS_FILTER_ALLFILES") + " (*.*)|*.*";
|
|
}
|
|
|
|
public static string FileNameToLower(string FileName)
|
|
{
|
|
if (!Constants.FileNamesCaseSensetive)
|
|
return FileName.ToLower();
|
|
return FileName;
|
|
}
|
|
|
|
public static string GetRangeDescription(int selectedItem, int itemCount)
|
|
{
|
|
return string.Format(PascalABCCompiler.StringResources.Get("CODE_COMPLETION_{0}_FROM_{1}"), selectedItem, itemCount);
|
|
}
|
|
|
|
public static bool IsUnix()
|
|
{
|
|
return System.Environment.OSVersion.Platform == System.PlatformID.Unix || System.Environment.OSVersion.Platform == System.PlatformID.MacOSX;
|
|
}
|
|
}
|
|
}
|