Skip to content

Commit 942df0d

Browse files
committed
Маленькие изменения, адаптированы боксы
1 parent 3946d12 commit 942df0d

File tree

1 file changed

+27
-72
lines changed

1 file changed

+27
-72
lines changed

rescript/Program.cs

Lines changed: 27 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public static void Main(string[] args) {
7575
Console.WriteLine("Not found file " + s);
7676
}
7777
break;
78-
} else if (s == "version") {
79-
Console.WriteLine("AuScript 3.0r by ix4Software | ReScript by etar125");
78+
} else if (s == "version" || s == "ver") {
79+
Console.WriteLine("AuScript 3.0r by ix4Software | ReScript 1.00 by etar125");
8080
Console.ReadKey();
8181
Environment.Exit(0);
8282
} else {
@@ -167,18 +167,14 @@ public static string ConvertS(string src) {
167167
} return src;
168168
}
169169
public static string ConvertV(string src) {
170-
if (src.StartsWith("$")) {
171-
string ofas = src.Remove(0, 1);
172-
if (vars.ContainsKey(ofas)) return vars[ofas];
173-
else {
174-
if (logs == true) {
175-
string text = "Not found variable " + ofas + "\n";
176-
File.AppendAllText(logf, text);
177-
}
178-
return "-0";
170+
if (vars.ContainsKey(src)) return vars[src];
171+
else {
172+
if (logs == true) {
173+
string text = "Not found variable " + src + "\n";
174+
File.AppendAllText(logf, text);
179175
}
176+
return "null";
180177
}
181-
return src;
182178
}
183179

184180
public static void oth(int stat)
@@ -1001,94 +997,53 @@ public static void oth(int stat)
1001997
string ofas3 = l[i].Remove(0, 8);
1002998
string sym = ConvertS(ofas3.Substring(0, ofas3.IndexOf(" ")));
1003999
string j = ofas3.Substring(ofas3.IndexOf(" ") + 1);
1004-
string froma = ConvertN(j.Substring(0, j.IndexOf("=")));
1000+
string froma = ConvertV(j.Substring(0, j.IndexOf("=")));
10051001
string to = j.Substring(j.IndexOf("=") + 1);
10061002
int va = froma.IndexOf(sym);
1007-
bool d = false;
1008-
for (int ch = 0; ch < vars.Count; ch++) {
1009-
if (vars[ch].StartsWith(to + "=")) {
1010-
vars[ch] = to + "=" + va;
1011-
d = true;
1012-
break;
1013-
}
1014-
}
1015-
if (!d) {
1016-
vars.Add(to + "=" + va);
1017-
}
1003+
if (vars.ContainsKey(to)) vars[to] = va.ToString();
1004+
else vars.Add(to, va.ToString());
10181005
} else {
10191006
if (logs == true) {
1020-
string texts = File.ReadAllText(logf);
1021-
texts += "Wrong command on line " + i.ToString() + ", text: " + l[i] + " *or end of custom???|";
1022-
File.WriteAllText(logf, texts);
1007+
string texts = "Wrong command on line " + i.ToString() + ", text: " + l[i] + " *or end of custom???\n";
1008+
File.AppendAllText(logf, texts);
10231009
}
10241010
}
10251011
}
10261012
catch
10271013
{
10281014
if (logs == true)
10291015
{
1030-
string texts = File.ReadAllText(logf);
1031-
texts += "Wrong command on line " + i.ToString() + ", text: " + l[i] + " *or end of custom??? or any error|";
1032-
File.WriteAllText(logf, texts);
1016+
string texts = "Wrong command on line " + i.ToString() + ", text: " + l[i] + " *or end of custom??? or any error\n";
1017+
File.AppendAllText(logf, texts);
10331018
}
10341019
}
10351020
}
10361021
}
10371022

1038-
public static double NextDouble(Random RandGenerator, double MinValue, double MaxValue)
1039-
{
1023+
public static double NextDouble(Random RandGenerator, double MinValue, double MaxValue) {
10401024
return RandGenerator.NextDouble() * (MaxValue - MinValue) + MinValue;
10411025
}
10421026

1043-
public static void MsgBoxClose(object sender, EventArgs e)
1044-
{
1027+
public static void MsgBoxClose(object sender, EventArgs e) {
10451028
msgbox.Close();
10461029
}
1047-
public static void InBoxClose(object sender, EventArgs e)
1048-
{
1030+
public static void InBoxClose(object sender, EventArgs e) {
10491031
string va = tb.Text;
1050-
bool d = false;
1051-
for (int ch = 0; ch < vars.Count; ch++)
1052-
{
1053-
if (vars[ch].StartsWith(invar + "="))
1054-
{
1055-
vars[ch] = invar + "=" + va;
1056-
d = true;
1057-
break;
1058-
}
1059-
}
1060-
if (!d)
1061-
{
1062-
vars.Add(invar + "=" + va);
1063-
}
1032+
if (vars.ContainsKey(invar)) vars[invar] = va;
1033+
else vars.Add(invar, va);
10641034
invar = "";
10651035
inbox.Close();
10661036
}
1067-
public static void ChBoxClose(object sender, EventArgs e)
1068-
{
1069-
try
1070-
{
1037+
public static void ChBoxClose(object sender, EventArgs e) {
1038+
try {
10711039
string va = lb.SelectedItem.ToString();
1072-
bool d = false;
1073-
for (int ch = 0; ch < vars.Count; ch++)
1074-
{
1075-
if (vars[ch].StartsWith(chvar + "="))
1076-
{
1077-
vars[ch] = chvar + "=" + va;
1078-
d = true;
1079-
break;
1080-
}
1081-
}
1082-
if (!d)
1083-
{
1084-
vars.Add(chvar + "=" + va);
1085-
}
1040+
if (vars.ContainsKey(chvar)) vars[chvar] = va;
1041+
else vars.Add(chvar, va);
10861042
chvar = "";
10871043
chbox.Close();
1088-
}
1089-
catch
1090-
{
1091-
1044+
} catch {
1045+
string texts = "ChooseBox error: no item selected maybe\n";
1046+
File.AppendAllText(logf, texts);
10921047
}
10931048
}
10941049
}

0 commit comments

Comments
 (0)