-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LanguageWeaver 2.0.2.1: SDLCOM-6140 - Language Weaver Provider plugin…
… throws an error after Studio was closed for several hours: "Authentication failed. Operation is not valid due to the current state of the object." * Add logging * Add more details to the exception message shown
- Loading branch information
Showing
7 changed files
with
423 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
using NLog; | ||
using NLog.Config; | ||
using NLog.Targets; | ||
|
||
namespace LanguageWeaverProvider | ||
{ | ||
public static class Log | ||
{ | ||
public static void Setup() | ||
{ | ||
LogManager.Configuration ??= new LoggingConfiguration(); | ||
|
||
var config = LogManager.Configuration; | ||
|
||
var logDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Trados AppStore", | ||
"Language Weaver", "Logs"); | ||
Directory.CreateDirectory(logDirectoryPath); | ||
|
||
var target = new FileTarget | ||
{ | ||
Name = "LanguageWeaver", | ||
FileName = Path.Combine(logDirectoryPath, "LanguageWeaverProvider.Logs.txt"), | ||
ArchiveEvery = FileArchivePeriod.Day, | ||
ArchiveNumbering = ArchiveNumberingMode.Date, | ||
Encoding = Encoding.UTF8, | ||
Layout = "${logger}: ${longdate} ${level} ${message} ${exception}" | ||
}; | ||
|
||
config.AddTarget(target); | ||
config.AddRuleForAllLevels(target, "*LanguageWeaverProvider*"); | ||
|
||
LogManager.ReconfigExistingLoggers(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
namespace LanguageWeaverProvider.Model | ||
{ | ||
public class CloudCredentials | ||
public class CloudCredentials | ||
{ | ||
public string AccountId { get; set; } | ||
public string AccountId { get; set; } | ||
|
||
public string AccountRegion { get; set; } | ||
public string AccountRegion { get; set; } | ||
|
||
public string UserName { get; set; } | ||
public string ClientID { get; set; } | ||
public string ClientSecret { get; set; } | ||
public string ConnectionCode { get; set; } | ||
public string UserName { get; set; } | ||
|
||
public string UserPassword { get; set; } | ||
public string UserPassword { get; set; } | ||
|
||
public string ClientID { get; set; } | ||
|
||
public string ClientSecret { get; set; } | ||
|
||
public string ConnectionCode { get; set; } | ||
public override string ToString() | ||
{ | ||
var password = string.IsNullOrWhiteSpace(UserPassword) ? "NULL" : "PRESENT"; | ||
var clientSecret = string.IsNullOrWhiteSpace(ClientSecret) ? "NULL" : "PRESENT"; | ||
return $"AccountId: {AccountId}, AccountRegion: {AccountRegion}, UserName: {UserName}, " + | ||
$"ClientID: {ClientID}, Password: {password}, ClientSecret: {clientSecret}, ConnectionCode: {ConnectionCode}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.