elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Estamos en la red social de Mastodon


  Mostrar Mensajes
Páginas: 1 ... 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 [684] 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 ... 1236
6831  Programación / Scripting / Re: [VBS] Utilizar parámetros desde línea de comandos? en: 16 Agosto 2014, 21:57 pm
Quisiera saber si es posible ejecutar un vbscript desde cmd utilizando parámetros.

Si, se puede.

Arguments Property (WScript Object)

Código
  1. Set Arguments = WScript.Arguments
  2.  
  3. If Arguments.Count <> 2 Then
  4.   WScript.Echo "Cantidad de parámetros incorrecta."
  5.   WScript.Quit(1)
  6.  
  7. Else
  8.   strSource = WScript.Arguments(0)
  9.   strDest = WScript.Arguments(1)
  10.   ' Resto del código aquí...
  11.  
  12. End If

Saludos.
6832  Programación / .NET (C#, VB.NET, ASP) / Re: Mis malas combinaciones :( en: 16 Agosto 2014, 03:29 am
04 07 10 13 16 19 22 24 28  ?  <- aca rellenar con un numero dentro del rango 01 al 99 y por supuesto no se repita en la conbinacion esto es cuando se agoten los números de que tenga la variable

1.
¿el número del 1 al 99 del interogante debe ser aleatorio? (ej: ¿daría igual si es 5 o 95?), o por lo contrario debería seguir un orden de incremento (primero el 1, luego en el siguiente interrogante el 2, y en otro interrogante el 3, etc...)

2.
¿el número del interogante debe ser un número del 1 al 99, pero ese número además debe existir dentro de la variable Result? (y, repito lo del punto .1, ¿debe ser aleatorio?)



En teoría supongo que con un For asignándole un Step de 2 e incrementando el valor de una variable que usariamos para especificar el índice del elemento inicial en cada repetición del búcle sería suficiente, pero lo de los interrogantes lo veo algo más complicado, quizás no lo sea tanto, aclárame eso y veré lo que puedo hacer.

Saludos!
6833  Programación / .NET (C#, VB.NET, ASP) / Re: Programa en C# de Matrices en: 16 Agosto 2014, 03:15 am
Buenas

Aquí no le hacemos el trabajo a nadie, ayudamos a que aprendas como conseguir hacerlo por ti mismo.

¿Donde está tu código?, muestra tu progreso.

PD: Un detalle que no has aclarado, ¿eso lo quieres hacer en una aplicación CommandLine-Interface?.

Saludos!
6834  Programación / .NET (C#, VB.NET, ASP) / Re: VB. Net conocimientos en: 16 Agosto 2014, 02:10 am
Buenas.

Esta es la mejor, actual, irremplazable, y más completa guía y documentación que existe y que existirá:




Descripción de las características del lenguaje

Documentación y ejemplos de uso de las características del lenguaje

Tutoriales y ejemplos de códigos

Video-tutoriales

Consejos de uso y adquisición de buenas costumbres

Códigos fuente

+

Documentación de la API de Windows





Aparte de todo lo que ofrece MSDN, ¿porque no miras los posts que hay con chincheta en esta sección? (para algo se pusieron arriba del todo, para que la gente no tenga que hacer siempre las mismas preguntas...)
· Manuales de .NET  (Leído 35263 veces)

PD: El tutorial de elguille está muy bien para iniciarse, ya que además de estar en Castellano no exponen la información de manera tan compleja como en algunos aspectos que enseñan en MSDN, pero en mi opinión es mejor aprender a lo hardcore matandose a leer y leer en MSDN, ya que aprenderás más y mejor.

¡Saludos!
6835  Programación / .NET (C#, VB.NET, ASP) / Re: Me pueden ayduar con esto en c# en: 16 Agosto 2014, 01:41 am
Buenas.

Si ni siquiera explicas como estás moviendo los controles en la UI, no se como esperas que alguien pueda ayudarte a detectar colisiones entre los controles.

1. ¿Que significa para ti "chocar"?, ¿quieres detectar cuando los márgenes de "X" PictureBox colisiona con los de "Y" PictureBox en la interface?.

2. Muestra los event-handlers de tu código (los de los pictureboxes) para saber como los mueves por la UI,
    muestra todo lo demás del código que pueda servir para ayudarte, todo lo que sea código relevante.

Pero sobretodo MUESTRA TU CÓDIGO cuando formules una pregunta que esté relacionada con un código.

Saludos!
6836  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 15 Agosto 2014, 20:33 pm
Una Class para cortar y unir archivos al mismo estilo que WinRAR (me refiero a la enumeración de los archivos partidos, este no comprime solo corta).

Código
  1. ' ***********************************************************************
  2. ' Author           : Elektro
  3. ' Last Modified On : 08-15-2014
  4. ' ***********************************************************************
  5. ' <copyright file="FileSplitter.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Imports "
  11.  
  12. Imports System.ComponentModel
  13. Imports System.IO
  14.  
  15. #End Region
  16.  
  17. Public Class FileSplitter
  18.  
  19. #Region " Properties "
  20.  
  21.    ''' <summary>
  22.    ''' Gets or sets the buffer-size to split or merge, in Bytes.
  23.    ''' Default value is: 1048576 bytes (1 megabyte).
  24.    ''' </summary>
  25.    ''' <value>The buffer-size.</value>
  26.    Public Property BufferSize As Integer = 1048576I
  27.  
  28. #End Region
  29.  
  30. #Region " Events "
  31.  
  32. #Region " EventHandlers "
  33.  
  34.    ''' <summary>
  35.    ''' Occurs when the progress changes splitting a file.
  36.    ''' </summary>
  37.    Public Event SplitProgressChanged As EventHandler(Of SplitProgressChangedArgs)
  38.  
  39.    ''' <summary>
  40.    ''' Occurs when the progress changes merging a file.
  41.    ''' </summary>
  42.    Public Event MergeProgressChanged As EventHandler(Of MergeProgressChangedArgs)
  43.  
  44. #End Region
  45.  
  46. #Region " Event Args "
  47.  
  48. #Region " SplitProgressChanged "
  49.  
  50.    ''' <summary>
  51.    ''' Contains the Event arguments of the SplitProgressChanged Event.
  52.    ''' </summary>
  53.    Public Class SplitProgressChangedArgs : Inherits EventArgs
  54.  
  55. #Region " Constructors "
  56.  
  57.        ''' <summary>
  58.        ''' Prevents a default instance of the <see cref="SplitProgressChangedArgs"/> class from being created.
  59.        ''' </summary>
  60.        Private Sub New()
  61.        End Sub
  62.  
  63.        ''' <summary>
  64.        ''' Initializes a new instance of the <see cref="SplitProgressChangedArgs"/> class.
  65.        ''' </summary>
  66.        ''' <param name="TotalProgress">The total progress value.</param>
  67.        ''' <param name="ChunkProgress">The current chunk progress value.</param>
  68.        ''' <param name="ChunksToCreate">The amount of chunks to create.</param>
  69.        ''' <param name="ChunksCreated">The amount of created chunks.</param>
  70.        Public Sub New(ByVal TotalProgress As Double,
  71.                       ByVal ChunkProgress As Double,
  72.                       ByVal ChunksToCreate As Integer,
  73.                       ByVal ChunksCreated As Integer)
  74.  
  75.            Me._TotalProgress = TotalProgress
  76.            Me._ChunkProgress = ChunkProgress
  77.            Me._ChunksToCreate = ChunksToCreate
  78.            Me._ChunksCreated = ChunksCreated
  79.  
  80.        End Sub
  81.  
  82. #End Region
  83.  
  84. #Region " Properties "
  85.  
  86.        ''' <summary>
  87.        ''' Gets the total progress value.
  88.        ''' (From 0 to 100)
  89.        ''' </summary>
  90.        ''' <value>The total progress value.</value>
  91.        Public ReadOnly Property TotalProgress As Double
  92.            Get
  93.                Return Me._TotalProgress
  94.            End Get
  95.        End Property
  96.        Private _TotalProgress As Double = 0.0R
  97.  
  98.        ''' <summary>
  99.        ''' Gets the current chunk progress value.
  100.        ''' </summary>
  101.        ''' <value>The current chunk progress value.</value>
  102.        Public ReadOnly Property ChunkProgress As Double
  103.            Get
  104.                Return Me._ChunkProgress
  105.            End Get
  106.        End Property
  107.        Private _ChunkProgress As Double = 0.0R
  108.  
  109.        ''' <summary>
  110.        ''' Gets the amount of chunks to create.
  111.        ''' </summary>
  112.        ''' <value>The amount of chunks to create.</value>
  113.        Public ReadOnly Property ChunksToCreate As Integer
  114.            Get
  115.                Return Me._ChunksToCreate
  116.            End Get
  117.        End Property
  118.        Private _ChunksToCreate As Integer = 0I
  119.  
  120.        ''' <summary>
  121.        ''' Gets the amount of created chunks.
  122.        ''' </summary>
  123.        ''' <value>The amount of created chunks.</value>
  124.        Public ReadOnly Property ChunksCreated As Integer
  125.            Get
  126.                Return Me._ChunksCreated
  127.            End Get
  128.        End Property
  129.        Private _ChunksCreated As Integer = 0I
  130.  
  131. #End Region
  132.  
  133. #Region " Hidden Methods "
  134.  
  135.        ''' <summary>
  136.        ''' Serves as a hash function for a particular type.
  137.        ''' </summary>
  138.        <EditorBrowsable(EditorBrowsableState.Never)>
  139.        Public Shadows Sub GetHashCode()
  140.        End Sub
  141.  
  142.        ''' <summary>
  143.        ''' Determines whether the specified System.Object instances are considered equal.
  144.        ''' </summary>
  145.        <EditorBrowsable(EditorBrowsableState.Never)>
  146.        Public Shadows Sub Equals()
  147.        End Sub
  148.  
  149.        ''' <summary>
  150.        ''' Determines whether the specified System.Object instances are the same instance.
  151.        ''' </summary>
  152.        <EditorBrowsable(EditorBrowsableState.Never)>
  153.        Private Shadows Sub ReferenceEquals()
  154.        End Sub
  155.  
  156.        ''' <summary>
  157.        ''' Returns a String that represents the current object.
  158.        ''' </summary>
  159.        <EditorBrowsable(EditorBrowsableState.Never)>
  160.        Public Shadows Sub ToString()
  161.        End Sub
  162.  
  163. #End Region
  164.  
  165.    End Class
  166.  
  167. #End Region
  168.  
  169. #Region " MergeProgressChangedArgs "
  170.  
  171.    ''' <summary>
  172.    ''' Contains the Event arguments of the MergeProgressChangedArgs Event.
  173.    ''' </summary>
  174.    Public Class MergeProgressChangedArgs : Inherits EventArgs
  175.  
  176. #Region " Constructors "
  177.  
  178.        ''' <summary>
  179.        ''' Prevents a default instance of the <see cref="MergeProgressChangedArgs"/> class from being created.
  180.        ''' </summary>
  181.        Private Sub New()
  182.        End Sub
  183.  
  184.        ''' <summary>
  185.        ''' Initializes a new instance of the <see cref="MergeProgressChangedArgs"/> class.
  186.        ''' </summary>
  187.        ''' <param name="TotalProgress">The total progress value.</param>
  188.        ''' <param name="ChunkProgress">The current chunk progress value.</param>
  189.        ''' <param name="ChunksToMerge">The amount of chunks to merge.</param>
  190.        ''' <param name="ChunksMerged">The amount of merged chunks.</param>
  191.        Public Sub New(ByVal TotalProgress As Double,
  192.                       ByVal ChunkProgress As Double,
  193.                       ByVal ChunksToMerge As Integer,
  194.                       ByVal ChunksMerged As Integer)
  195.  
  196.            Me._TotalProgress = TotalProgress
  197.            Me._ChunkProgress = ChunkProgress
  198.            Me._ChunksToMerge = ChunksToMerge
  199.            Me._ChunksMerged = ChunksMerged
  200.  
  201.        End Sub
  202.  
  203. #End Region
  204.  
  205. #Region " Properties "
  206.  
  207.        ''' <summary>
  208.        ''' Gets the total progress value.
  209.        ''' (From 0 to 100)
  210.        ''' </summary>
  211.        ''' <value>The total progress value.</value>
  212.        Public ReadOnly Property TotalProgress As Double
  213.            Get
  214.                Return Me._TotalProgress
  215.            End Get
  216.        End Property
  217.        Private _TotalProgress As Double = 0.0R
  218.  
  219.        ''' <summary>
  220.        ''' Gets the current chunk progress value.
  221.        ''' </summary>
  222.        ''' <value>The current chunk progress value.</value>
  223.        Public ReadOnly Property ChunkProgress As Double
  224.            Get
  225.                Return Me._ChunkProgress
  226.            End Get
  227.        End Property
  228.        Private _ChunkProgress As Double = 0.0R
  229.  
  230.        ''' <summary>
  231.        ''' Gets the amount of chunks to merge.
  232.        ''' </summary>
  233.        ''' <value>The amount of chunks to merge.</value>
  234.        Public ReadOnly Property ChunksToMerge As Integer
  235.            Get
  236.                Return Me._ChunksToMerge
  237.            End Get
  238.        End Property
  239.        Private _ChunksToMerge As Integer = 0I
  240.  
  241.        ''' <summary>
  242.        ''' Gets the amount of merged chunks.
  243.        ''' </summary>
  244.        ''' <value>The amount of merged chunks.</value>
  245.        Public ReadOnly Property ChunksMerged As Integer
  246.            Get
  247.                Return Me._ChunksMerged
  248.            End Get
  249.        End Property
  250.        Private _ChunksMerged As Integer = 0I
  251.  
  252. #End Region
  253.  
  254. #Region " Hidden Methods "
  255.  
  256.        ''' <summary>
  257.        ''' Serves as a hash function for a particular type.
  258.        ''' </summary>
  259.        <EditorBrowsable(EditorBrowsableState.Never)>
  260.        Public Shadows Sub GetHashCode()
  261.        End Sub
  262.  
  263.        ''' <summary>
  264.        ''' Determines whether the specified System.Object instances are considered equal.
  265.        ''' </summary>
  266.        <EditorBrowsable(EditorBrowsableState.Never)>
  267.        Public Shadows Sub Equals()
  268.        End Sub
  269.  
  270.        ''' <summary>
  271.        ''' Determines whether the specified System.Object instances are the same instance.
  272.        ''' </summary>
  273.        <EditorBrowsable(EditorBrowsableState.Never)>
  274.        Private Shadows Sub ReferenceEquals()
  275.        End Sub
  276.  
  277.        ''' <summary>
  278.        ''' Returns a String that represents the current object.
  279.        ''' </summary>
  280.        <EditorBrowsable(EditorBrowsableState.Never)>
  281.        Public Shadows Sub ToString()
  282.        End Sub
  283.  
  284. #End Region
  285.  
  286.    End Class
  287.  
  288. #End Region
  289.  
  290. #End Region
  291.  
  292. #End Region
  293.  
  294. #Region " Hidden Methods "
  295.  
  296.    ''' <summary>
  297.    ''' Serves as a hash function for a particular type.
  298.    ''' </summary>
  299.    <EditorBrowsable(EditorBrowsableState.Never)>
  300.    Public Shadows Sub GetHashCode()
  301.    End Sub
  302.  
  303.    ''' <summary>
  304.    ''' Determines whether the specified System.Object instances are considered equal.
  305.    ''' </summary>
  306.    <EditorBrowsable(EditorBrowsableState.Never)>
  307.    Public Shadows Sub Equals()
  308.    End Sub
  309.  
  310.    ''' <summary>
  311.    ''' Determines whether the specified System.Object instances are the same instance.
  312.    ''' </summary>
  313.    <EditorBrowsable(EditorBrowsableState.Never)>
  314.    Private Shadows Sub ReferenceEquals()
  315.    End Sub
  316.  
  317.    ''' <summary>
  318.    ''' Returns a String that represents the current object.
  319.    ''' </summary>
  320.    <EditorBrowsable(EditorBrowsableState.Never)>
  321.    Public Shadows Sub ToString()
  322.    End Sub
  323.  
  324. #End Region
  325.  
  326. #Region " Public Methods "
  327.  
  328.    ''' <summary>
  329.    ''' Splits the specified file.
  330.    ''' </summary>
  331.    ''' <param name="InputFile">Indicates the file to split.</param>
  332.    ''' <param name="ChunkSize">Indicates the size of each chunk.</param>
  333.    ''' <param name="ChunkName">Indicates the name-format for the chunks.</param>
  334.    ''' <param name="ChunkExt">Indicates the file-extension for the chunks.</param>
  335.    ''' <param name="Overwrite">
  336.    ''' If set to <c>true</c> any existing file will be overwritten if needed to create a chunk,
  337.    ''' otherwise, an exception will be thrown.
  338.    ''' </param>
  339.    ''' <param name="DeleteAfterSplit">If set to <c>true</c> the input file will be deleted after a successful split.</param>
  340.    ''' <exception cref="System.IO.FileNotFoundException">The specified file doesn't exists.</exception>
  341.    ''' <exception cref="System.IO.IOException">File already exists.</exception>
  342.    ''' <exception cref="System.OverflowException">'ChunkSize' should be smaller than the Filesize.</exception>
  343.    Public Sub Split(ByVal InputFile As String,
  344.                     ByVal ChunkSize As Long,
  345.                     Optional ByVal ChunkName As String = Nothing,
  346.                     Optional ByVal ChunkExt As String = Nothing,
  347.                     Optional ByVal Overwrite As Boolean = False,
  348.                     Optional ByVal DeleteAfterSplit As Boolean = False)
  349.  
  350.        If Not File.Exists(InputFile) Then
  351.            Throw New FileNotFoundException("The specified file doesn't exists.", InputFile)
  352.            Exit Sub
  353.        End If
  354.  
  355.        ' The progress event arguments.
  356.        Dim ProgressArguments As SplitProgressChangedArgs
  357.  
  358.        ' FileInfo instance of the input file.
  359.        Dim fInfo As New FileInfo(InputFile)
  360.  
  361.        ' The total filesize to split, in bytes.
  362.        Dim TotalSize As Long = fInfo.Length
  363.  
  364.        ' The remaining size to calculate the percentage, in bytes.
  365.        Dim SizeRemaining As Long = TotalSize
  366.  
  367.        ' Counts the length of the current chunk file to calculate the percentage, in bytes.
  368.        Dim SizeWritten As Long = 0L
  369.  
  370.        ' The buffer to read data and write the chunks.
  371.        Dim Buffer As Byte() = New Byte() {}
  372.  
  373.        ' The buffer length.
  374.        Dim BufferLength As Integer = Me.BufferSize
  375.  
  376.        ' The total amount of chunks to create.
  377.        Dim ChunkCount As Integer = CInt(Math.Floor(fInfo.Length / ChunkSize))
  378.  
  379.        ' Keeps track of the current chunk.
  380.        Dim ChunkIndex As Integer = 0I
  381.  
  382.        ' Keeps track of the total percentage done.
  383.        Dim TotalProgress As Double = 0.0R
  384.  
  385.        ' Keeps track of the current chunk percentage done.
  386.        Dim ChunkProgress As Double = 0.0R
  387.  
  388.        ' A zero-filled string to enumerate the chunk files.
  389.        Dim Zeros As String = String.Empty
  390.  
  391.        ' The given filename for each chunk.
  392.        Dim ChunkFile As String = String.Empty
  393.  
  394.        ' The chunk file basename.
  395.        ChunkName = If(String.IsNullOrEmpty(ChunkName),
  396.                       Path.Combine(fInfo.DirectoryName, Path.GetFileNameWithoutExtension(fInfo.Name)),
  397.                       Path.Combine(fInfo.DirectoryName, ChunkName))
  398.  
  399.        ' The chunk file extension.
  400.        ChunkExt = If(String.IsNullOrEmpty(ChunkExt),
  401.                      fInfo.Extension.Substring(1I),
  402.                      ChunkExt)
  403.  
  404.        ' If ChunkSize is bigger than filesize then...
  405.        If ChunkSize >= fInfo.Length Then
  406.            Throw New OverflowException("'ChunkSize' should be smaller than the Filesize.")
  407.            Exit Sub
  408.  
  409.            ' For cases where a chunksize is smaller than the buffersize.
  410.        ElseIf ChunkSize < BufferLength Then
  411.            BufferLength = CInt(ChunkSize)
  412.  
  413.        End If ' ChunkSize <>...
  414.  
  415.        ' If not file-overwrite is allowed then...
  416.        If Not Overwrite Then
  417.  
  418.            For Index As Integer = 0I To (ChunkCount)
  419.  
  420.                ' Set chunk filename.
  421.                Zeros = New String("0", CStr(ChunkCount).Length - CStr(Index + 1I).Length)
  422.                ChunkFile = String.Format("{0}.{1}.{2}", ChunkName, Zeros & CStr(Index + 1I), ChunkExt)
  423.  
  424.                ' If chunk file already exists then...
  425.                If File.Exists(ChunkFile) Then
  426.  
  427.                    Throw New IOException(String.Format("File already exists: {0}", ChunkFile))
  428.                    Exit Sub
  429.  
  430.                End If ' File.Exists(ChunkFile)
  431.  
  432.            Next Index
  433.  
  434.            Zeros = String.Empty
  435.            ChunkFile = String.Empty
  436.  
  437.        End If ' Overwrite
  438.  
  439.        ' Open the file to start reading bytes.
  440.        Using InputStream As New FileStream(fInfo.FullName, FileMode.Open)
  441.  
  442.            Using BinaryReader As New BinaryReader(InputStream)
  443.  
  444.                While (InputStream.Position < InputStream.Length)
  445.  
  446.                    ' Set chunk filename.
  447.                    Zeros = New String("0", CStr(ChunkCount).Length - CStr(ChunkIndex + 1I).Length)
  448.                    ChunkFile = String.Format("{0}.{1}.{2}", ChunkName, Zeros & CStr(ChunkIndex + 1I), ChunkExt)
  449.  
  450.                    ' Reset written byte-length counter.
  451.                    SizeWritten = 0L
  452.  
  453.  
  454.                    ' Create the chunk file to Write the bytes.
  455.                    Using OutputStream As New FileStream(ChunkFile, FileMode.Create)
  456.  
  457.                        Using BinaryWriter As New BinaryWriter(OutputStream)
  458.  
  459.                            ' Read until reached the end-bytes of the input file.
  460.                            While (SizeWritten < ChunkSize) AndAlso (InputStream.Position < InputStream.Length)
  461.  
  462.                                ' Read bytes from the original file (BufferSize byte-length).
  463.                                Buffer = BinaryReader.ReadBytes(BufferLength)
  464.  
  465.                                ' Write those bytes in the chunk file.
  466.                                BinaryWriter.Write(Buffer)
  467.  
  468.                                ' Increment the bytes-written counter.
  469.                                SizeWritten += Buffer.Count
  470.  
  471.                                ' Decrease the bytes-remaining counter.
  472.                                SizeRemaining -= Buffer.Count
  473.  
  474.                                ' Set the total progress.
  475.                                TotalProgress = (TotalSize - SizeRemaining) * (100I / TotalSize)
  476.  
  477.                                ' Set the current chunk progress.
  478.                                ChunkProgress =
  479.                                    If(Not ChunkIndex = ChunkCount,
  480.                                       (100I / ChunkSize) * (SizeWritten - BufferLength),
  481.                                       (100I / (InputStream.Length - (ChunkSize * ChunkIndex))) * (SizeWritten - BufferLength))
  482.  
  483.                                ' Set the progress event-arguments.
  484.                                ProgressArguments =
  485.                                    New SplitProgressChangedArgs(
  486.                                        TotalProgress:=If(Not TotalProgress > 99.9R, TotalProgress, 99.9R),
  487.                                        ChunkProgress:=ChunkProgress,
  488.                                        ChunksToCreate:=ChunkCount + 1I,
  489.                                        ChunksCreated:=ChunkIndex)
  490.  
  491.                                ' Report the progress event-arguments.
  492.                                RaiseEvent SplitProgressChanged(Me, ProgressArguments)
  493.  
  494.                            End While ' (SizeWritten < ChunkSize) AndAlso (InputStream.Position < InputStream.Length)
  495.  
  496.                            OutputStream.Flush()
  497.  
  498.                        End Using ' BinaryWriter
  499.  
  500.                    End Using ' OutputStream
  501.  
  502.                    ChunkIndex += 1I 'Increment the chunk file counter.
  503.  
  504.                End While ' InputStream.Position < InputStream.Length
  505.  
  506.            End Using ' BinaryReader
  507.  
  508.        End Using ' InputStream
  509.  
  510.        ' Set the progress event-arguments.
  511.        ProgressArguments =
  512.            New SplitProgressChangedArgs(
  513.                TotalProgress:=100.0R,
  514.                ChunkProgress:=100.0R,
  515.                ChunksToCreate:=ChunkCount + 1I,
  516.                ChunksCreated:=ChunkIndex)
  517.  
  518.        ' Report the progress event-arguments.
  519.        RaiseEvent SplitProgressChanged(Me, ProgressArguments)
  520.  
  521.    End Sub
  522.  
  523.    ''' <summary>
  524.    ''' Merges the specified file.
  525.    ''' </summary>
  526.    ''' <param name="InputFile">
  527.    ''' Indicates the file to merge its chunks.
  528.    ''' This should be the first chunk file (eg: 'File.Part.01.mkv')
  529.    ''' </param>
  530.    ''' <param name="OutputFile">Indicates the output file.</param>
  531.    ''' <param name="Overwrite">
  532.    ''' If set to <c>true</c>, in case that the 'OutputFile' exists it will be overwritten,
  533.    ''' otherwise, an exception will be thrown.
  534.    ''' </param>
  535.    ''' <param name="DeleteChunksAfterMerged">
  536.    ''' If set to <c>true</c>, the chunks will be deleted after a successful.
  537.    ''' </param>
  538.    ''' <exception cref="System.IO.FileNotFoundException">The specified file doesn't exists.</exception>
  539.    ''' <exception cref="System.IO.IOException">File already exists.</exception>
  540.    ''' <exception cref="System.Exception">The last chunk file is missing.</exception>
  541.    ''' <exception cref="System.Exception">Unexpected chunk filesize-count detected.</exception>
  542.    Public Sub Merge(ByVal InputFile As String,
  543.                     Optional ByVal OutputFile As String = Nothing,
  544.                     Optional ByVal Overwrite As Boolean = False,
  545.                     Optional DeleteChunksAfterMerged As Boolean = False)
  546.  
  547.        If Not File.Exists(InputFile) Then
  548.            Throw New FileNotFoundException("The specified file doesn't exists.", InputFile)
  549.            Exit Sub
  550.  
  551.        ElseIf Not Overwrite AndAlso File.Exists(OutputFile) Then
  552.            Throw New IOException(String.Format("File already exists: {0}", OutputFile))
  553.            Exit Sub
  554.  
  555.        End If
  556.  
  557.        ' The progress event arguments.
  558.        Dim ProgressArguments As MergeProgressChangedArgs
  559.  
  560.        ' FileInfo instance of the input chunk file.
  561.        Dim fInfo As New FileInfo(InputFile)
  562.  
  563.        ' Get the filename without extension.
  564.        Dim Filename As String = Path.GetFileNameWithoutExtension(fInfo.FullName)
  565.        ' Remove the chunk enumeration from the filename.
  566.        Filename = Filename.Substring(0I, Filename.LastIndexOf("."c))
  567.  
  568.        ' TSet the pattern to find the chunk files to merge.
  569.        Dim ChunkPatternSearch As String =
  570.            Filename & ".*" & If(Not String.IsNullOrEmpty(fInfo.Extension), fInfo.Extension, "")
  571.  
  572.        ' Retrieve all the chunk files to merge them.
  573.        Dim Chunks As IEnumerable(Of FileInfo) =
  574.           From Chunk As String In
  575.           Directory.GetFiles(fInfo.DirectoryName, ChunkPatternSearch, SearchOption.TopDirectoryOnly)
  576.           Select New FileInfo(Chunk)
  577.  
  578.        If Chunks.Count < 2I Then ' If chunk files are less than 2 then...
  579.            Throw New Exception("The last chunk file is missing.")
  580.            Exit Sub
  581.        End If
  582.  
  583.        ' The total filesize to merge, in bytes.
  584.        Dim TotalSize As Long =
  585.            (From Chunk As FileInfo In Chunks Select Chunk.Length).Sum
  586.  
  587.        ' Gets the filesize of the chunk files and the last chunk file, in bytes.
  588.        Dim ChunkSizes As Long() =
  589.            (From Chunk As FileInfo In Chunks
  590.             Select Chunk.Length Order By Length Descending
  591.            ).Distinct.ToArray
  592.  
  593.        If ChunkSizes.Count > 2I Then ' If chunk sizes are more than 2...
  594.            Throw New Exception("Unexpected chunk filesize-count detected.")
  595.            Exit Sub
  596.        End If
  597.  
  598.        ' The remaining size to calculate the percentage, in bytes.
  599.        Dim SizeRemaining As Long = TotalSize
  600.  
  601.        ' Counts the length of the current chunk file to calculate the percentage, in bytes.
  602.        Dim SizeWritten As Long = 0L
  603.  
  604.        ' Counts the length of the written size on the current chunk file, in bytes.
  605.        Dim ChunkSizeWritten As Long = 0L
  606.  
  607.        ' The buffer to read data and merge the chunks.
  608.        Dim Buffer As Byte() = New Byte() {}
  609.  
  610.        ' The buffer length.
  611.        Dim BufferLength As Integer = Me.BufferSize
  612.  
  613.        ' The total amount of chunks to merge.
  614.        Dim ChunkCount As Integer = Chunks.Count
  615.  
  616.        ' Keeps track of the current chunk.
  617.        Dim ChunkIndex As Integer = 0I
  618.  
  619.        ' Keeps track of the total percentage done.
  620.        Dim TotalProgress As Double = 0.0R
  621.  
  622.        ' Create the output file to merge the chunks inside.
  623.        Using OutputStream As New FileStream(OutputFile, FileMode.Create)
  624.  
  625.            Using BinaryWriter As New BinaryWriter(OutputStream)
  626.  
  627.                ' Iterate the chunks.
  628.                For Each Chunk As FileInfo In Chunks
  629.  
  630.                    ' Open the chunk to start reading bytes.
  631.                    Using InputStream As New FileStream(Chunk.FullName, FileMode.Open)
  632.  
  633.                        Using BinaryReader As New BinaryReader(InputStream)
  634.  
  635.                            ' Read until reached the end-bytes of the chunk file.
  636.                            While (InputStream.Position < InputStream.Length)
  637.  
  638.                                ' Read bytes from the chunk file (BufferSize byte-length).
  639.                                Buffer = BinaryReader.ReadBytes(BufferLength)
  640.  
  641.                                ' Write those bytes in the output file.
  642.                                BinaryWriter.Write(Buffer)
  643.  
  644.                                ' Increment the bytes-written counters.
  645.                                SizeWritten += Buffer.Count
  646.                                ChunkSizeWritten += Buffer.Count
  647.  
  648.                                ' Decrease the bytes-remaining counter.
  649.                                SizeRemaining -= Buffer.Count
  650.  
  651.                                ' Set the total progress.
  652.                                TotalProgress = (TotalSize - SizeRemaining) * (100I / TotalSize)
  653.  
  654.                                ' Set the progress event-arguments.
  655.                                ProgressArguments = New MergeProgressChangedArgs(
  656.                                    TotalProgress:=If(Not TotalProgress > 99.9R, TotalProgress, 99.9R),
  657.                                    ChunkProgress:=(100I / InputStream.Length) * (ChunkSizeWritten - BufferLength),
  658.                                    ChunksToMerge:=ChunkCount,
  659.                                    ChunksMerged:=ChunkIndex)
  660.  
  661.                                ' Report the progress.
  662.                                RaiseEvent MergeProgressChanged(Me, ProgressArguments)
  663.  
  664.                            End While ' (InputStream.Position < InputStream.Length)
  665.  
  666.                            ChunkIndex += 1I ' Increment the chunk file counter.
  667.                            ChunkSizeWritten = 0L ' Reset the bytes-written for the next chunk.
  668.  
  669.                        End Using ' BinaryReader
  670.  
  671.                    End Using ' InputStream
  672.  
  673.                Next Chunk
  674.  
  675.                OutputStream.Flush()
  676.  
  677.            End Using ' BinaryWriter
  678.  
  679.        End Using ' OutputStream
  680.  
  681.        ' Set the progress event-arguments.
  682.        ProgressArguments = New MergeProgressChangedArgs(
  683.            TotalProgress:=100.0R,
  684.            ChunkProgress:=100.0R,
  685.            ChunksToMerge:=ChunkCount,
  686.            ChunksMerged:=ChunkIndex)
  687.  
  688.        ' Report the progress.
  689.        RaiseEvent MergeProgressChanged(Me, ProgressArguments)
  690.  
  691.        If DeleteChunksAfterMerged Then ' Delethe the chunk files.
  692.  
  693.            For Each Chunk As FileInfo In Chunks
  694.                File.Delete(Chunk.FullName)
  695.            Next Chunk
  696.  
  697.        End If ' DeleteChunksAfterMerged
  698.  
  699.    End Sub
  700.  
  701. #End Region
  702.  
  703. End Class


Ejemplo de uso:



Código
  1. Public Class FileSplitter_Test
  2.  
  3.    ' Some Sizes to choose.
  4.    Private ReadOnly Megabyte As Integer = 1048576I
  5.    Private ReadOnly Gigabyte As Integer = 1073741824I
  6.  
  7.    ' The controls that will report the progress.
  8.    Private LabelSplit1, LabelSplit2, LabelSplit3 As New Label
  9.    Private LabelMerge1, LabelMerge2, LabelMerge3 As New Label
  10.  
  11.    ' The controls to split or merge.
  12.    Private WithEvents ButtonSplit, ButtonMerge As New Button
  13.  
  14.    ' The FileSplitter instance.
  15.    Private WithEvents Splitter As New FileSplitter() With
  16.        {
  17.          .BufferSize = (Megabyte * 10I)
  18.        } ' With BufferSize of 10 Megabytes.
  19.  
  20.    Public Sub New()
  21.  
  22.        ' This call is required by the designer.
  23.        InitializeComponent()
  24.  
  25.        ' Set the Form properties.
  26.        With Me
  27.            .Size = New Point(400, 200)
  28.            .FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
  29.            .MaximizeBox = False
  30.        End With
  31.  
  32.        ' Set the control properties.
  33.        With ButtonSplit
  34.            .Text = "Split"
  35.            .Font = New Font(Me.Font.FontFamily, 14.0F, FontStyle.Bold)
  36.            .Size = New Point(200I, 75I)
  37.            .Location = New Point(0I, 0I)
  38.            .Cursor = Cursors.Hand
  39.        End With
  40.  
  41.        With ButtonMerge
  42.            .Text = "Merge"
  43.            .Font = New Font(Me.Font.FontFamily, 14.0F, FontStyle.Bold)
  44.            .Size = New Point(200I, 75I)
  45.            .Location = New Point(ButtonSplit.Location.X + ButtonSplit.Width, 0I)
  46.            .Cursor = Cursors.Hand
  47.        End With
  48.  
  49.        With LabelSplit1
  50.            .Text = "Total Progress:"
  51.            .AutoSize = True
  52.            .Font = New Font(Me.Font.FontFamily, 9.0F, FontStyle.Regular)
  53.            .Location = New Point(0I, ButtonSplit.Location.Y + ButtonSplit.Height + 10I)
  54.        End With
  55.  
  56.        With LabelSplit2
  57.            .Text = "Chunk Progress:"
  58.            .AutoSize = True
  59.            .Font = New Font(Me.Font.FontFamily, 9.0F, FontStyle.Regular)
  60.            .Location = New Point(0I, LabelSplit1.Location.Y + LabelSplit1.Height)
  61.        End With
  62.  
  63.        With LabelSplit3
  64.            .Text = "Chunk Count:"
  65.            .AutoSize = True
  66.            .Font = New Font(Me.Font.FontFamily, 9.0F, FontStyle.Regular)
  67.            .Location = New Point(0I, LabelSplit2.Location.Y + LabelSplit2.Height)
  68.        End With
  69.  
  70.        With LabelMerge1
  71.            .Text = "Total Progress:"
  72.            .AutoSize = True
  73.            .Font = New Font(Me.Font.FontFamily, 9.0F, FontStyle.Regular)
  74.            .Location = New Point(ButtonMerge.Location.X, ButtonMerge.Location.Y + ButtonMerge.Height + 10I)
  75.        End With
  76.  
  77.        With LabelMerge2
  78.            .Text = "Chunk Progress:"
  79.            .AutoSize = True
  80.            .Font = New Font(Me.Font.FontFamily, 9.0F, FontStyle.Regular)
  81.            .Location = New Point(ButtonMerge.Location.X, LabelMerge1.Location.Y + LabelMerge1.Height)
  82.        End With
  83.  
  84.        With LabelMerge3
  85.            .Text = "Chunk Count:"
  86.            .AutoSize = True
  87.            .Font = New Font(Me.Font.FontFamily, 9.0F, FontStyle.Regular)
  88.            .Location = New Point(ButtonMerge.Location.X, LabelMerge2.Location.Y + LabelMerge2.Height)
  89.        End With
  90.  
  91.        ' Add the controls into the form.
  92.        Me.Controls.AddRange({LabelSplit1, LabelSplit2, LabelSplit3})
  93.        Me.Controls.AddRange({LabelMerge1, LabelMerge2, LabelMerge3})
  94.        Me.Controls.AddRange({ButtonSplit, ButtonMerge})
  95.  
  96.    End Sub
  97.  
  98.    ''' <summary>
  99.    ''' Handles the 'Click' event of the 'ButtonSplit' control.
  100.    ''' </summary>
  101.    Private Sub ButtonSplit_Click() Handles ButtonSplit.Click
  102.  
  103.        Splitter.Split(InputFile:="C:\File.mkv",
  104.                       ChunkSize:=Gigabyte,
  105.                       ChunkName:="File.Part",
  106.                       ChunkExt:="fs",
  107.                       Overwrite:=True,
  108.                       DeleteAfterSplit:=False)
  109.  
  110.    End Sub
  111.  
  112.    ''' <summary>
  113.    ''' Handles the 'Click' event of the 'ButtonMerge' control.
  114.    ''' </summary>
  115.    Private Sub ButtonMerge_Click() Handles ButtonMerge.Click
  116.  
  117.        Splitter.Merge(InputFile:="C:\File.Part.1.fs",
  118.                       OutputFile:="C:\Merged.mkv",
  119.                       Overwrite:=True,
  120.                       DeleteChunksAfterMerged:=True)
  121.  
  122.    End Sub
  123.  
  124.    ''' <summary>
  125.    ''' Handles the 'SplitProgressChangedArgs' event of the 'Splitter' object.
  126.    ''' </summary>
  127.    ''' <param name="sender">The source of the event.</param>
  128.    ''' <param name="e">The <see cref="FileSplitter.SplitProgressChangedArgs"/> instance containing the event data.</param>
  129.    Private Sub Splitter_SplitProgressChangedArgs(ByVal sender As Object, ByVal e As FileSplitter.SplitProgressChangedArgs) _
  130.    Handles Splitter.SplitProgressChanged
  131.  
  132.        LabelSplit1.Text = String.Format("Total Progress: {0}%", e.TotalProgress.ToString("n1"))
  133.        LabelSplit2.Text = String.Format("Chunk Progress: {0}%", e.ChunkProgress.ToString("n1"))
  134.        LabelSplit3.Text = String.Format("Chunk Count: {0} of {1}", CStr(e.ChunksCreated), CStr(e.ChunksToCreate))
  135.        Application.DoEvents()
  136.  
  137.    End Sub
  138.  
  139.    ''' <summary>
  140.    ''' Handles the 'MergeProgressChangedArgs' event of the 'Splitter' object.
  141.    ''' </summary>
  142.    ''' <param name="sender">The source of the event.</param>
  143.    ''' <param name="e">The <see cref="FileSplitter.MergeProgressChangedArgs"/> instance containing the event data.</param>
  144.    Private Sub Splitter_MergeProgressChangedArgs(ByVal sender As Object, ByVal e As FileSplitter.MergeProgressChangedArgs) _
  145.    Handles Splitter.MergeProgressChanged
  146.  
  147.        LabelMerge1.Text = String.Format("Total Progress: {0}%", e.TotalProgress.ToString("n1"))
  148.        LabelMerge2.Text = String.Format("Chunk Progress: {0}%", e.ChunkProgress.ToString("n1"))
  149.        LabelMerge3.Text = String.Format("Chunk Count: {0} of {1}", CStr(e.ChunksMerged), CStr(e.ChunksToMerge))
  150.        Application.DoEvents()
  151.  
  152.    End Sub
  153.  
  154. End Class
6837  Foros Generales / Foro Libre / Re: Textaloud en: 15 Agosto 2014, 00:03 am
he buscado hasta por debajo de las piedras

...Hasta debajo de las piedras no has buscado, se sincero, esta situación tan tópica me fastidia mucho.

La primera página de resultados que muestra Google está plagada de voces y de información acerca de las voces adicionales que existen,
en todos y cada uno de los resultados tienes algo, incluyendo Torrents con semillas para su descarga:
· https://www.google.com/search?q=textaloud+voices&ie=utf-8&oe=utf-8&lr=lang_en&gws_rd=ssl

Y la información acerca de las voces Yankees adicionales aparecen en la página oficial del programa (¿donde iba a ser sino?), que además es el primer resultado de Google.

Acapela™

Citar
Indian English    Deepa
US English    Micah    
US English    Saul    
US English    Will    
US English    Heather    
US English    Kenny    
US English    Laura    
US English    Nelly    
US English    Ryan    
US English    Tracy    
US English    Rod - NEW    
US English    Karen - NEW

AT&T Natural Voices™

Citar
English - Great Britain    Audrey
English - Great Britain    Charles
English - India            Anjali
English - United States    Mike
English - United States    Crystal
English - United States    Julia
English - United States    Lauren
English - United States    Mel
English - United States    Ray
English - United States    Rich
English - United States    Claire

Nuance Vocalizer™

Citar
English - Australia       Karen    
English - Australia       Lee    
English - Great Britain    Daniel    
English - Great Britain    Serena    
English - Great Britain    Emily    
English - India          Veena - NEW    
English - India          Sangeeta    
English - Ireland          Moira    
English - Scotland          Fiona    
English - South Africa       Tessa - NEW    
English - United States    Allison - NEW    
English - United States    Ava - NEW    
English - United States    Samantha    
English - United States    Tom    
English - United States    Jennifer    
English - United States    Jill

Nota: En la página specifican que todos los packs son compatibles con TextAloud.

Si no quieres comprar un pack de voces y prefieres probar el producto antes de adquirirlo (ya sabes, este foro y sus usuarios son legales), puedes buscar en Google (buscar de verdad) o usar motores de búsqueda de Torrents:
· http://kickass.to/torrents/usearch/?q=AT%26T+Natural+Voices


PD:
Tiempo que he invertido aproximadamente para buscar y encontrar: 20 segundos


¡Saludos!
6838  Programación / Scripting / Re: Dudas en: 14 Agosto 2014, 20:57 pm
Para ocultar los iconos del escritorio, puedes hacerlo desde Batch o VBS llamando al comando Attrib.exe:

Código
  1. Attrib.exe +R +A +H +S "%UserProfile%\Desktop\*"

Respecto a lo de ocultar la barra de tareas, Batch es un "lenguaje" (lenguaje entre comillas) muy simple, esa tarea no se puede llevar a cabo ya que requiere usar las funciones FindWindow y ShowWindow de la WinAPI primero para hallar el Handle de la ventana del TaskBar, y luego para asignarle un estado (Visible, Oculto, etc), y Batch no puede hacer nada de eso, como tampoco se puede con un lenguaje simple como VBS.

Lo único que puedes hacer es modificar las propiedades de "Ocultar automaticamente" o "Siempre visible" de la barra de tareas de Windows, mediante el registro, pero ocultar completamente ...NO, a menos que no te importe instalar algún COM de terceros para poder hacer llamadas a la API de windows desde VBS, como este: http://www.vbs2exe.com/call-win32-api.html

EDITO: O como este otro, DynaWrap, donde además te muestran un ejemplo para lllamar a la función que necesitas (FindWindow):
· http://www.qtpsudhakar.com/2009/06/how-to-accessing-windows-api-through.html

En resumen, en Batch y en VBS es imposible hacerlo por si solo, a menos que utilices aplicaciones de terceros como CMDOW o NirCMD en Batch, o instales librerías de terceros como VBS2EXE (XNHost) o DynaWrap para poder acceder a la WinAPI en VBS mediante objetos COM.

En cualquier otro lenguaje (lenguaje de verdad) es una tarea muy sencilla, solo debes usar las funciones que he mencionado de la WinAPI para buscar el título de la ventana "Shell_TrayWnd" y modificar su visibilidad, a penas son más de 10 lineas de código, y eso funcionaría a partir de Windows Vista (7, 8/8.1), para Windows XP se necesitaría una labor mayor.

Saludos
6839  Sistemas Operativos / Windows / Re: windows 7 ultimate en: 14 Agosto 2014, 17:24 pm
Comprueba cual es tu tarjeta de sonido, y descarga los drivers más actualizados desde la página del fabricante.
6840  Programación / Programación General / Re: Fuentes para programadores en: 14 Agosto 2014, 12:53 pm
He mirado las 20 primeras fuentes o así, y a simple vista todas esas fuentes parecen monoespaciadas, ¡que buen aporte! :)

EDITO:
El post está bien pero en realidad varios links están caidos, aparte de eso muchas de las fuentes comentadas son de pago (no hay link de descarga gratis), y otras fuentes no son siquiera para windows (fon/ttf/otf) y no se como se convertirán.

En fin, he repasado todas las fuentes de esa página y me he descargado las que se podian, aquí las tienen todas en este archivo comprimido:
· http://www.mediafire.com/download/5scp53zyhc3hzpd/{fnt}.rar

¡Saludos!
Páginas: 1 ... 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 [684] 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines