v4.0 - Design Update - Needs fixes; Uploaded other related projects too.
This commit is contained in:
parent
a0ca8ad5a8
commit
88a421ff72
900 changed files with 32478 additions and 1011 deletions
22
Handwriting program/Handwriting program.sln
Normal file
22
Handwriting program/Handwriting program.sln
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2013 for Windows Desktop
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Handwriting program", "Handwriting program\Handwriting program.csproj", "{9DED0C68-3F97-4B14-88D8-F76A749F8943}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
Handwriting program/Handwriting program.v12.suo
Normal file
BIN
Handwriting program/Handwriting program.v12.suo
Normal file
Binary file not shown.
6
Handwriting program/Handwriting program/App.config
Normal file
6
Handwriting program/Handwriting program/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
112
Handwriting program/Handwriting program/Form1.Designer.cs
generated
Normal file
112
Handwriting program/Handwriting program/Form1.Designer.cs
generated
Normal file
|
@ -0,0 +1,112 @@
|
|||
namespace Handwriting_program
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.trackBar1 = new System.Windows.Forms.TrackBar();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.handwriting1 = new Handwriting_program.Handwriting();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// trackBar1
|
||||
//
|
||||
this.trackBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.trackBar1.LargeChange = 20;
|
||||
this.trackBar1.Location = new System.Drawing.Point(12, 198);
|
||||
this.trackBar1.Maximum = 100;
|
||||
this.trackBar1.Name = "trackBar1";
|
||||
this.trackBar1.Size = new System.Drawing.Size(260, 45);
|
||||
this.trackBar1.SmallChange = 10;
|
||||
this.trackBar1.TabIndex = 1;
|
||||
this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.Location = new System.Drawing.Point(12, 249);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(260, 23);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Clear";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// handwriting1
|
||||
//
|
||||
this.handwriting1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.handwriting1.Location = new System.Drawing.Point(60, 29);
|
||||
this.handwriting1.Name = "handwriting1";
|
||||
this.handwriting1.PaintColor = System.Drawing.Color.Black;
|
||||
this.handwriting1.PaintSize = 1;
|
||||
this.handwriting1.Size = new System.Drawing.Size(150, 154);
|
||||
this.handwriting1.TabIndex = 0;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button2.Location = new System.Drawing.Point(12, 278);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(260, 23);
|
||||
this.button2.TabIndex = 3;
|
||||
this.button2.Text = "Save";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 319);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.trackBar1);
|
||||
this.Controls.Add(this.handwriting1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Handwriting handwriting1;
|
||||
private System.Windows.Forms.TrackBar trackBar1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
||||
|
35
Handwriting program/Handwriting program/Form1.cs
Normal file
35
Handwriting program/Handwriting program/Form1.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Handwriting_program
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void trackBar1_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
handwriting1.PaintSize = trackBar1.Value;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
handwriting1.Clear();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
handwriting1.GetBitmap().Save("bmp.bmp");
|
||||
}
|
||||
}
|
||||
}
|
120
Handwriting program/Handwriting program/Form1.resx
Normal file
120
Handwriting program/Handwriting program/Form1.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9DED0C68-3F97-4B14-88D8-F76A749F8943}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Handwriting_program</RootNamespace>
|
||||
<AssemblyName>Handwriting program</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Handwriting.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Handwriting.Designer.cs">
|
||||
<DependentUpon>Handwriting.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Handwriting.resx">
|
||||
<DependentUpon>Handwriting.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\colorpicker.jpg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\erase.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
142
Handwriting program/Handwriting program/Handwriting.Designer.cs
generated
Normal file
142
Handwriting program/Handwriting program/Handwriting.Designer.cs
generated
Normal file
|
@ -0,0 +1,142 @@
|
|||
namespace Handwriting_program
|
||||
{
|
||||
partial class Handwriting
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.colorbtn = new System.Windows.Forms.Button();
|
||||
this.erasebtn = new System.Windows.Forms.Button();
|
||||
this.trackBar1 = new System.Windows.Forms.TrackBar();
|
||||
this.sendbtn = new System.Windows.Forms.Button();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.White;
|
||||
this.panel1.Cursor = System.Windows.Forms.Cursors.Cross;
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(439, 129);
|
||||
this.panel1.TabIndex = 0;
|
||||
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.Handwriting_Paint);
|
||||
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Handwriting_MouseDown);
|
||||
this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Handwriting_MouseUp);
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Controls.Add(this.colorbtn);
|
||||
this.flowLayoutPanel1.Controls.Add(this.erasebtn);
|
||||
this.flowLayoutPanel1.Controls.Add(this.trackBar1);
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 129);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(514, 40);
|
||||
this.flowLayoutPanel1.TabIndex = 1;
|
||||
//
|
||||
// colorbtn
|
||||
//
|
||||
this.colorbtn.FlatAppearance.BorderColor = System.Drawing.Color.Blue;
|
||||
this.colorbtn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Red;
|
||||
this.colorbtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Aqua;
|
||||
this.colorbtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.colorbtn.Image = global::Handwriting_program.Properties.Resources.colorpicker;
|
||||
this.colorbtn.Location = new System.Drawing.Point(3, 3);
|
||||
this.colorbtn.Name = "colorbtn";
|
||||
this.colorbtn.Size = new System.Drawing.Size(32, 32);
|
||||
this.colorbtn.TabIndex = 0;
|
||||
this.colorbtn.UseVisualStyleBackColor = false;
|
||||
this.colorbtn.Click += new System.EventHandler(this.colorbtn_Click);
|
||||
//
|
||||
// erasebtn
|
||||
//
|
||||
this.erasebtn.FlatAppearance.BorderColor = System.Drawing.Color.Blue;
|
||||
this.erasebtn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Red;
|
||||
this.erasebtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Aqua;
|
||||
this.erasebtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.erasebtn.Image = global::Handwriting_program.Properties.Resources.erase;
|
||||
this.erasebtn.Location = new System.Drawing.Point(41, 3);
|
||||
this.erasebtn.Name = "erasebtn";
|
||||
this.erasebtn.Size = new System.Drawing.Size(32, 32);
|
||||
this.erasebtn.TabIndex = 1;
|
||||
this.erasebtn.UseVisualStyleBackColor = true;
|
||||
this.erasebtn.Click += new System.EventHandler(this.erasebtn_Click);
|
||||
//
|
||||
// trackBar1
|
||||
//
|
||||
this.trackBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.trackBar1.Location = new System.Drawing.Point(79, 3);
|
||||
this.trackBar1.Maximum = 50;
|
||||
this.trackBar1.Name = "trackBar1";
|
||||
this.trackBar1.Size = new System.Drawing.Size(130, 45);
|
||||
this.trackBar1.TabIndex = 2;
|
||||
this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
|
||||
//
|
||||
// sendbtn
|
||||
//
|
||||
this.sendbtn.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.sendbtn.Location = new System.Drawing.Point(439, 0);
|
||||
this.sendbtn.Name = "sendbtn";
|
||||
this.sendbtn.Size = new System.Drawing.Size(75, 129);
|
||||
this.sendbtn.TabIndex = 2;
|
||||
this.sendbtn.Text = "send";
|
||||
this.sendbtn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Handwriting
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.sendbtn);
|
||||
this.Controls.Add(this.flowLayoutPanel1);
|
||||
this.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.Name = "Handwriting";
|
||||
this.Size = new System.Drawing.Size(514, 169);
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.flowLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.Button colorbtn;
|
||||
private System.Windows.Forms.Button erasebtn;
|
||||
private System.Windows.Forms.TrackBar trackBar1;
|
||||
public System.Windows.Forms.Button sendbtn;
|
||||
|
||||
}
|
||||
}
|
310
Handwriting program/Handwriting program/Handwriting.cs
Normal file
310
Handwriting program/Handwriting program/Handwriting.cs
Normal file
|
@ -0,0 +1,310 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace Handwriting_program
|
||||
{
|
||||
public partial class Handwriting : UserControl //2014.09.11-12.
|
||||
{
|
||||
public Handwriting()
|
||||
{
|
||||
InitializeComponent();
|
||||
/*pictureBox1.Image = new Bitmap(this.Width, this.Height);
|
||||
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;*/
|
||||
//pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
//this.ResizeRedraw = true;
|
||||
pen = new Pen(PaintColor, PaintSize);
|
||||
//pen.Brush = new SolidBrush(PaintColor);
|
||||
pen.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
|
||||
pen.StartCap = LineCap.Round;
|
||||
pen.EndCap = LineCap.Round;
|
||||
//gr = this.CreateGraphics();
|
||||
gr = panel1.CreateGraphics(); //2014.11.08.
|
||||
gr.SmoothingMode = SmoothingMode.HighQuality;
|
||||
thread = new Thread(new ThreadStart(ThreadFunc));
|
||||
thread.IsBackground = true;
|
||||
MainT = Thread.CurrentThread;
|
||||
thread.Start();
|
||||
//bmp = new Bitmap(this.Width, this.Height);
|
||||
//bmp = new Bitmap(panel1.Width, panel1.Height, PixelFormat.Format64bppArgb); //2014.11.08. - 2014.12.05. - PixelFormat
|
||||
bmp = new Bitmap(panel1.Width, panel1.Height);
|
||||
}
|
||||
|
||||
private Color paintcolor = Color.Black;
|
||||
public Color PaintColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return paintcolor;
|
||||
}
|
||||
set
|
||||
{
|
||||
paintcolor = value;
|
||||
//pen.Dispose();
|
||||
//pen = new Pen(PaintColor, PaintSize);
|
||||
pen.Color = value;
|
||||
}
|
||||
}
|
||||
private int paintsize = 1;
|
||||
public int PaintSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return paintsize;
|
||||
}
|
||||
set
|
||||
{
|
||||
paintsize = value;
|
||||
//pen.Dispose();
|
||||
//pen = new Pen(PaintColor, PaintSize);
|
||||
pen.Width = value;
|
||||
}
|
||||
}
|
||||
public bool Erase { get; set; }
|
||||
//private Timer timer = new Timer();
|
||||
//private Timer resizeT = new Timer();
|
||||
private Thread thread;
|
||||
//private bool resizing = false;
|
||||
private Pen pen;
|
||||
private Point prevp;
|
||||
private Graphics gr;
|
||||
private Graphics bmpgr;
|
||||
private Bitmap bmp;
|
||||
private bool drawing = false;
|
||||
private Thread MainT;
|
||||
private void Handwriting_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
/*timer.Interval = 100;
|
||||
timer.Tick += timer_Tick;
|
||||
timer.Start();*/
|
||||
drawing = true;
|
||||
}
|
||||
|
||||
//void timer_Tick(object sender, EventArgs e)
|
||||
void ThreadFunc()
|
||||
{
|
||||
while (MainT.IsAlive)
|
||||
{
|
||||
if (!drawing)
|
||||
{
|
||||
prevp = new Point();
|
||||
continue;
|
||||
}
|
||||
//GC.Collect();
|
||||
/*var bm = new Bitmap(pictureBox1.Image);
|
||||
Point p = pictureBox1.PointToClient(Cursor.Position);*/
|
||||
Point p = new Point();
|
||||
//this.Invoke(new Action(() => p = this.PointToClient(Cursor.Position)));
|
||||
this.Invoke(new Action(() => p = panel1.PointToClient(Cursor.Position))); //2014.11.08.
|
||||
//Graphics gr = this.CreateGraphics();
|
||||
//this.Invoke(new Action(() => gr = this.CreateGraphics()));
|
||||
this.Invoke(new Action(() => gr = panel1.CreateGraphics())); //2014.11.08.
|
||||
/*if (bmp != null)
|
||||
{
|
||||
bmp.Dispose();
|
||||
bmp = null;
|
||||
}
|
||||
bmp = new Bitmap(this.Width, this.Height);*/
|
||||
this.Invoke(new Action(() => bmpgr = Graphics.FromImage(bmp)));
|
||||
var tmppen = (Pen)pen.Clone();
|
||||
if (Erase)
|
||||
tmppen.Color = Color.White; //2014.11.08.
|
||||
gr.DrawLine(tmppen, p, ((prevp.X != 0 && prevp.Y != 0) ? prevp : p));
|
||||
//if (Erase)
|
||||
//tmppen.Color = Color.Transparent; //2014.11.08.
|
||||
//tmppen.Color = Color.Empty; //2014.12.05.
|
||||
bmpgr.DrawLine(tmppen, p, ((prevp.X != 0 && prevp.Y != 0) ? prevp : p));
|
||||
if (Erase)
|
||||
bmp.MakeTransparent(Color.White); //2014.12.05.
|
||||
prevp = p;
|
||||
//Bitmap tmpbmp = new Bitmap(this.Width, this.Height);
|
||||
//Bitmap tmpbmp = new Bitmap(panel1.Width, panel1.Height, PixelFormat.Format64bppArgb); //2014.11.08. - 2014.12.05. - PixelFormat
|
||||
Bitmap tmpbmp = new Bitmap(panel1.Width, panel1.Height);
|
||||
using (Graphics g = Graphics.FromImage(tmpbmp))
|
||||
//g.DrawImage(bmp, 0, 0, this.Width, this.Height);
|
||||
g.DrawImage(bmp, 0, 0, panel1.Width, panel1.Height); //2014.11.08.
|
||||
bmp.Dispose();
|
||||
bmp = tmpbmp;
|
||||
|
||||
/*if (bmp != null)
|
||||
{
|
||||
bmp.Dispose();
|
||||
bmp = null;
|
||||
}
|
||||
bmp = new Bitmap(this.Width, this.Height);
|
||||
this.Invoke(new Action(() => this.DrawToBitmap(bmp, new Rectangle(new Point(), this.Size))));*/
|
||||
GC.Collect();
|
||||
}
|
||||
/*if (p.X < 0 || p.X >= bm.Width || p.Y < 0 || p.Y >= bm.Height)
|
||||
return;
|
||||
for (int i = 0; i < PaintSize; i++)
|
||||
{
|
||||
*try { bm.SetPixel(p.X - i, p.Y - i, PaintColor); }
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
}*
|
||||
if (p.X - i >= 0 && p.Y - i >= 0)
|
||||
bm.SetPixel(p.X - i, p.Y - i, PaintColor);
|
||||
if (p.X - i >= 0 && p.Y + i < bm.Height)
|
||||
bm.SetPixel(p.X - i, p.Y + i, PaintColor);
|
||||
if (p.X + i < bm.Width && p.Y - i >= 0)
|
||||
bm.SetPixel(p.X + i, p.Y - i, PaintColor);
|
||||
if (p.X + i < bm.Width && p.Y + i < bm.Height)
|
||||
bm.SetPixel(p.X + i, p.Y + i, PaintColor);
|
||||
if (p.Y - i >= 0)
|
||||
bm.SetPixel(p.X, p.Y - i, PaintColor);
|
||||
if (p.Y + i < bm.Height)
|
||||
bm.SetPixel(p.X, p.Y + i, PaintColor);
|
||||
if (p.X - i >= 0)
|
||||
bm.SetPixel(p.X - i, p.Y, PaintColor);
|
||||
if (p.X + i < bm.Width)
|
||||
bm.SetPixel(p.X + i, p.Y, PaintColor);
|
||||
for (int j = 0; j < i; j++)
|
||||
{
|
||||
if (p.X - j >= 0 && p.Y + i < bm.Height)
|
||||
bm.SetPixel(p.X - j, p.Y + i, PaintColor);
|
||||
if (p.X + j < bm.Width && p.Y + i < bm.Height)
|
||||
bm.SetPixel(p.X + j, p.Y + i, PaintColor);
|
||||
if (p.X - j >= 0 && p.Y - i >= 0)
|
||||
bm.SetPixel(p.X - j, p.Y - i, PaintColor);
|
||||
if (p.X + j < bm.Width && p.Y - i >= 0)
|
||||
bm.SetPixel(p.X + j, p.Y - i, PaintColor);
|
||||
//}
|
||||
//for (int j = 0; j < i; j++)
|
||||
//{
|
||||
if (p.X - i >= 0 && p.Y + j < bm.Height)
|
||||
bm.SetPixel(p.X - i, p.Y + j, PaintColor);
|
||||
if (p.X + i < bm.Height && p.Y + j < bm.Height)
|
||||
bm.SetPixel(p.X + i, p.Y + j, PaintColor);
|
||||
if (p.X - i >= 0 && p.Y - j >= 0)
|
||||
bm.SetPixel(p.X - i, p.Y - j, PaintColor);
|
||||
if (p.X + i < bm.Width && p.Y - j >= 0)
|
||||
bm.SetPixel(p.X + i, p.Y - j, PaintColor);
|
||||
}
|
||||
}
|
||||
|
||||
pictureBox1.Image.Dispose();
|
||||
pctureBox1.Image = bm;*/
|
||||
}
|
||||
|
||||
private void Handwriting_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
//timer.Stop();
|
||||
drawing = false;
|
||||
|
||||
//prevp = null;
|
||||
prevp = new Point();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
//pictureBox1.Image = new Bitmap(this.Width, this.Height);
|
||||
//Graphics gr = this.CreateGraphics();
|
||||
//gr.Clear(this.BackColor);
|
||||
gr.Clear(panel1.BackColor); //2014.11.08.
|
||||
bmpgr = Graphics.FromImage(bmp);
|
||||
bmpgr.Clear(Color.Transparent);
|
||||
}
|
||||
|
||||
/*private void pictureBox1_Resize(object sender, EventArgs e)
|
||||
{
|
||||
if(!resizeT.Enabled)
|
||||
{
|
||||
resizeT.Interval = 100;
|
||||
resizeT.Tick += resizeT_Tick;
|
||||
resizeT.Start();
|
||||
}
|
||||
resizing = true;
|
||||
//pictureBox1.Size = this.Size;
|
||||
/*try
|
||||
{
|
||||
var tmp = pictureBox1.Image;
|
||||
pictureBox1.Image = new Bitmap(pictureBox1.Image, this.Size);
|
||||
tmp.Dispose();
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}*/
|
||||
//Refresh();
|
||||
//}
|
||||
|
||||
/*void resizeT_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (!resizing)
|
||||
{
|
||||
pictureBox1.Size = this.Size;
|
||||
try
|
||||
{
|
||||
var tmp = pictureBox1.Image;
|
||||
pictureBox1.Image = new Bitmap(pictureBox1.Image, this.Size);
|
||||
tmp.Dispose();
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
}
|
||||
Refresh();
|
||||
resizeT.Stop();
|
||||
}
|
||||
else
|
||||
resizing = false; //If true set it to false and if it doesn't turn back to true then the resizing is done
|
||||
}*/
|
||||
|
||||
public Bitmap GetBitmap()
|
||||
{
|
||||
/*var bmp = new Bitmap(this.Width, this.Height);
|
||||
this.DrawToBitmap(bmp, new Rectangle(new Point(), this.Size));*/
|
||||
return bmp;
|
||||
}
|
||||
|
||||
private void Handwriting_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
/*var bmp = new Bitmap(this.Width, this.Height);
|
||||
this.DrawToBitmap(bmp, new Rectangle(new Point(), this.Size));*/
|
||||
if (bmp != null)
|
||||
e.Graphics.DrawImage(bmp, new Point());
|
||||
}
|
||||
|
||||
private void colorbtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
var cpicker = new ColorDialog();
|
||||
if (cpicker.ShowDialog() == DialogResult.Cancel)
|
||||
return;
|
||||
PaintColor = cpicker.Color;
|
||||
}
|
||||
|
||||
private void erasebtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Erase)
|
||||
{
|
||||
Erase = false;
|
||||
//erasebtn.Text = "erase"; //Képekkel helyettesíteni
|
||||
erasebtn.FlatAppearance.BorderSize = 1; //2014.11.08.
|
||||
}
|
||||
else
|
||||
{
|
||||
Erase = true;
|
||||
//erasebtn.Text = "draw"; //Képekkel helyettesíteni
|
||||
erasebtn.FlatAppearance.BorderSize = 3; //2014.11.08.
|
||||
}
|
||||
}
|
||||
|
||||
private void trackBar1_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
pen.Width = trackBar1.Value;
|
||||
}
|
||||
|
||||
/*private void Handwriting_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
Handwriting_MouseUp(sender, e);
|
||||
}*/
|
||||
}
|
||||
}
|
120
Handwriting program/Handwriting program/Handwriting.resx
Normal file
120
Handwriting program/Handwriting program/Handwriting.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
22
Handwriting program/Handwriting program/Program.cs
Normal file
22
Handwriting program/Handwriting program/Program.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Handwriting_program
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Handwriting program")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Handwriting program")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("ca0951cd-7f48-49c9-ab87-0efba0a54df8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
83
Handwriting program/Handwriting program/Properties/Resources.Designer.cs
generated
Normal file
83
Handwriting program/Handwriting program/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,83 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18444
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Handwriting_program.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Handwriting_program.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap colorpicker {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("colorpicker", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap erase {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("erase", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="colorpicker" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\colorpicker.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="erase" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\erase.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
30
Handwriting program/Handwriting program/Properties/Settings.Designer.cs
generated
Normal file
30
Handwriting program/Handwriting program/Properties/Settings.Designer.cs
generated
Normal file
|
@ -0,0 +1,30 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18444
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Handwriting_program.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
Handwriting program/Handwriting program/Resources/erase.png
Normal file
BIN
Handwriting program/Handwriting program/Resources/erase.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,19 @@
|
|||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\bin\Debug\Handwriting program.pdb
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\obj\Debug\Handwriting_program.Form1.resources
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\obj\Debug\Handwriting_program.Handwriting.resources
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\obj\Debug\Handwriting_program.Properties.Resources.resources
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\obj\Debug\Handwriting program.csproj.GenerateResource.Cache
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\obj\Debug\Handwriting program.pdb
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\bin\Debug\Handwriting program.dll.config
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\bin\Debug\Handwriting program.dll
|
||||
D:\Z - Norbi cucca\0 Projektek\Handwriting program\Handwriting program\obj\Debug\Handwriting program.dll
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\bin\Debug\Handwriting program.dll.config
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\bin\Debug\Handwriting program.dll
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\bin\Debug\Handwriting program.pdb
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\obj\Debug\Handwriting_program.Form1.resources
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\obj\Debug\Handwriting_program.Handwriting.resources
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\obj\Debug\Handwriting_program.Properties.Resources.resources
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\obj\Debug\Handwriting program.csproj.GenerateResource.Cache
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\obj\Debug\Handwriting program.dll
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\obj\Debug\Handwriting program.pdb
|
||||
D:\Z - Norbi cucca\0 Projektek\MSGer.tk\0 Repository\Handwriting program\Handwriting program\obj\Debug\Handwriting program.csprojResolveAssemblyReference.cache
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -9,7 +9,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
partial class AboutBox1 : Form
|
||||
partial class AboutBox1 : ThemedForms
|
||||
{
|
||||
public AboutBox1()
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class AddPartner : Form
|
||||
public partial class AddPartner : ThemedForms
|
||||
{
|
||||
public AddPartner()
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace MSGer.tk
|
|||
label1.Text = Language.Translate("addcontact");
|
||||
label2.Text = Language.Translate("addcontact_nameemail");
|
||||
searchbtn.Text = Language.Translate("addcontact_search");
|
||||
glacialList1.Columns[0].Text = Language.Translate("reg_username");
|
||||
glacialList1.Columns[0].Text = Language.Translate("username");
|
||||
gobtn.Text = Language.Translate("addcontact_add");
|
||||
}
|
||||
|
||||
|
|
68
MSGer.tk/BeforeLogin.Designer.cs
generated
Normal file
68
MSGer.tk/BeforeLogin.Designer.cs
generated
Normal file
|
@ -0,0 +1,68 @@
|
|||
namespace MSGer.tk
|
||||
{
|
||||
partial class BeforeLogin
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(0, 24);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// BeforeLogin
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(362, 53);
|
||||
this.Controls.Add(this.label1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "BeforeLogin";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "BeforeLogin";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.BeforeLogin_FormClosed);
|
||||
this.TextChanged += new System.EventHandler(this.BeforeLogin_TextChanged);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
64
MSGer.tk/BeforeLogin.cs
Normal file
64
MSGer.tk/BeforeLogin.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class BeforeLogin : ThemedForms
|
||||
{
|
||||
private static BeforeLogin mInstance;
|
||||
private static bool done = false;
|
||||
private static string ttext { get; set; }
|
||||
public static void Create()
|
||||
{
|
||||
var t = new System.Threading.Thread(() =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
if (done)
|
||||
return;
|
||||
mInstance = new BeforeLogin();
|
||||
mInstance.FormClosed += (s, e) => mInstance = null;
|
||||
Application.Run(mInstance);
|
||||
});
|
||||
t.SetApartmentState(System.Threading.ApartmentState.STA);
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
public static void Destroy()
|
||||
{
|
||||
done = true;
|
||||
if (mInstance != null) mInstance.Invoke(new Action(() => mInstance.Close()));
|
||||
}
|
||||
|
||||
public static void SetText(string text)
|
||||
{
|
||||
if (mInstance != null) mInstance.Invoke((MethodInvoker)delegate { mInstance.Text = text; });
|
||||
ttext = text;
|
||||
}
|
||||
|
||||
private BeforeLogin()
|
||||
{ //2014.09.06.
|
||||
InitializeComponent();
|
||||
Text = ttext;
|
||||
}
|
||||
|
||||
private void BeforeLogin_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
label1.Text = this.Text;
|
||||
}
|
||||
|
||||
private void BeforeLogin_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
if (!done)
|
||||
Program.Exit(false);
|
||||
}
|
||||
}
|
||||
}
|
120
MSGer.tk/BeforeLogin.resx
Normal file
120
MSGer.tk/BeforeLogin.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
149
MSGer.tk/ChatForm.Designer.cs
generated
149
MSGer.tk/ChatForm.Designer.cs
generated
|
@ -28,171 +28,22 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.messageTextBox = new Khendys.Controls.ExRichTextBox();
|
||||
this.recentMsgTextBox = new Khendys.Controls.ExRichTextBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.statusLabel = new Khendys.Controls.ExRichTextBox();
|
||||
this.partnerMsg = new Khendys.Controls.ExRichTextBox();
|
||||
this.partnerName = new Khendys.Controls.ExRichTextBox();
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.showicons = new System.Windows.Forms.CheckBox();
|
||||
this.panel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// messageTextBox
|
||||
//
|
||||
this.messageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.messageTextBox.BackColor = System.Drawing.Color.White;
|
||||
this.messageTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.messageTextBox.DetectUrls = false;
|
||||
this.messageTextBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.messageTextBox.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.messageTextBox.Location = new System.Drawing.Point(147, 310);
|
||||
this.messageTextBox.Name = "messageTextBox";
|
||||
this.messageTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.messageTextBox.Size = new System.Drawing.Size(418, 75);
|
||||
this.messageTextBox.TabIndex = 0;
|
||||
this.messageTextBox.Text = "";
|
||||
this.messageTextBox.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
this.messageTextBox.TextChanged += new System.EventHandler(this.MessageTextChanged);
|
||||
this.messageTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SendMessage);
|
||||
//
|
||||
// recentMsgTextBox
|
||||
//
|
||||
this.recentMsgTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.recentMsgTextBox.BackColor = System.Drawing.Color.White;
|
||||
this.recentMsgTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.recentMsgTextBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.recentMsgTextBox.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.recentMsgTextBox.Location = new System.Drawing.Point(147, 76);
|
||||
this.recentMsgTextBox.Name = "recentMsgTextBox";
|
||||
this.recentMsgTextBox.ReadOnly = true;
|
||||
this.recentMsgTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.recentMsgTextBox.Size = new System.Drawing.Size(418, 228);
|
||||
this.recentMsgTextBox.TabIndex = 1;
|
||||
this.recentMsgTextBox.Text = "";
|
||||
this.recentMsgTextBox.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
this.recentMsgTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.OpenLink);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(141, 422);
|
||||
this.panel1.TabIndex = 3;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.statusLabel);
|
||||
this.panel2.Controls.Add(this.partnerMsg);
|
||||
this.panel2.Controls.Add(this.partnerName);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(141, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(423, 70);
|
||||
this.panel2.TabIndex = 4;
|
||||
//
|
||||
// statusLabel
|
||||
//
|
||||
this.statusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.statusLabel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(200)))));
|
||||
this.statusLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.statusLabel.ForeColor = System.Drawing.Color.Black;
|
||||
this.statusLabel.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.statusLabel.Location = new System.Drawing.Point(9, 52);
|
||||
this.statusLabel.Multiline = false;
|
||||
this.statusLabel.Name = "statusLabel";
|
||||
this.statusLabel.Size = new System.Drawing.Size(390, 16);
|
||||
this.statusLabel.TabIndex = 5;
|
||||
this.statusLabel.Text = "statusLabel";
|
||||
this.statusLabel.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
//
|
||||
// partnerMsg
|
||||
//
|
||||
this.partnerMsg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.partnerMsg.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(200)))));
|
||||
this.partnerMsg.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.partnerMsg.ForeColor = System.Drawing.Color.Black;
|
||||
this.partnerMsg.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.partnerMsg.Location = new System.Drawing.Point(9, 30);
|
||||
this.partnerMsg.Multiline = false;
|
||||
this.partnerMsg.Name = "partnerMsg";
|
||||
this.partnerMsg.Size = new System.Drawing.Size(390, 24);
|
||||
this.partnerMsg.TabIndex = 4;
|
||||
this.partnerMsg.Text = "partnerMsg";
|
||||
this.partnerMsg.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
//
|
||||
// partnerName
|
||||
//
|
||||
this.partnerName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.partnerName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(200)))));
|
||||
this.partnerName.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.partnerName.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.partnerName.ForeColor = System.Drawing.Color.Black;
|
||||
this.partnerName.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.partnerName.Location = new System.Drawing.Point(9, 7);
|
||||
this.partnerName.Multiline = false;
|
||||
this.partnerName.Name = "partnerName";
|
||||
this.partnerName.ReadOnly = true;
|
||||
this.partnerName.Size = new System.Drawing.Size(399, 25);
|
||||
this.partnerName.TabIndex = 3;
|
||||
this.partnerName.Text = "partnerName";
|
||||
this.partnerName.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
//
|
||||
// openFileDialog1
|
||||
//
|
||||
this.openFileDialog1.FileName = "openFileDialog1";
|
||||
//
|
||||
// showicons
|
||||
//
|
||||
this.showicons.AutoSize = true;
|
||||
this.showicons.Location = new System.Drawing.Point(150, 392);
|
||||
this.showicons.Name = "showicons";
|
||||
this.showicons.Size = new System.Drawing.Size(76, 17);
|
||||
this.showicons.TabIndex = 5;
|
||||
this.showicons.Text = "showicons";
|
||||
this.showicons.UseVisualStyleBackColor = true;
|
||||
this.showicons.CheckedChanged += new System.EventHandler(this.showicons_CheckedChanged);
|
||||
//
|
||||
// ChatForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(200)))));
|
||||
this.ClientSize = new System.Drawing.Size(564, 422);
|
||||
this.Controls.Add(this.showicons);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.recentMsgTextBox);
|
||||
this.Controls.Add(this.messageTextBox);
|
||||
this.Name = "ChatForm";
|
||||
this.Text = "Beszélgetés";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ChatForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.ChatForm_Load);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Khendys.Controls.ExRichTextBox messageTextBox;
|
||||
private Khendys.Controls.ExRichTextBox recentMsgTextBox;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
public Khendys.Controls.ExRichTextBox partnerName;
|
||||
public Khendys.Controls.ExRichTextBox partnerMsg;
|
||||
public Khendys.Controls.ExRichTextBox statusLabel;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
private System.Windows.Forms.CheckBox showicons;
|
||||
}
|
||||
}
|
|
@ -21,198 +21,19 @@ using HdSystemLibrary.IO;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class ChatForm : Form
|
||||
public partial class ChatForm : ThemedForms
|
||||
{
|
||||
public static List<ChatForm> ChatWindows = new List<ChatForm>();
|
||||
public List<int> ChatPartners = new List<int>();
|
||||
public ChatForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
//Amint létrehozom, ez a kód lefut - Nem számit, hogy megjelenik-e
|
||||
|
||||
this.Text = Language.Translate("chat_title");
|
||||
showicons.Text = Language.Translate("chat_showicons");
|
||||
}
|
||||
|
||||
private void ChatForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (ChatPartners.Count == 0)
|
||||
MessageBox.Show(Language.Translate("error") + ": " + Language.Translate("chat_nowindow"));
|
||||
if (ChatPartners.Count == 1)
|
||||
{
|
||||
partnerName.Text = UserInfo.Select(ChatPartners[0]).Name;
|
||||
TextFormat.Parse(partnerName);
|
||||
partnerMsg.Text = UserInfo.Select(ChatPartners[0]).Message;
|
||||
TextFormat.Parse(partnerMsg);
|
||||
switch (UserInfo.Select(ChatPartners[0]).State)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("offline");
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("menu_file_status_online");
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("menu_file_status_busy");
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("menu_file_status_away");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("networking_alone");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool InternalMessageChange = false;
|
||||
public int SelectionStart = 0;
|
||||
public int SelectionLength = 0;
|
||||
public int TextLength = 0;
|
||||
private void SendMessage(object sender, KeyEventArgs e)
|
||||
{
|
||||
//SendMessage
|
||||
if (e.KeyCode != Keys.Enter || e.Shift || messageTextBox.Text.Length == 0)
|
||||
return;
|
||||
messageTextBox.ReadOnly = true;
|
||||
if (!Networking.SendChatMessage(this, messageTextBox.Text))
|
||||
MessageBox.Show(Language.Translate("networking_alone"));
|
||||
messageTextBox.Focus();
|
||||
messageTextBox.Text = "";
|
||||
messageTextBox.ReadOnly = false;
|
||||
}
|
||||
|
||||
private void MessageTextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!InternalMessageChange)
|
||||
{
|
||||
if (messageTextBox.Text == "\n")
|
||||
messageTextBox.Text = "";
|
||||
#if emoticons
|
||||
TextFormat.Parse((ExExRichTextBox)sender);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenLink(object sender, LinkClickedEventArgs e)
|
||||
{
|
||||
Process.Start(e.LinkText);
|
||||
this.Text = Language.Translate("chat_title", this);
|
||||
}
|
||||
|
||||
private void ChatForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
ChatWindows.Remove(this);
|
||||
}
|
||||
|
||||
public static ChatForm GetChatFormByUsers(IEnumerable<int> users) //2014.08.08. - IEnumerable: 2014.08.16.
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ChatWindows.Count; i++)
|
||||
{
|
||||
if (ChatWindows[i].ChatPartners.HasSameElementsAs(users))
|
||||
break;
|
||||
}
|
||||
return (i != ChatWindows.Count) ? ChatWindows[i] : null; //== --> !=: 2014.09.22.
|
||||
}
|
||||
|
||||
public string TMessage;
|
||||
public int SetThreadValues()
|
||||
{
|
||||
recentMsgTextBox.AppendText(TMessage);
|
||||
TextFormat.Parse(recentMsgTextBox);
|
||||
TMessage = "";
|
||||
recentMsgTextBox.SelectionStart = recentMsgTextBox.TextLength; //2014.04.10.
|
||||
recentMsgTextBox.ScrollToCaret(); //2014.04.10.
|
||||
return 0;
|
||||
}
|
||||
public void OpenSendFile(SelectPartnerForm spform)
|
||||
{
|
||||
//A küldő a szerver - 2014.06.15.
|
||||
//Fogadás: //sendfile üzenet
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
|
||||
return;
|
||||
Stream st = new FileStream(openFileDialog1.FileName, FileMode.Open);
|
||||
try
|
||||
{
|
||||
if (new FileInfo(openFileDialog1.FileName).Length > Int64.Parse(Storage.Settings["filelen"]))
|
||||
{
|
||||
List<byte> buf = new List<byte>();
|
||||
int b;
|
||||
do
|
||||
{
|
||||
b = st.ReadByte();
|
||||
buf.Add((byte)b);
|
||||
}
|
||||
while (b != -1);
|
||||
st = new MemoryStream(buf.ToArray(), false);
|
||||
}
|
||||
}
|
||||
catch (OutOfMemoryException)
|
||||
{ //A MemoryStream-et nem hozza létre, ezzel elméletileg memóriát felszabadítva
|
||||
st.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
IPHostEntry host;
|
||||
IPAddress localIP = IPAddress.Parse("127.0.0.1");
|
||||
host = Dns.GetHostEntry(Dns.GetHostName());
|
||||
foreach (IPAddress ip in host.AddressList)
|
||||
{
|
||||
if (ip.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
localIP = ip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//string ret = Networking.SendRequest("setip", spform.Partners[0] + 'ͦ' + localIP.ToString() + ":" + Settings.Default.port + ":" + openFileDialog1.FileName, 0, true);
|
||||
//var ipAddr = IPAddress.Parse(ret);
|
||||
IPAddress ipAddr = null; //Használja fel a partner ismert IP-címét
|
||||
Socket sListener;
|
||||
SocketPermission permission;
|
||||
permission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, "", SocketPermission.AllPorts);
|
||||
sListener = new Socket(ipAddr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
var ipEndPoint = new IPEndPoint(ipAddr, Int32.Parse(Storage.Settings["port"]));
|
||||
sListener.Listen(1);
|
||||
ST = st; //Átadja az adatfolyamot a nyilvánosabb változónak
|
||||
AsyncCallback aCallback = new AsyncCallback(SendFile_AcceptCallback);
|
||||
sListener.BeginAccept(aCallback, sListener);
|
||||
}
|
||||
private Stream ST;
|
||||
private void SendFile_AcceptCallback(IAsyncResult ar)
|
||||
{
|
||||
Socket listener = (Socket)ar.AsyncState;
|
||||
Socket handler = listener.EndAccept(ar);
|
||||
var ns = new NetworkStream(handler);
|
||||
ns.CopyFrom(ST, new CopyFromArguments(new ProgressChange(SendFile_ProgressChange)));
|
||||
}
|
||||
|
||||
private void SendFile_ProgressChange(long bytesRead, long totalBytesToRead)
|
||||
{
|
||||
Console.WriteLine("SendFile: " + bytesRead + " / " + totalBytesToRead);
|
||||
}
|
||||
|
||||
public string CurrentMessage = "";
|
||||
private void showicons_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (showicons.Checked)
|
||||
{
|
||||
CurrentMessage = messageTextBox.Text;
|
||||
messageTextBox.Enabled = false;
|
||||
TextFormat.Parse(messageTextBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageTextBox.Text = CurrentMessage;
|
||||
messageTextBox.Enabled = true;
|
||||
}
|
||||
//chatPanel.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,4 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
296
MSGer.tk/ChatPanel.Designer.cs
generated
Normal file
296
MSGer.tk/ChatPanel.Designer.cs
generated
Normal file
|
@ -0,0 +1,296 @@
|
|||
namespace MSGer.tk
|
||||
{
|
||||
partial class ChatPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.messageTextBox = new Khendys.Controls.ExRichTextBox();
|
||||
this.recentMsgTextBox = new Khendys.Controls.ExRichTextBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.partnerName = new Khendys.Controls.ExRichTextBox();
|
||||
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
||||
this.showicons = new System.Windows.Forms.CheckBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.masterPanel = new System.Windows.Forms.Panel();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||
this.splitContainer2.Panel1.SuspendLayout();
|
||||
this.splitContainer2.Panel2.SuspendLayout();
|
||||
this.splitContainer2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
|
||||
this.splitContainer3.Panel1.SuspendLayout();
|
||||
this.splitContainer3.Panel2.SuspendLayout();
|
||||
this.splitContainer3.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.masterPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// messageTextBox
|
||||
//
|
||||
this.messageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.messageTextBox.BackColor = System.Drawing.Color.White;
|
||||
this.messageTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.messageTextBox.DetectUrls = false;
|
||||
this.messageTextBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.messageTextBox.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.messageTextBox.Location = new System.Drawing.Point(0, 3);
|
||||
this.messageTextBox.Name = "messageTextBox";
|
||||
this.messageTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.messageTextBox.Size = new System.Drawing.Size(391, 113);
|
||||
this.messageTextBox.TabIndex = 0;
|
||||
this.messageTextBox.Text = "";
|
||||
this.messageTextBox.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
this.messageTextBox.TextChanged += new System.EventHandler(this.MessageTextChanged);
|
||||
this.messageTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SendMessage);
|
||||
//
|
||||
// recentMsgTextBox
|
||||
//
|
||||
this.recentMsgTextBox.BackColor = System.Drawing.Color.White;
|
||||
this.recentMsgTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.recentMsgTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.recentMsgTextBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.recentMsgTextBox.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.recentMsgTextBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.recentMsgTextBox.Name = "recentMsgTextBox";
|
||||
this.recentMsgTextBox.ReadOnly = true;
|
||||
this.recentMsgTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
|
||||
this.recentMsgTextBox.Size = new System.Drawing.Size(391, 160);
|
||||
this.recentMsgTextBox.TabIndex = 4;
|
||||
this.recentMsgTextBox.Text = "";
|
||||
this.recentMsgTextBox.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
this.recentMsgTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.OpenLink);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(169, 363);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.partnerName);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(391, 39);
|
||||
this.panel2.TabIndex = 0;
|
||||
//
|
||||
// partnerName
|
||||
//
|
||||
this.partnerName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.partnerName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(200)))));
|
||||
this.partnerName.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.partnerName.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.partnerName.ForeColor = System.Drawing.Color.Black;
|
||||
this.partnerName.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.partnerName.Location = new System.Drawing.Point(9, 7);
|
||||
this.partnerName.Multiline = false;
|
||||
this.partnerName.Name = "partnerName";
|
||||
this.partnerName.ReadOnly = true;
|
||||
this.partnerName.Size = new System.Drawing.Size(337, 25);
|
||||
this.partnerName.TabIndex = 3;
|
||||
this.partnerName.Text = "partnerName";
|
||||
this.partnerName.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
//
|
||||
// openFileDialog1
|
||||
//
|
||||
this.openFileDialog1.FileName = "openFileDialog1";
|
||||
//
|
||||
// showicons
|
||||
//
|
||||
this.showicons.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.showicons.AutoSize = true;
|
||||
this.showicons.Location = new System.Drawing.Point(2, 126);
|
||||
this.showicons.Name = "showicons";
|
||||
this.showicons.Size = new System.Drawing.Size(76, 17);
|
||||
this.showicons.TabIndex = 1;
|
||||
this.showicons.Text = "showicons";
|
||||
this.showicons.UseVisualStyleBackColor = true;
|
||||
this.showicons.CheckedChanged += new System.EventHandler(this.showicons_CheckedChanged);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.Location = new System.Drawing.Point(313, 122);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "handwriting";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.panel1);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(564, 363);
|
||||
this.splitContainer1.SplitterDistance = 169;
|
||||
this.splitContainer1.TabIndex = 7;
|
||||
this.splitContainer1.TabStop = false;
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
this.splitContainer2.Panel1.Controls.Add(this.splitContainer3);
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.showicons);
|
||||
this.splitContainer2.Panel2.Controls.Add(this.button1);
|
||||
this.splitContainer2.Panel2.Controls.Add(this.messageTextBox);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(391, 363);
|
||||
this.splitContainer2.SplitterDistance = 203;
|
||||
this.splitContainer2.TabIndex = 2;
|
||||
this.splitContainer2.TabStop = false;
|
||||
//
|
||||
// splitContainer3
|
||||
//
|
||||
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer3.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer3.Name = "splitContainer3";
|
||||
this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer3.Panel1
|
||||
//
|
||||
this.splitContainer3.Panel1.Controls.Add(this.panel2);
|
||||
//
|
||||
// splitContainer3.Panel2
|
||||
//
|
||||
this.splitContainer3.Panel2.Controls.Add(this.recentMsgTextBox);
|
||||
this.splitContainer3.Size = new System.Drawing.Size(391, 203);
|
||||
this.splitContainer3.SplitterDistance = 39;
|
||||
this.splitContainer3.TabIndex = 2;
|
||||
this.splitContainer3.TabStop = false;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackgroundImage = global::MSGer.tk.Properties.Resources.Menü_2;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.menuStrip1.Size = new System.Drawing.Size(564, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// masterPanel
|
||||
//
|
||||
this.masterPanel.Controls.Add(this.splitContainer1);
|
||||
this.masterPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.masterPanel.Location = new System.Drawing.Point(0, 24);
|
||||
this.masterPanel.Name = "masterPanel";
|
||||
this.masterPanel.Size = new System.Drawing.Size(564, 363);
|
||||
this.masterPanel.TabIndex = 0;
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
//
|
||||
// ChatPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(150)))), ((int)(((byte)(200)))));
|
||||
this.Controls.Add(this.masterPanel);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Name = "ChatPanel";
|
||||
this.Size = new System.Drawing.Size(564, 387);
|
||||
this.Load += new System.EventHandler(this.ChatForm_Load);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel1.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
||||
this.splitContainer2.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
||||
this.splitContainer2.ResumeLayout(false);
|
||||
this.splitContainer3.Panel1.ResumeLayout(false);
|
||||
this.splitContainer3.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
|
||||
this.splitContainer3.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.masterPanel.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Khendys.Controls.ExRichTextBox messageTextBox;
|
||||
private Khendys.Controls.ExRichTextBox recentMsgTextBox;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
public Khendys.Controls.ExRichTextBox partnerName;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
||||
private System.Windows.Forms.CheckBox showicons;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||
private System.Windows.Forms.SplitContainer splitContainer3;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.Panel masterPanel;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
}
|
||||
}
|
370
MSGer.tk/ChatPanel.cs
Normal file
370
MSGer.tk/ChatPanel.cs
Normal file
|
@ -0,0 +1,370 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using HdSystemLibrary.IO;
|
||||
using System.Diagnostics;
|
||||
using Handwriting_program;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class ChatPanel : UserControl
|
||||
{
|
||||
//public static List<ChatForm> ChatWindows = new List<ChatForm>();
|
||||
public static List<ChatPanel> ChatWindows = new List<ChatPanel>();
|
||||
public List<UserInfo> ChatPartners = new List<UserInfo>();
|
||||
private string chatname = "";
|
||||
public string ChatName //2014.12.13. - A beszélgetés neve
|
||||
{
|
||||
get
|
||||
{
|
||||
return chatname;
|
||||
}
|
||||
set
|
||||
{
|
||||
chatname = value;
|
||||
this.Text = chatname;
|
||||
}
|
||||
}
|
||||
public ChatPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
//Amint létrehozom, ez a kód lefut - Nem számit, hogy megjelenik-e
|
||||
|
||||
this.Text = Language.Translate("chat_title", this);
|
||||
showicons.Text = Language.Translate("chat_showicons", showicons);
|
||||
}
|
||||
|
||||
private void ChatForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (ChatPartners.Count == 0)
|
||||
MessageBox.Show(Language.Translate("error") + ": " + Language.Translate("chat_nowindow"));
|
||||
/*if (ChatPartners.Count == 1) - A partnerinformációkat bal oldalt jelezze, akárhányan vannak, hogy egységes legyen
|
||||
{ - Felül a csoportnév látszódjon
|
||||
partnerName.Text = ChatPartners[0].Name;
|
||||
TextFormat.Parse(partnerName);
|
||||
partnerMsg.Text = ChatPartners[0].Message;
|
||||
TextFormat.Parse(partnerMsg);
|
||||
switch (ChatPartners[0].State)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("offline");
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("menu_file_status_online");
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("menu_file_status_busy");
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("menu_file_status_away");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
statusLabel.Text = Language.Translate("networking_alone");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (ChatName.Length == 0)
|
||||
{
|
||||
this.Text = "";
|
||||
foreach (var item in ChatPartners)
|
||||
this.Text += item.Name + ", ";
|
||||
this.Text = this.Text.Remove(this.Text.Length - 2);
|
||||
partnerName.Text = this.Text;
|
||||
this.Text += " - " + Language.Translate("chat_title");
|
||||
Language.ReloadEvent += delegate
|
||||
{
|
||||
if (ChatName.Length != 0)
|
||||
return;
|
||||
this.Text = "";
|
||||
foreach (var item in ChatPartners)
|
||||
this.Text += item.Name + ", ";
|
||||
this.Text = this.Text.Remove(this.Text.Length - 2);
|
||||
partnerName.Text = this.Text;
|
||||
this.Text += " - " + Language.Translate("chat_title");
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text = ChatName;
|
||||
}
|
||||
Parent.Parent.Text = this.Text; //2014.12.22.
|
||||
messageTextBox.Select();
|
||||
}
|
||||
|
||||
public bool InternalMessageChange = false;
|
||||
public int SelectionStart = 0;
|
||||
public int SelectionLength = 0;
|
||||
public int TextLength = 0;
|
||||
private void SendMessage(object sender, KeyEventArgs e)
|
||||
{
|
||||
//SendMessage
|
||||
if (e.KeyCode != Keys.Enter || e.Shift || messageTextBox.Text.Length == 0 || !messageTextBox.Visible) //Visible: 2014.11.07.
|
||||
return;
|
||||
messageTextBox.ReadOnly = true;
|
||||
if (!Networking.SendChatMessage(this, messageTextBox.Text))
|
||||
MessageBox.Show(Language.Translate("networking_alone"));
|
||||
else //else: 2014.10.31.
|
||||
messageTextBox.Text = "";
|
||||
//messageTextBox.Focus();
|
||||
messageTextBox.Select(); //2014.12.13.
|
||||
messageTextBox.ReadOnly = false;
|
||||
}
|
||||
|
||||
private void MessageTextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!InternalMessageChange)
|
||||
{
|
||||
if (messageTextBox.Text == "\n")
|
||||
messageTextBox.Text = "";
|
||||
#if emoticons
|
||||
TextFormat.Parse((ExExRichTextBox)sender);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenLink(object sender, LinkClickedEventArgs e)
|
||||
{
|
||||
Process.Start(e.LinkText);
|
||||
}
|
||||
|
||||
/*private void ChatForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
ChatWindows.Remove(this);
|
||||
}*/
|
||||
|
||||
public static ChatPanel GetChatFormByUsers(IEnumerable<UserInfo> users) //2014.08.08. - IEnumerable: 2014.08.16.
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ChatWindows.Count; i++)
|
||||
{
|
||||
if (ChatWindows[i].ChatPartners.HasSameElementsAs(users))
|
||||
break;
|
||||
}
|
||||
return (i != ChatWindows.Count) ? ChatWindows[i] : null;
|
||||
}
|
||||
|
||||
public string TMessage;
|
||||
public int SetThreadValues()
|
||||
{
|
||||
recentMsgTextBox.AppendText(TMessage);
|
||||
TextFormat.Parse(recentMsgTextBox);
|
||||
TMessage = "";
|
||||
recentMsgTextBox.SelectionStart = recentMsgTextBox.TextLength; //2014.04.10.
|
||||
recentMsgTextBox.ScrollToCaret(); //2014.04.10.
|
||||
return 0;
|
||||
}
|
||||
public void OpenSendFile(SelectPartnerForm spform)
|
||||
{
|
||||
//A küldő a szerver - 2014.06.15.
|
||||
//Fogadás: //sendfile üzenet
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
|
||||
return;
|
||||
Stream st = new FileStream(openFileDialog1.FileName, FileMode.Open);
|
||||
try
|
||||
{
|
||||
if (new FileInfo(openFileDialog1.FileName).Length > Int64.Parse(Storage.Settings["filelen"]))
|
||||
{
|
||||
List<byte> buf = new List<byte>();
|
||||
int b;
|
||||
do
|
||||
{
|
||||
b = st.ReadByte();
|
||||
buf.Add((byte)b);
|
||||
}
|
||||
while (b != -1);
|
||||
st = new MemoryStream(buf.ToArray(), false);
|
||||
}
|
||||
}
|
||||
catch (OutOfMemoryException)
|
||||
{ //A MemoryStream-et nem hozza létre, ezzel elméletileg memóriát felszabadítva
|
||||
st.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
IPHostEntry host;
|
||||
IPAddress localIP = IPAddress.Parse("127.0.0.1");
|
||||
host = Dns.GetHostEntry(Dns.GetHostName());
|
||||
foreach (IPAddress ip in host.AddressList)
|
||||
{
|
||||
if (ip.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
localIP = ip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//string ret = Networking.SendRequest("setip", spform.Partners[0] + 'ͦ' + localIP.ToString() + ":" + Settings.Default.port + ":" + openFileDialog1.FileName, 0, true);
|
||||
//var ipAddr = IPAddress.Parse(ret);
|
||||
IPAddress ipAddr = null; //Használja fel a partner ismert IP-címét
|
||||
Socket sListener;
|
||||
SocketPermission permission;
|
||||
permission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, "", SocketPermission.AllPorts);
|
||||
sListener = new Socket(ipAddr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
var ipEndPoint = new IPEndPoint(ipAddr, Int32.Parse(Storage.Settings["port"]));
|
||||
sListener.Listen(1);
|
||||
ST = st; //Átadja az adatfolyamot a nyilvánosabb változónak
|
||||
AsyncCallback aCallback = new AsyncCallback(SendFile_AcceptCallback);
|
||||
sListener.BeginAccept(aCallback, sListener);
|
||||
}
|
||||
private Stream ST;
|
||||
private void SendFile_AcceptCallback(IAsyncResult ar)
|
||||
{
|
||||
Socket listener = (Socket)ar.AsyncState;
|
||||
Socket handler = listener.EndAccept(ar);
|
||||
var ns = new NetworkStream(handler);
|
||||
ns.CopyFrom(ST, new CopyFromArguments(new ProgressChange(SendFile_ProgressChange)));
|
||||
}
|
||||
|
||||
private void SendFile_ProgressChange(long bytesRead, long totalBytesToRead)
|
||||
{
|
||||
Console.WriteLine("SendFile: " + bytesRead + " / " + totalBytesToRead);
|
||||
}
|
||||
|
||||
public string CurrentMessage = "";
|
||||
private void showicons_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (showicons.Checked)
|
||||
{
|
||||
CurrentMessage = messageTextBox.Text;
|
||||
messageTextBox.Enabled = false;
|
||||
TextFormat.Parse(messageTextBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageTextBox.Text = CurrentMessage;
|
||||
messageTextBox.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
ChatWindows.Remove(this);
|
||||
if (Storage.Settings["chatwindow"] == "0" ^ SettingsForm.ApplyingSettings) //Ha az új beállítás szerint(!) külön ablakokban kell megjeleníteni, akkor hajtsa végre
|
||||
{ //2014.10.31.
|
||||
this.Dispose();
|
||||
if (ChatIcon != null) //Most már nem feltétlenül változik a beállítás
|
||||
ChatIcon.Dispose();
|
||||
}
|
||||
/*else
|
||||
((Form)this.Parent).Close();*/
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{ //2014.10.28.
|
||||
if (!Storage.LoggedInSettings.ContainsKey("chatwindow")) //2014.12.05.
|
||||
Storage.LoggedInSettings.Add("chatwindow", "0"); //2014.12.05.
|
||||
if (Storage.Settings["chatwindow"] == "1")
|
||||
{
|
||||
//ChatForm a ChatPanel-lel
|
||||
var cf = new ChatForm();
|
||||
cf.Controls.Add(this);
|
||||
cf.FormClosing += cf_FormClosing;
|
||||
this.Dock = DockStyle.Fill;
|
||||
cf.Show();
|
||||
//cf.Focus();
|
||||
cf.Select(); //2014.12.13.
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.MainF.Controls.Add(this);
|
||||
Program.MainF.PlaceChatIcon(this);
|
||||
this.BringToFront();
|
||||
this.Show();
|
||||
}
|
||||
}
|
||||
|
||||
void cf_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
internal static void ReopenChatWindows(bool settingchanged)
|
||||
{
|
||||
for (int i = 0; i < ChatWindows.Count; i++)
|
||||
{
|
||||
var tmp = ChatWindows[i].ChatPartners;
|
||||
if (settingchanged)
|
||||
{
|
||||
if (Storage.Settings["chatwindow"] == "0") //Ha az új beállítás szerint(!) külön ablakokban kell megjeleníteni, akkor hajtsa végre
|
||||
((Form)ChatWindows[i].Parent.Parent).Close(); //Ezzel meghívja a saját Close()-ját is
|
||||
else
|
||||
ChatWindows[i].Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Storage.Settings["chatwindow"] == "1") //Ha a régi beállítás szerint(!) külön ablakokban kell megjeleníteni, akkor hajtsa végre
|
||||
((Form)ChatWindows[i].Parent.Parent).Close(); //Ezzel meghívja a saját Close()-ját is
|
||||
else
|
||||
ChatWindows[i].Close();
|
||||
}
|
||||
var tmp2 = new ChatPanel();
|
||||
tmp2.ChatPartners = tmp;
|
||||
tmp2.Init();
|
||||
ChatWindows.Add(tmp2);
|
||||
}
|
||||
}
|
||||
|
||||
public new void Show()
|
||||
{
|
||||
if (Storage.Settings["chatwindow"] == "0")
|
||||
{
|
||||
foreach (var item in ChatWindows)
|
||||
{
|
||||
item.Hide();
|
||||
}
|
||||
//this.Location = new Point(this.ChatIcon.Location.X + 150, this.ChatIcon.Location.Y);
|
||||
//A ChatIcon-hoz a legközelebbi helyre rakja - Vagy fedje be kb. a partnerlistát, úgyis elég nagy
|
||||
this.Location = new Point(150, Program.MainF.contactList.Location.Y);
|
||||
}
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public PictureBox ChatIcon { get; set; }
|
||||
|
||||
public Handwriting handw;
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (messageTextBox.Visible)
|
||||
{
|
||||
if (handw == null)
|
||||
{
|
||||
handw = new Handwriting();
|
||||
handw.Parent = this.splitContainer2.Panel2;
|
||||
handw.Bounds = messageTextBox.Bounds;
|
||||
handw.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
handw.sendbtn.Text = Language.Translate("sendbtn_send", handw.sendbtn);
|
||||
handw.sendbtn.Click += Handw_sendbtn_Click;
|
||||
}
|
||||
else
|
||||
handw.Show();
|
||||
messageTextBox.Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
handw.Hide();
|
||||
messageTextBox.Show();
|
||||
}
|
||||
}
|
||||
|
||||
void Handw_sendbtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
handw.GetBitmap().Save("test.bmp");
|
||||
}
|
||||
}
|
||||
}
|
126
MSGer.tk/ChatPanel.resx
Normal file
126
MSGer.tk/ChatPanel.resx
Normal file
|
@ -0,0 +1,126 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>157, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -131,7 +131,8 @@ namespace MSGer.tk
|
|||
SendUpdate();
|
||||
}
|
||||
}
|
||||
public static IPAddress IP;
|
||||
//public static IPAddress IP;
|
||||
public static List<IPAddress> IPs;
|
||||
public static string[] Keys
|
||||
{ //2014.09.08-09.
|
||||
get
|
||||
|
@ -170,6 +171,21 @@ namespace MSGer.tk
|
|||
Storage.LoggedInSettings["currentuser_keys"] = value.ToString();
|
||||
}
|
||||
}
|
||||
public static int PicUpdateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Storage.LoggedInSettings.ContainsKey("currentuser_picupdatetime"))
|
||||
Storage.LoggedInSettings.Add("currentuser_picupdatetime", "0");
|
||||
return Int32.Parse(Storage.LoggedInSettings["currentuser_picupdatetime"]);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!Storage.LoggedInSettings.ContainsKey("currentuser_picupdatetime"))
|
||||
Storage.LoggedInSettings.Add("currentuser_picupdatetime", "0");
|
||||
Storage.LoggedInSettings["currentuser_picupdatetime"] = value.ToString();
|
||||
}
|
||||
}
|
||||
public static bool SendChanges = false;
|
||||
|
||||
public static void SendUpdate()
|
||||
|
@ -188,20 +204,24 @@ namespace MSGer.tk
|
|||
retstr += UserID + "_email=" + Email + "\n";
|
||||
retstr += UserID + "_ispartner=" + false + "\n"; //Ellenőrizze le, amikor megkapja
|
||||
retstr += UserID + "_lastupdate=" + Program.DateTimeToUnixTime(DateTime.Now);
|
||||
while (true)
|
||||
{
|
||||
byte[][] resp = Networking.SendUpdate(Networking.UpdateType.ListUpdate, Encoding.Unicode.GetBytes(retstr), false);
|
||||
bool fine = false;
|
||||
if (resp == null || resp.Length == 0)
|
||||
break;
|
||||
foreach (var item in resp) //Ha sehonnan nem kapott választ (egy perc után), újrapróbálkozik
|
||||
{
|
||||
if (Networking.ParsePacket(item).Data[0] == 0x01) //2014.09.19.
|
||||
fine = true;
|
||||
}
|
||||
if (fine)
|
||||
break;
|
||||
}
|
||||
retstr += UserID + "_picupdatetime=" + PicUpdateTime;
|
||||
//while (true)
|
||||
//{
|
||||
//byte[][] resp = Networking.SendUpdate(Networking.UpdateType.ListUpdate, Encoding.Unicode.GetBytes(retstr), false);
|
||||
//bool fine = false; //Elvileg így az event működésekor is tudja használni, és utána ha minden rendben, akkor törli az objectet
|
||||
Networking.SendUpdateInThread(Networking.UpdateType.ListUpdate, Encoding.Unicode.GetBytes(retstr), null);
|
||||
/*(e, resp) =>
|
||||
{
|
||||
if (resp == null || resp.Length == 0)
|
||||
fine = true;
|
||||
foreach (var item in resp) //Ha sehonnan nem kapott választ (egy perc után), újrapróbálkozik
|
||||
{
|
||||
if (Networking.ParsePacket(item).Data[0] == 0x01) //2014.09.19.
|
||||
fine = true;
|
||||
}*/
|
||||
/*if (fine)
|
||||
break;*/
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
54
MSGer.tk/ICMPPacket.cs
Normal file
54
MSGer.tk/ICMPPacket.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public static class ICMPPacket
|
||||
{
|
||||
public const byte Type = ICMP_ECHO;
|
||||
public const byte SubCode = 0;
|
||||
public const byte RespType = ICMP_TIME_EXCEEDED;
|
||||
public const byte RespCode = 1;
|
||||
public const UInt16 CheckSum = 0;
|
||||
public const UInt16 Identifier = 52;
|
||||
public const UInt16 SequenceNumber = 84;
|
||||
public static readonly byte[] Data = Encoding.Unicode.GetBytes("MSGer.tk connection");
|
||||
|
||||
public const byte ICMP_ECHO = 8;
|
||||
public const byte ICMP_REPLY = 0;
|
||||
public const byte ICMP_TIME_EXCEEDED = 11;
|
||||
|
||||
public static byte[] CreateRequest() //2015.02.05.
|
||||
{
|
||||
var data = new List<byte>();
|
||||
data.Add(Type);
|
||||
data.Add(SubCode);
|
||||
data.AddRange(BitConverter.GetBytes(CheckSum));
|
||||
data.AddRange(BitConverter.GetBytes(Identifier));
|
||||
data.AddRange(BitConverter.GetBytes(SequenceNumber));
|
||||
data.AddRange(Data);
|
||||
return data.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] CreateReply()
|
||||
{
|
||||
//ICMPPacket packet = new ICMPPacket();
|
||||
var data = new List<byte>();
|
||||
data.Add(RespType);
|
||||
data.Add(RespCode);
|
||||
data.AddRange(BitConverter.GetBytes(CheckSum));
|
||||
data.AddRange(BitConverter.GetBytes((int)0)); //4 bytes unused
|
||||
data.AddRange(CreateRequest()); //Original packet
|
||||
return data.ToArray();
|
||||
}
|
||||
|
||||
public static bool IsPacketGood(byte[] bytes)
|
||||
{
|
||||
return (bytes[0] == ICMP_TIME_EXCEEDED);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class InvitePartner : Form
|
||||
public partial class InvitePartner : ThemedForms
|
||||
{
|
||||
public InvitePartner()
|
||||
{
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace MSGer.tk
|
|||
|
||||
public Dictionary<string, string> Strings = new Dictionary<string, string>();
|
||||
|
||||
private static Dictionary<Control, string> Controls = new Dictionary<Control, string>();
|
||||
|
||||
private Language(string lang)
|
||||
{
|
||||
UsedLangs.Add(lang, this);
|
||||
|
@ -33,7 +35,16 @@ namespace MSGer.tk
|
|||
{
|
||||
string[] lines = File.ReadAllLines(files[x]);
|
||||
var dict = lines.Select(l => l.Split('=')).ToDictionary(a => a[0], a => a[1]);
|
||||
new Language(new FileInfo(files[x]).Name.Split('.')[0]).Strings = dict; //(FileInfo: 2014.09.01.) - Eltárol egy új nyelvet, majd a szövegeket hozzátársítja
|
||||
var finaldict = new Dictionary<string, string>();
|
||||
foreach(var item in dict)
|
||||
{
|
||||
var spl = item.Key.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach(var key in spl)
|
||||
{
|
||||
finaldict.Add(key, item.Value); //Hozzáadja az összes felsorolt keyt külön, ugyanazzal az értékkel
|
||||
}
|
||||
}
|
||||
new Language(new FileInfo(files[x]).Name.Split('.')[0]).Strings = finaldict; //(FileInfo: 2014.09.01.) - Eltárol egy új nyelvet, majd a szövegeket hozzátársítja
|
||||
}
|
||||
|
||||
/*if (Language.FromString(Storage.Settings["lang"]) == null)
|
||||
|
@ -66,20 +77,32 @@ namespace MSGer.tk
|
|||
UsedLangs.TryGetValue(value, out tmp);
|
||||
return tmp;
|
||||
}
|
||||
public static Language GetCuurentLanguage()
|
||||
public static Language GetCurrentLanguage() //Javítva Cuurent-ről Current-re: 2014.12.13. - Már régóta ki akartam javítani
|
||||
{
|
||||
return Language.FromString(Storage.Settings["lang"]);
|
||||
}
|
||||
public static string Translate(string id)
|
||||
public static string Translate(string id, Control defaultevent = null) //Csak akkor kell az event, ha látszódik az adott ablak, amikor átállítódik - Tehát csak MainForm és ChatForm
|
||||
{ //2014.08.19.
|
||||
Language lang = GetCuurentLanguage();
|
||||
Language lang = GetCurrentLanguage();
|
||||
if (lang.Strings.ContainsKey(id))
|
||||
{
|
||||
if (defaultevent != null) //2014.12.22.
|
||||
ReloadEvent += delegate { defaultevent.Text = lang.Strings[id]; }; //2014.12.22.
|
||||
return lang.Strings[id];
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Translation string not found: " + id + "\nIn file: " + lang + ".txt");
|
||||
return "Str not found";
|
||||
}
|
||||
}
|
||||
public static event EventHandler ReloadEvent;
|
||||
public static void ReloadLangs()
|
||||
{
|
||||
ChatPanel.ReopenChatWindows(false);
|
||||
ReloadEvent(null, null);
|
||||
Program.MainF.contactList.Items.Clear();
|
||||
Program.MainF.LoadPartnerList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
49
MSGer.tk/Logging.cs
Normal file
49
MSGer.tk/Logging.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public class Logging
|
||||
{
|
||||
public enum LogType
|
||||
{
|
||||
Network
|
||||
}
|
||||
public static void Log(string message, LogType logtype) //2014.12.31.
|
||||
{
|
||||
if (!Directory.Exists("logs"))
|
||||
Directory.CreateDirectory("logs");
|
||||
string path;
|
||||
switch (logtype)
|
||||
{
|
||||
case LogType.Network:
|
||||
path = "network";
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException("Log type not implemented.");
|
||||
}
|
||||
string finaltext = "[" + Process.GetCurrentProcess().Id + ": " + Thread.CurrentThread.Name + " | " + DateTime.Now.ToString("yyyy.MM.dd. HH:mm:ss") + "] " + message + Environment.NewLine;
|
||||
Console.WriteLine(logtype.ToString() + " - " + finaltext);
|
||||
while(true)
|
||||
{
|
||||
bool retry = false;
|
||||
try
|
||||
{
|
||||
File.AppendAllText("logs\\" + path + ".txt", finaltext);
|
||||
}
|
||||
catch(IOException)
|
||||
{
|
||||
retry = true;
|
||||
}
|
||||
if (!retry)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
MSGer.tk/LoginForm.Designer.cs
generated
9
MSGer.tk/LoginForm.Designer.cs
generated
|
@ -173,6 +173,15 @@
|
|||
this.Text = "Bejelentkezés";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LoginForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.LoginForm_Load);
|
||||
this.Controls.SetChildIndex(this.label1, 0);
|
||||
this.Controls.SetChildIndex(this.label2, 0);
|
||||
this.Controls.SetChildIndex(this.textBox1, 0);
|
||||
this.Controls.SetChildIndex(this.label3, 0);
|
||||
this.Controls.SetChildIndex(this.textBox2, 0);
|
||||
this.Controls.SetChildIndex(this.button1, 0);
|
||||
this.Controls.SetChildIndex(this.textBox3, 0);
|
||||
this.Controls.SetChildIndex(this.linkLabel1, 0);
|
||||
this.Controls.SetChildIndex(this.linkLabel2, 0);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
206
MSGer.tk/LoginForm.LoginUser.cs
Normal file
206
MSGer.tk/LoginForm.LoginUser.cs
Normal file
|
@ -0,0 +1,206 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
partial class LoginForm
|
||||
{
|
||||
public static string UserText = ""; //2014.02.14.
|
||||
public static string PassText = "";
|
||||
public static string LButtonText = "";
|
||||
public static bool RegistLinkEn = true;
|
||||
public static bool Closeable = false;
|
||||
public static HttpWebRequest Request; //2014.03.27. - A megállitáshoz
|
||||
|
||||
public void LoginUser()
|
||||
{
|
||||
//Állitson vissza minden változót, hogy újra belerakja az értekeket - 2014.02.28.
|
||||
UserText = "";
|
||||
PassText = "";
|
||||
RegistLinkEn = false; //2014.03.27.
|
||||
LButtonText = Language.Translate("button_cancel");
|
||||
this.Invoke(new MyDelegate(SetLoginValues));
|
||||
|
||||
//HttpWebRequest httpWReq =
|
||||
// (HttpWebRequest)WebRequest.Create("http://msger.tk/client.php");
|
||||
#if LOCAL_SERVER
|
||||
HttpWebRequest httpWReq =
|
||||
(HttpWebRequest)WebRequest.Create("http://localhost/ChatWithWords/client.php");
|
||||
#else
|
||||
HttpWebRequest httpWReq =
|
||||
(HttpWebRequest)WebRequest.Create("http://msger.url.ph/client.php");
|
||||
#endif
|
||||
|
||||
Request = httpWReq; //2014.03.27.
|
||||
|
||||
ASCIIEncoding encoding = new ASCIIEncoding();
|
||||
string postData = "username=" + UserText;
|
||||
postData += "&password=" + CalculateMD5Hash(PassText).ToLower(); //ToLower: 2014.10.24. 1:22 - Most már a PHP-nak is titkosítania kell többek közt MD5-tel
|
||||
postData += "&key=cas1fe4a6feFEFEFE1616CE8099VFE1444cdasf48c1ase5dg";
|
||||
postData += "&port=" + Storage.Settings["port"]; //2014.08.29.
|
||||
//postData += "&isserver=" + Storage.Settings["isserver"]; //2014.09.26.
|
||||
/*postData += "&myip=" + Dns.GetHostEntry(Dns.GetHostName()).AddressList.Single(entry =>
|
||||
entry.AddressFamily == AddressFamily.InterNetwork
|
||||
&& (entry.ToString().Contains("192.168.0.") || entry.ToString().Contains("192.168.1.") || entry.ToString().Contains("10.0.0.") || entry.ToString().Contains("172.16.0.")) //Helyi IP-k
|
||||
); //2014.11.15. - Pontok téve az IP-prefixek után, hogy pontos legyen az egyezés: 2014.12.22.
|
||||
*/ //Nincs már szükség rá; IPv6
|
||||
byte[] data = encoding.GetBytes(postData);
|
||||
|
||||
httpWReq.Method = "POST";
|
||||
httpWReq.ContentType = "application/x-www-form-urlencoded";
|
||||
httpWReq.ContentLength = data.Length;
|
||||
|
||||
try
|
||||
{
|
||||
using (Stream stream = httpWReq.GetRequestStream())
|
||||
{
|
||||
stream.Write(data, 0, data.Length);
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status != WebExceptionStatus.RequestCanceled)
|
||||
{
|
||||
MessageBox.Show(Language.Translate("connecterror") + "\n" + e.Message, Language.Translate("error"));
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebResponse response;
|
||||
try
|
||||
{
|
||||
response = (HttpWebResponse)httpWReq.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status != WebExceptionStatus.RequestCanceled)
|
||||
{
|
||||
MessageBox.Show(Language.Translate("connecterror") + "\n" + e.Message, Language.Translate("error"));
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
|
||||
|
||||
try
|
||||
{
|
||||
if (responseString[0] == '<')
|
||||
{
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
MessageBox.Show(Language.Translate("error") + ":\n" + responseString);
|
||||
return;
|
||||
}
|
||||
else
|
||||
responseString = responseString.Remove(responseString.IndexOf('<'));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
if (String.Compare(responseString, "Fail") == 0)
|
||||
{
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
MessageBox.Show(Language.Translate("error") + ": " + Language.Translate("login_badnamepass"), Language.Translate("error"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
//Elmenti az E-mail-t
|
||||
if (!Storage.Settings["email"].Contains(UserText))
|
||||
{
|
||||
if (Storage.Settings["email"].Length != 0) //2014.07.08.
|
||||
Storage.Settings["email"] += ",";
|
||||
Storage.Settings["email"] += UserText;
|
||||
}
|
||||
//else - 2014.10.02. - Egyszer észrevettem a Google Code összehasonlítójával, hogy ez nem kéne ide
|
||||
Storage.Settings["lastusedemail"] = Storage.Settings["email"].Split(',').ToList<string>().IndexOf(UserText).ToString();
|
||||
|
||||
/*
|
||||
* respstr:
|
||||
* 0: uid
|
||||
* 1: username
|
||||
* 2: myip
|
||||
* 3: server ips
|
||||
* 4: non-server ips
|
||||
* 5: server same ips
|
||||
* 6: non-server same ips
|
||||
* 7: password
|
||||
*/
|
||||
string[] respstr = responseString.Split('ͦ');
|
||||
|
||||
//if (respstr[3].Contains("Fail"))
|
||||
if(respstr.Any(entry=>entry.Contains("Fail"))) //2014.12.05.
|
||||
{
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
//MessageBox.Show(respstr[3]);
|
||||
try
|
||||
{
|
||||
MessageBox.Show(respstr.Single(entry => entry.Contains("Fail"))); //2014.12.05.
|
||||
}
|
||||
catch { }
|
||||
return;
|
||||
}
|
||||
//string[] entries = respstr[(int)LoginInfo.ServerIPs].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] entries = respstr[(int)LoginInfo.IPs].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
IEnumerable<IPEndPoint> ips = entries.Select(entry => ((entry != ":") ? new IPEndPoint(IPAddress.Parse(entry.Split(':')[0]), Int32.Parse(entry.Split(':')[1])) : new IPEndPoint(IPAddress.Loopback, 0)));
|
||||
UserInfo.IPs = new HashSet<IPEndPoint>(ips); //2014.08.30.
|
||||
//UserInfo.IPs = new HashSet<IPEndPoint>(ips.Select(entry => new IPEndPoint(entry, true))); //2014.11.23.
|
||||
//CurrentUser.IP = IPAddress.Parse(respstr[(int)LoginInfo.MyIP]); //2014.10.24. - Most már csak ott lehet rá hivatkozni, felesleges eltárolni
|
||||
CurrentUser.IPs = new List<IPAddress>(respstr[(int)LoginInfo.MyIP].Split(new char[] { ';' }).Select(entry => IPAddress.Parse(entry)));
|
||||
|
||||
/*entries = respstr[(int)LoginInfo.NonServerIPs].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
ips = entries.Select(entry => ((entry != ":") ? new IPEndPoint(IPAddress.Parse(entry.Split(':')[0]), Int32.Parse(entry.Split(':')[1])) : new IPEndPoint(IPAddress.Loopback, 0)));
|
||||
foreach (var item in ips)
|
||||
UserInfo.IPs.Add(new IPEndPoint(item, false)); //2014.11.23.*/
|
||||
|
||||
/*entries = respstr[(int)LoginInfo.ServerIPsOnNAT].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); //2014.12.18.
|
||||
ips = entries.Select(entry => ((entry != ":") ? new IPEndPoint(IPAddress.Parse(entry.Split(':')[0]), Int32.Parse(entry.Split(':')[1])) : new IPEndPoint(IPAddress.Loopback, 0))); //2014.12.18.
|
||||
foreach (var item in ips) //2014.12.18.
|
||||
UserInfo.IPs.Add(new IPEndPoint(item, true)); //2014.12.18.*/
|
||||
|
||||
/*entries = respstr[(int)LoginInfo.NonServerIPsOnNat].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); //2014.12.18.
|
||||
ips = entries.Select(entry => ((entry != ":") ? new IPEndPoint(IPAddress.Parse(entry.Split(':')[0]), Int32.Parse(entry.Split(':')[1])) : new IPEndPoint(IPAddress.Loopback, 0))); //2014.12.18.
|
||||
foreach (var item in ips) //2014.12.18.
|
||||
UserInfo.IPs.Add(new IPEndPoint(item, false)); //2014.12.18.*/
|
||||
|
||||
/*entries = respstr[(int)LoginInfo.IPs].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
ips = entries.Select(entry => ((entry != ":") ? new IPEndPoint(IPAddress.Parse(entry.Split(':')[0]), Int32.Parse(entry.Split(':')[1])) : new IPEndPoint(IPAddress.Loopback, 0)));
|
||||
f*oreach (var item in ips)
|
||||
UserInfo.IPs.Add(item);*/
|
||||
|
||||
//2014.09.19. - Bejelentkezés elküldése áthelyezve a MainForm-ba
|
||||
|
||||
CurrentUser.UserID = Int32.Parse(respstr[(int)LoginInfo.UserID]); //2014.09.01. - Áthelyeztem, hogy addig ne higgye bejelentkezettnek, amíg el nem küldi a többieknek
|
||||
|
||||
Storage.SaltKey = CalculateMD5Hash(PassText); //2014.08.07.
|
||||
Storage.FileName = respstr[(int)LoginInfo.UserID] + ".db"; //2014.09.01. - Felesleges számmá alakítani, majd vissza
|
||||
|
||||
CurrentUser.UserName = UserText; //2014.09.01. - Ha semmit nem tud saját magáról, és más sem, de nem ismerőse saját magának, akkor az itt beállított felhasználónév érvényesül
|
||||
CurrentUser.Name = UserText; //2014.09.01.
|
||||
string ReceivedPass = respstr[(int)LoginInfo.Password]; //2014.10.24. 1:39
|
||||
LoginForm.UserCode = CalculateMD5Hash(ReceivedPass + " Some text because why not " + CurrentUser.UserID).ToLower();
|
||||
|
||||
Closeable = true;
|
||||
this.Invoke(new MyDelegate(SetLoginValues));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class LoginForm_RegistrationForm : Form
|
||||
public partial class LoginForm_RegistrationForm : ThemedForms
|
||||
{
|
||||
public LoginForm_RegistrationForm()
|
||||
{
|
||||
|
|
|
@ -14,10 +14,11 @@ using System.IO;
|
|||
using System.Security.Cryptography;
|
||||
using System.Configuration;
|
||||
using System.Threading;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class LoginForm : Form
|
||||
public partial class LoginForm : ThemedForms
|
||||
{
|
||||
public static string UserCode = "";
|
||||
public static Thread LThread;
|
||||
|
@ -127,148 +128,18 @@ namespace MSGer.tk
|
|||
{ //2014.09.01.
|
||||
return ResetAfterLogin(false); //Ha a thread hívja meg, ne állítsa le a thread-et
|
||||
}
|
||||
public static string UserText = ""; //2014.02.14.
|
||||
public static string PassText = "";
|
||||
public static string LButtonText = "";
|
||||
public static bool RegistLinkEn = true;
|
||||
public static bool Closeable = false;
|
||||
public static HttpWebRequest Request; //2014.03.27. - A megállitáshoz
|
||||
|
||||
public void LoginUser()
|
||||
public enum LoginInfo
|
||||
{
|
||||
//Állitson vissza minden változót, hogy újra belerakja az értekeket - 2014.02.28.
|
||||
UserText = "";
|
||||
PassText = "";
|
||||
RegistLinkEn = false; //2014.03.27.
|
||||
LButtonText = Language.Translate("button_cancel");
|
||||
this.Invoke(new MyDelegate(SetLoginValues));
|
||||
|
||||
//HttpWebRequest httpWReq =
|
||||
// (HttpWebRequest)WebRequest.Create("http://msger.tk/client.php");
|
||||
#if LOCAL_SERVER
|
||||
HttpWebRequest httpWReq =
|
||||
(HttpWebRequest)WebRequest.Create("http://localhost/ChatWithWords/client.php");
|
||||
#else
|
||||
HttpWebRequest httpWReq =
|
||||
(HttpWebRequest)WebRequest.Create("http://msger.url.ph/client.php");
|
||||
#endif
|
||||
|
||||
Request = httpWReq; //2014.03.27.
|
||||
|
||||
ASCIIEncoding encoding = new ASCIIEncoding();
|
||||
string postData = "username=" + UserText;
|
||||
postData += "&password=" + CalculateMD5Hash(PassText).ToLower(); //ToLower: 2014.10.24. 1:22 - Most már a PHP-nak is titkosítania kell többek közt MD5-tel
|
||||
postData += "&key=cas1fe4a6feFEFEFE1616CE8099VFE1444cdasf48c1ase5dg";
|
||||
postData += "&port=" + Storage.Settings["port"]; //2014.08.29.
|
||||
postData += "&isserver=" + Storage.Settings["isserver"]; //2014.09.26.
|
||||
byte[] data = encoding.GetBytes(postData);
|
||||
|
||||
httpWReq.Method = "POST";
|
||||
httpWReq.ContentType = "application/x-www-form-urlencoded";
|
||||
httpWReq.ContentLength = data.Length;
|
||||
|
||||
try
|
||||
{
|
||||
using (Stream stream = httpWReq.GetRequestStream())
|
||||
{
|
||||
stream.Write(data, 0, data.Length);
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status != WebExceptionStatus.RequestCanceled)
|
||||
{
|
||||
MessageBox.Show(Language.Translate("connecterror") + "\n" + e.Message, Language.Translate("error"));
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebResponse response;
|
||||
try
|
||||
{
|
||||
response = (HttpWebResponse)httpWReq.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status != WebExceptionStatus.RequestCanceled)
|
||||
{
|
||||
MessageBox.Show(Language.Translate("connecterror") + "\n" + e.Message, Language.Translate("error"));
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
|
||||
|
||||
try
|
||||
{
|
||||
if (responseString[0] == '<')
|
||||
{
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
MessageBox.Show(Language.Translate("error") + ":\n" + responseString);
|
||||
return;
|
||||
}
|
||||
else
|
||||
responseString = responseString.Remove(responseString.IndexOf('<'));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
if (String.Compare(responseString, "Fail") == 0)
|
||||
{
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
MessageBox.Show(Language.Translate("error") + ": " + Language.Translate("login_badnamepass"), Language.Translate("error"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
//Elmenti az E-mail-t
|
||||
if (!Storage.Settings["email"].Contains(UserText))
|
||||
{
|
||||
if (Storage.Settings["email"].Length != 0) //2014.07.08.
|
||||
Storage.Settings["email"] += ",";
|
||||
Storage.Settings["email"] += UserText;
|
||||
}
|
||||
//else - 2014.10.02. - Egyszer észrevettem a Google Code összehasonlítójával, hogy ez nem kéne ide
|
||||
Storage.Settings["lastusedemail"] = Storage.Settings["email"].Split(',').ToList<string>().IndexOf(UserText).ToString();
|
||||
string[] respstr = responseString.Split('ͦ');
|
||||
|
||||
if (respstr[3].Contains("Fail"))
|
||||
{
|
||||
this.Invoke(new MyDelegate(ResetAfterLogin));
|
||||
MessageBox.Show(respstr[3]);
|
||||
return;
|
||||
}
|
||||
string[] entries = respstr[3].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
IEnumerable<IPEndPoint> ips = entries.Select(entry => ((entry != ":") ? new IPEndPoint(IPAddress.Parse(entry.Split(':')[0]), Int32.Parse(entry.Split(':')[1])) : new IPEndPoint(IPAddress.Loopback, 0)));
|
||||
UserInfo.IPs = new HashSet<IPEndPoint>(ips); //2014.08.30.
|
||||
CurrentUser.IP = IPAddress.Parse(respstr[2]); //2014.10.24. - Most már csak ott lehet rá hivatkozni, felesleges eltárolni
|
||||
//2014.09.19. - Bejelentkezés elküldése áthelyezve a MainForm-ba
|
||||
|
||||
CurrentUser.UserID = Int32.Parse(respstr[0]); //2014.09.01. - Áthelyeztem, hogy addig ne higgye bejelentkezettnek, amíg el nem küldi a többieknek
|
||||
|
||||
Storage.SaltKey = CalculateMD5Hash(PassText); //2014.08.07.
|
||||
Storage.FileName = respstr[0] + ".db"; //2014.09.01. - Felesleges számmá alakítani, majd vissza
|
||||
|
||||
CurrentUser.UserName = UserText; //2014.09.01. - Ha semmit nem tud saját magáról, és más sem, de nem ismerőse saját magának, akkor az itt beállított felhasználónév érvényesül
|
||||
CurrentUser.Name = UserText; //2014.09.01.
|
||||
string ReceivedPass = respstr[4]; //2014.10.24. 1:39
|
||||
LoginForm.UserCode = CalculateMD5Hash(ReceivedPass + " Some text because why not " + CurrentUser.UserID).ToLower();
|
||||
|
||||
Closeable = true;
|
||||
this.Invoke(new MyDelegate(SetLoginValues));
|
||||
}
|
||||
UserID,
|
||||
UserName,
|
||||
MyIP,
|
||||
//ServerIPs,
|
||||
//NonServerIPs,
|
||||
//ServerIPsOnNAT,
|
||||
//NonServerIPsOnNat,
|
||||
IPs,
|
||||
Password
|
||||
}
|
||||
|
||||
public static string CalculateMD5Hash(string input)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<AssemblyName>MSGer.tk</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
|
@ -23,7 +24,6 @@
|
|||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
|
@ -45,6 +45,7 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<NoWin32Manifest>true</NoWin32Manifest>
|
||||
|
@ -94,8 +95,15 @@
|
|||
<Compile Include="ChatForm.Designer.cs">
|
||||
<DependentUpon>ChatForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ChatPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ChatPanel.Designer.cs">
|
||||
<DependentUpon>ChatPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CurrentUser.cs" />
|
||||
<Compile Include="ErrorHandling.cs" />
|
||||
<Compile Include="ICMPPacket.cs" />
|
||||
<Compile Include="InvitePartner.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -103,6 +111,7 @@
|
|||
<DependentUpon>InvitePartner.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Language.cs" />
|
||||
<Compile Include="Logging.cs" />
|
||||
<Compile Include="LoginForm.RegistrationForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -121,7 +130,12 @@
|
|||
<Compile Include="LoginForm.Designer.cs">
|
||||
<DependentUpon>LoginForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Events.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Networking.CreateParse.cs" />
|
||||
<Compile Include="Networking.cs" />
|
||||
<Compile Include="Networking.SendRequest.cs" />
|
||||
<Compile Include="Notifier.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -144,6 +158,13 @@
|
|||
<Compile Include="Storage.cs" />
|
||||
<Compile Include="StreamHelper.cs" />
|
||||
<Compile Include="TextFormat.cs" />
|
||||
<Compile Include="Theme.cs" />
|
||||
<Compile Include="ThemedForms.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ThemedForms.Designer.cs">
|
||||
<DependentUpon>ThemedForms.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UpdateListAndChat.cs" />
|
||||
<Compile Include="_MyNotifier.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
|
@ -172,6 +193,9 @@
|
|||
<EmbeddedResource Include="ChatForm.resx">
|
||||
<DependentUpon>ChatForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ChatPanel.resx">
|
||||
<DependentUpon>ChatPanel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="InvitePartner.resx">
|
||||
<DependentUpon>InvitePartner.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -193,6 +217,7 @@
|
|||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SelectPartnerForm.resx">
|
||||
<DependentUpon>SelectPartnerForm.cs</DependentUpon>
|
||||
|
@ -200,6 +225,14 @@
|
|||
<EmbeddedResource Include="SettingsForm.resx">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ThemedForms.resx">
|
||||
<DependentUpon>ThemedForms.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="LoginForm.LoginUser.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Networking.SendUpdate.cs" />
|
||||
<Compile Include="Networking.Threads.cs" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
@ -255,11 +288,26 @@
|
|||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\RichListView\RichListView\RichListView\RichListView.csproj">
|
||||
<Project>{AE5CA7F1-D19E-479B-B06B-39C1280C5005}</Project>
|
||||
<ProjectReference Include="..\Handwriting program\Handwriting program\Handwriting program.csproj">
|
||||
<Project>{9ded0c68-3f97-4b14-88d8-f76a749f8943}</Project>
|
||||
<Name>Handwriting program</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\RichListView\RichListView\RichListView.csproj">
|
||||
<Project>{ae5ca7f1-d19e-479b-b06b-39c1280c5005}</Project>
|
||||
<Name>RichListView</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="NATUPNPLib">
|
||||
<Guid>{1C565858-F302-471E-B409-F180AA4ABEC6}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2013 for Windows Desktop
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
VisualStudioVersion = 12.0.30723.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSGer.tk", "MSGer.tk.csproj", "{F60940C0-05FC-46C0-948E-6DBECBBE38DD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{FCEAE638-329B-4392-8A9E-FEABEACBA077} = {FCEAE638-329B-4392-8A9E-FEABEACBA077}
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943} = {9DED0C68-3F97-4B14-88D8-F76A749F8943}
|
||||
{AE5CA7F1-D19E-479B-B06B-39C1280C5005} = {AE5CA7F1-D19E-479B-B06B-39C1280C5005}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RichListView", "..\..\..\RichListView\RichListView\RichListView\RichListView.csproj", "{AE5CA7F1-D19E-479B-B06B-39C1280C5005}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Handwriting program", "..\Handwriting program\Handwriting program\Handwriting program.csproj", "{9DED0C68-3F97-4B14-88D8-F76A749F8943}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RichListView", "..\RichListView\RichListView\RichListView.csproj", "{AE5CA7F1-D19E-479B-B06B-39C1280C5005}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "..\Updater\Updater.csproj", "{FCEAE638-329B-4392-8A9E-FEABEACBA077}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -17,10 +26,18 @@ Global
|
|||
{F60940C0-05FC-46C0-948E-6DBECBBE38DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F60940C0-05FC-46C0-948E-6DBECBBE38DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F60940C0-05FC-46C0-948E-6DBECBBE38DD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9DED0C68-3F97-4B14-88D8-F76A749F8943}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE5CA7F1-D19E-479B-B06B-39C1280C5005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE5CA7F1-D19E-479B-B06B-39C1280C5005}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE5CA7F1-D19E-479B-B06B-39C1280C5005}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE5CA7F1-D19E-479B-B06B-39C1280C5005}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FCEAE638-329B-4392-8A9E-FEABEACBA077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FCEAE638-329B-4392-8A9E-FEABEACBA077}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FCEAE638-329B-4392-8A9E-FEABEACBA077}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FCEAE638-329B-4392-8A9E-FEABEACBA077}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Binary file not shown.
312
MSGer.tk/MainForm.Designer.cs
generated
312
MSGer.tk/MainForm.Designer.cs
generated
|
@ -32,16 +32,16 @@
|
|||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
SzNPProjects.RichListViewColumn richListViewColumn1 = new SzNPProjects.RichListViewColumn();
|
||||
SzNPProjects.RichListViewColumn richListViewColumn2 = new SzNPProjects.RichListViewColumn();
|
||||
SzNPProjects.RichListViewColumn richListViewColumn3 = new SzNPProjects.RichListViewColumn();
|
||||
SzNPProjects.RichListViewColumn richListViewColumn4 = new SzNPProjects.RichListViewColumn();
|
||||
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.iconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fájlToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.kijelentkezésToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -104,25 +104,22 @@
|
|||
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.névjegyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.partnerImages = new System.Windows.Forms.ImageList(this.components);
|
||||
this.partnerMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.üzenetküldésToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.emailKüldéseemailToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.információToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ismerősLetiltásaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ismerősTörléseToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.becenévSzerkesztéseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.eseményértesitésekToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.beszélgetésnaplóMegnyitásaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contactList = new SzNPProjects.RichListView();
|
||||
this.MainPanel = new System.Windows.Forms.Panel();
|
||||
this.searchListView = new SzNPProjects.RichListView();
|
||||
this.statusStrip2 = new System.Windows.Forms.StatusStrip();
|
||||
this.servers = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.onlineservers = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.mainserver = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.chatIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.listPartnerMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.iconMenu.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.partnerMenu.SuspendLayout();
|
||||
this.MainPanel.SuspendLayout();
|
||||
this.statusStrip2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// notifyIcon1
|
||||
|
@ -170,16 +167,6 @@
|
|||
this.toolStripMenuItem9.Text = "Kilépés";
|
||||
this.toolStripMenuItem9.Click += new System.EventHandler(this.ExitProgram);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button1.Location = new System.Drawing.Point(519, 104);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(35, 23);
|
||||
this.button1.TabIndex = 4;
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
|
@ -187,10 +174,12 @@
|
|||
this.panel2.BackgroundImage = global::MSGer.tk.Properties.Resources.Keresősáv;
|
||||
this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.panel2.Controls.Add(this.textBox1);
|
||||
this.panel2.Location = new System.Drawing.Point(0, 96);
|
||||
this.panel2.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.panel2.Location = new System.Drawing.Point(3, 3);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(513, 31);
|
||||
this.panel2.Size = new System.Drawing.Size(494, 31);
|
||||
this.panel2.TabIndex = 5;
|
||||
this.panel2.Click += new System.EventHandler(this.panel2_Click);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
|
@ -201,23 +190,13 @@
|
|||
this.textBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(137)))), ((int)(((byte)(161)))), ((int)(((byte)(194)))));
|
||||
this.textBox1.Location = new System.Drawing.Point(6, 8);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(504, 13);
|
||||
this.textBox1.Size = new System.Drawing.Size(485, 13);
|
||||
this.textBox1.TabIndex = 3;
|
||||
this.textBox1.Text = "Ismerősök keresése...";
|
||||
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||
this.textBox1.Enter += new System.EventHandler(this.ClearSearchBar);
|
||||
this.textBox1.Leave += new System.EventHandler(this.PutTextInSearchBar);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel1.BackgroundImage = global::MSGer.tk.Properties.Resources.Blue_Wallpaper_HD_2;
|
||||
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 27);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(624, 63);
|
||||
this.panel1.TabIndex = 2;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.Color.Black;
|
||||
|
@ -231,7 +210,7 @@
|
|||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.menuStrip1.Size = new System.Drawing.Size(624, 24);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(799, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
|
@ -666,102 +645,6 @@
|
|||
this.partnerImages.ImageSize = new System.Drawing.Size(16, 16);
|
||||
this.partnerImages.TransparentColor = System.Drawing.Color.Transparent;
|
||||
//
|
||||
// partnerMenu
|
||||
//
|
||||
this.partnerMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.üzenetküldésToolStripMenuItem,
|
||||
this.emailKüldéseemailToolStripMenuItem,
|
||||
this.toolStripMenuItem2,
|
||||
this.információToolStripMenuItem,
|
||||
this.toolStripSeparator14,
|
||||
this.ismerősLetiltásaToolStripMenuItem,
|
||||
this.ismerősTörléseToolStripMenuItem1,
|
||||
this.toolStripSeparator15,
|
||||
this.becenévSzerkesztéseToolStripMenuItem,
|
||||
this.toolStripSeparator16,
|
||||
this.eseményértesitésekToolStripMenuItem,
|
||||
this.toolStripSeparator17,
|
||||
this.beszélgetésnaplóMegnyitásaToolStripMenuItem});
|
||||
this.partnerMenu.Name = "partnerMenu";
|
||||
this.partnerMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
|
||||
this.partnerMenu.Size = new System.Drawing.Size(238, 226);
|
||||
//
|
||||
// üzenetküldésToolStripMenuItem
|
||||
//
|
||||
this.üzenetküldésToolStripMenuItem.Name = "üzenetküldésToolStripMenuItem";
|
||||
this.üzenetküldésToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
|
||||
this.üzenetküldésToolStripMenuItem.Text = "Üzenetküldés";
|
||||
this.üzenetküldésToolStripMenuItem.Click += new System.EventHandler(this.PartnerMenu_SendMessage);
|
||||
//
|
||||
// emailKüldéseemailToolStripMenuItem
|
||||
//
|
||||
this.emailKüldéseemailToolStripMenuItem.Name = "emailKüldéseemailToolStripMenuItem";
|
||||
this.emailKüldéseemailToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
|
||||
this.emailKüldéseemailToolStripMenuItem.Text = "E-mail küldése (email)";
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(237, 22);
|
||||
this.toolStripMenuItem2.Text = "E-mail másolása";
|
||||
//
|
||||
// információToolStripMenuItem
|
||||
//
|
||||
this.információToolStripMenuItem.Name = "információToolStripMenuItem";
|
||||
this.információToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
|
||||
this.információToolStripMenuItem.Text = "Információ";
|
||||
this.információToolStripMenuItem.Click += new System.EventHandler(this.információToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator14
|
||||
//
|
||||
this.toolStripSeparator14.Name = "toolStripSeparator14";
|
||||
this.toolStripSeparator14.Size = new System.Drawing.Size(234, 6);
|
||||
//
|
||||
// ismerősLetiltásaToolStripMenuItem
|
||||
//
|
||||
this.ismerősLetiltásaToolStripMenuItem.Name = "ismerősLetiltásaToolStripMenuItem";
|
||||
this.ismerősLetiltásaToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
|
||||
this.ismerősLetiltásaToolStripMenuItem.Text = "Ismerős letiltása";
|
||||
//
|
||||
// ismerősTörléseToolStripMenuItem1
|
||||
//
|
||||
this.ismerősTörléseToolStripMenuItem1.Name = "ismerősTörléseToolStripMenuItem1";
|
||||
this.ismerősTörléseToolStripMenuItem1.Size = new System.Drawing.Size(237, 22);
|
||||
this.ismerősTörléseToolStripMenuItem1.Text = "Ismerős törlése";
|
||||
//
|
||||
// toolStripSeparator15
|
||||
//
|
||||
this.toolStripSeparator15.Name = "toolStripSeparator15";
|
||||
this.toolStripSeparator15.Size = new System.Drawing.Size(234, 6);
|
||||
//
|
||||
// becenévSzerkesztéseToolStripMenuItem
|
||||
//
|
||||
this.becenévSzerkesztéseToolStripMenuItem.Name = "becenévSzerkesztéseToolStripMenuItem";
|
||||
this.becenévSzerkesztéseToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
|
||||
this.becenévSzerkesztéseToolStripMenuItem.Text = "Becenév szerkesztése";
|
||||
//
|
||||
// toolStripSeparator16
|
||||
//
|
||||
this.toolStripSeparator16.Name = "toolStripSeparator16";
|
||||
this.toolStripSeparator16.Size = new System.Drawing.Size(234, 6);
|
||||
//
|
||||
// eseményértesitésekToolStripMenuItem
|
||||
//
|
||||
this.eseményértesitésekToolStripMenuItem.Name = "eseményértesitésekToolStripMenuItem";
|
||||
this.eseményértesitésekToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
|
||||
this.eseményértesitésekToolStripMenuItem.Text = "Eseményértesitések";
|
||||
//
|
||||
// toolStripSeparator17
|
||||
//
|
||||
this.toolStripSeparator17.Name = "toolStripSeparator17";
|
||||
this.toolStripSeparator17.Size = new System.Drawing.Size(234, 6);
|
||||
//
|
||||
// beszélgetésnaplóMegnyitásaToolStripMenuItem
|
||||
//
|
||||
this.beszélgetésnaplóMegnyitásaToolStripMenuItem.Name = "beszélgetésnaplóMegnyitásaToolStripMenuItem";
|
||||
this.beszélgetésnaplóMegnyitásaToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
|
||||
this.beszélgetésnaplóMegnyitásaToolStripMenuItem.Text = "Beszélgetésnapló megnyitása...";
|
||||
//
|
||||
// contactList
|
||||
//
|
||||
this.contactList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
|
@ -780,25 +663,131 @@
|
|||
richListViewColumn2};
|
||||
this.contactList.HeaderHeight = 0;
|
||||
this.contactList.ItemHeight = 50;
|
||||
this.contactList.Location = new System.Drawing.Point(0, 134);
|
||||
this.contactList.Location = new System.Drawing.Point(3, 40);
|
||||
this.contactList.Name = "contactList";
|
||||
this.contactList.SelectedIndex = -1;
|
||||
this.contactList.SelectionColor = System.Drawing.Color.Aqua;
|
||||
this.contactList.Size = new System.Drawing.Size(624, 311);
|
||||
this.contactList.TabIndex = 8;
|
||||
this.contactList.Size = new System.Drawing.Size(494, 468);
|
||||
this.contactList.TabIndex = 0;
|
||||
this.contactList.ItemDoubleClicked += new System.EventHandler<int>(this.contactList_ItemDoubleClicked);
|
||||
this.contactList.ItemRightClicked += new System.EventHandler<int>(this.contactList_ItemRightClicked);
|
||||
//
|
||||
// MainPanel
|
||||
//
|
||||
this.MainPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.MainPanel.Controls.Add(this.searchListView);
|
||||
this.MainPanel.Controls.Add(this.contactList);
|
||||
this.MainPanel.Controls.Add(this.statusStrip2);
|
||||
this.MainPanel.Controls.Add(this.panel2);
|
||||
this.MainPanel.Location = new System.Drawing.Point(150, 27);
|
||||
this.MainPanel.Name = "MainPanel";
|
||||
this.MainPanel.Size = new System.Drawing.Size(500, 533);
|
||||
this.MainPanel.TabIndex = 9;
|
||||
//
|
||||
// searchListView
|
||||
//
|
||||
this.searchListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.searchListView.AutoScroll = true;
|
||||
this.searchListView.AutoUpdate = true;
|
||||
this.searchListView.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
|
||||
this.searchListView.ColumnAutoFill = true;
|
||||
richListViewColumn3.Text = null;
|
||||
richListViewColumn3.Width = 50;
|
||||
richListViewColumn4.Text = null;
|
||||
richListViewColumn4.Width = 100;
|
||||
this.searchListView.Columns = new SzNPProjects.RichListViewColumn[] {
|
||||
richListViewColumn3,
|
||||
richListViewColumn4};
|
||||
this.searchListView.HeaderHeight = 0;
|
||||
this.searchListView.ItemHeight = 50;
|
||||
this.searchListView.Location = new System.Drawing.Point(3, 32);
|
||||
this.searchListView.Name = "searchListView";
|
||||
this.searchListView.SelectedIndex = -1;
|
||||
this.searchListView.SelectionColor = System.Drawing.Color.Aqua;
|
||||
this.searchListView.Size = new System.Drawing.Size(494, 363);
|
||||
this.searchListView.TabIndex = 7;
|
||||
this.searchListView.Visible = false;
|
||||
//
|
||||
// statusStrip2
|
||||
//
|
||||
this.statusStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.servers,
|
||||
this.onlineservers,
|
||||
this.mainserver});
|
||||
this.statusStrip2.Location = new System.Drawing.Point(0, 511);
|
||||
this.statusStrip2.Name = "statusStrip2";
|
||||
this.statusStrip2.Size = new System.Drawing.Size(500, 22);
|
||||
this.statusStrip2.SizingGrip = false;
|
||||
this.statusStrip2.TabIndex = 6;
|
||||
//
|
||||
// servers
|
||||
//
|
||||
this.servers.Name = "servers";
|
||||
this.servers.Size = new System.Drawing.Size(43, 17);
|
||||
this.servers.Text = "servers";
|
||||
//
|
||||
// onlineservers
|
||||
//
|
||||
this.onlineservers.Name = "onlineservers";
|
||||
this.onlineservers.Size = new System.Drawing.Size(76, 17);
|
||||
this.onlineservers.Text = "onlineservers";
|
||||
//
|
||||
// mainserver
|
||||
//
|
||||
this.mainserver.Name = "mainserver";
|
||||
this.mainserver.Size = new System.Drawing.Size(366, 17);
|
||||
this.mainserver.Spring = true;
|
||||
this.mainserver.Text = "mainserver";
|
||||
this.mainserver.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.flowLayoutPanel1.AutoScroll = true;
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 27);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(150, 533);
|
||||
this.flowLayoutPanel1.TabIndex = 10;
|
||||
this.flowLayoutPanel1.WrapContents = false;
|
||||
this.flowLayoutPanel1.Click += new System.EventHandler(this.flowLayoutPanel1_Click);
|
||||
//
|
||||
// flowLayoutPanel2
|
||||
//
|
||||
this.flowLayoutPanel2.AutoScroll = true;
|
||||
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowLayoutPanel2.Location = new System.Drawing.Point(649, 24);
|
||||
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(150, 538);
|
||||
this.flowLayoutPanel2.TabIndex = 11;
|
||||
this.flowLayoutPanel2.WrapContents = false;
|
||||
this.flowLayoutPanel2.Click += new System.EventHandler(this.flowLayoutPanel1_Click);
|
||||
//
|
||||
// chatIconMenu
|
||||
//
|
||||
this.chatIconMenu.Name = "contextMenuStrip1";
|
||||
this.chatIconMenu.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// listPartnerMenu
|
||||
//
|
||||
this.listPartnerMenu.Name = "listPartnerMenu";
|
||||
this.listPartnerMenu.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.LightSkyBlue;
|
||||
this.ClientSize = new System.Drawing.Size(624, 442);
|
||||
this.Controls.Add(this.contactList);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.ClientSize = new System.Drawing.Size(799, 562);
|
||||
this.Controls.Add(this.MainPanel);
|
||||
this.Controls.Add(this.flowLayoutPanel2);
|
||||
this.Controls.Add(this.flowLayoutPanel1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "MainForm";
|
||||
|
@ -811,7 +800,10 @@
|
|||
this.panel2.PerformLayout();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.partnerMenu.ResumeLayout(false);
|
||||
this.MainPanel.ResumeLayout(false);
|
||||
this.MainPanel.PerformLayout();
|
||||
this.statusStrip2.ResumeLayout(false);
|
||||
this.statusStrip2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -879,25 +871,9 @@
|
|||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
|
||||
private System.Windows.Forms.ToolStripMenuItem névjegyToolStripMenuItem;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.ImageList partnerImages;
|
||||
private System.Windows.Forms.ContextMenuStrip partnerMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem üzenetküldésToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem emailKüldéseemailToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
||||
private System.Windows.Forms.ToolStripMenuItem információToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
|
||||
private System.Windows.Forms.ToolStripMenuItem ismerősLetiltásaToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ismerősTörléseToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator15;
|
||||
private System.Windows.Forms.ToolStripMenuItem becenévSzerkesztéseToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator16;
|
||||
private System.Windows.Forms.ToolStripMenuItem eseményértesitésekToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator17;
|
||||
private System.Windows.Forms.ToolStripMenuItem beszélgetésnaplóMegnyitásaToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
|
||||
private System.Windows.Forms.ContextMenuStrip iconMenu;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator18;
|
||||
|
@ -906,6 +882,16 @@
|
|||
public System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
|
||||
internal System.Windows.Forms.NotifyIcon notifyIcon1;
|
||||
internal SzNPProjects.RichListView contactList;
|
||||
private System.Windows.Forms.Panel MainPanel;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||
private System.Windows.Forms.StatusStrip statusStrip2;
|
||||
private System.Windows.Forms.ToolStripStatusLabel servers;
|
||||
private System.Windows.Forms.ToolStripStatusLabel onlineservers;
|
||||
private System.Windows.Forms.ToolStripStatusLabel mainserver;
|
||||
private System.Windows.Forms.ContextMenuStrip chatIconMenu;
|
||||
private System.Windows.Forms.ContextMenuStrip listPartnerMenu;
|
||||
internal SzNPProjects.RichListView searchListView;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
316
MSGer.tk/MainForm.Events.cs
Normal file
316
MSGer.tk/MainForm.Events.cs
Normal file
|
@ -0,0 +1,316 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
private void PopupCloseClick(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Close");
|
||||
}
|
||||
|
||||
private void PopupClick(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Click");
|
||||
}
|
||||
|
||||
private void LoginNewUser(object sender, EventArgs e)
|
||||
{
|
||||
Storage.Save(true); //2014.09.19.
|
||||
Process.Start(((Program.ProcessName.Contains("vshost")) ? Program.ProcessName.Replace(".vshost", "") : Program.ProcessName) + ".exe", "multi");
|
||||
}
|
||||
|
||||
public void SetOnlineState(object sender, EventArgs e)
|
||||
{
|
||||
int state = 0;
|
||||
if (sender == elérhetőToolStripMenuItem)
|
||||
state = 1;
|
||||
if (sender == elfoglaltToolStripMenuItem)
|
||||
state = 2;
|
||||
if (sender == nincsAGépnélToolStripMenuItem)
|
||||
state = 3;
|
||||
if (sender == null) //2014.08.30. - Erre nagyon sokáig nem volt felkészítve, és ezt kihasználtam a kijelentkezéshez
|
||||
{
|
||||
if (Networking.SendRequest("setstate", 0 + "", 0, true).Contains("Fail")) //Kijelentkezés - if: 2014.11.15.
|
||||
MessageBox.Show(Language.Translate("error"));
|
||||
//byte[] tmpb = Encoding.Unicode.GetBytes(CurrentUser.IP.ToString());
|
||||
string str = "";
|
||||
foreach (var ip in CurrentUser.IPs)
|
||||
str += ip + ";";
|
||||
byte[] tmpb = Encoding.Unicode.GetBytes(str);
|
||||
byte[] sendb = new byte[4 + tmpb.Length];
|
||||
Array.Copy(BitConverter.GetBytes(tmpb.Length), sendb, 4);
|
||||
Array.Copy(tmpb, 0, sendb, 4, tmpb.Length);
|
||||
//Networking.SendUpdate(Networking.UpdateType.LogoutUser, sendb, false);
|
||||
Networking.SendUpdateInThread(Networking.UpdateType.LogoutUser, sendb, null);
|
||||
CurrentUser.SendChanges = false; //2014.12.31.
|
||||
}
|
||||
CurrentUser.State = state; //2014.08.28.
|
||||
}
|
||||
|
||||
private void SelectPartner(object sender, EventArgs e)
|
||||
{
|
||||
var form = new SelectPartnerForm((ToolStripMenuItem)sender);
|
||||
DialogResult dr = form.ShowDialog();
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
//2014.04.25.
|
||||
string[] partners = form.Partners;
|
||||
ChatPanel tmpchat = new ChatPanel();
|
||||
for (int i = 0; i < partners.Length; i++)
|
||||
{
|
||||
if (partners[i] != "") //2014.04.17.
|
||||
{
|
||||
for (int j = 0; j < UserInfo.KnownUsers.Count; j++)
|
||||
{
|
||||
if (!UserInfo.KnownUsers[j].IsPartner)
|
||||
continue;
|
||||
int tmp; //2014.04.17.
|
||||
if (!Int32.TryParse(partners[i], out tmp))
|
||||
tmp = -1;
|
||||
if (UserInfo.KnownUsers[j].UserName == partners[i] || UserInfo.KnownUsers[j].Email == partners[i] || UserInfo.KnownUsers[j].UserID == tmp)
|
||||
{ //Egyezik a név, E-mail vagy ID - UserName: 2014.04.17.
|
||||
tmpchat.ChatPartners.Add(UserInfo.KnownUsers[j]); //2014.08.28.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmpchat.ChatPartners.Count != 0)
|
||||
{
|
||||
ChatPanel.ChatWindows.Add(tmpchat);
|
||||
if (sender == fájlKüldéseToolStripMenuItem)
|
||||
{
|
||||
//tmpchat.Show();
|
||||
tmpchat.Init();
|
||||
tmpchat.OpenSendFile(form);
|
||||
}
|
||||
if (sender == azonnaliÜzenetKüldéseToolStripMenuItem)
|
||||
{
|
||||
//tmpchat.Show();
|
||||
tmpchat.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearSearchBar(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text == Language.Translate("searchbar"))
|
||||
textBox1.Clear();
|
||||
}
|
||||
|
||||
private void PutTextInSearchBar(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text == "")
|
||||
textBox1.Text = Language.Translate("searchbar");
|
||||
}
|
||||
//public static int RightClickedPartner = -1;
|
||||
|
||||
public static void OpenSendMessage(int uid)
|
||||
{
|
||||
var uinfo = UserInfo.Select(uid);
|
||||
//Üzenetküldő form
|
||||
int ChatNum = -1;
|
||||
for (int i = 0; i < ChatPanel.ChatWindows.Count; i++)
|
||||
{
|
||||
if (ChatPanel.ChatWindows[i].ChatPartners.Count == 1 && ChatPanel.ChatWindows[i].ChatPartners.Contains(uinfo))
|
||||
{ //Vele, és csak vele beszél
|
||||
ChatNum = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ChatNum == -1)
|
||||
{ //Nincs még chatablaka
|
||||
ChatPanel.ChatWindows.Add(new ChatPanel());
|
||||
//ChatPanel.ChatWindows[ChatPanel.ChatWindows.Count - 1].ChatPartners.Add(uid);
|
||||
//ChatPanel.ChatWindows[ChatPanel.ChatWindows.Count - 1].Show();
|
||||
//ChatPanel.ChatWindows[ChatPanel.ChatWindows.Count - 1].Focus(); //2014.08.08.
|
||||
var cf = ChatPanel.ChatWindows[ChatPanel.ChatWindows.Count - 1];
|
||||
cf.ChatPartners.Add(uinfo);
|
||||
cf.Init();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatPanel.ChatWindows[ChatNum].Show();
|
||||
ChatPanel.ChatWindows[ChatNum].Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMainFormLoad(object sender, EventArgs e)
|
||||
{
|
||||
if (CurrentUser.UserID == 0)
|
||||
Program.Exit();
|
||||
|
||||
LoadPartnerList(); //Be kell töltenie a MainForm-nak, hogy hivatkozhasson rá
|
||||
|
||||
CurrentUser.SendChanges = true; //2014.08.30.
|
||||
}
|
||||
|
||||
private void InvitePartner(object sender, EventArgs e)
|
||||
{
|
||||
(new InvitePartner()).ShowDialog();
|
||||
}
|
||||
|
||||
private void BeforeExit(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void toolStripMenuItem4_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CurrentUser.UserID != 0) //2014.04.18.
|
||||
{
|
||||
this.Show();
|
||||
this.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitProgram(object sender, EventArgs e)
|
||||
{
|
||||
Program.Exit();
|
||||
}
|
||||
|
||||
private void ismerősFelvételeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
(new AddPartner()).ShowDialog();
|
||||
}
|
||||
|
||||
private void névjegyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
(new AboutBox1()).ShowDialog();
|
||||
}
|
||||
|
||||
private void mindigLegfelülToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.TopMost = mindigLegfelülToolStripMenuItem.Checked;
|
||||
}
|
||||
|
||||
private void beállitásokToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
//(new SettingsForm()).Show();
|
||||
if (Program.SettingsF == null)
|
||||
{
|
||||
Program.SettingsF = new SettingsForm();
|
||||
Program.SettingsF.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void contactList_ItemDoubleClicked(object sender, int e)
|
||||
{
|
||||
int uid = UserInfo.GetUserIDFromListID(e);
|
||||
OpenSendMessage(uid);
|
||||
}
|
||||
|
||||
private void bezárásToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void információToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
/*if (RightClickedPartner == -1)
|
||||
return;*/
|
||||
for (int i = 0; i < UserInfo.KnownUsers.Count; i++)
|
||||
{
|
||||
if (UserInfo.KnownUsers[i].TMPListID != (int)((ToolStripMenuItem)sender).GetCurrentParent().Tag)
|
||||
continue;
|
||||
(new PartnerInformation(UserInfo.KnownUsers[i])).ShowDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void contactList_ItemRightClicked(object sender, int e)
|
||||
{
|
||||
contactList.Items[e].Selected = true;
|
||||
//RightClickedPartner = e;
|
||||
//partnerMenu.Show(Cursor.Position);
|
||||
listPartnerMenu.Tag = e;
|
||||
listPartnerMenu.Show(Cursor.Position);
|
||||
}
|
||||
|
||||
private void PartnerMenu_SendMessage(object sender, EventArgs e)
|
||||
{
|
||||
/*if (RightClickedPartner == -1)
|
||||
return;
|
||||
int uid = UserInfo.GetUserIDFromListID(RightClickedPartner);
|
||||
OpenSendMessage(uid);
|
||||
RightClickedPartner = -1;*/
|
||||
int uid = UserInfo.GetUserIDFromListID((int)((ToolStripMenuItem)sender).GetCurrentParent().Tag); //Erre kattintott jobb gombbal
|
||||
OpenSendMessage(uid);
|
||||
}
|
||||
|
||||
private void panel2_Click(object sender, EventArgs e)
|
||||
{ //2014.10.31.
|
||||
textBox1.Focus();
|
||||
}
|
||||
|
||||
private System.Windows.Forms.Timer searchbartimer = new System.Windows.Forms.Timer();
|
||||
//private RichListView searchlist = new RichListView();
|
||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||
{ //2014.11.30. 1:33
|
||||
var searchlist = searchListView; //2014.12.14. 1:46
|
||||
/*if (textBox1.Text.Length == 0 || textBox1.Text == Language.Translate("searchbar")) //text==translate...: 2014.12.05.
|
||||
{
|
||||
searchlist.Items.Clear();
|
||||
searchlist.Visible = false;
|
||||
contactList.Visible = true;
|
||||
return;
|
||||
}*/
|
||||
if (searchbartimer.Enabled)
|
||||
return;
|
||||
searchbartimer.Interval = 1000;
|
||||
searchbartimer.Tick += delegate
|
||||
{
|
||||
searchbartimer.Stop();
|
||||
if (textBox1.Text.Length == 0 || textBox1.Text == Language.Translate("searchbar")) //text==translate...: 2014.12.05.
|
||||
{
|
||||
//searchlist.Items.Clear();
|
||||
searchlist.Visible = false;
|
||||
contactList.Visible = true;
|
||||
return;
|
||||
}
|
||||
contactList.Visible = false;
|
||||
searchlist.Parent = contactList.Parent; //2014.12.05.
|
||||
searchlist.Bounds = contactList.Bounds;
|
||||
//var tmpcol = new RichListViewColumn[contactList.Columns.Length]; //2014.12.05.
|
||||
//contactList.Columns.CopyTo(tmpcol, 0); //2014.12.05.
|
||||
//searchlist.Columns = tmpcol; //2014.12.05.
|
||||
searchlist.Items.Clear(); //2014.12.05.
|
||||
//searchlist.Visible = true;
|
||||
searchlist.AutoUpdate = false;
|
||||
foreach (var item in UserInfo.KnownUsers)
|
||||
{
|
||||
if (!item.IsPartner)
|
||||
continue;
|
||||
if (item.Name.ToLower().Contains(textBox1.Text.ToLower()) || item.Email.ToLower().Contains(textBox1.Text.ToLower()) || item.UserName.ToLower().Contains(textBox1.Text.ToLower())) //ToLower: 2014.12.14. 1:53
|
||||
{
|
||||
/*searchlist.Items.Add(new RichListViewItem(contactList.Columns.Length));
|
||||
searchlist.Items.Last().SubItems[0] = new PictureBox();
|
||||
(searchlist.Items.Last().SubItems[0] as PictureBox).ImageLocation = item.GetImage();
|
||||
searchlist.Items.Last().SubItems[1].Text = "";*/
|
||||
item.CreateListItem(searchlist, searchlist.Items.Count);
|
||||
}
|
||||
}
|
||||
searchlist.AutoUpdate = true;
|
||||
searchlist.Visible = true;
|
||||
};
|
||||
searchbartimer.Start();
|
||||
}
|
||||
|
||||
private void flowLayoutPanel1_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var item in ChatPanel.ChatWindows)
|
||||
{
|
||||
item.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ using System.Net.NetworkInformation;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
public partial class MainForm : ThemedForms
|
||||
{
|
||||
public static LoginForm LoginDialog;
|
||||
public static Thread LThread;
|
||||
|
@ -29,6 +29,7 @@ namespace MSGer.tk
|
|||
public MainForm()
|
||||
{
|
||||
BeforeLogin.SetText("Starting...");
|
||||
Program.MainF = this;
|
||||
InitializeComponent();
|
||||
Thread.CurrentThread.Name = "Main Thread";
|
||||
toolStripMenuItem4.Enabled = false; //2014.04.12.
|
||||
|
@ -59,78 +60,131 @@ namespace MSGer.tk
|
|||
//try
|
||||
//{
|
||||
fájlToolStripMenuItem.Text = Language.Translate("menu_file");
|
||||
Language.ReloadEvent += delegate { fájlToolStripMenuItem.Text = Language.Translate("menu_file"); };
|
||||
kijelentkezésToolStripMenuItem.Text = Language.Translate("menu_file_logout");
|
||||
Language.ReloadEvent += delegate { kijelentkezésToolStripMenuItem.Text = Language.Translate("menu_file_logout"); };
|
||||
toolStripMenuItem1.Text = Language.Translate("menu_file_loginnewuser");
|
||||
Language.ReloadEvent += delegate { toolStripMenuItem1.Text = Language.Translate("menu_file_loginnewuser"); };
|
||||
állapotToolStripMenuItem.Text = Language.Translate("menu_file_status");
|
||||
Language.ReloadEvent += delegate { állapotToolStripMenuItem.Text = Language.Translate("menu_file_status"); };
|
||||
elérhetőToolStripMenuItem.Text = Language.Translate("menu_file_status_online");
|
||||
Language.ReloadEvent += delegate { elérhetőToolStripMenuItem.Text = Language.Translate("menu_file_status_online"); };
|
||||
elfoglaltToolStripMenuItem.Text = Language.Translate("menu_file_status_busy");
|
||||
Language.ReloadEvent += delegate { elfoglaltToolStripMenuItem.Text = Language.Translate("menu_file_status_busy"); };
|
||||
nincsAGépnélToolStripMenuItem.Text = Language.Translate("menu_file_status_away");
|
||||
Language.ReloadEvent += delegate { nincsAGépnélToolStripMenuItem.Text = Language.Translate("menu_file_status_away"); };
|
||||
rejtveKapcsolódikToolStripMenuItem.Text = Language.Translate("menu_file_status_hidden");
|
||||
Language.ReloadEvent += delegate { rejtveKapcsolódikToolStripMenuItem.Text = Language.Translate("menu_file_status_hidden"); };
|
||||
fájlKüldéseToolStripMenuItem.Text = Language.Translate("menu_file_sendfile");
|
||||
Language.ReloadEvent += delegate { fájlKüldéseToolStripMenuItem.Text = Language.Translate("menu_file_sendfile"); };
|
||||
beérkezettFájlokMappájánakMegnyitásaToolStripMenuItem.Text = Language.Translate("menu_file_openreceivedfiles");
|
||||
Language.ReloadEvent += delegate { beérkezettFájlokMappájánakMegnyitásaToolStripMenuItem.Text = Language.Translate("menu_file_openreceivedfiles"); };
|
||||
üzenetekElőzményeinekMegtekintéseToolStripMenuItem.Text = Language.Translate("menu_file_openrecentmsgs");
|
||||
Language.ReloadEvent += delegate { üzenetekElőzményeinekMegtekintéseToolStripMenuItem.Text = Language.Translate("menu_file_openrecentmsgs"); };
|
||||
bezárásToolStripMenuItem.Text = Language.Translate("menu_file_close");
|
||||
Language.ReloadEvent += delegate { bezárásToolStripMenuItem.Text = Language.Translate("menu_file_close"); };
|
||||
kilépésToolStripMenuItem.Text = Language.Translate("menu_file_exit");
|
||||
Language.ReloadEvent += delegate { kilépésToolStripMenuItem.Text = Language.Translate("menu_file_exit"); };
|
||||
|
||||
ismerősökToolStripMenuItem.Text = Language.Translate("menu_contacts");
|
||||
Language.ReloadEvent += delegate { ismerősökToolStripMenuItem.Text = Language.Translate("menu_contacts"); };
|
||||
ismerősFelvételeToolStripMenuItem.Text = Language.Translate("menu_contacts_add");
|
||||
Language.ReloadEvent += delegate { ismerősFelvételeToolStripMenuItem.Text = Language.Translate("menu_contacts_add"); };
|
||||
ismerősSzerkesztéseToolStripMenuItem.Text = Language.Translate("menu_contacts_edit");
|
||||
Language.ReloadEvent += delegate { ismerősSzerkesztéseToolStripMenuItem.Text = Language.Translate("menu_contacts_edit"); };
|
||||
ismerősTörléseToolStripMenuItem.Text = Language.Translate("menu_contacts_remove");
|
||||
Language.ReloadEvent += delegate { ismerősTörléseToolStripMenuItem.Text = Language.Translate("menu_contacts_remove"); };
|
||||
toolStripMenuItem3.Text = Language.Translate("menu_contacts_invite");
|
||||
Language.ReloadEvent += delegate { toolStripMenuItem3.Text = Language.Translate("menu_contacts_invite"); };
|
||||
csoportLétrehozásaToolStripMenuItem.Text = Language.Translate("menu_contacts_makegroup");
|
||||
Language.ReloadEvent += delegate { csoportLétrehozásaToolStripMenuItem.Text = Language.Translate("menu_contacts_makegroup"); };
|
||||
kategóriaLétrehozásaToolStripMenuItem.Text = Language.Translate("menu_contacts_makecategory");
|
||||
Language.ReloadEvent += delegate { kategóriaLétrehozásaToolStripMenuItem.Text = Language.Translate("menu_contacts_makecategory"); };
|
||||
kategóriaSzerkesztéseToolStripMenuItem.Text = Language.Translate("menu_contacts_editcategory");
|
||||
Language.ReloadEvent += delegate { kategóriaSzerkesztéseToolStripMenuItem.Text = Language.Translate("menu_contacts_editcategory"); };
|
||||
kategóriaTörléseToolStripMenuItem.Text = Language.Translate("menu_contacts_removecategory");
|
||||
Language.ReloadEvent += delegate { kategóriaTörléseToolStripMenuItem.Text = Language.Translate("menu_contacts_removecategory"); };
|
||||
|
||||
műveletekToolStripMenuItem.Text = Language.Translate("menu_operations");
|
||||
Language.ReloadEvent += delegate { műveletekToolStripMenuItem.Text = Language.Translate("menu_operations"); };
|
||||
azonnaliÜzenetKüldéseToolStripMenuItem.Text = Language.Translate("menu_operations_sendmsg");
|
||||
Language.ReloadEvent += delegate { azonnaliÜzenetKüldéseToolStripMenuItem.Text = Language.Translate("menu_operations_sendmsg"); };
|
||||
egyébKüldéseToolStripMenuItem.Text = Language.Translate("menu_operations_sendother");
|
||||
Language.ReloadEvent += delegate { egyébKüldéseToolStripMenuItem.Text = Language.Translate("menu_operations_sendother"); };
|
||||
emailKüldéseToolStripMenuItem.Text = Language.Translate("menu_operations_sendother_sendmail");
|
||||
Language.ReloadEvent += delegate { emailKüldéseToolStripMenuItem.Text = Language.Translate("menu_operations_sendother_sendmail"); };
|
||||
fájlKüldéseToolStripMenuItem1.Text = Language.Translate("menu_file_sendfile"); //Ugyanaz a szöveg
|
||||
Language.ReloadEvent += delegate { fájlKüldéseToolStripMenuItem1.Text = Language.Translate("menu_file_sendfile"); };
|
||||
ismerősSzámitógépénekFelhivásaToolStripMenuItem.Text = Language.Translate("menu_operations_callcontact");
|
||||
Language.ReloadEvent += delegate { ismerősSzámitógépénekFelhivásaToolStripMenuItem.Text = Language.Translate("menu_operations_callcontact"); };
|
||||
videóhivásInditásaToolStripMenuItem.Text = Language.Translate("menu_operations_videocall");
|
||||
Language.ReloadEvent += delegate { videóhivásInditásaToolStripMenuItem.Text = Language.Translate("menu_operations_videocall"); };
|
||||
onlineFájlokMegtekintéseToolStripMenuItem.Text = Language.Translate("menu_operations_showonlinefiles");
|
||||
Language.ReloadEvent += delegate { onlineFájlokMegtekintéseToolStripMenuItem.Text = Language.Translate("menu_operations_showonlinefiles"); };
|
||||
közösJátékToolStripMenuItem.Text = Language.Translate("menu_operations_playgame");
|
||||
Language.ReloadEvent += delegate { közösJátékToolStripMenuItem.Text = Language.Translate("menu_operations_playgame"); };
|
||||
távsegitségKéréseToolStripMenuItem.Text = Language.Translate("menu_operations_askforhelp");
|
||||
Language.ReloadEvent += delegate { távsegitségKéréseToolStripMenuItem.Text = Language.Translate("menu_operations_askforhelp"); };
|
||||
|
||||
eszközökToolStripMenuItem.Text = Language.Translate("menu_tools");
|
||||
Language.ReloadEvent += delegate { eszközökToolStripMenuItem.Text = Language.Translate("menu_tools"); };
|
||||
mindigLegfelülToolStripMenuItem.Text = Language.Translate("menu_tools_alwaysontop");
|
||||
Language.ReloadEvent += delegate { mindigLegfelülToolStripMenuItem.Text = Language.Translate("menu_tools_alwaysontop"); };
|
||||
hangulatjelekToolStripMenuItem.Text = Language.Translate("menu_tools_emoticons");
|
||||
Language.ReloadEvent += delegate { hangulatjelekToolStripMenuItem.Text = Language.Translate("menu_tools_emoticons"); };
|
||||
megjelenitendőKépVáltásaToolStripMenuItem.Text = Language.Translate("menu_tools_changeimage");
|
||||
Language.ReloadEvent += delegate { megjelenitendőKépVáltásaToolStripMenuItem.Text = Language.Translate("menu_tools_changeimage"); };
|
||||
háttérMódositásaToolStripMenuItem.Text = Language.Translate("menu_tools_changebackground");
|
||||
Language.ReloadEvent += delegate { háttérMódositásaToolStripMenuItem.Text = Language.Translate("menu_tools_changebackground"); };
|
||||
hangokÉsVideóBeállitásaToolStripMenuItem.Text = Language.Translate("menu_tools_voicevideosettings");
|
||||
Language.ReloadEvent += delegate { hangokÉsVideóBeállitásaToolStripMenuItem.Text = Language.Translate("menu_tools_voicevideosettings"); };
|
||||
beállitásokToolStripMenuItem.Text = Language.Translate("menu_tools_settings");
|
||||
Language.ReloadEvent += delegate { beállitásokToolStripMenuItem.Text = Language.Translate("menu_tools_settings"); };
|
||||
|
||||
súgóToolStripMenuItem.Text = Language.Translate("menu_help");
|
||||
Language.ReloadEvent += delegate { súgóToolStripMenuItem.Text = Language.Translate("menu_help"); };
|
||||
témakörökToolStripMenuItem.Text = Language.Translate("menu_help_contents");
|
||||
Language.ReloadEvent += delegate { témakörökToolStripMenuItem.Text = Language.Translate("menu_help_contents"); };
|
||||
aSzolgáltatásÁllapotsaToolStripMenuItem.Text = Language.Translate("menu_help_status");
|
||||
Language.ReloadEvent += delegate { aSzolgáltatásÁllapotsaToolStripMenuItem.Text = Language.Translate("menu_help_status"); };
|
||||
adatvédelmiNyilatkozatToolStripMenuItem.Text = Language.Translate("menu_help_privacypolicy");
|
||||
Language.ReloadEvent += delegate { adatvédelmiNyilatkozatToolStripMenuItem.Text = Language.Translate("menu_help_privacypolicy"); };
|
||||
használatiFeltételekToolStripMenuItem.Text = Language.Translate("menu_help_termsofuse");
|
||||
Language.ReloadEvent += delegate { használatiFeltételekToolStripMenuItem.Text = Language.Translate("menu_help_termsofuse"); };
|
||||
visszaélésBejelentéseToolStripMenuItem.Text = Language.Translate("menu_help_report");
|
||||
Language.ReloadEvent += delegate { visszaélésBejelentéseToolStripMenuItem.Text = Language.Translate("menu_help_report"); };
|
||||
segitsenAProgramTökéletesitésébenToolStripMenuItem.Text = Language.Translate("menu_help_improveprogram");
|
||||
Language.ReloadEvent += delegate { segitsenAProgramTökéletesitésébenToolStripMenuItem.Text = Language.Translate("menu_help_improveprogram"); };
|
||||
névjegyToolStripMenuItem.Text = Language.Translate("menu_help_about");
|
||||
Language.ReloadEvent += delegate { névjegyToolStripMenuItem.Text = Language.Translate("menu_help_about"); };
|
||||
|
||||
textBox1.Text = Language.Translate("searchbar");
|
||||
textBox1.Text = Language.Translate("searchbar", textBox1);
|
||||
//contactList.Items[0].SubItems[0].Text = Language.Translate("loading"); - 2014.08.28. - Nincs már rá szükség (hibát is ír, mivel nincs listaelem)
|
||||
|
||||
üzenetküldésToolStripMenuItem.Text = Language.Translate("menu_operations_sendmsg");
|
||||
emailKüldéseemailToolStripMenuItem.Text = Language.Translate("contact_sendemail");
|
||||
toolStripMenuItem2.Text = Language.Translate("contact_copyemail");
|
||||
információToolStripMenuItem.Text = Language.Translate("contact_info");
|
||||
ismerősLetiltásaToolStripMenuItem.Text = Language.Translate("contact_block");
|
||||
ismerősTörléseToolStripMenuItem.Text = Language.Translate("contact_remove");
|
||||
becenévSzerkesztéseToolStripMenuItem.Text = Language.Translate("contact_editname");
|
||||
eseményértesitésekToolStripMenuItem.Text = Language.Translate("contact_eventnotifications");
|
||||
beszélgetésnaplóMegnyitásaToolStripMenuItem.Text = Language.Translate("contact_openchatlog");
|
||||
//üzenetküldésToolStripMenuItem.Text = Language.Translate("menu_operations_sendmsg");
|
||||
//emailKüldéseemailToolStripMenuItem.Text = Language.Translate("contact_sendemail");
|
||||
//toolStripMenuItem2.Text = Language.Translate("contact_copyemail");
|
||||
//információToolStripMenuItem.Text = Language.Translate("contact_info");
|
||||
//ismerősLetiltásaToolStripMenuItem.Text = Language.Translate("contact_block");
|
||||
//ismerősTörléseToolStripMenuItem.Text = Language.Translate("contact_remove"); - Kétszer benne volt, ugyanilyen névvel, csak 1-re végződve lett volna a megfelelő
|
||||
//becenévSzerkesztéseToolStripMenuItem.Text = Language.Translate("contact_editname");
|
||||
//eseményértesitésekToolStripMenuItem.Text = Language.Translate("contact_eventnotifications");
|
||||
//beszélgetésnaplóMegnyitásaToolStripMenuItem.Text = Language.Translate("contact_openchatlog");
|
||||
|
||||
toolStripMenuItem4.Text = Language.Translate("iconmenu_show");
|
||||
Language.ReloadEvent += delegate { toolStripMenuItem4.Text = Language.Translate("iconmenu_show"); };
|
||||
toolStripMenuItem8.Text = Language.Translate("menu_file_logout");
|
||||
Language.ReloadEvent += delegate { toolStripMenuItem8.Text = Language.Translate("menu_file_logout"); };
|
||||
toolStripMenuItem9.Text = Language.Translate("menu_file_exit");
|
||||
Language.ReloadEvent += delegate { toolStripMenuItem9.Text = Language.Translate("menu_file_exit"); };
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
//MessageBox.Show("Error while loading translations.");
|
||||
//}
|
||||
|
||||
LoadMenu(MenuType.ChatIconMenu); //2014.12.12.
|
||||
LoadMenu(MenuType.PartnerMenu); //2014.12.13.
|
||||
#endregion
|
||||
|
||||
BeforeLogin.SetText(Language.Translate("beforelogin_loadtextformat"));
|
||||
|
@ -146,19 +200,60 @@ namespace MSGer.tk
|
|||
{
|
||||
var res = MessageBox.Show(Language.Translate("outofdate"), Language.Translate("outofdate_caption"), MessageBoxButtons.YesNo);
|
||||
if (res == DialogResult.Yes)
|
||||
System.Diagnostics.Process.Start("http://msger.url.ph/download.php?version=latest");
|
||||
//System.Diagnostics.Process.Start("http://msger.url.ph/download.php?version=latest");
|
||||
//(new UpdateDialog()).Show(); //2014.12.13. - Elvileg át lehet nevezni a programot, miközben fut (ami érdekes) - De inkább csinálok külön programot
|
||||
{ //2014.12.13.
|
||||
Process.Start("Updater.exe", "\"" + Language.Translate("updater") + "\" \"" + Language.Translate("updater_info") + "\"");
|
||||
Program.Exit(false);
|
||||
}
|
||||
}
|
||||
else if (response != "fine")
|
||||
MessageBox.Show(Language.Translate("error") + ": " + response);
|
||||
|
||||
//BeforeLogin.SetText(Language.Translate("beforelogin_server")); //2015.01.07.
|
||||
|
||||
//2014.09.06.
|
||||
if (Storage.Settings["isserver"] == "")
|
||||
/*if (Storage.Settings["isserver"] == "")
|
||||
{
|
||||
if (MessageBox.Show(Language.Translate("isserver_msg"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
Storage.Settings["isserver"] = "1";
|
||||
else
|
||||
Storage.Settings["isserver"] = "0";
|
||||
}
|
||||
}*/
|
||||
|
||||
/*if(Storage.Settings["isserver"]=="1") //2015.01.07.
|
||||
{
|
||||
NATUPNPLib.UPnPNAT upnpnat = new NATUPNPLib.UPnPNAT();
|
||||
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
|
||||
if (mappings == null)
|
||||
{
|
||||
//MessageBox.Show(Language.Translate("portforward_noaccess"));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
foreach (NATUPNPLib.IStaticPortMapping mapping in mappings)
|
||||
{
|
||||
if (mapping.Protocol == "UDP" && mapping.InternalPort.ToString() == Storage.Settings["port"])
|
||||
{
|
||||
if (MessageBox.Show(Language.Translate("portforward_existsremove"), "", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
mappings.Remove(mapping.ExternalPort, "UDP");
|
||||
else
|
||||
Storage.Settings["port"] = (Int32.Parse(Storage.Settings["port"]) + 1).ToString();
|
||||
}
|
||||
|
||||
}
|
||||
int port = int.Parse(Storage.Settings["port"]);
|
||||
mappings.Add(port, "UDP", port, Dns.GetHostEntry(Dns.GetHostName()).AddressList.Single(entry =>
|
||||
entry.AddressFamily == AddressFamily.InterNetwork
|
||||
&& (entry.ToString().Contains("192.168.0.") || entry.ToString().Contains("192.168.1.") || entry.ToString().Contains("10.0.0.") || entry.ToString().Contains("172.16.0.")) //Helyi IP-k
|
||||
).ToString(), true, "MSGer.tk chat program");
|
||||
Networking.ReceiverConnection = new UdpClient(Int32.Parse(Storage.Settings["port"]));
|
||||
//}
|
||||
}*/
|
||||
|
||||
//TO!DO: Nem kell az "isserver" beállítás, először kliensként próbáljon meg csatlakozni, majd szerverként fogadja az új klienseket
|
||||
// a pwnat segítségével
|
||||
//2015.03.15. - Nem kell az sem: IPv6 - A legtöbb eszköz már támogatja
|
||||
|
||||
BeforeLogin.SetText(Language.Translate("beforelogin_loginform"));
|
||||
try
|
||||
|
@ -182,11 +277,14 @@ namespace MSGer.tk
|
|||
LThread = new Thread(new ThreadStart(new UpdateListAndChat().Run));
|
||||
LThread.Name = "Update Partnerlist and Chat";
|
||||
|
||||
Thread keepupthread = new Thread(new ThreadStart(Networking.KeepUpThread));
|
||||
/*Thread keepupthread = new Thread(new ThreadStart(Networking.KeepUpThread));
|
||||
keepupthread.Name = "Keep Up Thread";
|
||||
|
||||
|
||||
Thread keepupuserst = new Thread(new ThreadStart(Networking.KeepUpUsersThread)); //2014.09.26.
|
||||
keepupuserst.Name = "Keep Up Users Thread";
|
||||
keepupuserst.Name = "Keep Up Users Thread";*/
|
||||
|
||||
Thread networkthread = new Thread(new ThreadStart(Networking.NetworkThread)); //2014.12.31.
|
||||
networkthread.Name = "Network Thread";
|
||||
|
||||
Storage.Load(true); //2014.08.07.
|
||||
|
||||
|
@ -208,33 +306,124 @@ namespace MSGer.tk
|
|||
// Start the thread
|
||||
LThread.Start();
|
||||
|
||||
keepupthread.Start();
|
||||
//keepupthread.Start();
|
||||
|
||||
keepupuserst.Start();
|
||||
//keepupuserst.Start();
|
||||
|
||||
networkthread.Start();
|
||||
|
||||
//2014.08.19. - Küldje el a bejelentkezés hírét, hogy frissítéseket kapjon
|
||||
byte[] strb = Encoding.Unicode.GetBytes(CurrentUser.IP.ToString());
|
||||
byte[] tmpfinal = new byte[8 * UserInfo.KnownUsers.Count + strb.Length + 4]; //Hosszúság, IP, ismert felh. ID, frissítési idő
|
||||
/*byte[] strb = Encoding.Unicode.GetBytes(CurrentUser.IP.ToString());
|
||||
byte[] tmpfinal = new byte[8 * UserInfo.KnownUsers.Count + strb.Length + 4 + 1]; //Hosszúság, IP, ismert felh. ID, frissítési idő
|
||||
Array.Copy(BitConverter.GetBytes(strb.Length), tmpfinal, 4);
|
||||
Array.Copy(strb, 0, tmpfinal, 4, strb.Length);
|
||||
//if (tmpfinal.Length != 0)
|
||||
if (UserInfo.KnownUsers.Count != 0)
|
||||
for (int i = 0; i < UserInfo.KnownUsers.Count; i++) //Ha a count 0, nem fogja végrehajtani
|
||||
{
|
||||
for (int i = 0; i < UserInfo.KnownUsers.Count; i++)
|
||||
{
|
||||
byte[] tmptmp = BitConverter.GetBytes(UserInfo.KnownUsers[i].UserID);
|
||||
Array.Copy(tmptmp, 0, tmpfinal, i * 4 + strb.Length + 4, 4);
|
||||
tmptmp = BitConverter.GetBytes(UserInfo.KnownUsers[i].LastUpdate);
|
||||
Array.Copy(tmptmp, 0, tmpfinal, i * 4 + strb.Length + 4, 4);
|
||||
}
|
||||
byte[] tmptmp = BitConverter.GetBytes(UserInfo.KnownUsers[i].UserID);
|
||||
Array.Copy(tmptmp, 0, tmpfinal, i * 4 + strb.Length + 4, 4);
|
||||
tmptmp = BitConverter.GetBytes(UserInfo.KnownUsers[i].LastUpdate);
|
||||
Array.Copy(tmptmp, 0, tmpfinal, i * 4 + strb.Length + 4, 4);
|
||||
}
|
||||
Networking.ParseUpdateInfo(Networking.SendUpdate(Networking.UpdateType.LoginUser, tmpfinal, false));
|
||||
tmpfinal[tmpfinal.Length - 1] = (Storage.Settings["isserver"] == "1") ? (byte)0x01 : (byte)0x00; //Mivel bejelentkezéstől függetlenül menti el, gépfüggő, hogy itt mit küld el
|
||||
Networking.ParseUpdateInfo(Networking.SendUpdate(Networking.UpdateType.LoginUser, tmpfinal, false));*/
|
||||
|
||||
while (!networkthread.IsAlive) ;
|
||||
SendLoginToUsers(); //2014.12.18.
|
||||
|
||||
notifyIcon1.Visible = true; //2014.09.22.
|
||||
taskbarNotifier.Show("Teszt cím", "Teszt tartalom\nMásodik sor");
|
||||
|
||||
Language.ReloadEvent += delegate { textBox1.Text = Language.Translate("searchbar"); }; //2014.12.22. - Nyelvváltáskor törölni fogja a beírt szöveget
|
||||
}
|
||||
|
||||
private void LoadPartnerList() //2014.08.28.
|
||||
private void SendLoginToUsers()
|
||||
{ //2014.12.18.
|
||||
var bytes = new List<byte>();
|
||||
//var tmpb = Encoding.Unicode.GetBytes(CurrentUser.IP.ToString());
|
||||
//bytes.AddRange(BitConverter.GetBytes(tmpb.Length));
|
||||
//bytes.AddRange(tmpb);
|
||||
for (int i = 0; i < UserInfo.KnownUsers.Count; i++) //Ha a count 0, nem fogja végrehajtani
|
||||
{
|
||||
bytes.AddRange(BitConverter.GetBytes(UserInfo.KnownUsers[i].UserID));
|
||||
bytes.AddRange(BitConverter.GetBytes(UserInfo.KnownUsers[i].LastUpdate));
|
||||
}
|
||||
//bytes.Add((Storage.Settings["isserver"] == "1") ? (byte)0x01 : (byte)0x00); //Mivel bejelentkezéstől függetlenül menti el, gépfüggő, hogy itt mit küld el
|
||||
//Networking.ParseUpdateInfo(Networking.SendUpdate(Networking.UpdateType.LoginUser, bytes.ToArray(), false));
|
||||
Networking.SendUpdateInThread(Networking.UpdateType.LoginUser, bytes.ToArray(), new EventHandler<byte[][]>(
|
||||
(e, resp) => Networking.ParseUpdateInfo(resp)));
|
||||
}
|
||||
|
||||
enum MenuType
|
||||
{
|
||||
ChatIconMenu,
|
||||
PartnerMenu
|
||||
}
|
||||
private void LoadMenu(MenuType mt)
|
||||
{
|
||||
switch(mt) //2014.12.13.
|
||||
{
|
||||
case MenuType.ChatIconMenu:
|
||||
chatIconMenu.Items.Add(Language.Translate("close"), null,
|
||||
new EventHandler((sender, e) => ((ChatPanel)chatIconMenu.Tag).Close())); //Tag: A chatikon
|
||||
chatIconMenu.Items[chatIconMenu.Items.Count-1].Name="close"; //2014.12.22.
|
||||
Language.ReloadEvent += delegate { chatIconMenu.Items["close"].Text = Language.Translate("close"); }; //2014.12.22.
|
||||
chatIconMenu.Items.Add(new ToolStripSeparator());
|
||||
/*chatIconMenu.Items.AddRange(
|
||||
partnerMenu.Items.Cast<ToolStripItem>().Select(entry=>{
|
||||
return new ToolStripMenuItem((ToolStripItem)entry.Clone();
|
||||
}).ToArray()); //Alapvetően eltávolítaná az eredeti menüből, és hibát jelezne*/
|
||||
LoadMenuPrep(chatIconMenu);
|
||||
break;
|
||||
case MenuType.PartnerMenu:
|
||||
listPartnerMenu.Items.Add(Language.Translate("menu_operations_sendmsg"), null, PartnerMenu_SendMessage);
|
||||
listPartnerMenu.Items[listPartnerMenu.Items.Count-1].Name="menu_operations_sendmsg"; //2014.12.22.
|
||||
Language.ReloadEvent += delegate { listPartnerMenu.Items["menu_operations_sendmsg"].Text = Language.Translate("menu_operations_sendmsg"); }; //2014.12.22.
|
||||
listPartnerMenu.Items.Add(new ToolStripSeparator());
|
||||
//listPartnerMenu.Items.AddRange(partnerMenu.Items.Cast<ToolStripItem>().ToArray());
|
||||
LoadMenuPrep(listPartnerMenu);
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException("Menu type not implemented.");
|
||||
}
|
||||
}
|
||||
private void LoadMenuPrep(ContextMenuStrip menu) //Csak a menüelemeket készíti elő
|
||||
{ //2014.12.13.
|
||||
menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { //A dizájnerből, átalakítva, hogy rögtön le is fordítsa
|
||||
new ToolStripMenuItem(Language.Translate("contact_sendemail")), //Ide jönnek majd az event handlerek is
|
||||
new ToolStripMenuItem(Language.Translate("contact_copyemail")),
|
||||
new ToolStripMenuItem(Language.Translate("contact_info")),
|
||||
new ToolStripSeparator(),
|
||||
new ToolStripMenuItem(Language.Translate("contact_block")),
|
||||
new ToolStripMenuItem(Language.Translate("contact_remove")),
|
||||
new ToolStripSeparator(),
|
||||
new ToolStripMenuItem(Language.Translate("contact_editname")),
|
||||
new ToolStripSeparator(),
|
||||
new ToolStripMenuItem(Language.Translate("contact_eventnotifications")),
|
||||
new ToolStripSeparator(),
|
||||
new ToolStripMenuItem(Language.Translate("contact_openchatlog"))});
|
||||
Language.ReloadEvent += delegate
|
||||
{
|
||||
int i = menu.Items.Count - 1;
|
||||
menu.Items[i].Text = Language.Translate("contact_openchatlog");
|
||||
i--;
|
||||
menu.Items[i].Text = Language.Translate("contact_eventnotifications");
|
||||
i--;
|
||||
menu.Items[i].Text = Language.Translate("contact_editname");
|
||||
i--;
|
||||
menu.Items[i].Text = Language.Translate("contact_remove");
|
||||
i--;
|
||||
menu.Items[i].Text = Language.Translate("contact_block");
|
||||
i--;
|
||||
menu.Items[i].Text = Language.Translate("contact_info");
|
||||
i--;
|
||||
menu.Items[i].Text = Language.Translate("contact_copyemail");
|
||||
i--;
|
||||
menu.Items[i].Text = Language.Translate("contact_sendemail");
|
||||
};
|
||||
}
|
||||
|
||||
public void LoadPartnerList() //2014.08.28.
|
||||
{
|
||||
contactList.AutoUpdate = false;
|
||||
UserInfo.AutoUpdate = false; //2014.09.26.
|
||||
|
@ -274,16 +463,6 @@ namespace MSGer.tk
|
|||
contactList.Refresh();
|
||||
}
|
||||
|
||||
private void PopupCloseClick(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Close");
|
||||
}
|
||||
|
||||
private void PopupClick(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Click");
|
||||
}
|
||||
|
||||
private void LogoutUser(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
|
@ -296,9 +475,9 @@ namespace MSGer.tk
|
|||
Storage.Dispose();
|
||||
LThread = null;
|
||||
CurrentUser.SendChanges = false; //2014.08.30.
|
||||
while (ChatForm.ChatWindows.Count > 0)
|
||||
while (ChatPanel.ChatWindows.Count > 0)
|
||||
{ //2014.09.06. - A Close() hatására törli a gyűjteményből, ezért sorra végig fog haladni rajta
|
||||
ChatForm.ChatWindows[0].Close();
|
||||
ChatPanel.ChatWindows[0].Close();
|
||||
}
|
||||
LoginDialog = new LoginForm(); //2014.04.04.
|
||||
LoginDialog.ShowDialog();
|
||||
|
@ -310,8 +489,8 @@ namespace MSGer.tk
|
|||
toolStripMenuItem8.Enabled = true; //2014.04.12.
|
||||
CurrentUser.SendChanges = true; //2014.08.30.
|
||||
contactList.Items.Clear(); //2014.10.09. - Kijelentkezéskor hozzáad egy üres listelemet egy (Nem elérhető) felirattal, ezt tünteti el
|
||||
LoadPartnerList();
|
||||
this.Show();
|
||||
//LoadPartnerList();
|
||||
//this.Show();
|
||||
// Create the thread object, passing in the Alpha.Beta method
|
||||
// via a ThreadStart delegate. This does not start the thread.
|
||||
LThread = new Thread(new ThreadStart(new UpdateListAndChat().Run));
|
||||
|
@ -319,210 +498,91 @@ namespace MSGer.tk
|
|||
|
||||
// Start the thread
|
||||
LThread.Start();
|
||||
|
||||
SendLoginToUsers(); //2014.12.18.
|
||||
|
||||
LoadPartnerList();
|
||||
this.Show();
|
||||
}
|
||||
|
||||
private void LoginNewUser(object sender, EventArgs e)
|
||||
public void PlaceChatIcon(ChatPanel cp)
|
||||
{
|
||||
Storage.Save(true); //2014.09.19.
|
||||
Process.Start(((Program.ProcessName.Contains("vshost")) ? Program.ProcessName.Replace(".vshost", "") : Program.ProcessName) + ".exe", "multi");
|
||||
}
|
||||
|
||||
public void SetOnlineState(object sender, EventArgs e)
|
||||
{
|
||||
int state = 0;
|
||||
if (sender == elérhetőToolStripMenuItem)
|
||||
state = 1;
|
||||
if (sender == elfoglaltToolStripMenuItem)
|
||||
state = 2;
|
||||
if (sender == nincsAGépnélToolStripMenuItem)
|
||||
state = 3;
|
||||
if (sender == null) //2014.08.30. - Erre nagyon sokáig nem volt felkészítve, és ezt kihasználtam a kijelentkezéshez
|
||||
{
|
||||
Networking.SendRequest("setstate", 0 + "", 0, true); //Kijelentkezés
|
||||
byte[] tmpb = Encoding.Unicode.GetBytes(CurrentUser.IP.ToString());
|
||||
byte[] sendb = new byte[4 + tmpb.Length];
|
||||
Array.Copy(BitConverter.GetBytes(tmpb.Length), sendb, 4);
|
||||
Array.Copy(tmpb, 0, sendb, 4, tmpb.Length);
|
||||
Networking.SendUpdate(Networking.UpdateType.LogoutUser, sendb, false);
|
||||
}
|
||||
CurrentUser.State = state; //2014.08.28.
|
||||
}
|
||||
|
||||
private void SelectPartner(object sender, EventArgs e)
|
||||
{
|
||||
var form = new SelectPartnerForm((ToolStripMenuItem)sender);
|
||||
DialogResult dr = form.ShowDialog();
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
//2014.04.25.
|
||||
string[] partners = form.Partners;
|
||||
ChatForm tmpchat = new ChatForm();
|
||||
for (int i = 0; i < partners.Length; i++)
|
||||
{
|
||||
if (partners[i] != "") //2014.04.17.
|
||||
{
|
||||
for (int j = 0; j < UserInfo.KnownUsers.Count; j++)
|
||||
{
|
||||
if (!UserInfo.KnownUsers[j].IsPartner)
|
||||
continue;
|
||||
int tmp; //2014.04.17.
|
||||
if (!Int32.TryParse(partners[i], out tmp))
|
||||
tmp = -1;
|
||||
if (UserInfo.KnownUsers[j].UserName == partners[i] || UserInfo.KnownUsers[j].Email == partners[i] || UserInfo.KnownUsers[j].UserID == tmp)
|
||||
{ //Egyezik a név, E-mail vagy ID - UserName: 2014.04.17.
|
||||
tmpchat.ChatPartners.Add(UserInfo.KnownUsers[j].UserID); //2014.08.28.
|
||||
}
|
||||
}
|
||||
}
|
||||
var newicon = new PictureBox();
|
||||
//newicon.ImageLocation = cp.ChatPartners[0].GetImage();
|
||||
newicon.ImageLocation = cp.ChatPartners[0].ImagePath; //2014.12.31.
|
||||
newicon.Size = new Size(100, 100);
|
||||
newicon.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
newicon.Click += new EventHandler((a, b) => cp.Show());
|
||||
newicon.MouseClick += new MouseEventHandler((s, e) => {
|
||||
if (e.Button == MouseButtons.Middle)
|
||||
cp.Close();
|
||||
else if (e.Button == MouseButtons.Right) //Chat menü
|
||||
{ //2014.12.13.
|
||||
chatIconMenu.Tag = cp;
|
||||
chatIconMenu.Show(Cursor.Position);
|
||||
}
|
||||
if (tmpchat.ChatPartners.Count != 0)
|
||||
{
|
||||
ChatForm.ChatWindows.Add(tmpchat);
|
||||
if (sender == fájlKüldéseToolStripMenuItem)
|
||||
{
|
||||
tmpchat.Show();
|
||||
tmpchat.OpenSendFile(form);
|
||||
}
|
||||
if (sender == azonnaliÜzenetKüldéseToolStripMenuItem)
|
||||
{
|
||||
tmpchat.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearSearchBar(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text == Language.Translate("searchbar"))
|
||||
textBox1.Clear();
|
||||
}
|
||||
|
||||
private void PutTextInSearchBar(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text == "")
|
||||
textBox1.Text = Language.Translate("searchbar");
|
||||
}
|
||||
public static int RightClickedPartner = -1;
|
||||
|
||||
public static void OpenSendMessage(int uid)
|
||||
{
|
||||
//Üzenetküldő form
|
||||
int ChatNum = -1;
|
||||
for (int i = 0; i < ChatForm.ChatWindows.Count; i++)
|
||||
});
|
||||
cp.ChatIcon = newicon;
|
||||
//---------------------------------------------------------------------
|
||||
int size = 0;
|
||||
bool putright = false;
|
||||
foreach (Control item in flowLayoutPanel1.Controls)
|
||||
{
|
||||
if (ChatForm.ChatWindows[i].ChatPartners.Count == 1 && ChatForm.ChatWindows[i].ChatPartners.Contains(uid))
|
||||
{ //Vele, és csak vele beszél
|
||||
ChatNum = i;
|
||||
break;
|
||||
}
|
||||
size += item.Size.Height;
|
||||
}
|
||||
if (ChatNum == -1)
|
||||
{ //Nincs még chatablaka
|
||||
ChatForm.ChatWindows.Add(new ChatForm());
|
||||
ChatForm.ChatWindows[ChatForm.ChatWindows.Count - 1].ChatPartners.Add(uid);
|
||||
ChatForm.ChatWindows[ChatForm.ChatWindows.Count - 1].Show();
|
||||
ChatForm.ChatWindows[ChatForm.ChatWindows.Count - 1].Focus(); //2014.08.08.
|
||||
size += newicon.Size.Height;
|
||||
if (size > flowLayoutPanel1.Size.Height)
|
||||
putright = true; //Ha nem fér el bal oldalt, rakja jobbra
|
||||
//---------------------------------------------------------------------
|
||||
size = 0;
|
||||
foreach (Control item in flowLayoutPanel2.Controls)
|
||||
{
|
||||
size += item.Size.Height;
|
||||
}
|
||||
size += newicon.Size.Height;
|
||||
if (size > flowLayoutPanel2.Size.Height)
|
||||
putright = false; //Ha jobbra sem fér el, csak rakja balra
|
||||
//---------------------------------------------------------------------
|
||||
if (!putright)
|
||||
flowLayoutPanel1.Controls.Add(newicon);
|
||||
else
|
||||
flowLayoutPanel2.Controls.Add(newicon);
|
||||
}
|
||||
|
||||
public enum StatType
|
||||
{
|
||||
MainServer,
|
||||
Servers,
|
||||
OnlineServers
|
||||
}
|
||||
public void UpdateStats(StatType type, int value)
|
||||
{ //Elvileg ha van forgalom, gyorsan frissíti a nyelvet is
|
||||
switch (type)
|
||||
{
|
||||
ChatForm.ChatWindows[ChatNum].Show();
|
||||
ChatForm.ChatWindows[ChatNum].Focus();
|
||||
case StatType.MainServer:
|
||||
if (value == 0)
|
||||
{
|
||||
mainserver.Text = Language.Translate("stats_mainserver") + ": " + Language.Translate("stats_nonetwork");
|
||||
mainserver.ForeColor = Color.Red;
|
||||
}
|
||||
else if (value == 1)
|
||||
{
|
||||
mainserver.Text = Language.Translate("stats_mainserver") + ": " + Language.Translate("stats_retrying");
|
||||
mainserver.ForeColor = Color.Orange;
|
||||
}
|
||||
else if (value == 2)
|
||||
{
|
||||
mainserver.Text = Language.Translate("stats_mainserver") + ": " + Language.Translate("stats_connected");
|
||||
mainserver.ForeColor = Color.Green;
|
||||
}
|
||||
break;
|
||||
case StatType.Servers:
|
||||
servers.Text = Language.Translate("stats_servers") + ": " + value;
|
||||
break;
|
||||
case StatType.OnlineServers:
|
||||
onlineservers.Text = Language.Translate("stats_onlineservers") + ": " + value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMainFormLoad(object sender, EventArgs e)
|
||||
{
|
||||
if (CurrentUser.UserID == 0)
|
||||
Program.Exit();
|
||||
|
||||
LoadPartnerList(); //Be kell töltenie a MainForm-nak, hogy hivatkozhasson rá
|
||||
|
||||
CurrentUser.SendChanges = true; //2014.08.30.
|
||||
}
|
||||
|
||||
private void InvitePartner(object sender, EventArgs e)
|
||||
{
|
||||
(new InvitePartner()).ShowDialog();
|
||||
}
|
||||
|
||||
private void BeforeExit(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
e.Cancel = true;
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void toolStripMenuItem4_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CurrentUser.UserID != 0) //2014.04.18.
|
||||
{
|
||||
this.Show();
|
||||
this.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitProgram(object sender, EventArgs e)
|
||||
{
|
||||
Program.Exit();
|
||||
}
|
||||
|
||||
private void ismerősFelvételeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
(new AddPartner()).ShowDialog();
|
||||
}
|
||||
|
||||
private void névjegyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
(new AboutBox1()).ShowDialog();
|
||||
}
|
||||
|
||||
private void mindigLegfelülToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.TopMost = mindigLegfelülToolStripMenuItem.Checked;
|
||||
}
|
||||
|
||||
private void beállitásokToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
(new SettingsForm()).Show();
|
||||
}
|
||||
|
||||
private void contactList_ItemDoubleClicked(object sender, int e)
|
||||
{
|
||||
int uid = UserInfo.GetUserIDFromListID(e);
|
||||
OpenSendMessage(uid);
|
||||
}
|
||||
|
||||
private void bezárásToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void információToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (RightClickedPartner == -1)
|
||||
return;
|
||||
for (int i = 0; i < UserInfo.KnownUsers.Count; i++)
|
||||
{
|
||||
if (UserInfo.KnownUsers[i].ListID != RightClickedPartner)
|
||||
continue;
|
||||
(new PartnerInformation(UserInfo.KnownUsers[i])).ShowDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void contactList_ItemRightClicked(object sender, int e)
|
||||
{
|
||||
contactList.Items[e].Selected = true;
|
||||
RightClickedPartner = e;
|
||||
partnerMenu.Show(Cursor.Position);
|
||||
}
|
||||
|
||||
private void PartnerMenu_SendMessage(object sender, EventArgs e)
|
||||
{
|
||||
if (RightClickedPartner == -1)
|
||||
return;
|
||||
int uid = UserInfo.GetUserIDFromListID(RightClickedPartner);
|
||||
OpenSendMessage(uid);
|
||||
RightClickedPartner = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,13 @@
|
|||
<metadata name="partnerImages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>245, 17</value>
|
||||
</metadata>
|
||||
<metadata name="partnerMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>375, 17</value>
|
||||
<metadata name="statusStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>791, 17</value>
|
||||
</metadata>
|
||||
<metadata name="chatIconMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>636, 17</value>
|
||||
</metadata>
|
||||
<metadata name="listPartnerMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>907, 17</value>
|
||||
</metadata>
|
||||
</root>
|
142
MSGer.tk/Networking.CreateParse.cs
Normal file
142
MSGer.tk/Networking.CreateParse.cs
Normal file
|
@ -0,0 +1,142 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
partial class Networking
|
||||
{
|
||||
public static string[] GetStrings(byte[] bytes, int startIndex)
|
||||
{
|
||||
List<string> strs = new List<string>();
|
||||
int pos = startIndex;
|
||||
while (pos < bytes.Length)
|
||||
{
|
||||
int len = BitConverter.ToInt32(bytes, pos);
|
||||
pos += 4;
|
||||
strs.Add(Encoding.Unicode.GetString(bytes, pos, len));
|
||||
}
|
||||
return strs.ToArray();
|
||||
}
|
||||
|
||||
public static void ParsePacket(byte[] bytes, out byte response, out UpdateType updatetype, out int keyversion, out int port, out int userid, out byte[] data)
|
||||
{ //2014.09.15.
|
||||
/*if (CurrentUser.Keys[CurrentUser.KeyIndex] != null)
|
||||
bytes = Storage.Decrypt(bytes, true, CurrentUser.Keys[CurrentUser.KeyIndex]);
|
||||
else
|
||||
bytes = Storage.Decrypt(bytes, true, "ihavenokeys");*/
|
||||
response = bytes[0];
|
||||
updatetype = (UpdateType)bytes[1];
|
||||
int pos = 2;
|
||||
//keyversion = BitConverter.ToInt32(bytes, 1 + 1);
|
||||
keyversion = BitConverter.ToInt32(bytes, pos);
|
||||
pos += sizeof(int);
|
||||
port = BitConverter.ToInt32(bytes, pos); //2014.12.19.
|
||||
pos += sizeof(int);
|
||||
var encryptedBytes = new byte[bytes.Length - pos];
|
||||
//Array.Copy(bytes, 6, encryptedBytes, 0, encryptedBytes.Length);
|
||||
Array.Copy(bytes, pos, encryptedBytes, 0, encryptedBytes.Length);
|
||||
if (CurrentUser.Keys[CurrentUser.KeyIndex] != null)
|
||||
bytes = Storage.Decrypt(encryptedBytes, true, CurrentUser.Keys[CurrentUser.KeyIndex]);
|
||||
else
|
||||
bytes = Storage.Decrypt(encryptedBytes, true, "ihavenokeys");
|
||||
/*userid = BitConverter.ToInt32(bytes, 1 + 1 + 4);
|
||||
data = new byte[bytes.Length - 1 - 1 - 4 - 4];
|
||||
Array.Copy(bytes, 2 + 4 + 4, data, 0, data.Length);*/
|
||||
userid = BitConverter.ToInt32(bytes, 0); //2014.12.18.
|
||||
data = new byte[bytes.Length - 4];
|
||||
Array.Copy(bytes, 4, data, 0, data.Length);
|
||||
}
|
||||
|
||||
public static void ParseUpdateInfo(byte[][] bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
return;
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
byte[] data = ParsePacket(bytes[i]).Data;
|
||||
string[] strs = Encoding.Unicode.GetString(data).Split(new string[] { "\n", "\n\r" }, StringSplitOptions.RemoveEmptyEntries); //2014.09.19.
|
||||
string str = "";
|
||||
for (int j = 0; j < strs.Length; j++)
|
||||
{
|
||||
string[] spl = strs[j].Split('_'); //2014.08.30.
|
||||
int uid = Int32.Parse(spl[0]); //2014.08.30.
|
||||
string[] keyvalue = spl[1].Split('='); //2014.08.30.
|
||||
UserInfo user = UserInfo.Select(uid); //2014.12.31.
|
||||
if (keyvalue[0] == "ispartner")
|
||||
{ //2014.08.30.
|
||||
string resp = Networking.SendRequest("ispartner", uid + "", 0, true);
|
||||
if (resp == "yes")
|
||||
str += "userinfo_" + uid + "_ispartner=True";
|
||||
else if (resp == "no")
|
||||
str += "userinfo_" + uid + "_ispartner=False";
|
||||
else
|
||||
MessageBox.Show("ispartner:\n" + resp);
|
||||
}
|
||||
else if (keyvalue[0] == "picupdatetime")
|
||||
{ //2014.12.31.
|
||||
user.GetImage(Int32.Parse(keyvalue[1])); //Megvizsgálja, hogy kell-e frissítés és ha kell, letölti
|
||||
}
|
||||
else
|
||||
str += "userinfo_" + strs[j];
|
||||
if (j + 1 != strs.Length)
|
||||
str += "\n";
|
||||
user.Update(); //2014.12.31.
|
||||
}
|
||||
Storage.Parse(str);
|
||||
}
|
||||
}
|
||||
|
||||
public static PacketParts ParsePacket(byte[] bytes)
|
||||
{ //2014.09.15.
|
||||
/*if (CurrentUser.Keys[CurrentUser.KeyIndex] != null)
|
||||
bytes = Storage.Encrypt(bytes, CurrentUser.Keys[CurrentUser.KeyIndex]);
|
||||
else
|
||||
bytes = Storage.Encrypt(bytes, "ihavenokeys");*/
|
||||
var ret = new PacketParts();
|
||||
ret.Response = (bytes[0] == 0x01) ? true : false;
|
||||
ret.UpdateType = (UpdateType)bytes[1];
|
||||
int pos = 2; //2014.12.19.
|
||||
//ret.KeyVersion = BitConverter.ToInt32(bytes, 1 + 1);
|
||||
ret.KeyVersion = BitConverter.ToInt32(bytes, pos);
|
||||
pos += sizeof(int);
|
||||
ret.Port = BitConverter.ToInt32(bytes, pos); //2014.12.19.
|
||||
pos += sizeof(int);
|
||||
byte[] encryptedBytes = new byte[bytes.Length - pos]; //2014.12.22. - A hátralévő rész titkosított
|
||||
Array.Copy(bytes, pos, encryptedBytes, 0, encryptedBytes.Length); //2014.12.22.
|
||||
if (CurrentUser.Keys[CurrentUser.KeyIndex] != null)
|
||||
bytes = Storage.Decrypt(encryptedBytes, true, CurrentUser.Keys[CurrentUser.KeyIndex]);
|
||||
else
|
||||
bytes = Storage.Decrypt(encryptedBytes, true, "ihavenokeys");
|
||||
//ret.UserID = BitConverter.ToInt32(bytes, 1 + 1 + 4);
|
||||
pos = 0; //2014.12.22. - Új tömb lett a visszafejtés után
|
||||
ret.UserID = BitConverter.ToInt32(bytes, pos);
|
||||
pos += sizeof(int);
|
||||
//ret.Data = new byte[bytes.Length - 1 - 1 - 4 - 4];
|
||||
ret.Data = new byte[bytes.Length - pos];
|
||||
//Array.Copy(bytes, 2 + 4 + 4, ret.Data, 0, ret.Data.Length);
|
||||
Array.Copy(bytes, pos, ret.Data, 0, ret.Data.Length);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static byte[] CreatePacket(bool response, byte updatetype, byte[] data)
|
||||
{ //2014.09.15.
|
||||
List<byte> senddata = new List<byte>();
|
||||
senddata.Add((response) ? (byte)0x01 : (byte)0x00); //0x00: Kérelem/Adatküldés, 0x01: Válasz
|
||||
senddata.Add(updatetype);
|
||||
senddata.AddRange(BitConverter.GetBytes(CurrentUser.KeyIndex));
|
||||
senddata.AddRange(BitConverter.GetBytes(Int32.Parse(Storage.Settings["port"]))); //2014.12.19.
|
||||
List<byte> sendd = new List<byte>();
|
||||
sendd.AddRange(BitConverter.GetBytes(CurrentUser.UserID));
|
||||
sendd.AddRange(data);
|
||||
if (CurrentUser.Keys[CurrentUser.KeyIndex] != null)
|
||||
senddata.AddRange(Storage.Encrypt(sendd.ToArray(), CurrentUser.Keys[CurrentUser.KeyIndex]));
|
||||
else
|
||||
senddata.AddRange(Storage.Encrypt(sendd.ToArray(), "ihavenokeys"));
|
||||
return senddata.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
124
MSGer.tk/Networking.SendRequest.cs
Normal file
124
MSGer.tk/Networking.SendRequest.cs
Normal file
|
@ -0,0 +1,124 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
partial class Networking
|
||||
{
|
||||
|
||||
private static int Tries = 0;
|
||||
public static string SendRequest(string action, string data, int remnum, bool loggedin) //2014.02.18.
|
||||
{
|
||||
if (!IsNetworkAvailable()) //2014.11.15.
|
||||
{
|
||||
if (Program.MainF != null)
|
||||
{ //2014.11.21.
|
||||
if (Program.MainF.InvokeRequired) //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
Program.MainF.Invoke(new Action<MainForm.StatType, int>(Program.MainF.UpdateStats), //2014.11.21.
|
||||
MainForm.StatType.MainServer, 0); //2014.11.21.
|
||||
}
|
||||
else //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
Program.MainF.UpdateStats(MainForm.StatType.MainServer, 0); //2014.11.21.
|
||||
}
|
||||
}
|
||||
return "Fail: " + Language.Translate("error_no_network");
|
||||
}
|
||||
|
||||
#if LOCAL_SERVER //2014.07.07. 22:00
|
||||
HttpWebRequest httpWReq =
|
||||
(HttpWebRequest)WebRequest.Create("http://localhost/ChatWithWords/client.php");
|
||||
#else
|
||||
HttpWebRequest httpWReq =
|
||||
(HttpWebRequest)WebRequest.Create("http://msger.url.ph/client.php");
|
||||
#endif
|
||||
|
||||
ASCIIEncoding encoding = new ASCIIEncoding();
|
||||
string postData = "action=" + action;
|
||||
if (loggedin) //2014.03.14.
|
||||
postData += "&uid=" + CurrentUser.UserID;
|
||||
postData += "&key=cas1fe4a6feFEFEFE1616CE8099VFE1444cdasf48c1ase5dg";
|
||||
if (loggedin) //2014.03.14.
|
||||
postData += "&code=" + LoginForm.UserCode; //2014.02.13.
|
||||
postData += "&data=" + Uri.EscapeUriString(data); //2014.02.13.
|
||||
byte[] datax = encoding.GetBytes(postData);
|
||||
|
||||
httpWReq.Method = "POST";
|
||||
httpWReq.ContentType = "application/x-www-form-urlencoded";
|
||||
httpWReq.ContentLength = datax.Length;
|
||||
|
||||
using (Stream stream = httpWReq.GetRequestStream())
|
||||
{
|
||||
stream.Write(datax, 0, datax.Length);
|
||||
}
|
||||
|
||||
HttpWebResponse response;
|
||||
|
||||
try
|
||||
{
|
||||
response = (HttpWebResponse)httpWReq.GetResponse();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (Tries > 10)
|
||||
{
|
||||
MessageBox.Show(Language.Translate("error_network") + ":\n" + e.Message + "\n\n" + Language.Translate("error_network2"), Language.Translate("error")); //2014.04.25.
|
||||
Tries = 0;
|
||||
}
|
||||
if (Program.MainF != null)
|
||||
{ //2014.11.21.
|
||||
if (Program.MainF.InvokeRequired) //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
Program.MainF.Invoke(new Action<MainForm.StatType, int>(Program.MainF.UpdateStats), //2014.11.21.
|
||||
MainForm.StatType.MainServer, 1); //2014.11.21.
|
||||
}
|
||||
else //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
Program.MainF.UpdateStats(MainForm.StatType.MainServer, 1); //2014.11.21.
|
||||
}
|
||||
}
|
||||
Tries++;
|
||||
return SendRequest(action, data, remnum, loggedin); //Újrapróbálkozik
|
||||
}
|
||||
string responseString;
|
||||
responseString = Uri.UnescapeDataString(new StreamReader(response.GetResponseStream()).ReadToEnd());
|
||||
if (Program.MainF != null)
|
||||
{ //2014.11.21.
|
||||
if (Program.MainF.InvokeRequired) //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
Program.MainF.Invoke(new Action<MainForm.StatType, int>(Program.MainF.UpdateStats), //2014.11.21.
|
||||
MainForm.StatType.MainServer, 2); //2014.11.21.
|
||||
}
|
||||
else //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
Program.MainF.UpdateStats(MainForm.StatType.MainServer, 2); //2014.11.21.
|
||||
}
|
||||
}
|
||||
return responseString;
|
||||
}
|
||||
|
||||
private static bool IsNetworkAvailable()
|
||||
{
|
||||
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
|
||||
|
||||
foreach (NetworkInterface nic in nics)
|
||||
{
|
||||
if (
|
||||
(nic.NetworkInterfaceType != NetworkInterfaceType.Loopback && nic.NetworkInterfaceType != NetworkInterfaceType.Tunnel) &&
|
||||
nic.OperationalStatus == OperationalStatus.Up)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
193
MSGer.tk/Networking.SendUpdate.cs
Normal file
193
MSGer.tk/Networking.SendUpdate.cs
Normal file
|
@ -0,0 +1,193 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
partial class Networking
|
||||
{
|
||||
public static UdpClient SenderConnection = new UdpClient(); //2014.09.04. - Ezt ne társítsa egy porthoz, hogy működjön az udp hole punching
|
||||
public static UdpClient ReceiverConnection = new UdpClient(); //2014.09.04. - Társítsa egy porthoz
|
||||
public static byte[] DataBuffer;
|
||||
public static IPEndPoint RemoteEP;
|
||||
public static bool WaitingOnResponse = false; //2014.08.16.
|
||||
public static byte WaitingOnPacket = 0x00; //2014.08.16. - 0x00: Nincs
|
||||
public static byte[][] SendUpdate(UpdateType ut, byte[] data, bool response, IPEndPoint onlythisep = null)
|
||||
{
|
||||
if (Program.MainF != null && Program.MainF.IsHandleCreated) //IsHandleCreated: 2014.12.31.
|
||||
{ //2014.11.21.
|
||||
if (Program.MainF.InvokeRequired) //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
Program.MainF.Invoke(new Action<MainForm.StatType, int>(Program.MainF.UpdateStats), //2014.11.21.
|
||||
MainForm.StatType.Servers, UserInfo.IPs.Count); //2014.11.21.
|
||||
Program.MainF.Invoke(new Action<MainForm.StatType, int>(Program.MainF.UpdateStats), //2014.11.21.
|
||||
MainForm.StatType.OnlineServers, UserInfo.IPs.Count - UserInfo.BannedIPs.Count); //2014.11.21.
|
||||
}
|
||||
else //2014.11.21.
|
||||
{ //2014.11.21.
|
||||
/*Program.MainF.UpdateStats(MainForm.StatType.Servers, UserInfo.IPs.Count); //2014.11.21.
|
||||
Program.MainF.UpdateStats(MainForm.StatType.OnlineServers, UserInfo.IPs.Count - UserInfo.BannedIPs.Count); //2014.11.21. - 2014.12.05. - Servers --> OnlineServers*/
|
||||
//2014.12.31.
|
||||
MessageBox.Show("Internal error: Network call was made in the same thread as the UI. This could lead to freezes.\nNetwork update canceled.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (UserInfo.IPs.Count == 0
|
||||
&& !UserInfo.IPs.Any(entry => entry.Address.Equals(RemoteEP.Address))
|
||||
&& ut != Networking.UpdateType.LoginUser
|
||||
/*&& ut != Networking.UpdateType.CheckConn
|
||||
&& ut != Networking.UpdateType.RequestConn
|
||||
&& ut != Networking.UpdateType.MakeConn
|
||||
&& ut != Networking.UpdateType.MakeConn2*/) //2014.12.19.
|
||||
return null;
|
||||
//Log("Packet sending begins: there are users online and/or it is an update type that does not require that.");
|
||||
byte[] senddata = CreatePacket(response, (byte)ut, data);
|
||||
//Log("Packet created successfully (" + ((response) ? "" : "not ") + "response) with update type " + ut.ToString());
|
||||
if (UserInfo.BanTime < Environment.TickCount - 1000 * 10) //2014.08.30. - 2014.10.09. - 10 percről 1-re csökkentve - 2014.11.22. - 1 percről 10 mp-re csökkentve
|
||||
//UserInfo.BannedIPs = new List<IPEndPoint>(); //2014.08.30.
|
||||
UserInfo.BannedIPs = new List<IPEndPoint>(); //2014.11.23.
|
||||
if (!response)
|
||||
{ //2014.08.30. - Azelőtt állítsa be, hogy elküldené a lekéréseket, hogy biztosan reagáljon a válaszra
|
||||
WaitingOnResponse = true; //2014.08.16.
|
||||
WaitingOnPacket = (byte)ut; //2014.08.16.
|
||||
}
|
||||
//Log("Hole punching begins.");
|
||||
/*if (ut != UpdateType.CheckConn && ut != UpdateType.RequestConn)
|
||||
CheckNPunchHole(); //2014.11.22.*/
|
||||
//Log("Hole punching done.");
|
||||
if (onlythisep == null) //2014.11.22. - != helyett ==: 2014.12.18.
|
||||
{
|
||||
//Log("Sending to every known user...");
|
||||
foreach (var item in UserInfo.IPs)
|
||||
{ //Elküldi az összes ismert címre
|
||||
try
|
||||
{
|
||||
if (!UserInfo.BannedIPs.Contains(item))
|
||||
//SenderConnection.Send(Storage.Encrypt(senddata.ToArray(), "sendupdatestringencrypted"), senddata.Count, item);
|
||||
SenderConnection.Send(senddata, senddata.Length, item);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //2014.11.22.
|
||||
//Log("Sending to single ip: " + onlythisep.Address + ":" + onlythisep.Port);
|
||||
try
|
||||
{
|
||||
//if (UserInfo.IPs.Any(entry=>entry.IP==onlythisep) && !UserInfo.BannedIPs.Any(entry=>entry.IP==onlythisep))
|
||||
//if (UserInfo.IPs.Any(entry => entry.IP == onlythisep) && !UserInfo.BannedIPs.Any(entry => entry.IP == onlythisep))
|
||||
SenderConnection.Send(senddata, senddata.Length, onlythisep);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!response)
|
||||
{
|
||||
int lasttick = Environment.TickCount;
|
||||
List<byte[]> Ret = new List<byte[]>();
|
||||
List<IPEndPoint> ResponsedIPs = new List<IPEndPoint>();
|
||||
int count = 1;
|
||||
//Log("Starting to wait on response...");
|
||||
while (Environment.TickCount - 1000 * 10 < lasttick && (
|
||||
(onlythisep == null) ? //2014.11.22.
|
||||
ResponsedIPs.Count < UserInfo.IPs.Count - UserInfo.BannedIPs.Count :
|
||||
ResponsedIPs.Count == 0 //2014.11.22.
|
||||
)) //2014.09.09. - 2014.10.09. - 60 mp --> 10 mp
|
||||
{ //2014.08.19. - Ret.Count == tmp.Length
|
||||
if (MainForm.LThread != null) //2014.09.06.
|
||||
{
|
||||
//Log("Waiting to get response... Wait time: " + count * 2 + "seconds");
|
||||
while (DataBuffer == null && Environment.TickCount - 1000 * count * 2 < lasttick) ; //Várakozik, amíg a másik thread át nem adja a választ - 2014.10.09. - 10 mp --> 2 mp
|
||||
|
||||
/*foreach (var item in UserInfo.IPs.Except(UserInfo.BannedIPs).Except(ResponsedIPs)) //2014.09.22.
|
||||
{ //Elküldi az összes ismert címre
|
||||
try
|
||||
{
|
||||
SenderConnection.Send(senddata, senddata.Length, item.IP);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
count++;*/
|
||||
}
|
||||
if (DataBuffer == null) //2014.08.30. - Az idő telt le
|
||||
{
|
||||
//Log("No response received. Retrying...");
|
||||
//UserInfo.BannedIPs = UserInfo.IPs.Except(ResponsedIPs).ToList(); //2014.08.30. - Ideiglenesen kitilt minden IP-t, ahonnan nem érkezett válasz
|
||||
//UserInfo.BanTime = Environment.TickCount;
|
||||
|
||||
foreach (var item in UserInfo.IPs.Except(UserInfo.BannedIPs).Except(ResponsedIPs)) //2014.09.22.
|
||||
{ //Elküldi az összes ismert címre
|
||||
try
|
||||
{
|
||||
SenderConnection.Send(senddata, senddata.Length, item);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
count++;
|
||||
//break;
|
||||
continue;
|
||||
}
|
||||
//Log("A response received.");
|
||||
//if (UserInfo.IPs.Any(entry=>entry.IP==RemoteEP) && !UserInfo.BannedIPs.Any(entry=>entry.IP==RemoteEP))
|
||||
if (!(!UserInfo.IPs.Any(entry => entry.Address.Equals(RemoteEP.Address))
|
||||
&& ut != Networking.UpdateType.LoginUser
|
||||
/*&& ut != Networking.UpdateType.CheckConn
|
||||
&& ut != Networking.UpdateType.RequestConn
|
||||
&& ut != Networking.UpdateType.MakeConn
|
||||
&& ut != Networking.UpdateType.MakeConn2*/)) //2014.12.22. - Ha az egész feltétel nem teljesül, akkor sikerült
|
||||
{
|
||||
//Log("Response is from known ip or it's not required to be that.");
|
||||
//ResponsedIPs.Add(RemoteEP);
|
||||
foreach (var item in UserInfo.IPs.Where(entry => entry == RemoteEP))
|
||||
ResponsedIPs.Add(item);
|
||||
var pparts = ParsePacket(DataBuffer);
|
||||
//Log("Packet parsed.");
|
||||
if (pparts.KeyVersion != CurrentUser.KeyIndex && pparts.UpdateType != UpdateType.SetKey)
|
||||
{
|
||||
//Log("Key version mismatch.");
|
||||
DataBuffer = null; //2014.09.22. - Mindig adja meg a lehetőséget, hogy újra beállítsa
|
||||
continue;
|
||||
}
|
||||
//Log("Complete success!");
|
||||
|
||||
int i;
|
||||
for (i = 0; i < Ret.Count; i++)
|
||||
{
|
||||
if (DataBuffer.SequenceEqual(Ret[i]))
|
||||
break;
|
||||
}
|
||||
if (i == Ret.Count)
|
||||
Ret.Add(DataBuffer);
|
||||
} //(2014.08.17. -->) Várja meg, amíg az összes online(!) ismerőse válaszol - Vagy letelik az egy perc
|
||||
DataBuffer = null; //2014.09.22. - Mindig adja meg a lehetőséget, hogy újra beállítsa
|
||||
}
|
||||
//Log("Resetting everything.");
|
||||
DataBuffer = null;
|
||||
RemoteEP = null;
|
||||
WaitingOnResponse = false;
|
||||
WaitingOnPacket = 0x00;
|
||||
//Log("Returning response if there was any.");
|
||||
return Ret.ToArray();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
102
MSGer.tk/Networking.Threads.cs
Normal file
102
MSGer.tk/Networking.Threads.cs
Normal file
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
partial class Networking
|
||||
{
|
||||
//private const string ConnID = "MSGer.tk connection";
|
||||
/*public static void WaitForNewConnections()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Ping pingSender = new Ping();
|
||||
//byte[] id = Encoding.Unicode.GetBytes(ConnID);
|
||||
//PingReply reply = pingSender.Send("3.3.3.3", 30000, id, new PingOptions(512, true));
|
||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp);
|
||||
socket.SendTo(ICMPPacket.CreateRequest(), new IPEndPoint(IPAddress.Parse("3.3.3.3"), 8988));
|
||||
byte[] buffer = new byte[128];
|
||||
//IPEndPoint ep = new IPEndPoint(IPAddress.Any, 8988);
|
||||
EndPoint ep = (EndPoint)new IPEndPoint(IPAddress.Any, 8988);
|
||||
socket.ReceiveFrom(buffer, ref ep);
|
||||
//if (reply.Status == IPStatus.TimeExceeded)
|
||||
if(ICMPPacket.IsPacketGood(buffer))
|
||||
{
|
||||
Log("A client is trying to connect...");
|
||||
//MakeConnection(reply.Address);
|
||||
MakeConnection(((IPEndPoint)ep).Address);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log("An error occured during ICMP... - Status: " + reply.Status);
|
||||
Log("An error occured during ICMP...");
|
||||
}
|
||||
Thread.Sleep(28 * 1000);
|
||||
}
|
||||
}
|
||||
public static void ConnectToServer(IPEndPoint server)
|
||||
{
|
||||
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp);
|
||||
socket.SendTo(ICMPPacket.CreateReply(),server);
|
||||
}
|
||||
|
||||
private static void MakeConnection(IPAddress addr)
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
public static void KeepUpThread()
|
||||
{ //2014.08.28.
|
||||
while (true) //while: 2014.12.19.
|
||||
{
|
||||
Thread.Sleep(59 * 60 * 1000); //59 percenként frissíti a jelenlétét, így biztosan nem jelenti offline-nak a PHP (elvileg)
|
||||
Console.WriteLine("KeepUpThread: " + Networking.SendRequest("keepactive", "", 0, true));
|
||||
}
|
||||
}
|
||||
public static void KeepUpUsersThread() //2014.09.26. - Nehogy bezáruljon a kapcsolat
|
||||
{
|
||||
while (true) //while: 2014.12.19.
|
||||
{
|
||||
Thread.Sleep(20 * 1000);
|
||||
Networking.SendUpdate(UpdateType.KeepAlive, new byte[] { 0x01 }, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendUpdateInThread(UpdateType ut, byte[] data, EventHandler<byte[][]> doneevent, IPEndPoint onlythisep = null)
|
||||
{ //2014.12.31. 0:24 - Válaszadásra van külön thread, itt csak eredeti küldést használhat
|
||||
threadobject.Clear();
|
||||
threadobject.Add(ut);
|
||||
threadobject.Add(data);
|
||||
threadobject.Add(doneevent);
|
||||
threadobject.Add(onlythisep);
|
||||
while (networkthread == null) ;
|
||||
networkthread.Interrupt();
|
||||
}
|
||||
private static List<object> threadobject = new List<object>();
|
||||
private static Thread networkthread;
|
||||
public static void NetworkThread() //A MainThread ezen keresztül hívja meg, hogy ne fagyjon le
|
||||
{ //2014.12.30.
|
||||
networkthread = Thread.CurrentThread;
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.Sleep(Timeout.Infinite);
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
var resp = SendUpdate((UpdateType)threadobject[0], (byte[])threadobject[1], false, (IPEndPoint)threadobject[3]);
|
||||
if (threadobject[2] != null)
|
||||
((EventHandler<byte[][]>)threadobject[2])(null, resp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
140
MSGer.tk/Networking.cs
Normal file
140
MSGer.tk/Networking.cs
Normal file
|
@ -0,0 +1,140 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
static partial class Networking
|
||||
{
|
||||
public enum UpdateType : byte
|
||||
{
|
||||
ListUpdate = 0x01, //0x01: OK
|
||||
UpdateMessages, //0x01: OK
|
||||
GetImage, //(int)0: Hiba, egyébként a kép hossza, majd a kép
|
||||
LoginUser, //0x00: Hiba - Egyébként minden fontos információ, amiről "lemaradt"
|
||||
LogoutUser, //0x01: OK
|
||||
SetKey, //0x01: OK
|
||||
KeepAlive,
|
||||
/*CheckConn, //0x01: Csatlakozva
|
||||
RequestConn, //
|
||||
MakeConn,
|
||||
MakeConn2*/
|
||||
};
|
||||
|
||||
private static void Log(string message) //2014.12.31.
|
||||
{
|
||||
Logging.Log(message, Logging.LogType.Network);
|
||||
}
|
||||
|
||||
/*public static byte[][] SendUpdate(UpdateType ut, byte[] data, bool response) - Opcionális paraméterre változtatva: 2014.12.22.
|
||||
{ //2014.11.22.
|
||||
return SendUpdate(ut, data, response, null);
|
||||
}*/
|
||||
/*private static void CheckNPunchHole() //Még előtte tudja meg a belső portot
|
||||
{ //2014.11.22.
|
||||
try
|
||||
{
|
||||
foreach (var item in UserInfo.IPs.Except(UserInfo.BannedIPs))
|
||||
{
|
||||
if (Thread.CurrentThread == MainForm.MainThread)
|
||||
{
|
||||
SendUpdateInThread(UpdateType.CheckConn, new byte[] { }, new EventHandler<byte[][]>(
|
||||
(e, resp) =>
|
||||
{
|
||||
if (resp != null && resp.Length != 0 && ParsePacket(resp[0]).Data[0] == 0x01)
|
||||
return; //Minden rendben, válaszolt
|
||||
UserInfo.BannedIPs.Remove(item); //2014.12.19.
|
||||
//if (Storage.Settings["isserver"] == "1") - Ha szerver, ha nem, kérje a többi szervert, hogy csatlakoztassa össze
|
||||
resp = SendUpdate(UpdateType.RequestConn, Encoding.Unicode.GetBytes(item.ToString()), false); //Mindenkitől kéri, akivel van kapcsolata
|
||||
if (resp != null && resp.Length != 0 && ParsePacket(resp[0]).Data[0] == 0x01) //2014.11.23. - Ilyenkor már tudnia kellene a portot, és hasonlókat
|
||||
{
|
||||
Networking.SendUpdate(UpdateType.MakeConn2, new byte[] { 0x01 }, false); //Elvileg akkor végez ez az utasítás, ha létrejött a kapcsolat, vagy letelt a határidő
|
||||
}
|
||||
}
|
||||
), item);
|
||||
}
|
||||
else
|
||||
{
|
||||
var resp = SendUpdate(UpdateType.CheckConn, new byte[] { }, false, item);
|
||||
if (resp != null && resp.Length != 0 && ParsePacket(resp[0]).Data[0] == 0x01)
|
||||
continue; //Minden rendben, válaszolt
|
||||
UserInfo.BannedIPs.Remove(item); //2014.12.19.
|
||||
//if (Storage.Settings["isserver"] == "1") - Ha szerver, ha nem, kérje a többi szervert, hogy csatlakoztassa össze
|
||||
resp = SendUpdate(UpdateType.RequestConn, Encoding.Unicode.GetBytes(item.ToString()), false); //Mindenkitől kéri, akivel van kapcsolata
|
||||
if (resp != null && resp.Length != 0 && ParsePacket(resp[0]).Data[0] == 0x01) //2014.11.23. - Ilyenkor már tudnia kellene a portot, és hasonlókat
|
||||
{
|
||||
Networking.SendUpdate(UpdateType.MakeConn2, new byte[] { 0x01 }, false); //Elvileg akkor végez ez az utasítás, ha létrejött a kapcsolat, vagy letelt a határidő
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException) { }
|
||||
}*/
|
||||
|
||||
public static bool SendChatMessage(ChatPanel chat, string message)
|
||||
{ //2014.09.22.
|
||||
List<byte> bytes = new List<byte>();
|
||||
string sendstr = "";
|
||||
foreach (var pID in chat.ChatPartners)
|
||||
{
|
||||
sendstr += pID + ",";
|
||||
}
|
||||
bytes.AddRange(BitConverter.GetBytes(Encoding.Unicode.GetByteCount(sendstr)));
|
||||
bytes.AddRange(Encoding.Unicode.GetBytes(sendstr));
|
||||
sendstr = message; //Átállítja a sendstr-t az üzenetre, majd újra belerakja
|
||||
bytes.AddRange(BitConverter.GetBytes(Encoding.Unicode.GetByteCount(sendstr)));
|
||||
bytes.AddRange(Encoding.Unicode.GetBytes(sendstr));
|
||||
sendstr = Program.DateTimeToUnixTime(DateTime.Now);
|
||||
bytes.AddRange(BitConverter.GetBytes(Encoding.Unicode.GetByteCount(sendstr)));
|
||||
bytes.AddRange(Encoding.Unicode.GetBytes(sendstr));
|
||||
byte[][] resp = SendUpdate(UpdateType.UpdateMessages, Encoding.Unicode.GetBytes(sendstr), false);
|
||||
if (resp == null || resp.Length == 0 || resp.All(bytesb => bytesb[0] != 0x01))
|
||||
return false;
|
||||
else //Ha válaszoltak, és senki sem válaszolt nem oké jelzéssel, akkor rendben van
|
||||
return true;
|
||||
}
|
||||
public static object[] ReceiveUpdates() //Thread function
|
||||
{
|
||||
IPEndPoint remoteEP;
|
||||
remoteEP = new IPEndPoint(IPAddress.Any, Int32.Parse(Storage.Settings["port"])); //2014.09.04. - A port beállítása már megtörtént
|
||||
byte[] buf;
|
||||
try
|
||||
{
|
||||
buf = ReceiverConnection.Receive(ref remoteEP);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (buf[0] == 0x01) //0x01: Válasz egy kérelemre
|
||||
{
|
||||
if (WaitingOnResponse == false || WaitingOnPacket != buf[1])
|
||||
return null;
|
||||
while (DataBuffer != null) ; //Várja meg, amíg feldolgozza a legutóbbi adatot
|
||||
DataBuffer = buf; //2014.09.19. - Küldön el mindenhova mindent, és egységesen egy funkcióval dolgozza fel
|
||||
RemoteEP = remoteEP;
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return new object[] { buf, remoteEP };
|
||||
}
|
||||
|
||||
public struct PacketParts
|
||||
{
|
||||
public bool Response;
|
||||
public UpdateType UpdateType;
|
||||
public int KeyVersion;
|
||||
public int Port; //2014.12.19.
|
||||
public int UserID;
|
||||
public byte[] Data;
|
||||
};
|
||||
}
|
||||
}
|
BIN
MSGer.tk/ObjectListView.dll
Normal file
BIN
MSGer.tk/ObjectListView.dll
Normal file
Binary file not shown.
188
MSGer.tk/ObjectListView2012.csproj
Normal file
188
MSGer.tk/ObjectListView2012.csproj
Normal file
|
@ -0,0 +1,188 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{18FEDA0C-D147-4286-B39A-01204808106A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BrightIdeasSoftware</RootNamespace>
|
||||
<AssemblyName>ObjectListView</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>olv-keyfile.snk</AssemblyOriginatorKeyFile>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<DocumentationFile>bin\Debug\ObjectListView.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Accessibility" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataTreeListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DragDrop\OLVDataObject.cs" />
|
||||
<Compile Include="Filtering\DateTimeClusteringStrategy.cs" />
|
||||
<Compile Include="Filtering\FlagClusteringStrategy.cs" />
|
||||
<Compile Include="Filtering\TextMatchFilter.cs" />
|
||||
<Compile Include="Implementation\Delegates.cs" />
|
||||
<Compile Include="Implementation\Enums.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Implementation\GroupingParameters.cs" />
|
||||
<Compile Include="Implementation\NullableDictionary.cs" />
|
||||
<Compile Include="Implementation\OLVListItem.cs" />
|
||||
<Compile Include="Implementation\OLVListSubItem.cs" />
|
||||
<Compile Include="Implementation\OlvListViewHitTestInfo.cs" />
|
||||
<Compile Include="Implementation\TreeDataSourceAdapter.cs" />
|
||||
<Compile Include="OLVColumn.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\Adornments.cs" />
|
||||
<Compile Include="Implementation\Attributes.cs" />
|
||||
<Compile Include="CellEditing\CellEditors.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CellEditing\EditorRegistry.cs" />
|
||||
<Compile Include="DataListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Implementation\DataSourceAdapter.cs" />
|
||||
<Compile Include="Rendering\Decorations.cs" />
|
||||
<Compile Include="DragDrop\DragSource.cs" />
|
||||
<Compile Include="DragDrop\DropSink.cs" />
|
||||
<Compile Include="Implementation\Events.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FastDataListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Filtering\ClusteringStrategy.cs" />
|
||||
<Compile Include="Filtering\Cluster.cs" />
|
||||
<Compile Include="Filtering\ClustersFromGroupsStrategy.cs" />
|
||||
<Compile Include="FastObjectListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Filtering\FilterMenuBuilder.cs" />
|
||||
<Compile Include="Filtering\Filters.cs" />
|
||||
<Compile Include="Filtering\ICluster.cs" />
|
||||
<Compile Include="Filtering\IClusteringStrategy.cs" />
|
||||
<Compile Include="Rendering\TreeRenderer.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SubControls\ToolStripCheckedListBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\ColumnSelectionForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\ColumnSelectionForm.Designer.cs">
|
||||
<DependentUpon>ColumnSelectionForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\Generator.cs" />
|
||||
<Compile Include="SubControls\GlassPanelForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Implementation\Groups.cs" />
|
||||
<Compile Include="SubControls\HeaderControl.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CellEditing\CellEditKeyEngine.cs" />
|
||||
<Compile Include="Implementation\Munger.cs" />
|
||||
<Compile Include="Implementation\NativeMethods.cs" />
|
||||
<Compile Include="Implementation\Comparers.cs">
|
||||
</Compile>
|
||||
<Compile Include="ObjectListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ObjectListView.DesignTime.cs" />
|
||||
<Compile Include="Rendering\Overlays.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Rendering\Renderers.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rendering\Styles.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SubControls\ToolTipControl.cs" />
|
||||
<Compile Include="TreeListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\OLVExporter.cs" />
|
||||
<Compile Include="Utilities\TypedObjectListView.cs" />
|
||||
<Compile Include="Implementation\VirtualGroups.cs" />
|
||||
<Compile Include="Implementation\VirtualListDataSource.cs" />
|
||||
<Compile Include="VirtualObjectListView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="CustomDictionary.xml" />
|
||||
<None Include="FullClassDiagram.cd" />
|
||||
<None Include="Resources\sort-descending.png" />
|
||||
<None Include="Resources\sort-ascending.png" />
|
||||
<None Include="Resources\filter.png" />
|
||||
<None Include="Resources\clear-filter.png" />
|
||||
<None Include="Resources\filter-icons3.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="olv-keyfile.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Utilities\ColumnSelectionForm.resx">
|
||||
<DependentUpon>ColumnSelectionForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
182
MSGer.tk/PartnerInformation.Designer.cs
generated
Normal file
182
MSGer.tk/PartnerInformation.Designer.cs
generated
Normal file
|
@ -0,0 +1,182 @@
|
|||
namespace MSGer.tk
|
||||
{
|
||||
partial class PartnerInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.nameTextBox = new Khendys.Controls.ExRichTextBox();
|
||||
this.messageTextBox = new Khendys.Controls.ExRichTextBox();
|
||||
this.statusLabel = new System.Windows.Forms.Label();
|
||||
this.userName1 = new System.Windows.Forms.Label();
|
||||
this.userName2 = new System.Windows.Forms.Label();
|
||||
this.userID1 = new System.Windows.Forms.Label();
|
||||
this.userID2 = new System.Windows.Forms.Label();
|
||||
this.email2 = new System.Windows.Forms.Label();
|
||||
this.email1 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(100, 100);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox1.TabIndex = 0;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nameTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.nameTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.nameTextBox.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(119, 12);
|
||||
this.nameTextBox.Multiline = false;
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.ReadOnly = true;
|
||||
this.nameTextBox.Size = new System.Drawing.Size(445, 30);
|
||||
this.nameTextBox.TabIndex = 1;
|
||||
this.nameTextBox.Text = "ShownName";
|
||||
this.nameTextBox.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
//
|
||||
// messageTextBox
|
||||
//
|
||||
this.messageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.messageTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.messageTextBox.HiglightColor = Khendys.Controls.RtfColor.White;
|
||||
this.messageTextBox.Location = new System.Drawing.Point(119, 57);
|
||||
this.messageTextBox.Name = "messageTextBox";
|
||||
this.messageTextBox.ReadOnly = true;
|
||||
this.messageTextBox.Size = new System.Drawing.Size(445, 55);
|
||||
this.messageTextBox.TabIndex = 2;
|
||||
this.messageTextBox.Text = "User Message\nLine";
|
||||
this.messageTextBox.TextColor = Khendys.Controls.RtfColor.Black;
|
||||
//
|
||||
// statusLabel
|
||||
//
|
||||
this.statusLabel.AutoSize = true;
|
||||
this.statusLabel.Location = new System.Drawing.Point(119, 38);
|
||||
this.statusLabel.Name = "statusLabel";
|
||||
this.statusLabel.Size = new System.Drawing.Size(63, 13);
|
||||
this.statusLabel.TabIndex = 3;
|
||||
this.statusLabel.Text = "StatusLabel";
|
||||
//
|
||||
// userName1
|
||||
//
|
||||
this.userName1.AutoSize = true;
|
||||
this.userName1.Location = new System.Drawing.Point(12, 120);
|
||||
this.userName1.Name = "userName1";
|
||||
this.userName1.Size = new System.Drawing.Size(63, 13);
|
||||
this.userName1.TabIndex = 4;
|
||||
this.userName1.Text = "UserName1";
|
||||
//
|
||||
// userName2
|
||||
//
|
||||
this.userName2.AutoSize = true;
|
||||
this.userName2.Location = new System.Drawing.Point(119, 120);
|
||||
this.userName2.Name = "userName2";
|
||||
this.userName2.Size = new System.Drawing.Size(63, 13);
|
||||
this.userName2.TabIndex = 5;
|
||||
this.userName2.Text = "UserName2";
|
||||
//
|
||||
// userID1
|
||||
//
|
||||
this.userID1.AutoSize = true;
|
||||
this.userID1.Location = new System.Drawing.Point(12, 135);
|
||||
this.userID1.Name = "userID1";
|
||||
this.userID1.Size = new System.Drawing.Size(46, 13);
|
||||
this.userID1.TabIndex = 6;
|
||||
this.userID1.Text = "UserID1";
|
||||
//
|
||||
// userID2
|
||||
//
|
||||
this.userID2.AutoSize = true;
|
||||
this.userID2.Location = new System.Drawing.Point(119, 135);
|
||||
this.userID2.Name = "userID2";
|
||||
this.userID2.Size = new System.Drawing.Size(46, 13);
|
||||
this.userID2.TabIndex = 7;
|
||||
this.userID2.Text = "UserID2";
|
||||
//
|
||||
// email2
|
||||
//
|
||||
this.email2.AutoSize = true;
|
||||
this.email2.Location = new System.Drawing.Point(119, 150);
|
||||
this.email2.Name = "email2";
|
||||
this.email2.Size = new System.Drawing.Size(38, 13);
|
||||
this.email2.TabIndex = 9;
|
||||
this.email2.Text = "Email2";
|
||||
//
|
||||
// email1
|
||||
//
|
||||
this.email1.AutoSize = true;
|
||||
this.email1.Location = new System.Drawing.Point(12, 150);
|
||||
this.email1.Name = "email1";
|
||||
this.email1.Size = new System.Drawing.Size(38, 13);
|
||||
this.email1.TabIndex = 8;
|
||||
this.email1.Text = "Email1";
|
||||
//
|
||||
// PartnerInformation
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(576, 273);
|
||||
this.Controls.Add(this.email2);
|
||||
this.Controls.Add(this.email1);
|
||||
this.Controls.Add(this.userID2);
|
||||
this.Controls.Add(this.userID1);
|
||||
this.Controls.Add(this.userName2);
|
||||
this.Controls.Add(this.userName1);
|
||||
this.Controls.Add(this.statusLabel);
|
||||
this.Controls.Add(this.messageTextBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Name = "PartnerInformation";
|
||||
this.Text = "PartnerInformation";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private Khendys.Controls.ExRichTextBox nameTextBox;
|
||||
private Khendys.Controls.ExRichTextBox messageTextBox;
|
||||
private System.Windows.Forms.Label statusLabel;
|
||||
private System.Windows.Forms.Label userName1;
|
||||
private System.Windows.Forms.Label userName2;
|
||||
private System.Windows.Forms.Label userID1;
|
||||
private System.Windows.Forms.Label userID2;
|
||||
private System.Windows.Forms.Label email2;
|
||||
private System.Windows.Forms.Label email1;
|
||||
}
|
||||
}
|
47
MSGer.tk/PartnerInformation.cs
Normal file
47
MSGer.tk/PartnerInformation.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class PartnerInformation : ThemedForms
|
||||
{
|
||||
public PartnerInformation(UserInfo uinfo)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
nameTextBox.BackColor = this.BackColor;
|
||||
messageTextBox.BackColor = this.BackColor;
|
||||
|
||||
string tmp = Path.GetTempPath();
|
||||
string pictlocation = tmp + "\\MSGer.tk\\pictures\\" + uinfo.UserID + ".png";
|
||||
if (File.Exists(pictlocation))
|
||||
pictureBox1.ImageLocation = pictlocation;
|
||||
else
|
||||
pictureBox1.ImageLocation = "noimage.png";
|
||||
nameTextBox.Text = uinfo.Name;
|
||||
if (uinfo.State == 1)
|
||||
statusLabel.Text = Language.Translate("menu_file_status_online");
|
||||
else if (uinfo.State == 2)
|
||||
statusLabel.Text = Language.Translate("menu_file_status_busy");
|
||||
else if (uinfo.State == 3)
|
||||
statusLabel.Text = Language.Translate("menu_file_status_away");
|
||||
else
|
||||
statusLabel.Text = "";
|
||||
messageTextBox.Text = uinfo.Message;
|
||||
userName1.Text = Language.Translate("reg_username") + ":";
|
||||
userName2.Text = uinfo.UserName;
|
||||
userID1.Text = Language.Translate("userid");
|
||||
userID2.Text = uinfo.UserID.ToString();
|
||||
email1.Text = "E-mail:";
|
||||
email2.Text = uinfo.Email;
|
||||
}
|
||||
}
|
||||
}
|
120
MSGer.tk/PartnerInformation.resx
Normal file
120
MSGer.tk/PartnerInformation.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -21,6 +21,7 @@ namespace MSGer.tk
|
|||
static class Program
|
||||
{
|
||||
public static MainForm MainF;
|
||||
public static SettingsForm SettingsF;
|
||||
public static string ProcessName = Process.GetCurrentProcess().ProcessName;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
|
@ -40,8 +41,9 @@ namespace MSGer.tk
|
|||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
try
|
||||
{
|
||||
MainF = new MainForm();
|
||||
Application.Run(MainF);
|
||||
//MainF = new MainForm(); - 2014.11.21. - A létrehozáskor hozzárendeli, így már akkor hozzáférhető ezen a néven
|
||||
//Application.Run(MainF);
|
||||
Application.Run(new MainForm()); //2014.11.21.
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
|
@ -161,7 +163,7 @@ namespace MSGer.tk
|
|||
///
|
||||
/// The object to be cloned must be serializable.
|
||||
///
|
||||
public static object Clone(object obj)
|
||||
public static object Clone(this object obj)
|
||||
{
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
|
@ -172,5 +174,16 @@ namespace MSGer.tk
|
|||
return temp;
|
||||
}
|
||||
}
|
||||
public static IEnumerable<Control> GetAll(this Control control, Type type = null)
|
||||
{ //2015.02.26.
|
||||
var controls = control.Controls.Cast<Control>();
|
||||
|
||||
/*return controls.SelectMany(ctrl => GetAll(ctrl, type))
|
||||
.Concat(controls)
|
||||
.Where(c => c.GetType() == type);*/
|
||||
var ret = controls.SelectMany(ctrl => GetAll(ctrl, type))
|
||||
.Concat(controls);
|
||||
return (type == null) ? ret : ret.Where(c => c.GetType() == type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
357
MSGer.tk/ProgressStatistic.cs
Normal file
357
MSGer.tk/ProgressStatistic.cs
Normal file
|
@ -0,0 +1,357 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HdSystemLibrary.IO
|
||||
{
|
||||
public class ProgressEventArgs : EventArgs
|
||||
{
|
||||
public ProgressEventArgs(ProgressStatistic progressStatistic)
|
||||
{
|
||||
if (progressStatistic == null)
|
||||
throw new ArgumentNullException("progressStatistic");
|
||||
ProgressStatistic = progressStatistic;
|
||||
}
|
||||
|
||||
public ProgressStatistic ProgressStatistic { get; private set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class OperationAlreadyStartedException : Exception
|
||||
{
|
||||
public OperationAlreadyStartedException() { }
|
||||
public OperationAlreadyStartedException(string message) : base(message) { }
|
||||
public OperationAlreadyStartedException(string message, Exception inner) : base(message, inner) { }
|
||||
protected OperationAlreadyStartedException(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A class which calculates progress statistics like average bytes per second or estimated finishing time.
|
||||
/// To use it, call the ProgressChange method in regular intervals with the actual progress.
|
||||
/// </summary>
|
||||
public class ProgressStatistic
|
||||
{
|
||||
public ProgressStatistic()
|
||||
{
|
||||
StartingTime = DateTime.MinValue;
|
||||
FinishingTime = DateTime.MinValue;
|
||||
|
||||
progressChangedArgs = new ProgressEventArgs(this); //Event args can be cached
|
||||
}
|
||||
|
||||
private bool hasStarted = false;
|
||||
/// <summary>
|
||||
/// Gets whether the operation has started
|
||||
/// </summary>
|
||||
public bool HasStarted { get { return hasStarted; } }
|
||||
/// <summary>
|
||||
/// Gets whether the operation has finished
|
||||
/// </summary>
|
||||
public bool HasFinished { get { return FinishingTime != DateTime.MinValue; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the operation is still running
|
||||
/// </summary>
|
||||
public bool IsRunning { get { return HasStarted && !HasFinished; } }
|
||||
|
||||
#region Time
|
||||
|
||||
/// <summary>
|
||||
/// Gets the date time when the operation has started
|
||||
/// </summary>
|
||||
public DateTime StartingTime { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the date time when the operation has finished
|
||||
/// </summary>
|
||||
public DateTime FinishingTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the duration of the operation.
|
||||
/// If the operation is still running, the time since starting is returned.
|
||||
/// If the operation has not started, TimeSpan.Zero is returned.
|
||||
/// If the operation has finished, the time between starting and finishing is returned.
|
||||
/// </summary>
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!HasStarted)
|
||||
return TimeSpan.Zero;
|
||||
else if (!HasFinished)
|
||||
return DateTime.Now - StartingTime;
|
||||
else
|
||||
return FinishingTime - StartingTime;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The method which will be used for estimating duration and finishing time
|
||||
/// </summary>
|
||||
public enum EstimatingMethod
|
||||
{
|
||||
/// <summary>
|
||||
/// Current bytes per second will be used for estimating.
|
||||
/// </summary>
|
||||
CurrentBytesPerSecond,
|
||||
/// <summary>
|
||||
/// Average bytes per second will be used for estimating
|
||||
/// </summary>
|
||||
AverageBytesPerSecond
|
||||
}
|
||||
|
||||
private EstimatingMethod estimatingMethod = EstimatingMethod.CurrentBytesPerSecond;
|
||||
/// <summary>
|
||||
/// Gets or sets which method will be used for estimating.
|
||||
/// Can only be set before the operation has started, otherwise an OperationAlreadyStartedException will be thrown.
|
||||
/// </summary>
|
||||
public EstimatingMethod UsedEstimatingMethod
|
||||
{
|
||||
get { return estimatingMethod; }
|
||||
set
|
||||
{
|
||||
if (HasStarted)
|
||||
throw new OperationAlreadyStartedException();
|
||||
estimatingMethod = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the estimated duration. Use UsedEstimatingMethod to specify which method will be used for estimating.
|
||||
/// If the operation will take more than 200 days, TimeSpan.MaxValue is returned.
|
||||
/// </summary>
|
||||
public TimeSpan EstimatedDuration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (HasFinished)
|
||||
return Duration;
|
||||
if (TotalBytesToRead == -1)
|
||||
return TimeSpan.MaxValue;
|
||||
|
||||
double bytesPerSecond = 1;
|
||||
if (UsedEstimatingMethod == EstimatingMethod.AverageBytesPerSecond)
|
||||
bytesPerSecond = AverageBytesPerSecond;
|
||||
else if (UsedEstimatingMethod == EstimatingMethod.CurrentBytesPerSecond)
|
||||
bytesPerSecond = CurrentBytesPerSecond;
|
||||
|
||||
double seconds = (TotalBytesToRead - BytesRead) / bytesPerSecond;
|
||||
if (seconds > 60 * 60 * 24 * 200) //over 200 Days -> infinite
|
||||
return TimeSpan.MaxValue;
|
||||
else
|
||||
return Duration + TimeSpan.FromSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the estimated finishing time based on EstimatedDuration.
|
||||
/// If the operation will take more than 200 days, DateTime.MaxValue is returned.
|
||||
/// If the operation has finished, the actual finishing time is returned.
|
||||
/// </summary>
|
||||
public DateTime EstimatedFinishingTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EstimatedDuration == TimeSpan.MaxValue)
|
||||
return DateTime.MaxValue;
|
||||
return StartingTime + EstimatedDuration;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of bytes already read.
|
||||
/// </summary>
|
||||
public long BytesRead { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets the amount of total bytes to read. Can be -1 if unknown.
|
||||
/// </summary>
|
||||
public long TotalBytesToRead { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the progress in percent between 0 and 1.
|
||||
/// If the amount of total bytes to read is unknown, -1 is returned.
|
||||
/// </summary>
|
||||
public double Progress
|
||||
{
|
||||
get
|
||||
{
|
||||
if (TotalBytesToRead == -1)
|
||||
return -1;
|
||||
else
|
||||
return (double)BytesRead / (double)TotalBytesToRead;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the average bytes per second.
|
||||
/// </summary>
|
||||
public double AverageBytesPerSecond { get { return (double)BytesRead / Duration.TotalSeconds; } }
|
||||
|
||||
#region CurrentBytesPerSecond
|
||||
|
||||
/// <summary>
|
||||
/// Gets the approximated current count of bytes processed per second
|
||||
/// </summary>
|
||||
public double CurrentBytesPerSecond { get; private set; }
|
||||
|
||||
|
||||
private TimeSpan currentBytesCalculationInterval = TimeSpan.FromSeconds(0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the interval used for the calculation of the current bytes per second. Default is 500 ms.
|
||||
/// </summary>
|
||||
/// <exception cref="OperationAlreadyStartedException">
|
||||
/// Thrown when trying to set although the operation has already started.</exception>
|
||||
public TimeSpan CurrentBytesCalculationInterval
|
||||
{
|
||||
get { return currentBytesCalculationInterval; }
|
||||
set
|
||||
{
|
||||
if (HasStarted)
|
||||
throw new InvalidOperationException("Task has already started!");
|
||||
currentBytesCalculationInterval = value;
|
||||
}
|
||||
}
|
||||
|
||||
KeyValuePair<DateTime, long>[] currentBytesSamples = new KeyValuePair<DateTime, long>[6];
|
||||
/// <summary>
|
||||
/// Gets or sets the number of samples in CurrentBytesPerSecondInterval used for current bytes per second approximation
|
||||
/// </summary>
|
||||
/// <exception cref="OperationAlreadyStartedException">
|
||||
/// Thrown when trying to set although the operation has already started.</exception>
|
||||
public int CurrentBytesSampleCount
|
||||
{
|
||||
get { return currentBytesSamples.Length; }
|
||||
set
|
||||
{
|
||||
if (HasStarted)
|
||||
throw new InvalidOperationException("Task has already started!");
|
||||
if (value != currentBytesSamples.Length)
|
||||
{
|
||||
currentBytesSamples = new KeyValuePair<DateTime, long>[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int currentSample = 0; //current sample index in currentBytesSamples
|
||||
|
||||
DateTime lastSample;
|
||||
|
||||
private void ProcessSample(long bytes)
|
||||
{
|
||||
if ((DateTime.Now - lastSample).Ticks > CurrentBytesCalculationInterval.Ticks / currentBytesSamples.Length)
|
||||
{
|
||||
lastSample = DateTime.Now;
|
||||
|
||||
KeyValuePair<DateTime, long> current = new KeyValuePair<DateTime, long>(DateTime.Now, bytes);
|
||||
|
||||
var old = currentBytesSamples[currentSample];
|
||||
currentBytesSamples[currentSample] = current;
|
||||
|
||||
if (old.Key == DateTime.MinValue)
|
||||
CurrentBytesPerSecond = AverageBytesPerSecond;
|
||||
else
|
||||
CurrentBytesPerSecond = (double)(current.Value - old.Value) / (current.Key - old.Key).TotalSeconds;
|
||||
|
||||
currentSample++;
|
||||
if (currentSample >= currentBytesSamples.Length)
|
||||
currentSample = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// This method can be called to report progress changes.
|
||||
/// The signature of this method is compliant with the ProgressChange-delegate
|
||||
/// </summary>
|
||||
/// <param name="bytesRead">The amount of bytes already read</param>
|
||||
/// <param name="totalBytesToRead">The amount of total bytes to read. Can be -1 if unknown.</param>
|
||||
/// <exception cref="ArgumentException">Thrown if bytesRead has not changed or even shrunk.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown if the operation has finished already.</exception>
|
||||
public virtual void ProgressChange(long bytesRead, long totalBytesToRead)
|
||||
{
|
||||
if (bytesRead <= BytesRead)
|
||||
throw new ArgumentException("Operation cannot go backwards!", "bytesRead");
|
||||
|
||||
if (HasFinished)
|
||||
throw new InvalidOperationException("Operation has finished already!");
|
||||
|
||||
if (!hasStarted)
|
||||
{
|
||||
StartingTime = DateTime.Now;
|
||||
hasStarted = true;
|
||||
OnStarted();
|
||||
}
|
||||
|
||||
BytesRead = bytesRead;
|
||||
TotalBytesToRead = totalBytesToRead;
|
||||
|
||||
ProcessSample(bytesRead);
|
||||
|
||||
OnProgressChanged();
|
||||
|
||||
if (bytesRead == TotalBytesToRead)
|
||||
{
|
||||
FinishingTime = DateTime.Now;
|
||||
OnFinished();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method can be called to finish an aborted operation.
|
||||
/// If the operation does not reach 100%, "Finished" will be never raised, so this method should be called.
|
||||
/// </summary>
|
||||
public virtual void Finish()
|
||||
{
|
||||
if (!HasFinished)
|
||||
{
|
||||
FinishingTime = DateTime.Now;
|
||||
OnFinished();
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
private readonly ProgressEventArgs progressChangedArgs;
|
||||
|
||||
protected virtual void OnStarted()
|
||||
{
|
||||
if (Started != null)
|
||||
Started(this, progressChangedArgs);
|
||||
}
|
||||
|
||||
protected virtual void OnProgressChanged()
|
||||
{
|
||||
if (ProgressChanged != null)
|
||||
ProgressChanged(this, progressChangedArgs);
|
||||
}
|
||||
|
||||
protected virtual void OnFinished()
|
||||
{
|
||||
if (Finished != null)
|
||||
Finished(this, progressChangedArgs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will be raised when the operation has started
|
||||
/// </summary>
|
||||
public event EventHandler<ProgressEventArgs> Started;
|
||||
/// <summary>
|
||||
/// Will be raised when the progress has changed
|
||||
/// </summary>
|
||||
public event EventHandler<ProgressEventArgs> ProgressChanged;
|
||||
/// <summary>
|
||||
/// Will be raised when the operation has finished
|
||||
/// </summary>
|
||||
public event EventHandler<ProgressEventArgs> Finished;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
BIN
MSGer.tk/Resources/tmp/colorpicker.jpg
Normal file
BIN
MSGer.tk/Resources/tmp/colorpicker.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
MSGer.tk/Resources/tmp/erase.png
Normal file
BIN
MSGer.tk/Resources/tmp/erase.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -11,7 +11,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class SelectPartnerForm : Form
|
||||
public partial class SelectPartnerForm : ThemedForms
|
||||
{
|
||||
public SelectPartnerForm(ToolStripMenuItem SelectPartnerSender) //paraméter: 2014.09.06.
|
||||
{
|
||||
|
|
180
MSGer.tk/SettingsForm.Designer.cs
generated
180
MSGer.tk/SettingsForm.Designer.cs
generated
|
@ -28,11 +28,23 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
GlacialComponents.Controls.GLColumn glColumn2 = new GlacialComponents.Controls.GLColumn();
|
||||
GlacialComponents.Controls.GLColumn glColumn1 = new GlacialComponents.Controls.GLColumn();
|
||||
GlacialComponents.Controls.GLItem glItem1 = new GlacialComponents.Controls.GLItem();
|
||||
GlacialComponents.Controls.GLSubItem glSubItem1 = new GlacialComponents.Controls.GLSubItem();
|
||||
GlacialComponents.Controls.GLItem glItem2 = new GlacialComponents.Controls.GLItem();
|
||||
GlacialComponents.Controls.GLSubItem glSubItem2 = new GlacialComponents.Controls.GLSubItem();
|
||||
GlacialComponents.Controls.GLItem glItem3 = new GlacialComponents.Controls.GLItem();
|
||||
GlacialComponents.Controls.GLSubItem glSubItem3 = new GlacialComponents.Controls.GLSubItem();
|
||||
this.glacialList1 = new GlacialComponents.Controls.GlacialList();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.isserver = new System.Windows.Forms.CheckBox();
|
||||
this.technical = new System.Windows.Forms.Label();
|
||||
this.chatwindowTabs = new System.Windows.Forms.CheckBox();
|
||||
this.chatwindow = new System.Windows.Forms.CheckBox();
|
||||
this.layout = new System.Windows.Forms.Label();
|
||||
this.listView1 = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.messageText = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.nameText = new System.Windows.Forms.TextBox();
|
||||
|
@ -40,9 +52,6 @@
|
|||
this.personal = new System.Windows.Forms.Label();
|
||||
this.okbtn = new System.Windows.Forms.Button();
|
||||
this.cancelbtn = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.listView1 = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -57,16 +66,16 @@
|
|||
this.glacialList1.AutoHeight = true;
|
||||
this.glacialList1.BackColor = System.Drawing.Color.White;
|
||||
this.glacialList1.BackgroundStretchToFit = true;
|
||||
glColumn2.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
|
||||
glColumn2.CheckBoxes = false;
|
||||
glColumn2.ImageIndex = -1;
|
||||
glColumn2.Name = "Column1";
|
||||
glColumn2.NumericSort = false;
|
||||
glColumn2.Text = "Column";
|
||||
glColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
glColumn2.Width = 115;
|
||||
glColumn1.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None;
|
||||
glColumn1.CheckBoxes = false;
|
||||
glColumn1.ImageIndex = -1;
|
||||
glColumn1.Name = "Column1";
|
||||
glColumn1.NumericSort = false;
|
||||
glColumn1.Text = "Column";
|
||||
glColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
glColumn1.Width = 115;
|
||||
this.glacialList1.Columns.AddRange(new GlacialComponents.Controls.GLColumn[] {
|
||||
glColumn2});
|
||||
glColumn1});
|
||||
this.glacialList1.ControlStyle = GlacialComponents.Controls.GLControlStyles.Normal;
|
||||
this.glacialList1.ForeColor = System.Drawing.Color.Black;
|
||||
this.glacialList1.FullRowSelect = true;
|
||||
|
@ -84,6 +93,20 @@
|
|||
this.glacialList1.HoverTime = 1;
|
||||
this.glacialList1.ImageList = null;
|
||||
this.glacialList1.ItemHeight = 17;
|
||||
glItem1.BackColor = System.Drawing.Color.White;
|
||||
glItem1.ForeColor = System.Drawing.Color.Black;
|
||||
glItem1.RowBorderColor = System.Drawing.Color.Black;
|
||||
glItem1.RowBorderSize = 0;
|
||||
glSubItem1.BackColor = System.Drawing.Color.Empty;
|
||||
glSubItem1.Checked = false;
|
||||
glSubItem1.ForceText = false;
|
||||
glSubItem1.ForeColor = System.Drawing.Color.Black;
|
||||
glSubItem1.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
|
||||
glSubItem1.ImageIndex = -1;
|
||||
glSubItem1.Text = "Személyes";
|
||||
glItem1.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
|
||||
glSubItem1});
|
||||
glItem1.Text = "Személyes";
|
||||
glItem2.BackColor = System.Drawing.Color.White;
|
||||
glItem2.ForeColor = System.Drawing.Color.Black;
|
||||
glItem2.RowBorderColor = System.Drawing.Color.Black;
|
||||
|
@ -94,12 +117,28 @@
|
|||
glSubItem2.ForeColor = System.Drawing.Color.Black;
|
||||
glSubItem2.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
|
||||
glSubItem2.ImageIndex = -1;
|
||||
glSubItem2.Text = "Személyes";
|
||||
glSubItem2.Text = "Kinézet";
|
||||
glItem2.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
|
||||
glSubItem2});
|
||||
glItem2.Text = "Személyes";
|
||||
glItem2.Text = "Kinézet";
|
||||
glItem3.BackColor = System.Drawing.Color.White;
|
||||
glItem3.ForeColor = System.Drawing.Color.Black;
|
||||
glItem3.RowBorderColor = System.Drawing.Color.Black;
|
||||
glItem3.RowBorderSize = 0;
|
||||
glSubItem3.BackColor = System.Drawing.Color.Empty;
|
||||
glSubItem3.Checked = false;
|
||||
glSubItem3.ForceText = false;
|
||||
glSubItem3.ForeColor = System.Drawing.Color.Black;
|
||||
glSubItem3.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left;
|
||||
glSubItem3.ImageIndex = -1;
|
||||
glSubItem3.Text = "Technikai";
|
||||
glItem3.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] {
|
||||
glSubItem3});
|
||||
glItem3.Text = "Technikai";
|
||||
this.glacialList1.Items.AddRange(new GlacialComponents.Controls.GLItem[] {
|
||||
glItem2});
|
||||
glItem1,
|
||||
glItem2,
|
||||
glItem3});
|
||||
this.glacialList1.ItemWordWrap = false;
|
||||
this.glacialList1.Location = new System.Drawing.Point(12, 12);
|
||||
this.glacialList1.Name = "glacialList1";
|
||||
|
@ -122,6 +161,11 @@
|
|||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panel1.AutoScroll = true;
|
||||
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel1.Controls.Add(this.isserver);
|
||||
this.panel1.Controls.Add(this.technical);
|
||||
this.panel1.Controls.Add(this.chatwindowTabs);
|
||||
this.panel1.Controls.Add(this.chatwindow);
|
||||
this.panel1.Controls.Add(this.layout);
|
||||
this.panel1.Controls.Add(this.listView1);
|
||||
this.panel1.Controls.Add(this.label3);
|
||||
this.panel1.Controls.Add(this.messageText);
|
||||
|
@ -134,13 +178,85 @@
|
|||
this.panel1.Size = new System.Drawing.Size(385, 391);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// isserver
|
||||
//
|
||||
this.isserver.AutoSize = true;
|
||||
this.isserver.Location = new System.Drawing.Point(12, 405);
|
||||
this.isserver.Name = "isserver";
|
||||
this.isserver.Size = new System.Drawing.Size(217, 17);
|
||||
this.isserver.TabIndex = 11;
|
||||
this.isserver.Text = "Szerver mód (port forwarding szükséges)";
|
||||
this.isserver.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// technical
|
||||
//
|
||||
this.technical.AutoSize = true;
|
||||
this.technical.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.technical.Location = new System.Drawing.Point(6, 371);
|
||||
this.technical.Name = "technical";
|
||||
this.technical.Size = new System.Drawing.Size(131, 31);
|
||||
this.technical.TabIndex = 10;
|
||||
this.technical.Text = "Technikai";
|
||||
//
|
||||
// chatwindowTabs
|
||||
//
|
||||
this.chatwindowTabs.AutoSize = true;
|
||||
this.chatwindowTabs.Enabled = false;
|
||||
this.chatwindowTabs.Location = new System.Drawing.Point(50, 329);
|
||||
this.chatwindowTabs.Name = "chatwindowTabs";
|
||||
this.chatwindowTabs.Size = new System.Drawing.Size(194, 17);
|
||||
this.chatwindowTabs.TabIndex = 9;
|
||||
this.chatwindowTabs.Text = "A beszélgetések fülekbe rendezése";
|
||||
this.chatwindowTabs.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chatwindow
|
||||
//
|
||||
this.chatwindow.AutoSize = true;
|
||||
this.chatwindow.Location = new System.Drawing.Point(12, 305);
|
||||
this.chatwindow.Name = "chatwindow";
|
||||
this.chatwindow.Size = new System.Drawing.Size(272, 17);
|
||||
this.chatwindow.TabIndex = 8;
|
||||
this.chatwindow.Text = "A beszélgetések jelenjenek meg külön ablak(ok)ban";
|
||||
this.chatwindow.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// layout
|
||||
//
|
||||
this.layout.AutoSize = true;
|
||||
this.layout.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.layout.Location = new System.Drawing.Point(6, 270);
|
||||
this.layout.Name = "layout";
|
||||
this.layout.Size = new System.Drawing.Size(105, 31);
|
||||
this.layout.TabIndex = 7;
|
||||
this.layout.Text = "Kinézet";
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1});
|
||||
this.listView1.LabelWrap = false;
|
||||
this.listView1.Location = new System.Drawing.Point(12, 148);
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(121, 97);
|
||||
this.listView1.TabIndex = 6;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(9, 131);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(34, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Nyelv";
|
||||
//
|
||||
// messageText
|
||||
//
|
||||
this.messageText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.messageText.Location = new System.Drawing.Point(12, 99);
|
||||
this.messageText.Name = "messageText";
|
||||
this.messageText.Size = new System.Drawing.Size(354, 20);
|
||||
this.messageText.Size = new System.Drawing.Size(337, 20);
|
||||
this.messageText.TabIndex = 4;
|
||||
//
|
||||
// label2
|
||||
|
@ -158,7 +274,7 @@
|
|||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nameText.Location = new System.Drawing.Point(12, 52);
|
||||
this.nameText.Name = "nameText";
|
||||
this.nameText.Size = new System.Drawing.Size(354, 20);
|
||||
this.nameText.Size = new System.Drawing.Size(337, 20);
|
||||
this.nameText.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
|
@ -194,6 +310,7 @@
|
|||
//
|
||||
// cancelbtn
|
||||
//
|
||||
this.cancelbtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelbtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelbtn.Location = new System.Drawing.Point(449, 410);
|
||||
this.cancelbtn.Name = "cancelbtn";
|
||||
|
@ -203,27 +320,6 @@
|
|||
this.cancelbtn.UseVisualStyleBackColor = true;
|
||||
this.cancelbtn.Click += new System.EventHandler(this.cancelbtn_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(9, 131);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(34, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Nyelv";
|
||||
//
|
||||
// listView1
|
||||
//
|
||||
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1});
|
||||
this.listView1.LabelWrap = false;
|
||||
this.listView1.Location = new System.Drawing.Point(12, 148);
|
||||
this.listView1.MultiSelect = false;
|
||||
this.listView1.Name = "listView1";
|
||||
this.listView1.Size = new System.Drawing.Size(121, 97);
|
||||
this.listView1.TabIndex = 6;
|
||||
this.listView1.UseCompatibleStateImageBehavior = false;
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -235,6 +331,7 @@
|
|||
this.Controls.Add(this.glacialList1);
|
||||
this.Name = "SettingsForm";
|
||||
this.Text = "SettingsForm";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SettingsForm_FormClosed);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
@ -255,5 +352,10 @@
|
|||
private System.Windows.Forms.ListView listView1;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.Label layout;
|
||||
private System.Windows.Forms.CheckBox chatwindowTabs;
|
||||
private System.Windows.Forms.CheckBox chatwindow;
|
||||
private System.Windows.Forms.Label technical;
|
||||
private System.Windows.Forms.CheckBox isserver;
|
||||
}
|
||||
}
|
|
@ -10,25 +10,38 @@ using System.Windows.Forms;
|
|||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class SettingsForm : Form
|
||||
public partial class SettingsForm : ThemedForms
|
||||
{
|
||||
public static bool ApplyingSettings = false;
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
listView1.Columns[0].Width = listView1.Width;
|
||||
this.Text = Language.Translate("settings");
|
||||
//Language.Translate(this, "settings");
|
||||
|
||||
glacialList1.Items[0].Text = Language.Translate("settings_personal");
|
||||
personal.Text = Language.Translate("settings_personal");
|
||||
glacialList1.Items[1].Text = Language.Translate("settings_layout");
|
||||
|
||||
layout.Text = Language.Translate("settings_layout"); //2014.10.28.
|
||||
label1.Text = Language.Translate("name");
|
||||
label2.Text = Language.Translate("message");
|
||||
label3.Text = Language.Translate("language");
|
||||
chatwindow.Text = Language.Translate("settings_chatwindow"); //2014.10.28.
|
||||
chatwindowTabs.Text = Language.Translate("settings_chatwindowTabs"); //2014.10.28.
|
||||
//isserver.Text = Language.Translate("settings_isserver"); //2014.11.15.
|
||||
|
||||
nameText.Text = CurrentUser.Name;
|
||||
messageText.Text = CurrentUser.Message;
|
||||
chatwindow.Checked = (Storage.Settings["chatwindow"] == "1"); //2014.10.28.
|
||||
//isserver.Checked = (Storage.Settings["isserver"] == "1"); //2014.11.15.
|
||||
isserver.Enabled = false; //2015.01.12.
|
||||
|
||||
foreach(var entry in Language.UsedLangs)
|
||||
foreach (var entry in Language.UsedLangs)
|
||||
{
|
||||
listView1.Items.Add(Language.UsedLangs[entry.Key].Strings["currentlang"], Language.UsedLangs[entry.Key].Strings["currentlang"], 0);
|
||||
if (Language.UsedLangs[entry.Key].Equals(Language.GetCuurentLanguage()))
|
||||
if (Language.UsedLangs[entry.Key].Equals(Language.GetCurrentLanguage()))
|
||||
listView1.Items[listView1.Items.Count - 1].Selected = true;
|
||||
}
|
||||
}
|
||||
|
@ -44,28 +57,52 @@ namespace MSGer.tk
|
|||
//Személyes
|
||||
panel1.ScrollControlIntoView(personal);
|
||||
break;
|
||||
case 1:
|
||||
//Kinézet
|
||||
panel1.ScrollControlIntoView(layout);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void okbtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
string lang = "en";
|
||||
foreach (var lng in Language.UsedLangs)
|
||||
{
|
||||
if (lng.Value.Strings.ContainsKey("currentlang") && listView1.SelectedItems[0].Text == lng.Value.Strings["currentlang"])
|
||||
{
|
||||
lang = lng.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ApplyingSettings = true;
|
||||
CurrentUser.Name = nameText.Text;
|
||||
CurrentUser.Message = messageText.Text;
|
||||
if (Storage.Settings["lang"] != lang)
|
||||
bool reopen = false;
|
||||
if (chatwindow.Checked && Storage.Settings["chatwindow"] == "0")
|
||||
{
|
||||
Storage.Settings["lang"] = lang;
|
||||
MessageBox.Show(Language.Translate("restart_needed"));
|
||||
Program.Restart(true);
|
||||
reopen = true;
|
||||
Storage.Settings["chatwindow"] = "1";
|
||||
}
|
||||
else if (!chatwindow.Checked && Storage.Settings["chatwindow"] == "1")
|
||||
{
|
||||
reopen = true;
|
||||
Storage.Settings["chatwindow"] = "0";
|
||||
}
|
||||
//Storage.Settings["isserver"] = isserver.Checked ? "1" : "0"; //2014.11.15.
|
||||
string lang = "en";
|
||||
if(listView1.SelectedItems.Count!=0) //2014.10.28. - Eddig valószínűleg hiba történt a SelectedItems[0]-nál
|
||||
{
|
||||
foreach (var lng in Language.UsedLangs)
|
||||
{
|
||||
if (lng.Value.Strings.ContainsKey("currentlang") && listView1.SelectedItems[0].Text == lng.Value.Strings["currentlang"])
|
||||
{
|
||||
lang = lng.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Storage.Settings["lang"] != lang)
|
||||
{
|
||||
Storage.Settings["lang"] = lang;
|
||||
//MessageBox.Show(Language.Translate("restart_needed"));
|
||||
//Program.Restart(true);
|
||||
Language.ReloadLangs();
|
||||
}
|
||||
}
|
||||
if (reopen)
|
||||
ChatPanel.ReopenChatWindows(true);
|
||||
ApplyingSettings = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
@ -73,5 +110,10 @@ namespace MSGer.tk
|
|||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Program.SettingsF = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
222
MSGer.tk/Storage.cs
Normal file
222
MSGer.tk/Storage.cs
Normal file
|
@ -0,0 +1,222 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
static class Storage
|
||||
{ //2014.08.07.
|
||||
public static string FileName;
|
||||
public static Dictionary<string, string> Settings = new Dictionary<string, string>();
|
||||
public static Dictionary<string, string> LoggedInSettings = new Dictionary<string, string>();
|
||||
public static readonly string PasswordHash = "PWPassword";
|
||||
public static string SaltKey; //Bejelentkezéskor kapja meg
|
||||
public static readonly string VIKey = "SGf546HEfg56h45K";
|
||||
public static void Load(bool loggedin)
|
||||
{
|
||||
if (!loggedin)
|
||||
{
|
||||
SaltKey = "nologinnologinnologinnologin";
|
||||
FileName = "program.db";
|
||||
}
|
||||
if (!File.Exists(FileName))
|
||||
{
|
||||
if (!loggedin)
|
||||
{
|
||||
Settings.Add("email", "");
|
||||
Settings.Add("windowstate", "3");
|
||||
Settings.Add("lang", CultureInfo.InstalledUICulture.TwoLetterISOLanguageName);
|
||||
Settings.Add("port", "4510"); //Use this to connect to different users <-- És fogalmam sincs, miért angolul írtam...
|
||||
Settings.Add("lastusedemail", "0");
|
||||
Settings.Add("filelen", "-1"); //(long) Maximum fájlméret, ameddig bemásolhatja a memóriába
|
||||
//Settings.Add("isserver", "");
|
||||
Settings.Add("chatwindow", "0");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Parse(Decrypt(Read(loggedin)), loggedin);
|
||||
if (loggedin)
|
||||
UserInfo.Load();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Save(bool loggedin)
|
||||
{
|
||||
if (!loggedin)
|
||||
SaltKey = "nologinnologinnologinnologin";
|
||||
Write(Encrypt(GetString(loggedin)), loggedin);
|
||||
}
|
||||
|
||||
public static string GetString(bool loggedin)
|
||||
{
|
||||
string s = "";
|
||||
if (loggedin)
|
||||
{
|
||||
foreach (var entry in LoggedInSettings)
|
||||
{
|
||||
s += entry.Key;
|
||||
s += "=";
|
||||
s += entry.Value;
|
||||
s += "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var entry in Settings)
|
||||
{
|
||||
s += entry.Key;
|
||||
s += "=";
|
||||
s += entry.Value;
|
||||
s += "\n";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
private static void Parse(string filecontent, bool loggedin)
|
||||
{
|
||||
string[] splitCache = filecontent.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var tmp = splitCache.ToDictionary(
|
||||
entry => entry.Substring(0, entry.IndexOf("=")),
|
||||
entry => entry.Substring(entry.IndexOf("=") + 1));
|
||||
if (loggedin)
|
||||
LoggedInSettings = tmp;
|
||||
else
|
||||
Settings = tmp;
|
||||
}
|
||||
|
||||
public static void Parse(string filecontent) //Publikus metódus
|
||||
{
|
||||
string[] splitCache = filecontent.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var tmp = splitCache.ToDictionary(
|
||||
entry => "userinfo_" + entry.Substring(0, entry.IndexOf("=")),
|
||||
entry => entry.Substring(entry.IndexOf("=") + 1));
|
||||
LoggedInSettings = LoggedInSettings.Concat(tmp)
|
||||
.ToLookup(pair => pair.Key, pair => pair.Value)
|
||||
.ToDictionary(group => group.Key, group => group.Last());
|
||||
}
|
||||
|
||||
public static byte[] Encrypt(byte[] content, string code)
|
||||
{
|
||||
//byte[] plainTextBytes = content;
|
||||
|
||||
byte[] keyBytes = new Rfc2898DeriveBytes(PasswordHash, Encoding.ASCII.GetBytes(code)).GetBytes(256 / 8);
|
||||
var symmetricKey = new RijndaelManaged() { Mode = CipherMode.CBC, Padding = PaddingMode.None };
|
||||
var encryptor = symmetricKey.CreateEncryptor(keyBytes, Encoding.ASCII.GetBytes(VIKey));
|
||||
|
||||
byte[] plainTextBytes;
|
||||
//if (content.Length + 4 > keyBytes.Length)
|
||||
/*plainTextBytes = new byte[content.Length + 4];
|
||||
else
|
||||
plainTextBytes = new byte[content.Length + 4];*/
|
||||
int targetsize = content.Length + 16 - content.Length % 16; //Hozzáadja a hosszához a hossz 16-tal való osztásának maradékát - Tehát 16-tal osztható lesz
|
||||
plainTextBytes = new byte[targetsize];
|
||||
/*Array.Copy(BitConverter.GetBytes(content.Length), plainTextBytes, 4);
|
||||
Array.Copy(content, 0, plainTextBytes, 4, content.Length);*/
|
||||
Array.Copy(content, plainTextBytes, content.Length);
|
||||
|
||||
byte[] cipherTextBytes;
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
|
||||
{
|
||||
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
cipherTextBytes = memoryStream.ToArray();
|
||||
cryptoStream.Close();
|
||||
}
|
||||
memoryStream.Close();
|
||||
}
|
||||
byte[] final = new byte[cipherTextBytes.Length + 4];
|
||||
Array.Copy(BitConverter.GetBytes(cipherTextBytes.Length), final, 4);
|
||||
Array.Copy(cipherTextBytes, 0, final, 4, cipherTextBytes.Length);
|
||||
return final;
|
||||
}
|
||||
private static byte[] Encrypt(byte[] filecontent)
|
||||
{ //2014.09.01.
|
||||
return Encrypt(filecontent, SaltKey);
|
||||
}
|
||||
private static byte[] Encrypt(string filecontent)
|
||||
{
|
||||
return Encrypt(Encoding.UTF8.GetBytes(filecontent));
|
||||
}
|
||||
|
||||
public static byte[] Decrypt(byte[] b, bool tr, string code)
|
||||
{
|
||||
//byte[] cipherTextBytes = b;
|
||||
int len = BitConverter.ToInt32(b, 0);
|
||||
byte[] cipherTextBytes = new byte[len];
|
||||
Array.Copy(b, 4, cipherTextBytes, 0, b.Length - 4); //Itt még az eredeti, feltöltött hosszal számol
|
||||
byte[] keyBytes = new Rfc2898DeriveBytes(PasswordHash, Encoding.ASCII.GetBytes(code)).GetBytes(256 / 8);
|
||||
var symmetricKey = new RijndaelManaged() { Mode = CipherMode.CBC, Padding = PaddingMode.None };
|
||||
|
||||
var decryptor = symmetricKey.CreateDecryptor(keyBytes, Encoding.ASCII.GetBytes(VIKey));
|
||||
var memoryStream = new MemoryStream(cipherTextBytes);
|
||||
var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read);
|
||||
byte[] plainTextBytes = new byte[cipherTextBytes.Length];
|
||||
//List<byte> plainTextBytes = new List<byte>(); //2014.12.18.
|
||||
|
||||
int decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
|
||||
/*int r=0; //2014.12.18.
|
||||
while ((r = cryptoStream.ReadByte()) != -1)
|
||||
{ //2014.12.18.
|
||||
plainTextBytes.Add((byte)r);
|
||||
}*/
|
||||
memoryStream.Close();
|
||||
cryptoStream.Close();
|
||||
byte[] ret = new byte[len];
|
||||
Array.Copy(plainTextBytes, ret, len);
|
||||
return ret;
|
||||
}
|
||||
private static byte[] Decrypt(byte[] b, bool tr)
|
||||
{ //2014.09.01.
|
||||
return Decrypt(b, tr, SaltKey);
|
||||
}
|
||||
private static string Decrypt(byte[] b)
|
||||
{
|
||||
byte[] tmp = Decrypt(b, true, SaltKey);
|
||||
return Encoding.UTF8.GetString(tmp, 0, tmp.Length).TrimEnd("\0".ToCharArray());
|
||||
}
|
||||
|
||||
private static byte[] Read(bool loggedin)
|
||||
{
|
||||
FileStream fs;
|
||||
if (loggedin)
|
||||
fs = new FileStream(FileName, FileMode.Open);
|
||||
else
|
||||
fs = new FileStream("program.db", FileMode.Open);
|
||||
byte[] b = new byte[4];
|
||||
fs.Read(b, 0, b.Length);
|
||||
var file_len = BitConverter.ToInt32(b, 0);
|
||||
b = new byte[file_len];
|
||||
fs.Read(b, 0, b.Length);
|
||||
fs.Close();
|
||||
return b;
|
||||
}
|
||||
|
||||
private static void Write(byte[] b, bool loggedin)
|
||||
{
|
||||
var len = BitConverter.GetBytes(b.Length);
|
||||
FileStream fs;
|
||||
if (loggedin)
|
||||
fs = new FileStream(FileName, FileMode.Create);
|
||||
else
|
||||
fs = new FileStream("program.db", FileMode.Create);
|
||||
fs.Write(len, 0, len.Length);
|
||||
fs.Write(b, 0, b.Length);
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
public static void Dispose()
|
||||
{
|
||||
LoggedInSettings = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
}
|
213
MSGer.tk/StreamHelper.cs
Normal file
213
MSGer.tk/StreamHelper.cs
Normal file
|
@ -0,0 +1,213 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HdSystemLibrary.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// A delegate for reporting binary progress
|
||||
/// </summary>
|
||||
/// <param name="bytesRead">The amount of bytes already read</param>
|
||||
/// <param name="totalBytesToRead">The amount of total bytes to read. Can be -1 if unknown.</param>
|
||||
public delegate void ProgressChange(long bytesRead, long totalBytesToRead);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The arguments for StreamHelper.CopyFrom(Stream, Stream, CopyFromArguments)
|
||||
/// </summary>
|
||||
public sealed class CopyFromArguments
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the default arguments
|
||||
/// </summary>
|
||||
public CopyFromArguments()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates arguments with a progress change callback.
|
||||
/// </summary>
|
||||
/// <param name="progressChangeCallback">The progress change callback (see <see cref="ProgressChangeCallback"/>)</param>
|
||||
public CopyFromArguments(ProgressChange progressChangeCallback)
|
||||
{
|
||||
ProgressChangeCallback = progressChangeCallback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates arguments with a progress change callback and an interval between to progress changes.
|
||||
/// </summary>
|
||||
/// <param name="progressChangeCallback">The progress change callback (see <see cref="ProgressChangeCallback"/>)</param>
|
||||
/// <param name="progressChangeCallbackInterval">The interval between to progress change callbacks (see <see cref="ProgressChangeCallbackInterval"/>)</param>
|
||||
public CopyFromArguments(ProgressChange progressChangeCallback,
|
||||
TimeSpan progressChangeCallbackInterval)
|
||||
{
|
||||
ProgressChangeCallback = progressChangeCallback;
|
||||
ProgressChangeCallbackInterval = progressChangeCallbackInterval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates arguments with a progress change callback, an interval between to progress changes and a total length
|
||||
/// </summary>
|
||||
/// <param name="progressChangeCallback">The progress change callback (see <see cref="ProgressChangeCallback"/>)</param>
|
||||
/// <param name="progressChangeCallbackInterval">The interval between to progress change callbacks (see <see cref="ProgressChangeCallbackInterval"/>)</param>
|
||||
/// <param name="totalLength">The total bytes to read (see <see cref="TotalLength"/>)</param>
|
||||
public CopyFromArguments(ProgressChange progressChangeCallback,
|
||||
TimeSpan progressChangeCallbackInterval, long totalLength)
|
||||
{
|
||||
ProgressChangeCallback = progressChangeCallback;
|
||||
ProgressChangeCallbackInterval = progressChangeCallbackInterval;
|
||||
TotalLength = totalLength;
|
||||
}
|
||||
|
||||
private long totalLength = -1;
|
||||
/// <summary>
|
||||
/// Gets or sets the total length of stream. Set to -1 if the value has to be determined by stream.Length.
|
||||
/// If the stream is not seekable, the total length in the progress report will be stay -1.
|
||||
/// </summary>
|
||||
public long TotalLength { get { return totalLength; } set { totalLength = value; } }
|
||||
|
||||
private int bufferSize = 4096;
|
||||
/// <summary>
|
||||
/// Gets or sets the size of the buffer used for copying bytes. Default is 4096.
|
||||
/// </summary>
|
||||
public int BufferSize { get { return bufferSize; } set { bufferSize = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the callback for progress-report. Default is null.
|
||||
/// </summary>
|
||||
public ProgressChange ProgressChangeCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the event for aborting the operation. Default is null.
|
||||
/// </summary>
|
||||
public WaitHandle StopEvent { get; set; }
|
||||
|
||||
private TimeSpan progressCallbackInterval = TimeSpan.FromSeconds(0.2);
|
||||
/// <summary>
|
||||
/// Gets or sets the time interval between to progress change callbacks. Default is 200 ms.
|
||||
/// </summary>
|
||||
public TimeSpan ProgressChangeCallbackInterval
|
||||
{
|
||||
get { return progressCallbackInterval; }
|
||||
set { progressCallbackInterval = value; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A static class for basic stream operations.
|
||||
/// </summary>
|
||||
public static class StreamHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Copies the source stream into the current while reporting the progress.
|
||||
/// The copying process is done in a separate thread, therefore the stream has to
|
||||
/// support reading from a different thread as the one used for construction.
|
||||
/// Nethertheless, the separate thread is synchronized with the calling thread.
|
||||
/// The callback in arguments is called from the calling thread.
|
||||
/// </summary>
|
||||
/// <param name="target">The current stream</param>
|
||||
/// <param name="source">The source stream</param>
|
||||
/// <param name="arguments">The arguments for copying</param>
|
||||
/// <returns>The number of bytes actually copied.</returns>
|
||||
/// <exception cref="ArgumentNullException">Thrown if either target, source of arguments is null</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Thrown if arguments.BufferSize is less than 128 or arguments.ProgressChangeCallbackInterval is less than 0</exception>
|
||||
public static long CopyFrom(this Stream target, Stream source, CopyFromArguments arguments)
|
||||
{
|
||||
if (target == null)
|
||||
throw new ArgumentNullException("target");
|
||||
if (source == null)
|
||||
throw new ArgumentNullException("source");
|
||||
if (arguments == null)
|
||||
throw new ArgumentNullException("arguments");
|
||||
if (arguments.BufferSize < 128)
|
||||
throw new ArgumentOutOfRangeException("arguments.BufferSize",
|
||||
arguments.BufferSize, "BufferSize has to be greater or equal than 128.");
|
||||
if (arguments.ProgressChangeCallbackInterval.TotalSeconds < 0)
|
||||
throw new ArgumentOutOfRangeException("arguments.ProgressChangeCallbackInterval",
|
||||
arguments.ProgressChangeCallbackInterval,
|
||||
"ProgressChangeCallbackInterval has to be greater or equal than 0.");
|
||||
|
||||
long length = 0;
|
||||
|
||||
bool runningFlag = true;
|
||||
|
||||
Action<Stream, Stream, int> copyMemory = (Stream _target, Stream _source, int bufferSize) =>
|
||||
//Raw copy-operation, "length" and "runningFlag" are enclosed as closure
|
||||
{
|
||||
int count;
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
|
||||
while ((count = _source.Read(buffer, 0, bufferSize)) != 0 && runningFlag)
|
||||
{
|
||||
_target.Write(buffer, 0, count);
|
||||
long newLength = length + count;
|
||||
//"length" can be read as this is the only thread which writes to "length"
|
||||
Interlocked.Exchange(ref length, newLength);
|
||||
}
|
||||
};
|
||||
|
||||
IAsyncResult asyncResult = copyMemory.BeginInvoke(target, source, arguments.BufferSize, null, null);
|
||||
|
||||
long totalLength = arguments.TotalLength;
|
||||
if (totalLength == -1 && source.CanSeek)
|
||||
totalLength = (long)source.Length;
|
||||
|
||||
DateTime lastCallback = DateTime.Now;
|
||||
long lastLength = 0;
|
||||
|
||||
while (!asyncResult.IsCompleted)
|
||||
{
|
||||
if (arguments.StopEvent != null && arguments.StopEvent.WaitOne(0))
|
||||
runningFlag = false; //to indicate that the copy-operation has to abort
|
||||
|
||||
Thread.Sleep((int)(arguments.ProgressChangeCallbackInterval.TotalMilliseconds / 10));
|
||||
|
||||
if (arguments.ProgressChangeCallback != null
|
||||
&& DateTime.Now - lastCallback > arguments.ProgressChangeCallbackInterval)
|
||||
{
|
||||
long currentLength = Interlocked.Read(ref length); //Since length is 64 bit, reading is not an atomic operation.
|
||||
|
||||
if (currentLength != lastLength)
|
||||
{
|
||||
lastLength = currentLength;
|
||||
lastCallback = DateTime.Now;
|
||||
arguments.ProgressChangeCallback(currentLength, totalLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments.ProgressChangeCallback != null && lastLength != length)
|
||||
//to ensure that the callback is called once with maximum progress
|
||||
arguments.ProgressChangeCallback(length, totalLength);
|
||||
|
||||
copyMemory.EndInvoke(asyncResult);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies the source stream into the current
|
||||
/// </summary>
|
||||
/// <param name="stream">The current stream</param>
|
||||
/// <param name="source">The source stream</param>
|
||||
/// <param name="bufferSize">The size of buffer used for copying bytes</param>
|
||||
/// <returns>The number of bytes actually copied.</returns>
|
||||
public static long CopyFrom(this Stream stream, Stream source, int bufferSize = 4096)
|
||||
{
|
||||
int count = 0;
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
long length = 0;
|
||||
|
||||
while ((count = source.Read(buffer, 0, bufferSize)) != 0)
|
||||
{
|
||||
length += count;
|
||||
stream.Write(buffer, 0, count);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
76
MSGer.tk/TextFormat.cs
Normal file
76
MSGer.tk/TextFormat.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
using Khendys.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
class TextFormat
|
||||
{
|
||||
public TextFormat()
|
||||
{
|
||||
var img = Image.FromFile("emoticons\\iconbase.png");
|
||||
var bitmap = new Bitmap(img);
|
||||
int x = 0;
|
||||
Bitmap bitmap1 = bitmap.Clone(new Rectangle(x, 0, 19, 19), bitmap.PixelFormat);
|
||||
x += 19;
|
||||
new TextFormat(":)", bitmap1);
|
||||
new TextFormat(":-)", bitmap1);
|
||||
bitmap1 = bitmap.Clone(new Rectangle(x, 0, 19, 19), bitmap.PixelFormat);
|
||||
x += 19;
|
||||
new TextFormat(":D", bitmap1);
|
||||
new TextFormat(":-D", bitmap1);
|
||||
new TextFormat(":d", bitmap1);
|
||||
new TextFormat(":-d", bitmap1);
|
||||
bitmap1 = bitmap.Clone(new Rectangle(x, 0, 19, 19), bitmap.PixelFormat);
|
||||
x += 19;
|
||||
new TextFormat(";)", bitmap1);
|
||||
new TextFormat(";-)", bitmap1);
|
||||
bitmap1 = bitmap.Clone(new Rectangle(x, 0, 19, 19), bitmap.PixelFormat);
|
||||
x += 19;
|
||||
new TextFormat(":O", bitmap1);
|
||||
new TextFormat(":o", bitmap1);
|
||||
new TextFormat(":-O", bitmap1);
|
||||
new TextFormat(":-o", bitmap1);
|
||||
bitmap1 = bitmap.Clone(new Rectangle(x, 0, 19, 19), bitmap.PixelFormat);
|
||||
x += 19;
|
||||
new TextFormat(":P", bitmap1);
|
||||
new TextFormat(":-P", bitmap1);
|
||||
new TextFormat(":p", bitmap1);
|
||||
new TextFormat(":-p", bitmap1);
|
||||
|
||||
bitmap.Dispose();
|
||||
}
|
||||
private TextFormat(string text, Image image)
|
||||
{
|
||||
var tmp = new ImgReplaceStrs();
|
||||
tmp.Text = text;
|
||||
tmp.Image = image;
|
||||
ImgReplaceStrings.Add(tmp);
|
||||
}
|
||||
public static List<ImgReplaceStrs> ImgReplaceStrings = new List<ImgReplaceStrs>();
|
||||
public static ExRichTextBox Parse(ExRichTextBox textbox)
|
||||
{
|
||||
for (int i = 0; i < ImgReplaceStrings.Count; i++)
|
||||
{ //2014.10.12.
|
||||
int index=0;
|
||||
while((index=textbox.Text.IndexOf(ImgReplaceStrings[i].Text))!=-1)
|
||||
{
|
||||
textbox.Select(index, ImgReplaceStrings[i].Text.Length);
|
||||
textbox.InsertImage(ImgReplaceStrings[i].Image);
|
||||
}
|
||||
}
|
||||
return textbox;
|
||||
}
|
||||
}
|
||||
class ImgReplaceStrs
|
||||
{
|
||||
public string Text;
|
||||
public Image Image;
|
||||
}
|
||||
}
|
89
MSGer.tk/Theme.cs
Normal file
89
MSGer.tk/Theme.cs
Normal file
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public class Theme
|
||||
{
|
||||
public void Save(string themepath)
|
||||
{
|
||||
List<byte> bytes = new List<byte>();
|
||||
foreach (var item in Images)
|
||||
{
|
||||
bytes.AddRange(BitConverter.GetBytes((int)item.Key));
|
||||
var ms = new MemoryStream();
|
||||
item.Value.Save(ms, ImageFormat.Tiff);
|
||||
byte[] img = ms.ToArray();
|
||||
ms.Dispose();
|
||||
bytes.AddRange(BitConverter.GetBytes(img.Length));
|
||||
bytes.AddRange(img);
|
||||
}
|
||||
File.WriteAllBytes(themepath, bytes.ToArray());
|
||||
}
|
||||
|
||||
public enum ThemePart
|
||||
{
|
||||
MainBackgorund,
|
||||
MinimizeButton,
|
||||
MaximizeButton,
|
||||
CloseButton,
|
||||
Border
|
||||
}
|
||||
|
||||
public Theme(string themepath)
|
||||
{
|
||||
//FileStream fs = new FileStream(themepath, FileMode.Open);
|
||||
Images.Clear();
|
||||
byte[] bytes = File.ReadAllBytes(themepath);
|
||||
int i = 0;
|
||||
while (i < bytes.Length)
|
||||
{
|
||||
int part = BitConverter.ToInt32(bytes, i); //4 byte ThemePart
|
||||
i += sizeof(int);
|
||||
int len = BitConverter.ToInt32(bytes, i); //4 byte imglen
|
||||
i += sizeof(int);
|
||||
Image img = Image.FromStream(new MemoryStream(bytes, i, len)); //len byte image
|
||||
new Theme((ThemePart)part, img);
|
||||
}
|
||||
ReloadEvent(null, null);
|
||||
}
|
||||
private Theme(ThemePart themepart, Image image)
|
||||
{
|
||||
Images.Add(themepart, image);
|
||||
//Frissítse az összes helyen a képeket (lásd Language osztály) - Csak ne itt
|
||||
}
|
||||
public static event EventHandler ReloadEvent; //2014.12.24.
|
||||
|
||||
public static void SkinControl(ThemePart themepart, Control control)
|
||||
{
|
||||
if (control != null && !control.IsDisposed && Images.ContainsKey(themepart))
|
||||
{
|
||||
control.BackgroundImage = Images[themepart];
|
||||
if (themepart == ThemePart.MainBackgorund)
|
||||
{
|
||||
foreach(Control c in control.GetAll())
|
||||
{
|
||||
Bitmap bmp = new Bitmap(Images[themepart]).Clone(new Rectangle(c.Location.X, c.Location.Y, c.Width, c.Height), PixelFormat.Format32bppRgb);
|
||||
c.BackgroundImage = bmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
ReloadEvent += delegate
|
||||
{ //Ugyanazt az indexű képet fogja használni, csak a kép változik meg
|
||||
if (control != null && !control.IsDisposed && Images.ContainsKey(themepart))
|
||||
{
|
||||
control.BackgroundImage = Images[themepart];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static Dictionary<ThemePart, Image> Images = new Dictionary<ThemePart, Image>();
|
||||
}
|
||||
}
|
120
MSGer.tk/ThemedForms.Designer.cs
generated
Normal file
120
MSGer.tk/ThemedForms.Designer.cs
generated
Normal file
|
@ -0,0 +1,120 @@
|
|||
namespace MSGer.tk
|
||||
{
|
||||
partial class ThemedForms
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.containerPanel = new System.Windows.Forms.Panel();
|
||||
this.titleLabel = new System.Windows.Forms.Label();
|
||||
this.CloseButton = new System.Windows.Forms.PictureBox();
|
||||
this.MaximizeButton = new System.Windows.Forms.PictureBox();
|
||||
this.MinimizeButton = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CloseButton)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MaximizeButton)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MinimizeButton)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// containerPanel
|
||||
//
|
||||
this.containerPanel.Location = new System.Drawing.Point(12, 30);
|
||||
this.containerPanel.Name = "containerPanel";
|
||||
this.containerPanel.Size = new System.Drawing.Size(123, 51);
|
||||
this.containerPanel.TabIndex = 0;
|
||||
//
|
||||
// titleLabel
|
||||
//
|
||||
this.titleLabel.AutoSize = true;
|
||||
this.titleLabel.Location = new System.Drawing.Point(13, 11);
|
||||
this.titleLabel.Name = "titleLabel";
|
||||
this.titleLabel.Size = new System.Drawing.Size(27, 13);
|
||||
this.titleLabel.TabIndex = 1;
|
||||
this.titleLabel.Text = "Title";
|
||||
//
|
||||
// CloseButton
|
||||
//
|
||||
this.CloseButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.CloseButton.Location = new System.Drawing.Point(122, 1);
|
||||
this.CloseButton.Name = "CloseButton";
|
||||
this.CloseButton.Size = new System.Drawing.Size(24, 23);
|
||||
this.CloseButton.TabIndex = 2;
|
||||
this.CloseButton.TabStop = false;
|
||||
this.CloseButton.Click += new System.EventHandler(this.CloseButton_Click);
|
||||
//
|
||||
// MaximizeButton
|
||||
//
|
||||
this.MaximizeButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.MaximizeButton.Location = new System.Drawing.Point(92, 1);
|
||||
this.MaximizeButton.Name = "MaximizeButton";
|
||||
this.MaximizeButton.Size = new System.Drawing.Size(24, 23);
|
||||
this.MaximizeButton.TabIndex = 3;
|
||||
this.MaximizeButton.TabStop = false;
|
||||
this.MaximizeButton.Click += new System.EventHandler(this.MaximizeButton_Click);
|
||||
//
|
||||
// MinimizeButton
|
||||
//
|
||||
this.MinimizeButton.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.MinimizeButton.Location = new System.Drawing.Point(62, 1);
|
||||
this.MinimizeButton.Name = "MinimizeButton";
|
||||
this.MinimizeButton.Size = new System.Drawing.Size(24, 23);
|
||||
this.MinimizeButton.TabIndex = 4;
|
||||
this.MinimizeButton.TabStop = false;
|
||||
this.MinimizeButton.Click += new System.EventHandler(this.MinimizeButton_Click);
|
||||
//
|
||||
// ThemedForms
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(147, 93);
|
||||
this.Controls.Add(this.MinimizeButton);
|
||||
this.Controls.Add(this.MaximizeButton);
|
||||
this.Controls.Add(this.CloseButton);
|
||||
this.Controls.Add(this.titleLabel);
|
||||
this.Controls.Add(this.containerPanel);
|
||||
this.Name = "ThemedForms";
|
||||
this.Text = "ThemedForms";
|
||||
this.DoubleClick += new System.EventHandler(this.ThemedForms_DoubleClick);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ThemedForms_MouseDown);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ThemedForms_MouseUp);
|
||||
this.Resize += new System.EventHandler(this.ThemedForms_Resize);
|
||||
((System.ComponentModel.ISupportInitialize)(this.CloseButton)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MaximizeButton)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MinimizeButton)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private System.Windows.Forms.Panel containerPanel;
|
||||
private System.Windows.Forms.Label titleLabel;
|
||||
private System.Windows.Forms.PictureBox CloseButton;
|
||||
private System.Windows.Forms.PictureBox MaximizeButton;
|
||||
private System.Windows.Forms.PictureBox MinimizeButton;
|
||||
}
|
||||
}
|
242
MSGer.tk/ThemedForms.cs
Normal file
242
MSGer.tk/ThemedForms.cs
Normal file
|
@ -0,0 +1,242 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
public partial class ThemedForms : Form
|
||||
{ //2014.12.21.
|
||||
public const int BorderSize = 3;
|
||||
|
||||
private bool overridecontrols = false;
|
||||
public ThemedForms()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Load += ThemedForms_Load;
|
||||
overridecontrols = true;
|
||||
}
|
||||
|
||||
protected void ThemedForms_Load(object sender, EventArgs e)
|
||||
{
|
||||
List<AnchorStyles> anchors = new List<AnchorStyles>();
|
||||
foreach (Control control in containerPanel.Controls)
|
||||
{
|
||||
anchors.Add(control.Anchor);
|
||||
control.Anchor = AnchorStyles.Top | AnchorStyles.Left;
|
||||
}
|
||||
this.SuspendLayout();
|
||||
base.FormBorderStyle = FormBorderStyle.None;
|
||||
this.Size = base.Size;
|
||||
CloseButton.Location = new Point(this.Size.Width - CloseButton.Size.Width, 0);
|
||||
MaximizeButton.Location = new Point(this.Size.Width - CloseButton.Size.Width - MaximizeButton.Size.Width, 0);
|
||||
MinimizeButton.Location = new Point(this.Size.Width - CloseButton.Size.Width - MaximizeButton.Size.Width - MinimizeButton.Size.Width, 0);
|
||||
titleLabel.Location = new Point(BorderSize, titleLabel.Location.Y);
|
||||
containerPanel.Location = new Point(BorderSize, titleLabel.Location.Y + titleLabel.Size.Height);
|
||||
int i = 0;
|
||||
this.ResumeLayout(true);
|
||||
foreach (var anchor in anchors)
|
||||
{
|
||||
containerPanel.Controls[i].Anchor = anchor;
|
||||
i++;
|
||||
}
|
||||
titleLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left;
|
||||
CloseButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
MaximizeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
MinimizeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
containerPanel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
|
||||
Theme.SkinControl(Theme.ThemePart.Border, this); //2014.12.24.
|
||||
Theme.SkinControl(Theme.ThemePart.MinimizeButton, MinimizeButton); //2014.12.24.
|
||||
Theme.SkinControl(Theme.ThemePart.MaximizeButton, MaximizeButton); //2014.12.24.
|
||||
Theme.SkinControl(Theme.ThemePart.CloseButton, CloseButton); //2014.12.24.
|
||||
}
|
||||
public new Control.ControlCollection Controls
|
||||
{
|
||||
get
|
||||
{
|
||||
if (overridecontrols)
|
||||
return containerPanel.Controls;
|
||||
else
|
||||
return base.Controls;
|
||||
}
|
||||
}
|
||||
private FormBorderStyle borderstyle = FormBorderStyle.Sizable;
|
||||
public new FormBorderStyle FormBorderStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return borderstyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
borderstyle = value;
|
||||
base.FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
}
|
||||
public override string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
titleLabel.Text = value;
|
||||
base.Text = value;
|
||||
}
|
||||
}
|
||||
public new Size Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Size;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Size = new Size(value.Width + containerPanel.Location.X + BorderSize, value.Height + containerPanel.Location.Y + BorderSize);
|
||||
containerPanel.Size = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void MaximizeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MaximizeBox)
|
||||
return;
|
||||
FormWindowState ws; //Anti-virus program miatt
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
ws = FormWindowState.Maximized;
|
||||
else
|
||||
ws = FormWindowState.Normal;
|
||||
|
||||
Timer t = new Timer();
|
||||
t.Interval = 10;
|
||||
t.Tick += delegate
|
||||
{
|
||||
t.Stop();
|
||||
base.FormBorderStyle = FormBorderStyle.Sizable; //Látszik egy kis időre, de tán így a legkönnyebb
|
||||
WindowState = ws;
|
||||
base.FormBorderStyle = FormBorderStyle.None;
|
||||
};
|
||||
t.Start();
|
||||
}
|
||||
|
||||
private void MinimizeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MinimizeBox)
|
||||
return;
|
||||
//base.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
WindowState = FormWindowState.Minimized;
|
||||
}
|
||||
|
||||
private FormWindowState wstate;
|
||||
private void ThemedForms_Resize(object sender, EventArgs e)
|
||||
{
|
||||
if (this.WindowState == wstate)
|
||||
return;
|
||||
if (this.WindowState == FormWindowState.Maximized && wstate == FormWindowState.Minimized) //minimized-ről váltott maximized-re
|
||||
{
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
base.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
base.FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
wstate = this.WindowState;
|
||||
}
|
||||
|
||||
private bool moving = false;
|
||||
private int resizing = 0;
|
||||
private Timer moveresizetimer = new Timer();
|
||||
//private Point diffcursorpos;
|
||||
private Point moveresizecursor;
|
||||
private void ThemedForms_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
Point cursorpos = this.PointToClient(Cursor.Position);
|
||||
//diffcursorpos = this.PointToClient(Cursor.Position);
|
||||
moveresizecursor = this.PointToClient(Cursor.Position); //Mindig ehhez igazítsa
|
||||
if (cursorpos.X > containerPanel.Location.X + containerPanel.Size.Width)
|
||||
resizing = 1; //right
|
||||
else if (cursorpos.X < containerPanel.Location.X)
|
||||
resizing = 2; //left
|
||||
else if (cursorpos.Y > containerPanel.Location.Y + containerPanel.Size.Height)
|
||||
resizing = 3; //bottom
|
||||
else if (cursorpos.Y < containerPanel.Location.Y)
|
||||
moving = true; //top
|
||||
if(!moveresizetimer.Enabled)
|
||||
{
|
||||
moveresizetimer.Interval = 10;
|
||||
moveresizetimer.Tick += moveresizetimer_Tick;
|
||||
moveresizetimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
void moveresizetimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (moving)
|
||||
{
|
||||
//this.Location -= cursorpos - this.PointToClient(Cursor.Position);
|
||||
/*int diffx = diffcursorpos.X - this.PointToClient(Cursor.Position).X;
|
||||
int diffy = diffcursorpos.Y - this.PointToClient(Cursor.Position).Y;
|
||||
this.Location = new Point(this.Location.X - diffx, this.Location.Y - diffy);
|
||||
diffcursorpos = this.PointToClient(Cursor.Position);*/
|
||||
int diffx = this.PointToClient(Cursor.Position).X - moveresizecursor.X;
|
||||
int diffy = this.PointToClient(Cursor.Position).Y - moveresizecursor.Y;
|
||||
this.Location = new Point(this.Location.X + diffx, this.Location.Y + diffy);
|
||||
}
|
||||
if (resizing > 0 && borderstyle == FormBorderStyle.Sizable)
|
||||
{
|
||||
/*int diffx = diffcursorpos.X - this.PointToClient(Cursor.Position).X;
|
||||
int diffy = diffcursorpos.Y - this.PointToClient(Cursor.Position).Y;
|
||||
switch(resizing)
|
||||
{
|
||||
case 1: //right
|
||||
base.Size = new Size(this.Size.Width - diffx, this.Size.Height);
|
||||
break;
|
||||
}
|
||||
diffcursorpos = this.PointToClient(Cursor.Position);*/
|
||||
if (resizing == 1)
|
||||
base.Size = new Size(Cursor.Position.X - base.Location.X, base.Size.Height);
|
||||
else if (resizing == 2)
|
||||
{
|
||||
int diff = base.Location.X - Cursor.Position.X;
|
||||
base.Location = new Point(Cursor.Position.X, base.Location.Y);
|
||||
base.Size = new Size(base.Size.Width + diff, base.Size.Height);
|
||||
}
|
||||
else if (resizing == 3)
|
||||
base.Size = new Size(base.Size.Width, Cursor.Position.Y - base.Location.Y);
|
||||
}
|
||||
}
|
||||
|
||||
private void ThemedForms_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
moving = false;
|
||||
resizing = 0;
|
||||
moveresizetimer.Stop();
|
||||
}
|
||||
|
||||
private void ThemedForms_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (this.PointToClient(Cursor.Position).Y < containerPanel.Location.Y)
|
||||
{
|
||||
if (this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
base.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
base.FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
else
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
MSGer.tk/ThemedForms.resx
Normal file
120
MSGer.tk/ThemedForms.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
199
MSGer.tk/UpdateListAndChat.cs
Normal file
199
MSGer.tk/UpdateListAndChat.cs
Normal file
|
@ -0,0 +1,199 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MSGer.tk
|
||||
{
|
||||
class UpdateListAndChat
|
||||
{
|
||||
public void Run()
|
||||
{
|
||||
while (MainForm.LThread != null && MainForm.MainThread.IsAlive)
|
||||
{
|
||||
do
|
||||
{
|
||||
object[] retobj = Networking.ReceiveUpdates();
|
||||
if (retobj == null) //2014.12.05.
|
||||
return; //2014.12.05. - Leállt a program
|
||||
byte[] resp = (byte[])retobj[0]; //2014.10.24.
|
||||
IPEndPoint remoteEP = (IPEndPoint)retobj[1]; //2014.10.24.
|
||||
if (resp == null)
|
||||
break;
|
||||
byte isresponse; //2014.09.15.
|
||||
Networking.UpdateType updatetype; //2014.09.15.
|
||||
int keyversion; //2014.09.15.
|
||||
int port; //2014.12.19.
|
||||
int userid; //2014.09.15.
|
||||
byte[] data; //2014.09.15.
|
||||
Networking.ParsePacket(resp, out isresponse, out updatetype, out keyversion, out port, out userid, out data); //2014.09.15.
|
||||
//if (!UserInfo.IPs.Any(entry=>entry.IP==remoteEP) && updatetype != Networking.UpdateType.LoginUser) //2014.10.24.
|
||||
//if (!UserInfo.IPs.Any(entry => entry.IP == remoteEP) && updatetype != Networking.UpdateType.LoginUser) //2014.11.23
|
||||
if (!UserInfo.IPs.Any(entry => entry.Address.Equals(remoteEP.Address)) //2014.12.19. - A port nem ugyanaz, ráadásul a == nem hívja meg a .Equals metódust
|
||||
&& updatetype != Networking.UpdateType.LoginUser
|
||||
/*&& updatetype != Networking.UpdateType.CheckConn
|
||||
&& updatetype != Networking.UpdateType.RequestConn
|
||||
&& updatetype != Networking.UpdateType.MakeConn
|
||||
&& updatetype != Networking.UpdateType.MakeConn2*/)
|
||||
break;
|
||||
//bool x = UserInfo.IPs.Single().IP.Address.Equals(remoteEP.Address);
|
||||
if (updatetype == Networking.UpdateType.ListUpdate)
|
||||
{
|
||||
//Networking.ParseUpdateInfo(new byte[][] { data }); //2014.09.15.
|
||||
Networking.ParseUpdateInfo(new byte[][] { resp }); //2014.12.22. - A funkció az egész packet-re számít, nem csak a data-ra
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.UpdateMessages)
|
||||
{
|
||||
string[] response = Networking.GetStrings(data, 0);
|
||||
string[] tmp = response[0].Split(',');
|
||||
List<UserInfo> tmp2 = new List<UserInfo>();
|
||||
tmp2.Add(UserInfo.Select(userid)); //Adja hozzá a küldőt is
|
||||
tmp2.AddRange(tmp.Select(entry => UserInfo.Select(Int32.Parse(entry)))); //2014.10.24.
|
||||
//if (tmp2.All(entry => !UserInfo.Select(entry).IsPartner)) //2014.10.24.
|
||||
if (tmp2.All(entry => !entry.IsPartner)) //2014.10.31.
|
||||
break; //Ha a beszélgetésben nincs ismerőse, akkor nem foglalkozik vele
|
||||
var cf = ChatPanel.GetChatFormByUsers(tmp2);
|
||||
if (cf == null)
|
||||
{
|
||||
Program.MainF.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
ChatPanel.ChatWindows.Add(new ChatPanel());
|
||||
cf = ChatPanel.ChatWindows[ChatPanel.ChatWindows.Count - 1];
|
||||
cf.ChatPartners.AddRange(tmp2);
|
||||
cf.Init();
|
||||
});
|
||||
}
|
||||
//0 - Résztvevők; 1 - Üzenet; 2 - Üzenetküldés időpontja
|
||||
string[] cmd = response[1].Split(' ');
|
||||
switch (cmd[0])
|
||||
{
|
||||
case "//sendfile":
|
||||
string[] ipportname = cmd[1].Split(':');
|
||||
IPAddress ipAddr = IPAddress.Parse(ipportname[0]);
|
||||
var permission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, "", SocketPermission.AllPorts);
|
||||
var ipEndPoint = new IPEndPoint(ipAddr, Int32.Parse(ipportname[1]));
|
||||
var receiverSock = new Socket(ipAddr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
receiverSock.Connect(ipEndPoint);
|
||||
var ns = new NetworkStream(receiverSock);
|
||||
var fs = new FileStream(ipportname[2], FileMode.Create);
|
||||
break;
|
||||
}
|
||||
cf.TMessage = "\n" + ((userid == CurrentUser.UserID) ? CurrentUser.Name : UserInfo.Select(userid).Name) + " " + Language.Translate("said") + " (" + Program.UnixTimeToDateTime(response[2]).ToString("yyyy.MM.dd. HH:mm:ss") + "):\n" + response[1] + "\n";
|
||||
Program.MainF.Invoke(new LoginForm.MyDelegate(cf.SetThreadValues));
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.LoginUser)
|
||||
{
|
||||
string tmpresp = Networking.SendRequest("checkuser", userid.ToString(), 0, true); //2014.09.19.
|
||||
if (tmpresp == "Fail")
|
||||
{
|
||||
break; //Nem küld el neki semmit, hanem újra várja a packet-eket
|
||||
}
|
||||
else if (tmpresp != "Success")
|
||||
{
|
||||
MessageBox.Show("LoginUser:\n" + tmpresp);
|
||||
break;
|
||||
}
|
||||
|
||||
//int iplen = BitConverter.ToInt32(data, 0);
|
||||
//string ip = Encoding.Unicode.GetString(data, 4, iplen);
|
||||
//IPAddress ip = IPAddress.Parse(Encoding.Unicode.GetString(data, 4, iplen));
|
||||
/*if (!Storage.Settings["ips"].Contains(ip))
|
||||
Storage.Settings["ips"] += ";" + ip;*/
|
||||
//var ep = new IPEndPoint(ip, UserInfo.GetPortForIP(ip)); //2014.11.15.
|
||||
//var ep = new IPEndPoint(ip, port); //2014.12.19.
|
||||
var ep = new IPEndPoint(remoteEP.Address, port);
|
||||
//if (!UserInfo.IPs.Any(entry=>entry.IP==ep))
|
||||
if (!UserInfo.IPs.Any(entry=>entry==ep))
|
||||
UserInfo.IPs.Add(ep);
|
||||
string retstr = "";
|
||||
//for (int i = 4 + iplen; i + 8 < resp.Length; i += 8)
|
||||
for (int i = 0; i + 8 < data.Length; i += 8)
|
||||
{
|
||||
int uid = BitConverter.ToInt32(data, i);
|
||||
int utime = BitConverter.ToInt32(data, i + 4);
|
||||
if (Storage.LoggedInSettings.ContainsKey("userinfo_" + uid + "_updatetime") && Int32.Parse(Storage.LoggedInSettings["userinfo_" + uid + "_updatetime"]) > utime)
|
||||
{
|
||||
retstr += uid + "_name=" + Storage.LoggedInSettings["userinfo_" + uid + "_name"] + "\n";
|
||||
retstr += uid + "_message=" + Storage.LoggedInSettings["userinfo_" + uid + "_message"] + "\n";
|
||||
retstr += uid + "_state=" + Storage.LoggedInSettings["userinfo_" + uid + "_state"] + "\n";
|
||||
retstr += uid + "_username=" + Storage.LoggedInSettings["userinfo_" + uid + "_username"] + "\n";
|
||||
retstr += uid + "_email=" + Storage.LoggedInSettings["userinfo_" + uid + "_email"] + "\n";
|
||||
retstr += uid + "_ispartner=" + Storage.LoggedInSettings["userinfo_" + uid + "_ispartner"] + "\n";
|
||||
//retstr += uid + "_lastupdate=" + Program.DateTimeToUnixTime(DateTime.Now);
|
||||
if (uid != CurrentUser.UserID) //2014.11.29.
|
||||
retstr += uid + "_lastupdate=" + Storage.LoggedInSettings["userinfo_" + uid + "_lastupdate"]; //2014.11.29. - Arra az időpontra állítsa, amikor ő kapta a frissítést, így ez elvileg az eredeti frissítés időpontját mutatja kb. - Ezért a sajátját biztosan frissen kell tartani
|
||||
else
|
||||
retstr += uid + "_lastupdate=" + Program.DateTimeToUnixTime(DateTime.Now);
|
||||
//if (i + 1 != (resp.Length - 9) / 8)
|
||||
if (i + 16 < data.Length)
|
||||
retstr += "\n";
|
||||
}
|
||||
}
|
||||
UserInfo.Select(userid).State = 1;
|
||||
Networking.SendUpdate(Networking.UpdateType.LoginUser, Encoding.Unicode.GetBytes(retstr), true);
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.LogoutUser)
|
||||
{ //2014.08.31. 0:32
|
||||
int len = BitConverter.ToInt32(data, 0);
|
||||
string ipstr = Encoding.Unicode.GetString(data, 4, len);
|
||||
//Storage.Settings["ips"] = Storage.Settings["ips"].Remove(Storage.Settings["ips"].IndexOf(ipstr), ipstr.Length); //2014.09.22.
|
||||
//var ip = IPAddress.Parse(ipstr);
|
||||
string[] ips = ipstr.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var ip = ips.Select(entry => IPAddress.Parse(entry));
|
||||
//UserInfo.IPs.RemoveWhere(entry => entry.IP.Address == ip && entry.IP.Port == UserInfo.GetPortForIP(entry.IP.Address)); //2014.11.15.
|
||||
UserInfo.IPs.RemoveWhere(entry => entry.Address == ip && entry.Port == port); //2014.11.15. - Port: 2014.12.19.
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.SetKey) //2014.09.09.
|
||||
{ //2014.09.22.
|
||||
CurrentUser.KeyIndex = BitConverter.ToInt32(data, 0);
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.GetImage) //2014.11.01. 0:53
|
||||
{
|
||||
string tmp = Path.GetTempPath();
|
||||
List<byte> sendb = new List<byte>();
|
||||
int user = BitConverter.ToInt32(data, 0);
|
||||
int picupdatetime = BitConverter.ToInt32(data, 4);
|
||||
//int thispicupdatetime = UserInfo.Select(user).PicUpdateTime;
|
||||
int thispicupdatetime = 0;
|
||||
UserInfo userinfo = UserInfo.Select(user);
|
||||
if (userinfo != null)
|
||||
thispicupdatetime = UserInfo.Select(user).PicUpdateTime;
|
||||
if (thispicupdatetime > picupdatetime)
|
||||
{
|
||||
sendb.AddRange(BitConverter.GetBytes(thispicupdatetime));
|
||||
sendb.AddRange(File.ReadAllBytes(tmp + "\\MSGer.tk\\pictures\\" + user + ".png"));
|
||||
}
|
||||
Networking.SendUpdate(Networking.UpdateType.GetImage, sendb.ToArray(), true); //2014.11.23.
|
||||
}
|
||||
/*else if (updatetype == Networking.UpdateType.CheckConn)
|
||||
{ //2014.11.23.
|
||||
Networking.SendUpdate(Networking.UpdateType.CheckConn, new byte[] { 0x01 }, true, new IPEndPoint(remoteEP.Address, port));
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.RequestConn)
|
||||
{ //2014.11.23.
|
||||
string[] s = Encoding.Unicode.GetString(data).Split(':');
|
||||
var secondEP = new IPEndPoint(IPAddress.Parse(s[0]), Int32.Parse(s[1]));
|
||||
Networking.SendUpdate(Networking.UpdateType.MakeConn, Encoding.Unicode.GetBytes(secondEP.ToString()), false, remoteEP); //Elküldi, hogy próbálkozzon kapcsolódni
|
||||
Networking.SendUpdate(Networking.UpdateType.RequestConn, new byte[] { 0x01 }, true); //Majd válaszol, hogy ő is próbálkozhat
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.MakeConn)
|
||||
{ //2014.11.23.
|
||||
string[] s = Encoding.Unicode.GetString(data).Split(':');
|
||||
var secondEP = new IPEndPoint(IPAddress.Parse(s[0]), Int32.Parse(s[1]));
|
||||
Networking.SendUpdate(Networking.UpdateType.MakeConn2, new byte[] { 0x01 }, false, secondEP); //Próbálkoziks
|
||||
Networking.SendUpdate(Networking.UpdateType.MakeConn, new byte[] { 0x01 }, true); //Válaszol, hogy ne várjon rá a szerver
|
||||
}
|
||||
else if (updatetype == Networking.UpdateType.MakeConn2)
|
||||
{ //2014.11.23.
|
||||
Networking.SendUpdate(Networking.UpdateType.MakeConn2, new byte[] { 0x01 }, true); //Végzett
|
||||
}*/
|
||||
} while (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ namespace MSGer.tk
|
|||
Storage.LoggedInSettings["userinfo_" + UserID + "_listid"] = value.ToString();
|
||||
}
|
||||
}
|
||||
public int TMPListID { get; set; } //2014.12.05.
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
@ -150,7 +151,7 @@ namespace MSGer.tk
|
|||
Update();
|
||||
}
|
||||
}
|
||||
public string LoginCode
|
||||
public string LoginCode //
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -166,6 +167,39 @@ namespace MSGer.tk
|
|||
Update();
|
||||
}
|
||||
}
|
||||
public int PicUpdateTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Storage.LoggedInSettings.ContainsKey("userinfo_" + UserID + "_picupdatetime"))
|
||||
Storage.LoggedInSettings.Add("userinfo_" + UserID + "_picupdatetime", "0");
|
||||
return Int32.Parse(Storage.LoggedInSettings["userinfo_" + UserID + "_picupdatetime"]);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!Storage.LoggedInSettings.ContainsKey("userinfo_" + UserID + "_picupdatetime"))
|
||||
Storage.LoggedInSettings.Add("userinfo_" + UserID + "_picupdatetime", "0");
|
||||
Storage.LoggedInSettings["userinfo_" + UserID + "_picupdatetime"] = value.ToString();
|
||||
Update();
|
||||
}
|
||||
}
|
||||
public string ImagePath = "noimage.png";
|
||||
/*public struct IPEndPoint - Nincs már szükség az IsServer beállításra
|
||||
{
|
||||
public IPEndPoint IP;
|
||||
public bool IsServer;*/
|
||||
/*public IPEndPoint(IPEndPoint ip)
|
||||
{
|
||||
IP = ip;
|
||||
IsServer = false;
|
||||
}*/
|
||||
/*public IPEndPoint(IPEndPoint ip, bool isserver)
|
||||
{
|
||||
IP = ip;
|
||||
IsServer = isserver;
|
||||
}
|
||||
}*/
|
||||
|
||||
private static HashSet<IPEndPoint> ips = new HashSet<IPEndPoint>();
|
||||
public static HashSet<IPEndPoint> IPs
|
||||
{
|
||||
|
@ -199,51 +233,62 @@ namespace MSGer.tk
|
|||
~UserInfo() //2014.10.09.
|
||||
{
|
||||
}
|
||||
public int PicUpdateTime = 0;
|
||||
public string GetImage()
|
||||
{
|
||||
//public int PicUpdateTime = 0;
|
||||
//public string GetImage()
|
||||
public void GetImage(int receivedupdate)
|
||||
{ //Most már elvileg csak akkor hívja meg, amikor feldolgozza a kapott adatokat, tehát nem a Main Thread-ban
|
||||
string tmp = Path.GetTempPath();
|
||||
if (!Directory.Exists(tmp + "\\MSGer.tk\\pictures")) //2014.08.16. - Áthelyezve, hogy mindig létrehozza, ha kell, és letöltse a képeket
|
||||
Directory.CreateDirectory(tmp + "\\MSGer.tk\\pictures");
|
||||
|
||||
if (this.PicUpdateTime > receivedupdate)
|
||||
{
|
||||
if (File.Exists(tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png"))
|
||||
this.ImagePath = tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png";
|
||||
else
|
||||
this.ImagePath = "noimage.png";
|
||||
}
|
||||
|
||||
//2014.08.16. - A képeket azért nem menti felhasználónként, mert úgyis le tudja tölteni mindenkinek a képét szinte bárki, és amúgy is UserID-val van azonosítva
|
||||
List<byte> sendb = new List<byte>();
|
||||
sendb.AddRange(BitConverter.GetBytes(CurrentUser.UserID));
|
||||
//sendb.AddRange(BitConverter.GetBytes(CurrentUser.UserID));
|
||||
sendb.AddRange(BitConverter.GetBytes(UserID));
|
||||
sendb.AddRange(BitConverter.GetBytes((File.Exists(tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png")) ? PicUpdateTime : 0));
|
||||
byte[][] bytesb = Networking.SendUpdate(Networking.UpdateType.GetImage, sendb.ToArray(), false);
|
||||
if (bytesb == null || bytesb.All(entry => entry.Length == 0)) //bytesb.All(...): 2014.09.01.
|
||||
{
|
||||
if (File.Exists(tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png"))
|
||||
return tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png";
|
||||
this.ImagePath = tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png";
|
||||
else
|
||||
return "noimage.png";
|
||||
this.ImagePath = "noimage.png";
|
||||
}
|
||||
bytesb = bytesb.Select(entry => Networking.ParsePacket(entry).Data).ToArray();
|
||||
int[] picupdatetimes = bytesb.Select(b => BitConverter.ToInt32(b, 0)).ToArray();
|
||||
int maxIndex = Array.IndexOf<int>(picupdatetimes, picupdatetimes.Max());
|
||||
byte[] bytes = bytesb[maxIndex]; //Attól tölti le a képet, akinek a legfrissebb
|
||||
//byte[] bytes = bytesb[maxIndex]; //Attól tölti le a képet, akinek a legfrissebb
|
||||
byte[] bytes = new byte[bytesb[maxIndex].Length];
|
||||
Array.Copy(bytesb[maxIndex], 4, bytes, 0, bytes.Length); //Hagyja ki a PicUpdateTime-ot
|
||||
|
||||
if (bytes[0] == 0x00) //Nincs kép, vagy hiba történt
|
||||
{
|
||||
return "noimage.png";
|
||||
this.ImagePath = "noimage.png";
|
||||
}
|
||||
else if (bytes[0] == 0x01)
|
||||
{
|
||||
return tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png";
|
||||
this.ImagePath = tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png";
|
||||
}
|
||||
else
|
||||
{ //Mentse el a képet
|
||||
File.WriteAllBytes(tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png", bytes);
|
||||
return tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png"; //2014.08.16.
|
||||
this.ImagePath = tmp + "\\MSGer.tk\\pictures\\" + UserID + ".png"; //2014.08.16.
|
||||
}
|
||||
}
|
||||
public List<int> GetChatWindows()
|
||||
{
|
||||
List<int> retlist = new List<int>();
|
||||
for (int x = 0; x < ChatForm.ChatWindows.Count; x++)
|
||||
for (int x = 0; x < ChatPanel.ChatWindows.Count; x++)
|
||||
{
|
||||
if (ChatForm.ChatWindows[x].ChatPartners.Contains(UserID))
|
||||
if (ChatPanel.ChatWindows[x].ChatPartners.Any(entry => entry.UserID == UserID))
|
||||
{
|
||||
retlist.Add(x);
|
||||
}
|
||||
|
@ -282,7 +327,7 @@ namespace MSGer.tk
|
|||
{
|
||||
for (int i = 0; i < UserInfo.KnownUsers.Count; i++)
|
||||
{
|
||||
if (UserInfo.KnownUsers[i].IsPartner && UserInfo.KnownUsers[i].ListID == ListID)
|
||||
if (UserInfo.KnownUsers[i].IsPartner && UserInfo.KnownUsers[i].TMPListID == ListID) //Ahol szükség van rá, ott az aktuális ListID szükséges, nem a beállított
|
||||
return UserInfo.KnownUsers[i].UserID;
|
||||
}
|
||||
return 0;
|
||||
|
@ -306,7 +351,66 @@ namespace MSGer.tk
|
|||
UpdateTimer.Stop();
|
||||
//Partnerlista frissítése
|
||||
//2014.10.09.
|
||||
string imgpath = this.GetImage();
|
||||
/*string imgpath = this.GetImage();
|
||||
if (!(imgpath != "noimage.png" || File.Exists("noimage.png"))) //2014.03.13. - 2014.10.09.
|
||||
{
|
||||
imgpath = "";
|
||||
MessageBox.Show(Language.Translate("noimage_notfound"), Language.Translate("error"));
|
||||
}
|
||||
string state = "";
|
||||
if (this.State == 1)
|
||||
state = " (" + Language.Translate("menu_file_status_online") + ")";
|
||||
else if (this.State == 2)
|
||||
state = " (" + Language.Translate("menu_file_status_busy") + ")";
|
||||
else if (this.State == 3)
|
||||
state = " (" + Language.Translate("menu_file_status_away") + ")";
|
||||
else
|
||||
state = " (" + Language.Translate("offline") + ")";
|
||||
string text = this.Name + state + "\n" + this.Message;
|
||||
*/
|
||||
if (ListID == -1)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < Program.MainF.contactList.Items.Count; i++)
|
||||
{
|
||||
if (Program.MainF.contactList.Items[i].SubItems[1].Text == "")
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ListID = i;
|
||||
}
|
||||
//2014.10.09.
|
||||
/*bool tmp = Program.MainF.contactList.AutoUpdate;
|
||||
Program.MainF.contactList.AutoUpdate = false;
|
||||
while (Program.MainF.contactList.Items.Count <= ListID) //Azt is adja hozzá, ami a kész listaelem lesz
|
||||
{
|
||||
var pictb = new PictureBox();
|
||||
pictb.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
pictb.ImageLocation = imgpath;
|
||||
var listtext = new ExRichTextBox();
|
||||
listtext.Text = text;
|
||||
listtext = TextFormat.Parse(listtext);
|
||||
Program.MainF.contactList.Items.Add(new RichListViewItem(new Control[] { pictb, listtext }));
|
||||
}
|
||||
((PictureBox)Program.MainF.contactList.Items[ListID].SubItems[0]).ImageLocation = imgpath;
|
||||
Program.MainF.contactList.Items[ListID].SubItems[1].Text = text;
|
||||
Program.MainF.contactList.Items[ListID].SubItems[1] = TextFormat.Parse((ExRichTextBox)Program.MainF.contactList.Items[ListID].SubItems[1]);
|
||||
Program.MainF.contactList.AutoUpdate = tmp;*/
|
||||
|
||||
CreateListItem(Program.MainF.contactList, ListID);
|
||||
}
|
||||
|
||||
/*internal static int GetPortForIP(IPAddress iPAddress) - Elküldi
|
||||
{
|
||||
throw new NotImplementedException(); //TODO
|
||||
}*/
|
||||
|
||||
public void CreateListItem(RichListView listView, int pos)
|
||||
{
|
||||
//TO!DO: A fenti kódot átrakni ide, hogy itt létrehozza az item-et
|
||||
//string imgpath = this.GetImage();
|
||||
string imgpath = this.ImagePath; //2014.12.31.
|
||||
if (!(imgpath != "noimage.png" || File.Exists("noimage.png"))) //2014.03.13. - 2014.10.09.
|
||||
{
|
||||
imgpath = "";
|
||||
|
@ -323,22 +427,12 @@ namespace MSGer.tk
|
|||
state = " (" + Language.Translate("offline") + ")";
|
||||
string text = this.Name + state + "\n" + this.Message;
|
||||
|
||||
if (ListID == -1)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < Program.MainF.contactList.Items.Count; i++)
|
||||
{
|
||||
if (Program.MainF.contactList.Items[i].SubItems[1].Text == "")
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ListID = i;
|
||||
}
|
||||
//2014.10.09.
|
||||
bool tmp = Program.MainF.contactList.AutoUpdate;
|
||||
Program.MainF.contactList.AutoUpdate = false;
|
||||
while (Program.MainF.contactList.Items.Count <= ListID) //Azt is adja hozzá, ami a kész listaelem lesz
|
||||
TMPListID = pos;
|
||||
|
||||
bool tmp = listView.AutoUpdate;
|
||||
listView.AutoUpdate = false;
|
||||
listView.SuspendLayout(); //2014.12.21.
|
||||
while (listView.Items.Count <= TMPListID) //Azt is adja hozzá, ami a kész listaelem lesz
|
||||
{
|
||||
var pictb = new PictureBox();
|
||||
pictb.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
|
@ -346,12 +440,13 @@ namespace MSGer.tk
|
|||
var listtext = new ExRichTextBox();
|
||||
listtext.Text = text;
|
||||
listtext = TextFormat.Parse(listtext);
|
||||
Program.MainF.contactList.Items.Add(new RichListViewItem(new Control[] { pictb, listtext }));
|
||||
listView.Items.Add(new RichListViewItem(new Control[] { pictb, listtext }));
|
||||
}
|
||||
((PictureBox)Program.MainF.contactList.Items[ListID].SubItems[0]).ImageLocation = imgpath;
|
||||
Program.MainF.contactList.Items[ListID].SubItems[1].Text = text;
|
||||
Program.MainF.contactList.Items[ListID].SubItems[1] = TextFormat.Parse((ExRichTextBox)Program.MainF.contactList.Items[ListID].SubItems[1]);
|
||||
Program.MainF.contactList.AutoUpdate = tmp;
|
||||
((PictureBox)listView.Items[TMPListID].SubItems[0]).ImageLocation = imgpath;
|
||||
listView.Items[TMPListID].SubItems[1].Text = text;
|
||||
listView.Items[TMPListID].SubItems[1] = TextFormat.Parse((ExRichTextBox)listView.Items[TMPListID].SubItems[1]);
|
||||
listView.AutoUpdate = tmp;
|
||||
listView.ResumeLayout(true); //2014.12.21.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
MSGer.tk/bin/Debug/1.db
Normal file
BIN
MSGer.tk/bin/Debug/1.db
Normal file
Binary file not shown.
BIN
MSGer.tk/bin/Debug/2.db
Normal file
BIN
MSGer.tk/bin/Debug/2.db
Normal file
Binary file not shown.
BIN
MSGer.tk/bin/Debug/Handwriting program.dll
Normal file
BIN
MSGer.tk/bin/Debug/Handwriting program.dll
Normal file
Binary file not shown.
BIN
MSGer.tk/bin/Debug/Handwriting program.pdb
Normal file
BIN
MSGer.tk/bin/Debug/Handwriting program.pdb
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue