diff --git a/MTApiService/ILMerge.props b/MTApiService/ILMerge.props new file mode 100755 index 00000000..08fa84c3 --- /dev/null +++ b/MTApiService/ILMerge.props @@ -0,0 +1,67 @@ + + + + + + + + + + + true + + + + + + + + + + + + MtApiKey.snk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MTApiService/ILMergeOrder.txt b/MTApiService/ILMergeOrder.txt new file mode 100755 index 00000000..c39ca3e4 --- /dev/null +++ b/MTApiService/ILMergeOrder.txt @@ -0,0 +1,4 @@ +# this file contains the partial list of the merged assemblies in the merge order +# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build +# and finetune merge order to your satisfaction + diff --git a/MTApiService/IMtApiServer.cs b/MTApiService/IMtApiServer.cs index 2962612b..d43e5a85 100755 --- a/MTApiService/IMtApiServer.cs +++ b/MTApiService/IMtApiServer.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; namespace MTApiService { public interface IMtApiServer { MtResponse SendCommand(MtCommand command); - IEnumerable GetQuotes(); + List GetQuotes(); } } diff --git a/MTApiService/LogConfigurator.cs b/MTApiService/LogConfigurator.cs new file mode 100755 index 00000000..ca1beef8 --- /dev/null +++ b/MTApiService/LogConfigurator.cs @@ -0,0 +1,55 @@ +using System; +using log4net; +using log4net.Appender; +using log4net.Core; +using log4net.Layout; +using log4net.Repository.Hierarchy; + +namespace MTApiService +{ + public class LogConfigurator + { + private const string LogFileNameExtension = "txt"; + + public static void Setup(string profileName) + { + if (string.IsNullOrEmpty(profileName)) + throw new ArgumentNullException(); + + var hierarchy = (Hierarchy) LogManager.GetRepository(); + + var patternLayout = new PatternLayout + { + ConversionPattern = "%date [%thread] %-5level %logger - %message%newline" + }; + patternLayout.ActivateOptions(); + + string filename = $"{DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss")}.{LogFileNameExtension}"; + + var roller = new RollingFileAppender + { + AppendToFile = false, + File = $@"{System.IO.Path.GetTempPath()}{profileName}\Logs\{filename}", + Layout = patternLayout, + PreserveLogFileNameExtension = true, + MaxSizeRollBackups = 5, + MaximumFileSize = "1GB", + RollingStyle = RollingFileAppender.RollingMode.Size, + StaticLogFileName = false + }; + roller.ActivateOptions(); + hierarchy.Root.AddAppender(roller); + + var memory = new MemoryAppender(); + memory.ActivateOptions(); + hierarchy.Root.AddAppender(memory); + +#if (DEBUG) + hierarchy.Root.Level = Level.Debug; +#else + hierarchy.Root.Level = Level.Info; +#endif + hierarchy.Configured = true; + } + } +} diff --git a/MTApiService/MTApiService.csproj b/MTApiService/MTApiService.csproj index ed103b9b..f27bbab7 100755 --- a/MTApiService/MTApiService.csproj +++ b/MTApiService/MTApiService.csproj @@ -1,5 +1,6 @@  + Debug AnyCPU @@ -14,6 +15,8 @@ 512 + + true @@ -35,12 +38,17 @@ AnyCPU - true + false - MtApiKey.pfx + + + + ..\packages\log4net.2.0.5\lib\net40-full\log4net.dll + True + @@ -54,6 +62,7 @@ + @@ -78,13 +87,28 @@ - + + Designer + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + +