You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
958 B
38 lines
958 B
using System.Globalization;
|
|
using System.Text;
|
|
using ICU4N.Text;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Kynareth.Managers;
|
|
|
|
public class ImageModifier
|
|
{
|
|
protected static BreakIterator lineBreakIterator = BreakIterator.GetLineInstance(CultureInfo.InvariantCulture);
|
|
|
|
protected string GetText(string text)
|
|
{
|
|
StringBuilder newText = new();
|
|
|
|
// set the text to be broken
|
|
lineBreakIterator.SetText(text);
|
|
|
|
// get the first boundary
|
|
int start = lineBreakIterator.First();
|
|
|
|
// iterate over all boundaries
|
|
for (int end = lineBreakIterator.Next(); end != BreakIterator.Done; start = end, end = lineBreakIterator.Next())
|
|
{
|
|
// get the current line
|
|
string line = text.Substring(start, end - start);
|
|
|
|
// do something with the line
|
|
newText.AppendLine(line);
|
|
Console.WriteLine(line);
|
|
}
|
|
|
|
return newText.ToString();
|
|
}
|
|
|
|
protected ObjectResult GetResult(int statusCode, object data)
|
|
=> new(data) { StatusCode = statusCode };
|
|
} |