From 823f1df5e92a931942adceade961a83cc25d79eb Mon Sep 17 00:00:00 2001 From: juanjo Date: Fri, 27 Oct 2023 12:58:53 +0200 Subject: [PATCH] 06 ClientePPT --- 06-ClientePPT/06-ClientePPT.csproj | 84 ++++++++++ 06-ClientePPT/App.config | 6 + 06-ClientePPT/Form1.Designer.cs | 149 ++++++++++++++++++ 06-ClientePPT/Form1.cs | 55 +++++++ 06-ClientePPT/Form1.resx | 120 ++++++++++++++ 06-ClientePPT/Program.cs | 22 +++ 06-ClientePPT/Properties/AssemblyInfo.cs | 36 +++++ .../Properties/Resources.Designer.cs | 63 ++++++++ 06-ClientePPT/Properties/Resources.resx | 117 ++++++++++++++ 06-ClientePPT/Properties/Settings.Designer.cs | 26 +++ 06-ClientePPT/Properties/Settings.settings | 7 + 11 files changed, 685 insertions(+) create mode 100644 06-ClientePPT/06-ClientePPT.csproj create mode 100644 06-ClientePPT/App.config create mode 100644 06-ClientePPT/Form1.Designer.cs create mode 100644 06-ClientePPT/Form1.cs create mode 100644 06-ClientePPT/Form1.resx create mode 100644 06-ClientePPT/Program.cs create mode 100644 06-ClientePPT/Properties/AssemblyInfo.cs create mode 100644 06-ClientePPT/Properties/Resources.Designer.cs create mode 100644 06-ClientePPT/Properties/Resources.resx create mode 100644 06-ClientePPT/Properties/Settings.Designer.cs create mode 100644 06-ClientePPT/Properties/Settings.settings diff --git a/06-ClientePPT/06-ClientePPT.csproj b/06-ClientePPT/06-ClientePPT.csproj new file mode 100644 index 0000000..522d406 --- /dev/null +++ b/06-ClientePPT/06-ClientePPT.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {C45C9724-9C15-4893-9C31-6CA2D37928C7} + WinExe + _06_ClientePPT + 06-ClientePPT + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/06-ClientePPT/App.config b/06-ClientePPT/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/06-ClientePPT/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/06-ClientePPT/Form1.Designer.cs b/06-ClientePPT/Form1.Designer.cs new file mode 100644 index 0000000..e6f978c --- /dev/null +++ b/06-ClientePPT/Form1.Designer.cs @@ -0,0 +1,149 @@ +namespace _06_ClientePPT +{ + partial class Form1 + { + /// + /// Variable del diseñador necesaria. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén usando. + /// + /// true si los recursos administrados se deben desechar; false en caso contrario. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido de este método con el editor de código. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(30, 35); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(112, 32); + this.button1.TabIndex = 0; + this.button1.Text = "Conectar"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.Button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(30, 92); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(112, 32); + this.button2.TabIndex = 1; + this.button2.Text = "Inscribir"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.Button2_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(30, 149); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(112, 32); + this.button3.TabIndex = 2; + this.button3.Text = "Jugar"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.Button3_Click); + // + // button4 + // + this.button4.Location = new System.Drawing.Point(30, 206); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(112, 32); + this.button4.TabIndex = 3; + this.button4.Text = "Puntuación"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.Button4_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(33, 259); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.TabIndex = 4; + this.label1.Text = "label1"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(174, 44); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(123, 20); + this.textBox1.TabIndex = 5; + this.textBox1.Text = "127.0.0.1"; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(174, 99); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(123, 20); + this.textBox2.TabIndex = 6; + // + // comboBox1 + // + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "piedra", + "papel", + "tijera"}); + this.comboBox1.Location = new System.Drawing.Point(174, 152); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(122, 21); + this.comboBox1.TabIndex = 7; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.ComboBox comboBox1; + } +} + diff --git a/06-ClientePPT/Form1.cs b/06-ClientePPT/Form1.cs new file mode 100644 index 0000000..93a315f --- /dev/null +++ b/06-ClientePPT/Form1.cs @@ -0,0 +1,55 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Net.Sockets; +using System.Windows.Forms; + +namespace _06_ClientePPT { + public partial class Form1 : Form { + TcpClient client; + NetworkStream ns; + StreamReader sr; + StreamWriter sw; + String dato; + public Form1() { + InitializeComponent(); + } + + private void Button1_Click(object sender, EventArgs e) { + try { + client = new TcpClient(this.textBox1.Text, 2000); + ns = client.GetStream(); + sr = new StreamReader(ns); + sw = new StreamWriter(ns); + dato = sr.ReadLine() + System.Environment.NewLine + + sr.ReadLine() + System.Environment.NewLine + + sr.ReadLine(); + this.label1.Text = dato; + } + catch (Exception error) { + Debug.WriteLine("Error: " + error.ToString()); + } + } + + private void Button2_Click(object sender, EventArgs e) { + sw.WriteLine("#INSCRIBIR#" + this.textBox2.Text + "#"); + sw.Flush(); + dato = sr.ReadLine(); + this.label1.Text = dato; + } + + private void Button3_Click(object sender, EventArgs e) { + sw.WriteLine("#JUGADA#" + this.comboBox1.Text + "#"); + sw.Flush(); + dato = sr.ReadLine(); + this.label1.Text = dato; + } + + private void Button4_Click(object sender, EventArgs e) { + sw.WriteLine("#PUNTUACION#"); + sw.Flush(); + dato = sr.ReadLine(); + this.label1.Text = dato; + } + } +} diff --git a/06-ClientePPT/Form1.resx b/06-ClientePPT/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/06-ClientePPT/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/06-ClientePPT/Program.cs b/06-ClientePPT/Program.cs new file mode 100644 index 0000000..5b636fc --- /dev/null +++ b/06-ClientePPT/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace _06_ClientePPT +{ + static class Program + { + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/06-ClientePPT/Properties/AssemblyInfo.cs b/06-ClientePPT/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cf93247 --- /dev/null +++ b/06-ClientePPT/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general de un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos valores de atributo para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("06-ClientePPT")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("06-ClientePPT")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible en false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si es necesario obtener acceso a un tipo en este ensamblado desde +// COM, establezca el atributo ComVisible en true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM. +[assembly: Guid("c45c9724-9c15-4893-9c31-6ca2d37928c7")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión +// utilizando el carácter "*", como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/06-ClientePPT/Properties/Resources.Designer.cs b/06-ClientePPT/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1740d4e --- /dev/null +++ b/06-ClientePPT/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime:4.0.30319.42000 +// +// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si +// se vuelve a generar el código. +// +//------------------------------------------------------------------------------ + +namespace _06_ClientePPT.Properties { + using System; + + + /// + /// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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() { + } + + /// + /// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase. + /// + [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("_06_ClientePPT.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos mediante esta clase de recurso fuertemente tipado. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/06-ClientePPT/Properties/Resources.resx b/06-ClientePPT/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/06-ClientePPT/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/06-ClientePPT/Properties/Settings.Designer.cs b/06-ClientePPT/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6c626cc --- /dev/null +++ b/06-ClientePPT/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime:4.0.30319.42000 +// +// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si +// se vuelve a generar el código. +// +//------------------------------------------------------------------------------ + +namespace _06_ClientePPT.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.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; + } + } + } +} diff --git a/06-ClientePPT/Properties/Settings.settings b/06-ClientePPT/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/06-ClientePPT/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +