Skip to content

Commit e88de6e

Browse files
remove usings
1 parent 5faa0cb commit e88de6e

10 files changed

Lines changed: 98 additions & 109 deletions

File tree

Code/ArgumentSystem/Arguments/GeneratorsArgument.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using JetBrains.Annotations;
2-
using LabApi.Features.Enums;
32
using LabApi.Features.Wrappers;
4-
using MapGeneration;
53
using SER.Code.ArgumentSystem.BaseArguments;
64
using SER.Code.Extensions;
75
using SER.Code.Helpers.ResultSystem;

Code/ContextSystem/Contexts/ValueExpressionContext.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using SER.Code.ContextSystem.BaseContexts;
22
using SER.Code.ContextSystem.Structures;
33
using SER.Code.Exceptions;
4-
using SER.Code.Extensions;
54
using SER.Code.Helpers;
65
using SER.Code.Helpers.ResultSystem;
76
using SER.Code.MethodSystem.BaseMethods.Interfaces;

Code/ContextSystem/Contexts/VariableDefinition/ReferenceVariableDefinitionContext.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using SER.Code.VariableSystem.Variables;
66
using SER.Code.ValueSystem.PropertySystem;
77
using SER.Code.Helpers.ResultSystem;
8-
using System.Collections.Generic;
98
using SER.Code.Exceptions;
109

1110
namespace SER.Code.ContextSystem.Contexts.VariableDefinition;

Code/MethodSystem/Methods/BroadcastMethods/AnimatedBroadcastMethod.cs

Lines changed: 98 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -40,122 +40,122 @@ public override void Execute()
4040
public string AdditionalDescription =>
4141
"Uses CASSIE to make an animated broadcast - if there is CASSIE playing, it will be stopped. " +
4242
"Keep custom formatting to a minimum, this system is very limited.";
43-
}
44-
45-
public static class Helper
46-
{
47-
public static string FormatToRawCassieSubtitles(string text, int lineBreakLength)
48-
{
49-
var result = "";
50-
var index = 72;
51-
52-
foreach (var line in text.Split('\n'))
53-
{
54-
// Skip empty lines
55-
if (line.Length == 0)
56-
{
57-
index -= 1;
58-
continue;
59-
}
60-
61-
// Calculate actual length excluding HTML tags
62-
var len = CalculateTextLength(line);
63-
var parts = new List<string>();
64-
65-
// Split long lines
66-
if (len > lineBreakLength)
67-
{
68-
SplitLongLine(line, parts, lineBreakLength);
69-
}
70-
else
71-
{
72-
parts.Add(line);
73-
}
7443

75-
// Add all parts to result with proper formatting
76-
foreach (var part in parts)
77-
{
78-
index -= 1;
79-
result += FormatLine(part, index);
80-
}
81-
}
82-
83-
return result;
84-
}
85-
86-
private static int CalculateTextLength(string line)
44+
public static class Helper
8745
{
88-
var len = 0;
89-
var isTag = false;
90-
91-
foreach (var c in line)
46+
public static string FormatToRawCassieSubtitles(string text, int lineBreakLength)
9247
{
93-
switch (c)
48+
var result = "";
49+
var index = 72;
50+
51+
foreach (var line in text.Split('\n'))
9452
{
95-
case '<':
96-
isTag = true;
97-
continue;
98-
case '>':
99-
isTag = false;
53+
// Skip empty lines
54+
if (line.Length == 0)
55+
{
56+
index -= 1;
10057
continue;
58+
}
59+
60+
// Calculate actual length excluding HTML tags
61+
var len = CalculateTextLength(line);
62+
var parts = new List<string>();
63+
64+
// Split long lines
65+
if (len > lineBreakLength)
66+
{
67+
SplitLongLine(line, parts, lineBreakLength);
68+
}
69+
else
70+
{
71+
parts.Add(line);
72+
}
73+
74+
// Add all parts to result with proper formatting
75+
foreach (var part in parts)
76+
{
77+
index -= 1;
78+
result += FormatLine(part, index);
79+
}
10180
}
102-
103-
if (!isTag) len++;
81+
82+
return result;
10483
}
105-
106-
return len;
107-
}
108-
109-
private static void SplitLongLine(string line, List<string> parts, int lineBreakLength)
110-
{
111-
int? lastUnusedSpaceIndex = null;
11284

113-
for (var i = 0; i < line.Length; i++)
85+
private static int CalculateTextLength(string line)
11486
{
115-
if (!char.IsWhiteSpace(line[i])) continue;
116-
117-
if (i <= lineBreakLength)
87+
var len = 0;
88+
var isTag = false;
89+
90+
foreach (var c in line)
11891
{
119-
lastUnusedSpaceIndex = i;
120-
continue;
92+
switch (c)
93+
{
94+
case '<':
95+
isTag = true;
96+
continue;
97+
case '>':
98+
isTag = false;
99+
continue;
100+
}
101+
102+
if (!isTag) len++;
121103
}
104+
105+
return len;
106+
}
107+
108+
private static void SplitLongLine(string line, List<string> parts, int lineBreakLength)
109+
{
110+
int? lastUnusedSpaceIndex = null;
122111

123-
var lastAvailableSpaceIndex = lastUnusedSpaceIndex ?? i;
124-
var leftPart = line[..lastAvailableSpaceIndex].Trim();
125-
parts.Add(leftPart);
126-
127-
var rightPart = line[(lastAvailableSpaceIndex + 1)..].Trim();
128-
if (CalculateTextLength(rightPart) > lineBreakLength)
129-
{
130-
SplitLongLine(rightPart, parts, lineBreakLength);
131-
}
132-
else
112+
for (var i = 0; i < line.Length; i++)
133113
{
134-
parts.Add(rightPart);
114+
if (!char.IsWhiteSpace(line[i])) continue;
115+
116+
if (i <= lineBreakLength)
117+
{
118+
lastUnusedSpaceIndex = i;
119+
continue;
120+
}
121+
122+
var lastAvailableSpaceIndex = lastUnusedSpaceIndex ?? i;
123+
var leftPart = line[..lastAvailableSpaceIndex].Trim();
124+
parts.Add(leftPart);
125+
126+
var rightPart = line[(lastAvailableSpaceIndex + 1)..].Trim();
127+
if (CalculateTextLength(rightPart) > lineBreakLength)
128+
{
129+
SplitLongLine(rightPart, parts, lineBreakLength);
130+
}
131+
else
132+
{
133+
parts.Add(rightPart);
134+
}
135+
136+
return;
135137
}
136138

137-
return;
139+
parts.Add(line);
138140
}
139141

140-
parts.Add(line);
141-
}
142-
143-
private static string FormatLine(string text, int index)
144-
{
145-
return $"<voffset={index}em>{text}</voffset>\\n";
146-
}
142+
private static string FormatLine(string text, int index)
143+
{
144+
return $"<voffset={index}em>{text}</voffset>\\n";
145+
}
147146

148-
public static string FormatToCassieCentralScreenSubtitles(string text, int lineBreakLength)
149-
{
150-
return
151-
@"<line-height=2700>\n</line-height></size><align=center><size=30><line-height=0%>\n"
152-
+ FormatToRawCassieSubtitles(text, lineBreakLength);
153-
}
147+
public static string FormatToCassieCentralScreenSubtitles(string text, int lineBreakLength)
148+
{
149+
return
150+
@"<line-height=2700>\n</line-height></size><align=center><size=30><line-height=0%>\n"
151+
+ FormatToRawCassieSubtitles(text, lineBreakLength);
152+
}
154153

155-
// public static string FormatToCassieSpeechSubtitles(string text, bool addWaits)
156-
// {
157-
// return @"<line-height=3500>\n</line-height></size><align=left><size=25><line-height=0%>\n"
158-
// + FormatToRawCassieSubtitles(text);
159-
// }
154+
// public static string FormatToCassieSpeechSubtitles(string text, bool addWaits)
155+
// {
156+
// return @"<line-height=3500>\n</line-height></size><align=left><size=25><line-height=0%>\n"
157+
// + FormatToRawCassieSubtitles(text);
158+
// }
159+
}
160160
}
161161

