using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using XUnity.AutoTranslator.Plugin.Core.Endpoints; using XUnity.AutoTranslator.Plugin.Core.Endpoints.Http; using XUnity.AutoTranslator.Plugin.Core.Web; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("gravydevsupreme, Bepis, others at https://github.com/bbepis/XUnity.AutoTranslator")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2018 / MIT License")] [assembly: AssemblyFileVersion("5.6.1.0")] [assembly: AssemblyInformationalVersion("5.6.1+7f1f3b9e8fc7d93a97734773804ba9c8fdf57714")] [assembly: AssemblyProduct("CustomTranslate")] [assembly: AssemblyTitle("CustomTranslate")] [assembly: AssemblyVersion("5.6.1.0")] namespace CustomTranslate; internal class CustomTranslateEndpoint : HttpEndpoint { private static readonly string ServicePointTemplateUrl = "{0}?from={1}&to={2}&text={3}"; private string _endpoint; private string _friendlyName; private bool _enableShortDelay; private bool _disableSpamChecks; public override string Id => "CustomTranslate"; public override string FriendlyName => _friendlyName; public CustomTranslateEndpoint() { _friendlyName = "Custom"; } public override void Initialize(IInitializationContext context) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) _endpoint = context.GetOrCreateSetting("Custom", "Url", ""); _enableShortDelay = context.GetOrCreateSetting("Custom", "EnableShortDelay", false); _disableSpamChecks = context.GetOrCreateSetting("Custom", "DisableSpamChecks", false); if (string.IsNullOrEmpty(_endpoint)) { throw new EndpointInitializationException("The custom endpoint requires a url which has not been provided."); } Uri uri = new Uri(_endpoint); context.DisableCertificateChecksFor(new string[1] { uri.Host }); _friendlyName = _friendlyName + " (" + uri.Host + ")"; if (_enableShortDelay) { context.SetTranslationDelay(0.1f); } if (_disableSpamChecks) { context.DisableSpamChecks(); } } public override void OnCreateRequest(IHttpRequestCreationContext context) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown XUnityWebRequest val = new XUnityWebRequest(string.Format(ServicePointTemplateUrl, _endpoint, ((ITranslationContextBase)context).SourceLanguage, ((ITranslationContextBase)context).DestinationLanguage, Uri.EscapeDataString(((ITranslationContextBase)context).UntranslatedText))); context.Complete(val); } public override void OnExtractTranslation(IHttpTranslationExtractionContext context) { context.Complete(((IHttpResponseInspectionContext)context).Response.Data); } } internal static class GeneratedInfo { public const string PROJECT_VERSION = "5.6.1"; }