Teacher Control Plugin - возможность задать server.dat
This commit is contained in:
parent
0848a1b796
commit
1bd21857cc
|
|
@ -12,6 +12,7 @@ namespace VisualPascalABCPlugins
|
|||
private const string LabelEntered = "Авторизация: ";
|
||||
private const string LabelNotEntered = "Авторизация: вход не выполнен";
|
||||
public static string StringsPrefix = "VPP_REGISTER_AND_CONTROL_PLUGIN_";
|
||||
public static string ServerAddress = "https://air.mmcs.sfedu.ru/pascalabc";
|
||||
IVisualEnvironmentCompiler VisualEnvironmentCompiler;
|
||||
|
||||
IWorkbench Workbench;
|
||||
|
|
@ -23,7 +24,7 @@ namespace VisualPascalABCPlugins
|
|||
private PluginGUIItem Item;
|
||||
public string Name { get => "Teacher Control Plugin"; }
|
||||
public string Version { get => "0.1"; }
|
||||
public string Copyright { get => "Copyright © 2021-2024 by Stanislav Mikhalkovich"; }
|
||||
public string Copyright { get => "Copyright © 2021-2025 by Stanislav Mikhalkovich"; }
|
||||
|
||||
public string Login = null;
|
||||
public string Password = null;
|
||||
|
|
@ -47,7 +48,9 @@ namespace VisualPascalABCPlugins
|
|||
if (IsLightPTInWorkingDirectory())
|
||||
{
|
||||
IsMechmath = System.Environment.MachineName.ToLower().StartsWith("mil8a-");
|
||||
User.ServAddr = "https://air.mmcs.sfedu.ru/pascalabc";
|
||||
// Попытаемся изменить ServerAddress если в папке есть server.dat
|
||||
TryChangeServerAddress(ref ServerAddress);
|
||||
User.ServAddr = ServerAddress;
|
||||
loginForm = new LoginForm(this);
|
||||
}
|
||||
// RegisterForm.VisualEnvironmentCompiler = VisualEnvironmentCompiler; // Пока форма регистрации никак не связана с компилятором
|
||||
|
|
@ -91,6 +94,26 @@ namespace VisualPascalABCPlugins
|
|||
return File.Exists(lightptname);
|
||||
}
|
||||
|
||||
public bool TryChangeServerAddress(ref string ServerAddress)
|
||||
{
|
||||
var WorkingDir = WorkingDirectory();
|
||||
var server_dat_name = Path.Combine(WorkingDir, "server.dat");
|
||||
if (File.Exists(server_dat_name))
|
||||
{
|
||||
try
|
||||
{
|
||||
ServerAddress = System.IO.File.ReadAllText(server_dat_name).Trim();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false; // не поменяли ServerName
|
||||
// погасить исключение
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public /*async*/ void TryLogin(string login, string pass)
|
||||
{
|
||||
// Гасим все исключения
|
||||
|
|
|
|||
|
|
@ -11587,7 +11587,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
/// Превращает последовательность в последовательность n-ок соседних элементов
|
||||
/// Превращает последовательность в последовательность массивов, содержащих n соседних элементов
|
||||
function Nwise<T>(Self: sequence of T; n: integer): sequence of array of T; extensionmethod;
|
||||
begin
|
||||
var chunk := new Queue<T>(n);
|
||||
|
|
|
|||
6
bin/Lng/Rus/RegisterAndControlPlugin.dat
Normal file
6
bin/Lng/Rus/RegisterAndControlPlugin.dat
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//Register and Control Plugin
|
||||
|
||||
%PREFIX%=VPP_REGISTER_AND_CONTROL_PLUGIN_
|
||||
NAME=Авторизация
|
||||
DESCRIPTION=Авторизация: вход не выполнен
|
||||
FORMNAME=Авторизация
|
||||
Loading…
Reference in a new issue