Hi, ich danke für die Rückmeldung, selbstverständlich ist das ein Teil meiner Schöpfung naja er ist nicht ansatzweise fertig aber es kann schon was schönes, und das mit den Variablen das ist mein stiel und damit komm ich gut klar.
Also hier der Rest:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Net.Sockets;
using System.Net;
using System.Threading;
using System.Drawing;
namespace ConsoleApplication1
{
class Program
{
static public bool Aus; //Variabel für das beenden Des Programms
private static Thread S1 = new Thread(new ThreadStart(KontrolKern.Satart));// Start des Seperatem Programms der Fungtionen Kontrolle
static void Main(string[] args)
{
S1.Start();//1 Start
Aus=true;
string F1="";
while (true != KontrolKern.B3 && Aus)
{
Console.ResetColor();
Console.Clear();
Console.WriteLine("Wollen sie warten<1> oder direkt Verbinden?<2>");
F1 = Console.ReadLine();
Console.Clear();
if (F1=="1")
{
Console.WriteLine("Wartet");
TcpListener L1 = new TcpListener(IPAddress.Any,88);
L1.Start();
KontrolKern.V1 = L1.AcceptSocket();
L1.Stop();
Console.Clear();
Console.WriteLine();
Console.Write("Paswort:");
Console.ReadLine();
Console.Clear();
}
else
{
KontrolKern.DiVB();
}
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Black;
Console.Clear();
if (!KontrolKern.B10)
{
KontrolKern.Tr1.Start();
}
while (KontrolKern.B3)
{
byte[] P1=new byte[15];
try
{
if (0 != KontrolKern.V1.Receive(P1))
{
Console.ForegroundColor = ConsoleColor.Black;
Console.WriteLine(KontrolKern.S1.GetString(P1).Trim());
}
else
{
KontrolKern.V1.Disconnect(true);
}
}
catch (Exception)
{
}
}
}
}
public static byte[] AES(byte[] A1, String PW,bool verde)
{
byte[] A4 = new byte[A1.Length];
Stream A2 = new MemoryStream(A1, false);
if (verde)
{
SharpAESCrypt.SharpAESCrypt A3 = new SharpAESCrypt.SharpAESCrypt(PW, A2, SharpAESCrypt.OperationMode.Decrypt);
A3.Write(A4, 0, A1.Length);
}
else
{
SharpAESCrypt.SharpAESCrypt A3 = new SharpAESCrypt.SharpAESCrypt(PW, A2, SharpAESCrypt.OperationMode.Encrypt);
A3.Write(A4, 0, A1.Length);
}
return A4;
}
}
}
^Das hupt Programm
\/ Eingabe Formular
Code:
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 ConsoleApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void E1(object sender, KeyEventArgs e)//Senden von der Nachicht pär EnterTaste
{
if (e.KeyCode==Keys.Enter)
{
KontrolKern.V1.Send(KontrolKern.S1.GetBytes(text.Text));
Console.ForegroundColor = ConsoleColor.Black;
Console.WriteLine(">" + text.Text);
text.Text = "";
}
}
private void Prüf(object sender, EventArgs e)//Interwal Prüfung
{
if (!KontrolKern.V1.Connected)
{
this.Close();
Timer.Stop();
}
}
private void End(object sender, FormClosedEventArgs e)//Formula schliest
{
Timer.Stop();
if (KontrolKern.B3)
{
KontrolKern.V1.Disconnect(true);
}
KontrolKern.B10 = false;
}
private void Tren(object sender, EventArgs e)//Tren Taste
{
KontrolKern.V1.Disconnect(true);
KontrolKern.B3 = false;
KontrolKern.B10 = false;
}
private void Start(object sender, EventArgs e) //Formorlar Startet
{
KontrolKern.B10 = true;
Timer.Start();
}
}
}
Ich hoffe das reicht ,danke.