Skip to content

Commit beb84bd

Browse files
committed
Merge branch 'UshakovMV_GUI'
2 parents 8181fbe + f6e56a2 commit beb84bd

26 files changed

+1264
-49
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.21005.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MossbauerLab.TinyTcpServer.MnGUI", "MossbauerLab.TinyTcpServer.MnGUI\MossbauerLab.TinyTcpServer.MnGUI.csproj", "{ECA495EA-1125-4FFC-BC2A-54EA06C74D80}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{ECA495EA-1125-4FFC-BC2A-54EA06C74D80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{ECA495EA-1125-4FFC-BC2A-54EA06C74D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{ECA495EA-1125-4FFC-BC2A-54EA06C74D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{ECA495EA-1125-4FFC-BC2A-54EA06C74D80}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
5+
</configSections>
6+
7+
<log4net>
8+
<appender name="Main" type="log4net.Appender.RollingFileAppender">
9+
<file type="log4net.Util.PatternString" value="MossbauerLab.TinyTcpServer.MnGUI.log" />
10+
<param name="rollingStyle" value="Size" />
11+
<param name="maximumFileSize" value="5MB" />
12+
<param name="appendtofile" value="true" />
13+
<param name="maxSizeRollBackups" value="3" />
14+
<param name="staticLogFileName" value="true" />
15+
<param name="datepattern" value="dd-MM-yyyy HH:mm" />
16+
<layout type="log4net.Layout.PatternLayout">
17+
<param name="conversionPattern" value="%date [%9.9thread] %-5level %message %newline" />
18+
</layout>
19+
<param name="Encoding" value="UTF-16" />
20+
</appender>
21+
22+
<logger name="MainLoggerSystem" additivity="false">
23+
<level value="ALL" />
24+
<appender-ref ref="Main" />
25+
</logger>
26+
27+
<root>
28+
<level value="ALL" />
29+
<appender-ref ref="Main" />
30+
</root>
31+
32+
</log4net>
33+
</configuration>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace MossbauerLab.TinyTcpServer.MnGUI.Data
4+
{
5+
[Flags]
6+
public enum ServerType
7+
{
8+
Echo,
9+
Time,
10+
Scripting // this option is for Server specifying with script
11+
}
12+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Drawing;
4+
using System.Windows.Forms;
5+
using log4net.Appender;
6+
using log4net.Core;
7+
8+
namespace MossbauerLab.TinyTcpServer.MnGUI.LogUtils
9+
{
10+
public class RichTextBoxAppender : MemoryAppender
11+
{
12+
public RichTextBoxAppender()
13+
{
14+
}
15+
16+
public RichTextBoxAppender(RichTextBox richTextBox, Int32 maximumRichTextBoxLinesQuantity = DefaultRichTextBoxLines)
17+
{
18+
if(richTextBox == null)
19+
throw new ArgumentNullException("richTextBox");
20+
_richTextBox = richTextBox;
21+
_richTextBox.BackColor = Color.Black;;
22+
_maximumRichTextBoxLinesQuantity = maximumRichTextBoxLinesQuantity;
23+
}
24+
25+
protected override void Append(LoggingEvent loggingEvent)
26+
{
27+
String logMessage = String.Format(LogMessageTemplate, loggingEvent.Level, loggingEvent.TimeStamp, loggingEvent.RenderedMessage);
28+
_richTextBox.BeginInvoke(new Action<RichTextBox>(richTextBox =>
29+
{
30+
richTextBox.AppendText(logMessage + Environment.NewLine);
31+
richTextBox.Select(richTextBox.TextLength - logMessage.Length, logMessage.Length);
32+
}), _richTextBox);
33+
ApplyRichTextBoxFont(loggingEvent.Level);
34+
if (_richTextBox.Lines.Length > _maximumRichTextBoxLinesQuantity)
35+
_richTextBox.Clear();
36+
base.Append(loggingEvent);
37+
}
38+
39+
private void ApplyRichTextBoxFont(Level level)
40+
{
41+
_richTextBox.BeginInvoke(new Action<RichTextBox>(richTextBox =>
42+
{
43+
Color richTextBoxTextColor = _richTextBoxLogsColors.ContainsKey(level) ? _richTextBoxLogsColors[level] : _defaultColor;
44+
richTextBox.SelectionColor = richTextBoxTextColor;
45+
richTextBox.SelectionFont = _defaultFont;
46+
}), _richTextBox);
47+
}
48+
49+
private const Int32 DefaultRichTextBoxLines = 10000;
50+
private const String DefaultFontFamily = "Times New Roman";
51+
private const float DefaultFontSize = 10.0f;
52+
private const String LogMessageTemplate = "[{0}] [{1}] : {2}";
53+
54+
private readonly Font _defaultFont = new Font(DefaultFontFamily, DefaultFontSize, FontStyle.Bold);
55+
private readonly Color _defaultColor = Color.Azure;
56+
private readonly RichTextBox _richTextBox;
57+
private readonly IDictionary<Level, Color> _richTextBoxLogsColors = new Dictionary<Level, Color>
58+
{
59+
{Level.Error, Color.OrangeRed},
60+
{Level.Warn, Color.Orange},
61+
{Level.Info, Color.LimeGreen},
62+
{Level.Debug, Color.Olive},
63+
{Level.All, Color.Azure}
64+
};
65+
66+
private readonly Int32 _maximumRichTextBoxLinesQuantity;
67+
}
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{ECA495EA-1125-4FFC-BC2A-54EA06C74D80}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>MossbauerLab.TinyTcpServer.MnGUI</RootNamespace>
11+
<AssemblyName>MossbauerLab.TinyTcpServer.MnGUI</AssemblyName>
12+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="log4net">
36+
<HintPath>..\lib\log4net.dll</HintPath>
37+
</Reference>
38+
<Reference Include="MossbauerLab.SimpleExtensions">
39+
<HintPath>..\lib\MossbauerLab.SimpleExtensions.dll</HintPath>
40+
</Reference>
41+
<Reference Include="MossbauerLab.TinyTcpServer.Core">
42+
<HintPath>..\lib\MossbauerLab.TinyTcpServer.Core.dll</HintPath>
43+
</Reference>
44+
<Reference Include="System" />
45+
<Reference Include="System.Core" />
46+
<Reference Include="System.Xml.Linq" />
47+
<Reference Include="System.Data.DataSetExtensions" />
48+
<Reference Include="Microsoft.CSharp" />
49+
<Reference Include="System.Data" />
50+
<Reference Include="System.Deployment" />
51+
<Reference Include="System.Drawing" />
52+
<Reference Include="System.Windows.Forms" />
53+
<Reference Include="System.Xml" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<Compile Include="Data\ServerType.cs" />
57+
<Compile Include="LogUtils\RichTextBoxAppender.cs" />
58+
<Compile Include="View\Forms\Factories\ServerFactory.cs" />
59+
<Compile Include="View\Helpers\ServerConfigInfoHelper.cs" />
60+
<Compile Include="View\Forms\MainForm.cs">
61+
<SubType>Form</SubType>
62+
</Compile>
63+
<Compile Include="View\Forms\MainForm.Designer.cs">
64+
<DependentUpon>MainForm.cs</DependentUpon>
65+
</Compile>
66+
<Compile Include="Program.cs" />
67+
<Compile Include="Properties\AssemblyInfo.cs" />
68+
<EmbeddedResource Include="View\Forms\MainForm.resx">
69+
<DependentUpon>MainForm.cs</DependentUpon>
70+
</EmbeddedResource>
71+
<EmbeddedResource Include="Properties\Resources.resx">
72+
<Generator>ResXFileCodeGenerator</Generator>
73+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
74+
<SubType>Designer</SubType>
75+
</EmbeddedResource>
76+
<Compile Include="Properties\Resources.Designer.cs">
77+
<AutoGen>True</AutoGen>
78+
<DependentUpon>Resources.resx</DependentUpon>
79+
</Compile>
80+
<None Include="App.config" />
81+
<None Include="Properties\Settings.settings">
82+
<Generator>SettingsSingleFileGenerator</Generator>
83+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
84+
</None>
85+
<Compile Include="Properties\Settings.Designer.cs">
86+
<AutoGen>True</AutoGen>
87+
<DependentUpon>Settings.settings</DependentUpon>
88+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
89+
</Compile>
90+
</ItemGroup>
91+
<ItemGroup />
92+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
93+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
94+
Other similar extension points exist, see Microsoft.Common.targets.
95+
<Target Name="BeforeBuild">
96+
</Target>
97+
<Target Name="AfterBuild">
98+
</Target>
99+
-->
100+
</Project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Windows.Forms;
3+
using MossbauerLab.TinyTcpServer.MnGUI.View.Forms;
4+
5+
namespace MossbauerLab.TinyTcpServer.MnGUI
6+
{
7+
static class Program
8+
{
9+
/// <summary>
10+
/// The main entry point for the application.
11+
/// </summary>
12+
[STAThread]
13+
static void Main(String[] args)
14+
{
15+
Application.EnableVisualStyles();
16+
Application.SetCompatibleTextRenderingDefault(false);
17+
Application.Run(new MainForm());
18+
}
19+
}
20+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("MossbauerLab.TinyTcpServer.MnGUI")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("DDGroup")]
12+
[assembly: AssemblyProduct("MossbauerLab.TinyTcpServer.MnGUI")]
13+
[assembly: AssemblyCopyright("Copyright © DDGroup 2017")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("cf1dcdc3-d468-4a81-ac05-48c5c175cae0")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

GUI/MossbauerLab.TinyTcpServer.MnGUI/MossbauerLab.TinyTcpServer.MnGUI/Properties/Resources.Designer.cs

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)