|
6901
|
Informática / Software / Re: NO PUEDO DESACARGAR FILEZILLA
|
en: 5 Agosto 2014, 15:00 pm
|
Buenas 1) ¿Lo estás intentando descargar desde la página oficial?: https://filezilla-project.org/download.php?type=clientHe comprobado que los servidores de SourceForge funcionan correctamente, la descarga se finaliza tanto la del cliente de Filezilla como la del Server, es posible que exista algún tipo de problema ajeno relacionado con tu conexión (con tu router), o quizás simplemente tengas descargando demasiadas cosas ocupando el espacio de banda ancha necesario para descargar otras cosas... Prueba desde otro navegador, o con algún administrador de descargas como JDownloader. Saludos
|
|
|
6902
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets)
|
en: 4 Agosto 2014, 20:13 pm
|
Ejemplos de uso de la librería nDDE para controlar un navegador compatible (aunque la verdad, DDE es muy limitado ...por no decir obsoleto, es preferible echar mano de UI Automation). Nota: Aquí teneis algunos ServiceNames y Topics de DDE para IExplore por si alguien está interesado en esta librería: support.microsoft.com/kb/160957 He probado el tópico "WWW_Exit" por curiosidad y funciona, pero ninguno de ellos funciona en Firefox (solo los que añadi a la Class de abajo). ' nDDE Helper ' By Elektro ' ' Instructions: ' 1. Add a reference to 'NDDE.dll' library. ' ' Usage Examples: ' MessageBox.Show(GetFirefoxUrl()) ' NavigateFirefox(New Uri("http://www.mozilla.org"), OpenInNewwindow:=False) ''' <summary> ''' Gets the url of the active Tab-page from a running Firefox process. ''' </summary> ''' <returns>The url of the active Tab-page.</returns> Public Function GetFirefoxUrl() As String Using dde As New DdeClient("Firefox", "WWW_GetWindowInfo") dde.Connect() Dim Url As String = dde.Request("URL", Integer.MaxValue). Trim({ControlChars.NullChar, ControlChars.Quote, ","c}) dde.Disconnect() Return Url End Using End Function ''' <summary> ''' Navigates to an URL in the running Firefox process. ''' </summary> ''' <param name="url">Indicates the URL to navigate.</param> ''' <param name="OpenInNewwindow"> ''' If set to <c>true</c> the url opens in a new Firefox window, otherwise, the url opens in a new Tab. ''' </param> Public Sub NavigateFirefox(ByVal url As Uri, ByVal OpenInNewwindow As Boolean) Dim Address As String = url.AbsoluteUri If OpenInNewwindow Then Address &= ",,0" End If Using dde As New DdeClient("Firefox", "WWW_OpenURL") dde.Connect() dde.Request(Address, Integer.MaxValue) dde.Disconnect() End Using End Sub
|
|
|
6903
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets)
|
en: 4 Agosto 2014, 18:44 pm
|
Una Class para ayudar a implementar una lista MRU (MostRecentUsed) ( La parte gráfica sobre como implementar los items en un menú no la voy a explicar, al menos en esta publicación ) ' *********************************************************************** ' Author : Elektro ' Last Modified On : 08-04-2014 ' *********************************************************************** ' <copyright file="MRU.vb" company="Elektro Studios"> ' Copyright (c) Elektro Studios. All rights reserved. ' </copyright> ' *********************************************************************** #Region " Usage Examples " 'Public Class Form1 ' ' ' Initialize a new List of MostRecentUsed-Item ' Dim MRUList As New List(Of MRU.Item) ' ' Private Sub Test() Handles MyBase.Shown ' ' ' Add some items into the collection. ' With MRUList ' .Add(New MRU.Item("C:\File1.ext")) ' .Add(New MRU.Item("C:\File2.ext") With {.Date = Date.Today, ' .Icon = Bitmap.FromFile("C:\Image.ico"), ' .Tag = Nothing}) ' End With ' ' ' Save the MRUItem collection to local file. ' MRU.IO.Save(MRUList, ".\MRU.tmp") ' ' ' Load the saved collection from local file. ' For Each MRUItem As MRU.Item In MRU.IO.Load(Of List(Of MRU.Item))(".\MRU.tmp") ' MessageBox.Show(MRUItem.FilePath) ' Next MRUItem ' ' ' Just another way to load the collection: ' MRU.IO.Load(MRUList, ".\MRU.tmp") ' ' End Sub ' 'End Class #End Region #Region " MostRecentUsed " ''' <summary> ''' Class MRU (MostRecentUsed). ''' Administrates the usage of a MRU item collection. ''' </summary> Public Class MRU #Region " Constructors " ''' <summary> ''' Prevents a default instance of the <see cref="MRU"/> class from being created. ''' </summary> Private Sub New() End Sub #End Region #Region " Types " #Region "IO" ''' <summary> ''' Performs IO operations with a <see cref="MRU.Item"/> Collection. ''' </summary> Public Class [IO] #Region " Constructors " ''' <summary> ''' Prevents a default instance of the <see cref="MRU.IO"/> class from being created. ''' </summary> Private Sub New() End Sub #End Region #Region " Public Methods " ''' <summary> ''' Saves the specified MRU List to local file, using binary serialization. ''' </summary> ''' <typeparam name="T"></typeparam> ''' <param name="MRUItemCollection">The <see cref="MRU.Item"/> Collection.</param> ''' <param name="filepath">The filepath to save the <see cref="MRU.Item"/> Collection.</param> Public Shared Sub Save(Of T)(ByVal MRUItemCollection As T, ByVal filepath As String) Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter ' Serialization. Using Writer As New System.IO.FileStream(filepath, System.IO.FileMode.Create) Serializer.Serialize(Writer, MRUItemCollection) End Using ' Writer End Sub ''' <summary> ''' Loads the specified <see cref="MRU.Item"/> Collection from a local file, using binary deserialization. ''' </summary> ''' <typeparam name="T"></typeparam> ''' <param name="MRUItemCollection">The ByRefered <see cref="MRU.Item"/> collection.</param> ''' <param name="filepath">The filepath to load its <see cref="MRU.Item"/> Collection.</param> Public Shared Sub Load(Of T)(ByRef MRUItemCollection As T, ByVal filepath As String) Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter ' Deserialization. Using Reader As New System.IO.FileStream(filepath, System.IO.FileMode.Open) MRUItemCollection = Serializer.Deserialize(Reader) End Using ' Reader End Sub ''' <summary> ''' Loads the specified <see cref="MRU.Item"/> Collection from a local file, using the specified deserialization. ''' </summary> ''' <typeparam name="T"></typeparam> ''' <param name="filepath">The filepath to load its <see cref="MRU.Item"/> Collection.</param> Public Shared Function Load(Of T)(ByVal filepath As String) As T Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter ' Deserialization. Using Reader As New System.IO.FileStream(filepath, System.IO.FileMode.Open) Return Serializer.Deserialize(Reader) End Using ' Reader End Function #End Region End Class #End Region #Region " Item " ''' <summary> ''' An Item for a MostRecentUsed-Item collection that stores the item filepath and optionally additional info. ''' This Class can be serialized. ''' </summary> <Serializable()> Public Class Item #Region " Constructors " ''' <summary> ''' Prevents a default instance of the <see cref="MRU.Item"/> class from being created. ''' </summary> Private Sub New() End Sub ''' <summary> ''' Initializes a new instance of the <see cref="MRU.Item"/> class. ''' </summary> ''' <param name="FilePath">The item filepath.</param> ''' <exception cref="System.ArgumentNullException">FilePath</exception> Public Sub New(ByVal FilePath As String) If FilePath Is Nothing Then Throw New ArgumentNullException("FilePath") End If Me._FilePath = FilePath End Sub ''' <summary> ''' Initializes a new instance of the <see cref="MRU.Item"/> class. ''' </summary> ''' <param name="File">The fileinfo object.</param> Public Sub New(ByVal File As System. IO. FileInfo) End Sub #End Region #Region " Properties " ''' <summary> ''' Gets the item filepath. ''' </summary> ''' <value>The file path.</value> Public ReadOnly Property FilePath As String Get Return Me._FilePath End Get End Property Private _FilePath As String = String.Empty ''' <summary> ''' Gets the FileInfo object of the item. ''' </summary> ''' <value>The FileInfo object.</value> Public ReadOnly Property FileInfo As System.IO.FileInfo Get Return New System.IO.FileInfo(FilePath) End Get End Property ''' <summary> ''' (Optionally) Gets or sets the item last-time open date. ''' </summary> ''' <value>The index.</value> Public Property [Date] As Date ''' <summary> ''' (Optionally) Gets or sets the item icon. ''' </summary> ''' <value>The icon.</value> Public Property Icon As Bitmap ''' <summary> ''' (Optionally) Gets or sets the item tag. ''' </summary> ''' <value>The tag object.</value> Public Property Tag As Object #End Region End Class #End Region #End Region End Class #End Region
|
|
|
6904
|
Foros Generales / Foro Libre / Re: Raro a la hora de mover algo liquido
|
en: 4 Agosto 2014, 18:41 pm
|
Elektro ¿que pasa si cuando hago el 6 el pie se mueve hacia el lado contrario? xD Que eres normal PD: Supongo que cuando dices que se mueve hacia el lado contrario significa hacia el sentido contrario de las agujas del reloj, de lo contrario ...una de dos, o en vez de intentar hacer un 6 has echo trampas y dibujaste un 3, o tienes genes de Alien. Saludos!
|
|
|
6905
|
Foros Generales / Foro Libre / Re: Raro a la hora de mover algo liquido
|
en: 4 Agosto 2014, 16:11 pm
|
muevo de izquierda a derecha y bueno veo a mis familiares y veo que todos lo mueven de otra forma diferente a la mia Puedes sentirte especial y único por no hacer las cosas como lo hacen todos los demás (aunque sea en la forma en mover un puñetero Té xD) Yo creo que a menos que seas capaz de solucionar el problema que sugiere la siguiente imagen entonces no tienes nada de lo que preocuparte respecto al movimiento que hacen tus extremidades
|
|
|
6906
|
Foros Generales / Dudas Generales / Re: Desactivar Zonas Del Teclado
|
en: 4 Agosto 2014, 14:07 pm
|
No me queda muy clara la pregunta ya que ahí solo hay dígitos por lo tanto siempre es numérico (un punto no es alfabético por lo tanto no hay combinación alfanumérica). De todas formas puedes modificar y/o eliminar la funcionalidad de un set de teclas específicos con aplicaciones como SharpKeys y KeyTweak, eso solucionará el problema que tengas con esas teclas. Si prefieres hacerlo mediante un script este no es el subforo indicado, pásate por la sección de Scripting, explica el problema detalladamente y especifica el lenguaje en el que lo vas a intentar hacer ...no sin antes haber demostrado que has investigado un poco sobre el tema y mostrar tu código. Hay varias maneras de llevarlo a cabo, una manera simple sería registrando un acceso directo global (un Hotkey) de la tecla especifica y no hacer nada cuando se presione dicha tecla, puedes hacerlo con AutoHotkey, la otra seria manipulando la clave de registro del mapeo de teclas como hace la aplicación SharpKeys. Saludos.
|
|
|
6907
|
Programación / .NET (C#, VB.NET, ASP) / Re: Programa en C#
|
en: 4 Agosto 2014, 10:19 am
|
En el código de .::IT::. se está asumiendo que los valores sean enteros y que el resultado también lo sea, pero obviamente el resultado de la suma de dos Int32 podría dar un valor más alto (ej: Int64) Aquí tienes mi versión, por si te sirve de algo: Module Module1 #Region " Enumerations " ''' <summary> ''' Indicates an arithmetic operation. ''' </summary> Public Enum ArithmeticOperation As Integer ''' <summary> ''' Any arithmetic operation. ''' </summary> None = 0 ''' <summary> ''' Sums the values. ''' </summary> Sum = 1I ''' <summary> ''' Subtracts the values. ''' </summary> Subtract = 2I ''' <summary> ''' Multiplies the values. ''' </summary> Multiply = 3I ''' <summary> ''' Divides the values. ''' </summary> Divide = 4I End Enum #End Region #Region " Entry Point (Main)" ''' <summary> ''' Defines the entry point of the application. ''' </summary> Public Sub Main() DoArithmetics() End Sub #End Region #Region " Public Methods " Public Sub DoArithmetics() Dim ExitString As String = String.Empty Dim ExitDemand As Boolean = False Dim Operation As ArithmeticOperation = ArithmeticOperation.None Dim Value1 As Decimal = 0D Dim Value2 As Decimal = 0D Dim Result As Decimal = 0D Do Until ExitDemand SetValue(Value1, "Ingresar el primer numero: ") SetValue(Value2, "Ingresar el segundo numero: ") Console.WriteLine() SetOperation(Operation, "Elegir una operacion aritmética: ") SetResult(Operation, Value1, Value2, Result) Console.WriteLine() Console.WriteLine(String.Format("El resultado es: {0}", CStr(Result))) Console.WriteLine() SetExit(ExitDemand, "S"c, "N"c, "¿Quiere salir? [S/N]: ") Console.Clear() Loop ' ExitDemand End Sub ''' <summary> ''' Asks for a value and waits for the user-input to set the value. ''' </summary> ''' <param name="Value">The ByRefered variable to set the input result.</param> ''' <param name="message">The output message.</param> Public Sub SetValue(ByRef Value As Decimal, Optional ByVal message As String = "Enter a value: ") Dim Success As Boolean = False Do Until Success Console.Write(message) Try Value = Decimal.Parse(Console.ReadLine().Replace("."c, ","c)) Success = True Catch ex As Exception Console.WriteLine(ex.Message) Console.WriteLine() End Try Loop ' Success End Sub ''' <summary> ''' Asks for an arithmetic operation and waits for the user-input to set the value. ''' </summary> ''' <param name="Operation">The ByRefered variable to set the input result.</param> ''' <param name="message">The output message.</param> Public Sub SetOperation(ByRef Operation As ArithmeticOperation, Optional ByVal message As String = "Choose an operation: ") Dim Success As Boolean = False For Each Value As ArithmeticOperation In [Enum].GetValues(GetType(ArithmeticOperation)) Console.Write(String.Format("{0}={1} | ", CStr(Value), Value.ToString)) Next Value Console.WriteLine() Do Until Success Console.Write(message) Try Operation = [Enum].Parse(GetType(ArithmeticOperation), Console.ReadLine, True) Success = True Catch ex As Exception Console.WriteLine(ex.Message) Console.WriteLine() End Try Loop ' Success End Sub ''' <summary> ''' Performs an arithmetic operation on the given values. ''' </summary> ''' <param name="Operation">The arithmetic operation to perform.</param> ''' <param name="Value1">The first value.</param> ''' <param name="Value2">The second value.</param> ''' <param name="Result">The ByRefered variable to set the operation result value.</param> Public Sub SetResult(ByVal Operation As ArithmeticOperation, ByVal Value1 As Decimal, ByVal Value2 As Decimal, ByRef Result As Decimal) Select Case Operation Case ArithmeticOperation.Sum Result = Sum(Value1, Value2) Case ArithmeticOperation.Subtract Result = Subtract(Value1, Value2) Case ArithmeticOperation.Multiply Result = Multiply(Value1, Value2) Case ArithmeticOperation.Divide Result = Divide(Value1, Value2) Case ArithmeticOperation.None ' Do Nothing End Select End Sub ''' <summary> ''' Asks for a Boolean value and waits for the user-input to set the value. ''' </summary> ''' <param name="ExitBool">The ByRefered variable to set the input result.</param> ''' <param name="TrueChar">Indicates the character threated as 'True'.</param> ''' <param name="FalseChar">Indicates the character threated as 'False'.</param> ''' <param name="message">The output message.</param> Public Sub SetExit(ByRef ExitBool As Boolean, Optional ByVal TrueChar As Char = "Y"c, Optional ByVal FalseChar As Char = "N"c, Optional ByVal message As String = "¿Want to exit? [Y/N]: ") Dim Success As Boolean = False Dim Result As Char = Nothing Console.Write(message) Do Until Success Result = Console.ReadKey().KeyChar Select Case Char.ToLower(Result) Case Char.ToLower(TrueChar) ExitBool = True Success = True Case Char.ToLower(FalseChar) ExitBool = False Success = True Case Else Console.Beep() If Not Char.IsLetterOrDigit(Result) Then Console.CursorLeft = 0 SetExit(ExitBool, TrueChar, FalseChar, message) Else Console.CursorLeft = Console.CursorLeft - 1 Console.Write(" ") Console.CursorLeft = Console.CursorLeft - 1 End If End Select ' Char.ToLower(Result) Loop ' Success End Sub #End Region #Region " Private Functions " ''' <summary> ''' Performs a Sum operation on the specified values. ''' </summary> Private Function Sum(ByVal Value1 As Decimal, ByVal Value2 As Decimal) As Decimal Return (Value1 + Value2) End Function ''' <summary> ''' Performs a subtraction operation on the specified values. ''' </summary> Private Function Subtract(ByVal Value1 As Decimal, ByVal Value2 As Decimal) As Decimal Return (Value1 - Value2) End Function ''' <summary> ''' Performs a multiplier operation on the specified values. ''' </summary> Private Function Multiply(ByVal Value1 As Decimal, ByVal Value2 As Decimal) As Decimal Return (Value1 * Value2) End Function ''' <summary> ''' Performs a divider operation on the specified values. ''' </summary> Private Function Divide(ByVal Value1 As Decimal, ByVal Value2 As Decimal) As Decimal Return (Value1 / Value2) End Function #End Region End Module
Traducción instantanea a C#: using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; static class Module1 { #region " Enumerations " /// <summary> /// Indicates an arithmetic operation. /// </summary> public enum ArithmeticOperation : int { /// <summary> /// Any arithmetic operation. /// </summary> None = 0, /// <summary> /// Sums the values. /// </summary> Sum = 1, /// <summary> /// Subtracts the values. /// </summary> Subtract = 2, /// <summary> /// Multiplies the values. /// </summary> Multiply = 3, /// <summary> /// Divides the values. /// </summary> Divide = 4 } #endregion #region " Entry Point (Main)" /// <summary> /// Defines the entry point of the application. /// </summary> public static void Main() { DoArithmetics(); } #endregion #region " Public Methods " public static void DoArithmetics() { string ExitString = string.Empty; bool ExitDemand = false; ArithmeticOperation Operation = ArithmeticOperation.None; decimal Value1 = 0m; decimal Value2 = 0m; decimal Result = 0m; while (!(ExitDemand)) { SetValue(ref Value1, "Ingresar el primer numero: "); SetValue(ref Value2, "Ingresar el segundo numero: "); Console.WriteLine(); SetOperation(ref Operation, "Elegir una operacion aritmética: "); SetResult(Operation, Value1, Value2, ref Result); Console.WriteLine(); Console.WriteLine(string.Format("El resultado es: {0}", Convert.ToString(Result))); Console.WriteLine(); SetExit(ref ExitDemand, 'S', 'N', "¿Quiere salir? [S/N]: "); Console.Clear(); } // ExitDemand } /// <summary> /// Asks for a value and waits for the user-input to set the value. /// </summary> /// <param name="Value">The ByRefered variable to set the input result.</param> /// <param name="message">The output message.</param> public static void SetValue(ref decimal Value, string message = "Enter a value: ") { bool Success = false; while (!(Success)) { Console.Write(message); try { Value = decimal.Parse(Console.ReadLine().Replace('.', ',')); Success = true; } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(); } } // Success } /// <summary> /// Asks for an arithmetic operation and waits for the user-input to set the value. /// </summary> /// <param name="Operation">The ByRefered variable to set the input result.</param> /// <param name="message">The output message.</param> public static void SetOperation(ref ArithmeticOperation Operation, string message = "Choose an operation: ") { bool Success = false; foreach (ArithmeticOperation Value in Enum.GetValues(typeof(ArithmeticOperation ))) { Console.Write(string.Format("{0}={1} | ", Convert.ToString(Value), Value.ToString)); } Console.WriteLine(); while (!(Success)) { Console.Write(message); try { Operation = Enum.Parse(typeof(ArithmeticOperation ), Console .ReadLine, true); Success = true; } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(); } } // Success } /// <summary> /// Performs an arithmetic operation on the given values. /// </summary> /// <param name="Operation">The arithmetic operation to perform.</param> /// <param name="Value1">The first value.</param> /// <param name="Value2">The second value.</param> /// <param name="Result">The ByRefered variable to set the operation result value.</param> public static void SetResult(ArithmeticOperation Operation, decimal Value1, decimal Value2, ref decimal Result) { switch (Operation) { case ArithmeticOperation.Sum: Result = Sum(Value1, Value2); break; case ArithmeticOperation.Subtract: Result = Subtract(Value1, Value2); break; case ArithmeticOperation.Multiply: Result = Multiply(Value1, Value2); break; case ArithmeticOperation.Divide: Result = Divide(Value1, Value2); break; case ArithmeticOperation.None: break; // Do Nothing } } /// <summary> /// Asks for a Boolean value and waits for the user-input to set the value. /// </summary> /// <param name="ExitBool">The ByRefered variable to set the input result.</param> /// <param name="TrueChar">Indicates the character threated as 'True'.</param> /// <param name="FalseChar">Indicates the character threated as 'False'.</param> /// <param name="message">The output message.</param> public static void SetExit(ref bool ExitBool, char TrueChar = 'Y', char FalseChar = 'N', string message = "¿Want to exit? [Y/N]: ") { bool Success = false; char Result = null; Console.Write(message); while (!(Success)) { Result = Console.ReadKey().KeyChar; switch (char.ToLower(Result)) { case char.ToLower(TrueChar): ExitBool = true; Success = true; break; case char.ToLower(FalseChar): ExitBool = false; Success = true; break; default: Console.Beep(); if (!char.IsLetterOrDigit(Result)) { Console.CursorLeft = 0; SetExit(ref ExitBool, TrueChar, FalseChar, message); } else { Console.CursorLeft = Console.CursorLeft - 1; Console.Write(" "); Console.CursorLeft = Console.CursorLeft - 1; } break; } // Char.ToLower(Result) } // Success } #endregion #region " Private Functions " /// <summary> /// Performs a Sum operation on the specified values. /// </summary> private static decimal Sum(decimal Value1, decimal Value2) { return (Value1 + Value2); } /// <summary> /// Performs a subtraction operation on the specified values. /// </summary> private static decimal Subtract(decimal Value1, decimal Value2) { return (Value1 - Value2); } /// <summary> /// Performs a multiplier operation on the specified values. /// </summary> private static decimal Multiply(decimal Value1, decimal Value2) { return (Value1 * Value2); } /// <summary> /// Performs a divider operation on the specified values. /// </summary> private static decimal Divide(decimal Value1, decimal Value2) { return (Value1 / Value2); } #endregion } //======================================================= //Service provided by Telerik (www.telerik.com) //Conversion powered by NRefactory. //Twitter: @telerik //Facebook: facebook.com/telerik //=======================================================
|
|
|
6909
|
Programación / .NET (C#, VB.NET, ASP) / Re: Ayuda con un pequeño ejercicio que estoy haciendo en C# con windows form?
|
en: 3 Agosto 2014, 19:24 pm
|
"talonary"? , menuda invención , supongo que intentaste traducir "talonario" al inglés, en ese caso el termino correcto es counterfoil. Respecto a la Class, ¿podrias especificar en que necesitas ayuda?, eso no me ha quedado claro, de todas formas si lo que buscas son que te demos consejos, entonces yo te sugiero que guardes la información a modo de base de datos (XML es un formato que me gusta, porque es legible por el humano) y la guardes en un archivo local para guardar los datos de todos los clientes, serializándolo, y acceder cuando precises (deserializando). Te mostraría un ejemplo, pero sería en VB.NET, de todas formas en MSDN puedes encontrar ejemplos de serialización por XML como este. Espero que te haya servido de algo, Saludos. EDITO:No estoy acostumbrado a manejar C#, pero aqui tienes unas cuantas mejoras que le hice: EDITO:Se me olvidaba comentar que mientras la class siga igual de "simple" realmente no es necesario implementar ISerializable (ni IXmlSerializable), pero mejor tenerlo implementado de manera básica por si piensas hacerle cambios "importantes" en el futuro y lo puedas necesitar, le añadí la implementación de serialización binaria, pero como ya digo todo eso no es necesario ahora mismo, sin implementarlo puedes serializar. #region Usings using System; using System.Runtime.Serialization; using System.Security.Permissions; using System.Xml.Serialization; using System.Xml; #endregion /// <summary> /// Class talonary (or Counterfoil? xD). /// This class can be serialized. /// </summary> [Serializable] public class talonary : ISerializable, IXmlSerializable { #region Properties /// <summary> /// Gets or sets the client name. /// </summary> /// <value>The name.</value> public string name { get { return this._name; } set { this._name = value; } } private string _name; /// <summary> /// Gets or sets the client surname. /// </summary> /// <value>The surname.</value> public string surname { get { return this._surname; } set { this._surname = value; } } private string _surname; /// <summary> /// Gets or sets the client salary. /// </summary> /// <value>The salary.</value> public double salary { get { return this._salary; } set { this._salary = value; } } private double _salary; /// <summary> /// Gets the client salary. /// </summary> /// <value>The salary.</value> public double discountedSalary { get { return (this._salary * 0.05D) - this._salary; } } #endregion #region Constructors /// <summary> /// Prevents a default instance of the <see cref="talonary"/> class from being created. /// </summary> private talonary() { } /// <summary> /// Initializes a new instance of the <see cref="talonary"/> class. /// </summary> /// <param name="name">Indicates the client name.</param> /// <param name="surname">Indicates the client surname.</param> /// <param name="salary">Indicates the client salary.</param> public talonary(string name, string surname, double salary) { if (name == null) { throw new ArgumentNullException ("name"); } this._name = name; this._surname = surname; this._salary = salary; } #endregion #region ISerializable implementation | For Binary serialization. /// <summary> /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data.</param> /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this serialization.</param> [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException ("info"); } info .AddValue("name", this._name, typeof(string)); info .AddValue("surname", this._surname, typeof(string)); info .AddValue("salary", this._salary, typeof(double)); } /// <summary> /// Initializes a new instance of the <see cref="talonary"/> class. /// This constructor is used to deserialize values. /// </summary> /// <param name="info">The information.</param> /// <param name="context">The context.</param> protected talonary(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException ("info"); } this._name = (string)info .GetValue("name", typeof(string)); this._surname = (string)info .GetValue("surname", typeof(string)); this._salary = (double)info .GetValue("salary", typeof(double)); } #endregion #region "IXMLSerializable implementation" | For XML serialization. /// <summary> /// This method is reserved and should not be used. /// When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, /// and instead, if specifying a custom schema is required, apply the <see cref="T:XmlSchemaProviderAttribute"/> to the class. /// </summary> /// <returns> /// An <see cref="T:Xml.Schema.XmlSchema"/> that describes the XML representation of the object /// that is produced by the <see cref="M:IXmlSerializable.WriteXml(Xml.XmlWriter)"/> method /// and consumed by the <see cref="M:IXmlSerializable.ReadXml(Xml.XmlReader)"/> method. /// </returns> public System.Xml.Schema.XmlSchema GetSchema() { return null; } /// <summary> /// Converts an object into its XML representation. /// </summary> /// <param name="writer">The <see cref="T:Xml.XmlWriter"/> stream to which the object is serialized.</param> public void WriteXml(XmlWriter writer) { writer.WriteElementString("name", this._name); writer.WriteElementString("surname", this._surname); writer.WriteElementString("salary", Convert.ToString(this._salary)); } /// <summary> /// Generates an object from its XML representation. /// </summary> /// <param name="reader">The <see cref="T:Xml.XmlReader"/> stream from which the object is deserialized.</param> public void ReadXml(XmlReader reader) { reader.ReadStartElement(base.GetType().Name); this._name = reader.ReadElementContentAsString(); this._surname = reader.ReadElementContentAsString(); this._salary = reader.ReadElementContentAsDouble(); } #endregion }
EDITO:No te vendría mal leer esto, sobre la serialización XML: http://support.microsoft.com/kb/316730Ejemplo: Imports System.IO Imports System.Xml.Serialization Public Class TestClass : Inherits form Private Sub Test_Handler() Handles MyBase.Shown Dim Clients As New List(Of talonary) With Clients .Add(New talonary("pedro", "castaño", 10.0R)) .Add(New talonary("manolo", "ToLoko", 150.0R)) .Add(New talonary("Elektro", "Zero", Double.MaxValue)) End With ' Serialización XML. Using Writer As New StreamWriter(".\Clients.xml") Dim Serializer As New XmlSerializer(Clients.GetType) Serializer.Serialize(Writer, Clients) End Using ' Deserialización XML. Using Reader As New StreamReader(".\Clients.xml") Dim Serializer As New XmlSerializer(Clients.GetType) Dim tmpClients As List(Of talonary) = Serializer.Deserialize(Reader) For Each Client As talonary In tmpClients MessageBox.Show(Client.name) Next End Using End Sub End Class
Traducción al vuelo a C# (no lo he testeado): using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.IO; using System.Xml.Serialization; public class TestClass : form { private void Test_Handler() { List <talonary > Clients = new List <talonary >(); var _with1 = Clients; _with1 .Add(new talonary ("pedro", "castaño", 10.0)); _with1 .Add(new talonary ("manolo", "ToLoko", 150.0)); _with1 .Add(new talonary ("Elektro", "Zero", double.MaxValue)); // Serialización XML. using (StreamWriter Writer = new StreamWriter (".\\Clients.xml")) { XmlSerializer Serializer = new XmlSerializer (Clients .GetType); Serializer.Serialize(Writer, Clients); } // Deserialización XML. using (StreamReader Reader = new StreamReader (".\\Clients.xml")) { XmlSerializer Serializer = new XmlSerializer (Clients .GetType); List<talonary> tmpClients = Serializer.Deserialize(Reader); foreach (talonary Client in tmpClients) { MessageBox.Show(Client.name); } } } public TestClass() { Shown += Test_Handler; } } //======================================================= //Service provided by Telerik (www.telerik.com) //Conversion powered by NRefactory. //Twitter: @telerik //Facebook: facebook.com/telerik //=======================================================
Saludos.
|
|
|
6910
|
Foros Generales / Foro Libre / Re: desproteger un archivo comprimido con contraseña sin saberla
|
en: 3 Agosto 2014, 19:11 pm
|
Buenas Este es un tema que se ha comentado, explicado, y solucionado CIENTOS de veces en el foro, pues no eres el único que se ha preguntado " como crackear un archivo comprimido", eso ya lo sabías, así que porfavor utiliza el buscador del foro antes de preguntar, que para algo está, jeje. · http://foro.elhacker.net/hacking_avanzado/como_sacar_la_contrasena_de_un_archivo_winrar-t399233.0.html;msg1886728#msg1886728· http://foro.elhacker.net/hacking_basico/como_hackear_archivos_con_metodo_fuerza_bruta-t410646.0.html;msg1927549#msg1927549· http://foro.elhacker.net/software/iquestcomo_abrir_archivos_rar_que_tengan_contrasenas-t311203.0.html;msg1899910#msg1899910· http://foro.elhacker.net/search.htmlLo más práctico, lógico, y sencillo es que antes de descargarte un archivo pesado compruebes si especifica alguna contraseña en la fuente (página) desde donde iniciaste la descarga. Saludos.
|
|
|
|
|
|
|