Skip to content

Commit 03b6ac9

Browse files
committed
Further refactoring / reorganizing
1 parent 3ea2949 commit 03b6ac9

23 files changed

Lines changed: 107 additions & 116 deletions

SpeechResponder/CustomFunctions/Humanise.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Cottle;
22
using EddiSpeechResponder.ScriptResolverService;
3-
using EddiSpeechService;
3+
using EddiSpeechService.SpeechConversions;
44
using JetBrains.Annotations;
55
using System;
66

@@ -13,6 +13,6 @@ public class Humanise : ICustomFunction
1313
public FunctionCategory Category => FunctionCategory.Utility;
1414
public string description => Properties.CustomFunctions_Untranslated.Humanise;
1515
public Type ReturnType => typeof( string );
16-
public IFunction function => Function.CreateNative1( ( runtime, input, writer ) => Translations.Humanize( (decimal?)Convert.ToDecimal( input.AsNumber ) ) );
16+
public IFunction function => Function.CreateNative1( ( runtime, input, writer ) => SpeechConversions.Humanize( (decimal?)Convert.ToDecimal( input.AsNumber ) ) );
1717
}
1818
}

SpeechResponder/CustomFunctions/ICAO.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Cottle;
22
using EddiSpeechResponder.ScriptResolverService;
3-
using EddiSpeechService;
3+
using EddiSpeechService.SpeechConversions;
44
using JetBrains.Annotations;
55
using System;
66

@@ -20,7 +20,7 @@ public class ICAO : ICustomFunction
2020
if (string.IsNullOrEmpty(value)) { return ""; }
2121

2222
// Translate to ICAO, removing anything that isn't alphanumeric
23-
return Translations.ICAO( value.ToUpperInvariant().Replace( "[^A-Z0-9]", "" ) );
23+
return SpeechConversions.ICAO( value.ToUpperInvariant().Replace( "[^A-Z0-9]", "" ) );
2424
});
2525
}
2626
}

SpeechResponder/CustomFunctions/P.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Cottle;
22
using EddiSpeechResponder.ScriptResolverService;
33
using EddiSpeechService;
4+
using EddiSpeechService.SpeechConversions;
45
using JetBrains.Annotations;
56
using System;
67

@@ -18,7 +19,7 @@ public class P : ICustomFunction
1819
var val = values[0].AsString;
1920
var type = values.Count > 1 ? values[1].AsString : null;
2021
var useICAO = SpeechServiceConfiguration.FromFile().EnableIcao;
21-
return Translations.GetTranslation(val, useICAO, type);
22+
return SpeechConversions.GetTranslation(val, useICAO, type);
2223
}, 1, 2);
2324
}
2425
}

SpeechResponder/CustomFunctions/ShipCallsign.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using EddiCore;
44
using EddiDataDefinitions;
55
using EddiSpeechResponder.ScriptResolverService;
6-
using EddiSpeechService;
6+
using EddiSpeechService.SpeechConversions;
77
using JetBrains.Annotations;
88
using System;
99
using System.Linq;
@@ -102,7 +102,7 @@ internal static string phoneticCallsign(Ship ship, string id)
102102
private static string Get3LeadingCharacters(string input)
103103
{
104104
// Obtain the first three characters of the input string, zero padded and converted to ICAO (e.g. "A" becomes "Alpha Zero Zero")
105-
return Translations.ICAO(new Regex("[^a-zA-Z0-9]")
105+
return SpeechConversions.ICAO(new Regex("[^a-zA-Z0-9]")
106106
.Replace(input, "")
107107
.ToUpperInvariant()
108108
.PadRight(3, '0')

SpeechResponder/CustomFunctions/Spacialise.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Cottle;
22
using EddiSpeechResponder.ScriptResolverService;
33
using EddiSpeechService;
4+
using EddiSpeechService.SpeechConversions;
45
using JetBrains.Annotations;
56
using System;
67

@@ -17,7 +18,7 @@ public class Spacialise : ICustomFunction
1718
{
1819
if ( string.IsNullOrEmpty( input.AsString ) ) { return ""; }
1920
var useICAO = SpeechServiceConfiguration.FromFile().EnableIcao;
20-
return Translations.sayAsLettersOrNumbers( input.AsString, false, useICAO );
21+
return SpeechConversions.sayAsLettersOrNumbers( input.AsString, false, useICAO );
2122
});
2223
}
2324
}

SpeechService/Humanize.cs renamed to SpeechService/SpeechConversions/Humanize.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Globalization;
33
using Utilities;
44

5-
namespace EddiSpeechService
5+
namespace EddiSpeechService.SpeechConversions
66
{
7-
public static partial class Translations
7+
public static partial class SpeechConversions
88
{
99
/// <summary>
1010
/// Present a number's approximate value in a format suitable for text-to-speech

SpeechService/PhoneticBody.cs renamed to SpeechService/SpeechConversions/PhoneticBody.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System.Collections.Generic;
22
using System.Text.RegularExpressions;
33

4-
namespace EddiSpeechService
4+
namespace EddiSpeechService.SpeechConversions
55
{
6-
public static partial class Translations
6+
public static partial class SpeechConversions
77
{
88
/// <summary>Fix up body names</summary>
99
private static string getPhoneticBody(string body, bool useICAO = false)

SpeechService/PhoneticFaction.cs renamed to SpeechService/SpeechConversions/PhoneticFaction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.Generic;
22

3-
namespace EddiSpeechService
3+
namespace EddiSpeechService.SpeechConversions
44
{
5-
public static partial class Translations
5+
public static partial class SpeechConversions
66
{
77
// Fixes to avoid issues with some of the more strangely-named factions
88
private static readonly Dictionary<string, string> FACTION_FIXES = new Dictionary<string, string>()

SpeechService/PhoneticPlanetClass.cs renamed to SpeechService/SpeechConversions/PhoneticPlanetClass.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using EddiDataDefinitions;
22

3-
namespace EddiSpeechService
3+
namespace EddiSpeechService.SpeechConversions
44
{
5-
public static partial class Translations
5+
public static partial class SpeechConversions
66
{
77
public static string getPhoneticPlanetClass(string val)
88
{

SpeechService/PhoneticPower.cs renamed to SpeechService/SpeechConversions/PhoneticPower.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
namespace EddiSpeechService
1+
namespace EddiSpeechService.SpeechConversions
22
{
3-
public static partial class Translations
3+
public static partial class SpeechConversions
44
{
55
/// <summary>Fix up power names</summary>
66
public static string getPhoneticPower(string power)

0 commit comments

Comments
 (0)