Code/MethodSystem/Methods/DatabaseMethods/GetFromDBMethod.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using SER.Code.Exceptions;
55
using SER.Code.MethodSystem.BaseMethods.Synchronous;
66
using SER.Code.MethodSystem.MethodDescriptors;
7-
using SER.Code.ValueSystem;
87
using SER.Code.ValueSystem.Other;
98

109
namespace SER.Code.MethodSystem.Methods.DatabaseMethods;

Code/MethodSystem/Methods/PlayerDataMethods/GetPlayerDataMethod.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using SER.Code.Exceptions;
55
using SER.Code.MethodSystem.BaseMethods.Synchronous;
66
using SER.Code.MethodSystem.MethodDescriptors;
7-
using SER.Code.ValueSystem;
87
using SER.Code.ValueSystem.Other;
98

109
namespace SER.Code.MethodSystem.Methods.PlayerDataMethods;

Code/MethodSystem/Methods/VariableMethods/GetVariableByNameMethod.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using SER.Code.MethodSystem.MethodDescriptors;
77
using SER.Code.TokenSystem;
88
using SER.Code.TokenSystem.Tokens.VariableTokens;
9-
using SER.Code.ValueSystem;
109
using SER.Code.ValueSystem.Other;
1110
using SER.Code.VariableSystem;
1211
using SER.Code.VariableSystem.Bases;

Code/MethodSystem/Methods/VariableMethods/PopVariableMethod.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using SER.Code.ArgumentSystem.Arguments;
33
using SER.Code.ArgumentSystem.BaseArguments;
44
using SER.Code.MethodSystem.BaseMethods.Synchronous;
5-
using SER.Code.ValueSystem;
65
using SER.Code.ValueSystem.Other;
76
using SER.Code.VariableSystem;
87

Code/ValueSystem/PropertySystem/PropertyAccess.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
using SER.Code.Helpers.ResultSystem;
44
using SER.Code.TokenSystem.Tokens;
55
using SER.Code.TokenSystem.Tokens.Interfaces;
6-
using System.Collections.Generic;
7-
using System.Linq;
86
using SER.Code.ValueSystem.Other;
97

108
namespace SER.Code.ValueSystem.PropertySystem;

Code/ValueSystem/TextValue.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Text.RegularExpressions;
22
using JetBrains.Annotations;
3-
using SER.Code.Exceptions;
43
using SER.Code.Extensions;
54
using SER.Code.Helpers;
65
using SER.Code.Helpers.ResultSystem;

0 commit comments

Comments
 (0)