diff --git a/Galactic Colors Control Console/Galactic Colors Control Console.csproj b/Galactic Colors Control Console/Galactic Colors Control Console.csproj new file mode 100644 index 0000000..276d774 --- /dev/null +++ b/Galactic Colors Control Console/Galactic Colors Control Console.csproj @@ -0,0 +1,64 @@ + + + + + Debug + AnyCPU + {5D6A09D1-DCAB-4FD8-B4E6-62D9F41AE8F0} + Exe + Properties + Galactic_Colors_Control_Console + Galactic Colors Control Console + v4.5 + 512 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {93582ce8-c8c8-4e19-908b-d671ecbade25} + Galactic Colors Control + + + + + \ No newline at end of file diff --git a/Galactic Colors Control Console/Program.cs b/Galactic Colors Control Console/Program.cs new file mode 100644 index 0000000..9d5bf8d --- /dev/null +++ b/Galactic Colors Control Console/Program.cs @@ -0,0 +1,98 @@ +using System; +using Galactic_Colors_Control; +using System.Threading; +using System.Reflection; + +namespace Galactic_Colors_Control_Console +{ + internal class Program + { + private static Client client; + private static bool run = true; + private static Thread Writer; + + private static void Main() + { + client = new Client(); + Console.Title = "Galactic Colors Control Client"; + Console.Write(">"); + Write("Galactic Colors Control Client"); + Write("Console " + Assembly.GetEntryAssembly().GetName().Version.ToString()); + bool hostSet = false; + while(!hostSet) + { + Write("Enter server host:"); + string host = client.ValidateHost(Console.ReadLine()); + if(host == null) + { + foreach (string output in client.Output.ToArray()) + { + Write(output); + } + client.Output.Clear(); + client.ResetHost(); + } + else + { + Write("Use " + host + "? y/n"); + ConsoleKeyInfo c = new ConsoleKeyInfo(); + while(c.Key != ConsoleKey.Y && c.Key != ConsoleKey.N) + { + c = Console.ReadKey(); + } + if(c.Key == ConsoleKey.Y) + { + hostSet = true; + } + else + { + client.ResetHost(); + } + } + } + if (client.ConnectHost()) + { + run = true; + Writer = new Thread(OutputWriter); + Writer.Start(); + while (run) + { + client.SendRequest(Console.ReadLine()); + if (!client.isRunning) { run = false; } + } + Writer.Join(); + Console.Read(); + } + else + { + foreach (string output in client.Output.ToArray()) + { + Write(output); + } + client.Output.Clear(); + Console.Read(); + } + } + + private static void OutputWriter() + { + while (run || client.Output.Count > 0) + { + if (client.Output.Count > 0) + { + string text = client.Output[0]; + Write(text); + client.Output.Remove(text); + } + Thread.Sleep(200); + } + } + + private static void Write( string text) + { + Console.Write("\b"); + Console.WriteLine(text); + Console.Write(">"); + } + } +} \ No newline at end of file diff --git a/Galactic Colors Control Console/Properties/AssemblyInfo.cs b/Galactic Colors Control Console/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4a2e9d8 --- /dev/null +++ b/Galactic Colors Control Console/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("Galactic Colors Control Console")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("sheychen")] +[assembly: AssemblyProduct("Galactic Colors Control Console")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("5d6a09d1-dcab-4fd8-b4e6-62d9f41ae8f0")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.1.1")] +[assembly: AssemblyFileVersion("1.0.1.1")] diff --git a/Galactic Colors Control GUI/Galactic Colors Control GUI.csproj b/Galactic Colors Control GUI/Galactic Colors Control GUI.csproj index 65f971b..8a5784c 100644 --- a/Galactic Colors Control GUI/Galactic Colors Control GUI.csproj +++ b/Galactic Colors Control GUI/Galactic Colors Control GUI.csproj @@ -110,6 +110,12 @@ + + + {93582ce8-c8c8-4e19-908b-d671ecbade25} + Galactic Colors Control + +