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

 

 


Tema destacado: Curso de javascript por TickTack


  Mostrar Mensajes
Páginas: 1 ... 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 [697] 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 ... 1236
6961  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Sistema de publicidad que usó el-brujo (Dudas para el-brujo en: 22 Julio 2014, 18:41 pm
Hola, este mensaje ya os lo envié a los participantes del hilo, pero principalmente me habría gustado poder haberlo publicado aquí, así que eso haré:



Todo el mundo se puso a hablar de interés, desinterés, fama, programación, ¡y cosas sin sentido!.

¿Que os pasa?.

Porfavor, dejarme aclararos punto por punto lo que pensais cada uno y lo que habeis insinuado acerca de mi, porque estais equivocados... menos @Dantemc y @engel-lex cuyas perspectiva me parecieron correctas, positivas y razonables.

Yo no busco que se me de algo de nada, yo no exijo nada, ¿sabeis?, pero cuando estás haciendo una labor (DESINTERESADA) de la que otra persona (el Admin, en este caso) si que se beneficia en algún sentido (porque mal no le viene, le viene bien), pues lo mímimo que espero por parte de esa persona es que esté ahí cuando se lanecesite, en caso de tener una idea ...para decirme "SI", o "NO", y en caso de tener una duda ...para explicarmela.
Ccreo que eso es lo mínimo que puede esperar cualquier persona de su "jefe", y si no es así pues uno se cansa y deja de "cumplir", ¿o no?. Pero vosotros lo llamais interés, cuando en realidad se llama RESPETO.

PD: Con lo siguiente ya habré dicho todo lo que tengo que decir sobre el tema, no voy a publicar ningún comentario más en este hilo para volver a intentar aclarar dudas, quien quiera pensar a su manera y mal... que lo siga haciendo.





Elektro, no tienes que ponerme así como disputa de un usuario común, que yoo también llevo tiempo aquí. Nadie vale más que otros solo porque saben prgramar o fueron superman en el pasado. No juzgues a un libro por su portada.   :-\

Te pido disculpas por crear un OFF-TOPIC invadiendo tu post (aunque de todas formas, ten en cuenta que ya te habian respondido para resolverte tus dudas), pero en el resto de lo que has dicho te equivocas, no te juzgo, si lees mi comentario verás que cuando digo "nuevos" es generalizando ...porque este no es el primer caso, creo que se entiende, por supuesto no tengo nada contra ti.

o único que tiene aquí Christian Soriano, es el conocimiento de la programación, que pena que no tenga para más y como muchos programadores, caen muy bajo creyendo que son mejores que los demás

No se porque tienes que faltarme tanto el respeto con cada comentario ...o con los programadores en general, pues parece que tengas algún problema con los programadores, pero si no pretendes caer en la hipocresía entonces deberías aplicarte tus propias palabras y no juzgar a los demás.

Se nota que me conoces bien poco, pero para tu información como ya te he comentado no me creo mejor que nadie, podrías revisar los miles de comentarios que he publicado y lo que encontrarías es que nunca me verás haber afirmado que yo sepa más que alguien, ni tampoco que yo sepa mucho sobre algo, ni mucho menos haber ridiculizado los conocimientos de los demás, PERO SI VERÁS COMO EN MUCHAS OCASIONES HE LLEGADO A DECIR TODO LO CONTRARIO (cuando por ejemplo me dicen que se mucho sobre "algo" o que soy muy bueno en "algo"), creo que eso demuestra que, a pesar de que tu intentes insinuar que yo me creo mejor que alguien, en ralidad soy modesto, y esto te lo digo yo como te lo puede decir cualquier otra persona del foro que haya leido suficientes comentarios mios, por dios, pero creo que en realidad simplemente te molestó lo que hice y ahora pretendes trollear con ese tipo de comentarios... porque me cuesta creer que me consideres un "creido".

Citar
además de que Christian Soriano (Elektro), me cagó el tema
Tu tema ya quedo resuelto con el primer comentario que recibiste, mi comentrio llegó luego, aunque no te lo discuto ...se que te ha sentado mal, disculpas.





( Con DaniPhii ya hablé por privado, es un tio muy majo y ya hemos arreglado nuestras diferencias, pero creo que no sería correcto modificar el contenido de este mensaje original )

si decides dedicarte desinteresadamente a determinadas tareas, pasarás de hacerlo estando pendiente de la valoración que los demás hagan de tu trabajo (y a la espera de una oportunidad para rechazar críticas invalidándolas con argumentos típicos y/o falaces) a hacerlo de forma verdaderamente desinteresada, convirtiendo las críticas y vacíos que pretenden hacerte los demás en ruido ambiental para que la valoración que haces de tu propio trabajo y de ti mismo se convierta en tu único incentivo.

En el momento que le echas en cara a alguien que, en resumen, es un inepto por no valorar tu trabajo, estás dejando de valorar tus propios principios, así que no tiene sentido que los defiendas después de caer así de bajo.

Si después de leerme te estás tomando mis palabras como un ataque personal, quizá te falta objetividad para

Citar
Si lo hace de forma desinteresada, no tiene por qué importarle lo que los demás piensan.

No me lo tomo como un ataque personal, pero no estoy deacuerdo contigo en la mayor parte de lo que dices.

Si una persona no se valora a si mismo o si tampoco puede estimar una valoración de su rendimiento cumpliendo "X" tarea entonces esa persona TIENE UN GRAVE PROBLEMA, pero tu insinuas que debe ser todo lo contrario, que si una persona afirma que no se le valora entonces esa persona es estúpida, engreida, o no vale nada como persona...

Tus palabras también pueden dar lugar a pensar que yo durante estos años no me he tomado mi tarea de forma verdaderamente desinteresada como subrayas, de echo eso es lo que insinuas en tu segundo comentario, vale, dime tú:
¿Que ves de interés en esperar respeto por el "jefe"?, ¿el respeto es algo relacionado con el interés?, creo que además de estar equivocado no te estás poniendo en mi lugar, así que te daré un ejemplo real:

Si tu llevases a cabo una labor desinteresada y en varias ocasiones necesitases acudir a "el jefe" para proponerle una idea o que te resolviese una duda, pero "el jefe" te ignorase siempre, eso significaría que ni te valora a ti ni tampoco está valorando tu tarea ...¿o no?, ¿y no tendrías derecho a quejarte y afirmar que "no se te valora" sin dar lugar a pensar chorradas como por ejemplo que tu labor es interesada?, digo yo, ¡vaya!.

Y ya, para acabar el tema contigo, sobre la comparación de "comida" bien echa, o sobre todo lo que has insinuado de mi, en mi opinión creo que el interés no sería esperar (o pensar, dudar, imaginar, soñar) que la comida gustase a los demás, interés sería esperar que la comida les gustase para intentar sacar beneficio/provecho/ganancia de esa situación, y creo que con eso... ya te lo he dicho todo, ¿entiendes?.





No tiene nada que ver contigo, te lo aseguro. Entiendo en parte que etés disgustado con el foro, porque supongo que ya te gustaría ser algo más que moderador.

( Ya le he comentado lo que le tenia que decir a el-Brujo por privado respecto a este tema, pero lo resumiré muy brevemente para los demás: )

A mi lo que me molesta de este asunto no es tener un "rango" mayor o menor en el foro, a mi lo que me molesta es que yo, siendo bastante veterano ya en el foro habiendo echo una labor desinteresada durante todo ese tiempo, sea el último mono cuando se trata de dirigirme la palabra, y eso debería ser al revés, ya que considero que al estar colaborando dia tras dia en el foro debería tener algo más de preferencia en ese sentido..., por ejemplo cuando yo tengo una pregunta "el jefe" no está ahí para contestarme, y cuando tengo una idea "el jefe" tampoco aparece para confirmarme o denegarme la idea, mientras que (generalizando) para todos los usuarios nuevos del foro (los cuales no han invertido tiempo de sus vidas en ayudar a esta página) es muy diferente, es todo lo diferente a lo que sucede conmigo, así que en mi opinión eso significa que ni a mi ni a mi lavor se nos valora, y no le veo ningún interés en decir eso.

PD: @All: ¿Se entiende el concepto de "valoración" y "desinterés" o aun no quieren entenderlo?.

Saludos!
6962  Programación / .NET (C#, VB.NET, ASP) / [APORTE] FileDater (Preserva, establece, o restaura las fechas de un archivo) en: 22 Julio 2014, 05:34 am
Esta Class sirve para preservar una o todas las fechas de un archivo para poder restaurarlas en cualquier otro momento, me parece muy útil para modificar archivos los cuales no quieres que sus fechas actuales se alteren después de la modificación... y con este "ayudante" ahorrarás tiempo y escritura de código.
Esta Class también sirve para establecer fechas en un archivo (aunque esa característica simplemente está ahí para decorar, para extender un poco su funcionalidad).

Nota: En la Class podrán notar que le añadí la implementación de la interface IDisposable, en un principio esto podría parecer innecesario, pero la añadí para evitar el poder crear instancias que usen el mismo archivo, ya que no le encuentro sentido alguno al permitir estar preservando/restaurando las fechas de un mismo archivo en distintas instancias y esto podría ocasionar confusiones además de un uso indebido, y además, de esta forma el uso de los bloques Using también pueden prevenir algún que otro descuido.

Espero que a alguien le sirva :).





Ejemplo de uso:

1.
Código
  1.        ' Instance the FileDater Class.
  2.        Using fd As New FileDater(File:="C:\Test File.txt")
  3.  
  4.            ' Preserve the current date-modified of the file.
  5.            fd.Preserve(FileDater.DateType.Modified)
  6.  
  7.            ' Do some kind of operation that alters the current date-modified of the file.
  8.            IO.File.AppendAllText(fd.File.FullName, New String("X"c, 10I))
  9.  
  10.            ' Restore the previously preserved date-modified on the TestFile.
  11.            fd.Restore(FileDater.DateType.Modified)
  12.  
  13.        End Using '/ fd

2.
Código
  1.        ' Instance a test FileInfo using an unique temp file.
  2.        Dim TestFile As New IO.FileInfo(IO.Path.GetTempFileName)
  3.  
  4.        ' Instance the FileDater Class.
  5.        Using fd As New FileDater(File:=TestFile)
  6.  
  7.            ' Preserve the current dates of the TestFile.
  8.            fd.Preserve(FileDater.DateType.Created Or FileDater.DateType.Accessed Or FileDater.DateType.Modified)
  9.  
  10.            ' Show the type of the current preserved dates.
  11.            MessageBox.Show(fd.PreservedTypes.ToString)
  12.  
  13.            ' Show current preserved date-creation.
  14.            MessageBox.Show(fd.PreservedCreationDate.ToString)
  15.  
  16.            ' Modify the current date-creation on the TestFile.
  17.            fd.Set(FileDater.DateType.Created, Date.Parse("01/01/2015"))
  18.  
  19.            ' Restore the previously preserved date-creation on the TestFile.
  20.            fd.Restore(FileDater.DateType.Created)
  21.  
  22.            ' Show the current Creation date of the TestFile.
  23.            MessageBox.Show(TestFile.CreationTime)
  24.  
  25.        End Using





El código:

Código
  1. ' ***********************************************************************
  2. ' Author   : Elektro
  3. ' Modified : 07-22-2014
  4. ' ***********************************************************************
  5. ' <copyright file="FileDater.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Usage Examples "
  11.  
  12. #Region " Example 1 "
  13.  
  14. '' Instance the FileDater Class.
  15. 'Using fd As New FileDater(File:="C:\Test File.txt")
  16.  
  17. '    ' Preserve the current date-modified of the file.
  18. '    fd.Preserve(FileDater.DateType.Modified)
  19.  
  20. '    ' Do some kind of operation that alters the current date-modified of the file.
  21. '    IO.File.AppendAllText(fd.File.FullName, New String("X"c, 10I))
  22.  
  23. '    ' Restore the previously preserved date-modified on the TestFile.
  24. '    fd.Restore(FileDater.DateType.Modified)
  25.  
  26. 'End Using '/ fd
  27.  
  28. #End Region
  29.  
  30. #Region " Example 2 "
  31.  
  32. '' Instance a test FileInfo using an unique temp file.
  33. 'Dim TestFile As New IO.FileInfo(IO.Path.GetTempFileName)
  34.  
  35. '' Instance the FileDater Class.
  36. 'Using fd As New FileDater(File:=TestFile)
  37.  
  38. '    ' Preserve the current dates of the TestFile.
  39. '    fd.Preserve(FileDater.DateType.Created Or FileDater.DateType.Accessed Or FileDater.DateType.Modified)
  40.  
  41. '    ' Show the type of the current preserved dates.
  42. '    MessageBox.Show(fd.PreservedTypes.ToString)
  43.  
  44. '    ' Show current preserved date-creation.
  45. '    MessageBox.Show(fd.PreservedCreationDate.ToString)
  46.  
  47. '    ' Modify the current date-creation on the TestFile.
  48. '    fd.Set(FileDater.DateType.Created, Date.Parse("01/01/2015"))
  49.  
  50. '    ' Restore the previously preserved date-creation on the TestFile.
  51. '    fd.Restore(FileDater.DateType.Created)
  52.  
  53. '    ' Show the current Creation date of the TestFile.
  54. '    MessageBox.Show(TestFile.CreationTime)
  55.  
  56. 'End Using
  57.  
  58. #End Region
  59.  
  60. #End Region
  61.  
  62. #Region " Imports "
  63.  
  64. Imports System.ComponentModel
  65. Imports System.IO
  66.  
  67. #End Region
  68.  
  69. #Region " FileDater "
  70.  
  71. ''' <summary>
  72. ''' Contains methods to preserve, set, and restore the dates contained on file.
  73. ''' </summary>
  74. Public NotInheritable Class FileDater : Implements IDisposable
  75.  
  76. #Region " Objects "
  77.  
  78.    ''' <summary>
  79.    ''' Contains the files that are already used in the constructor to prevent a duplicated instance for the same file.
  80.    ''' </summary>
  81.    Private Shared InstancedFiles As New List(Of FileInfo)
  82.  
  83. #End Region
  84.  
  85. #Region " Properties "
  86.  
  87.    ''' <summary>
  88.    ''' Gets the file.
  89.    ''' </summary>
  90.    ''' <value>The file.</value>
  91.    Public ReadOnly Property [File] As FileInfo
  92.        Get
  93.            Return Me._File
  94.        End Get
  95.    End Property
  96.    Private _File As FileInfo
  97.  
  98.    ''' <summary>
  99.    ''' Gets the type of the current preserved dates.
  100.    ''' </summary>
  101.    Public ReadOnly Property PreservedTypes As DateType
  102.        Get
  103.            Return Me._PreservedTypes
  104.        End Get
  105.    End Property
  106.    Private _PreservedTypes As DateType = Nothing
  107.  
  108.    ''' <summary>
  109.    ''' Gets the preserved creation date.
  110.    ''' </summary>
  111.    ''' <value>The preserved creation date.</value>
  112.    Public ReadOnly Property PreservedCreationDate As Date
  113.        Get
  114.            Return Me._PreservedCreationDate
  115.        End Get
  116.    End Property
  117.    Private _PreservedCreationDate As Date
  118.  
  119.    ''' <summary>
  120.    ''' Gets the preserved last-access date.
  121.    ''' </summary>
  122.    ''' <value>The preserved creation date.</value>
  123.    Public ReadOnly Property PreservedLastAccessDate As Date
  124.        Get
  125.            Return Me._PreservedLastAccessDate
  126.        End Get
  127.    End Property
  128.    Private _PreservedLastAccessDate As Date
  129.  
  130.    ''' <summary>
  131.    ''' Gets the preserved last-modify date.
  132.    ''' </summary>
  133.    ''' <value>The preserved creation date.</value>
  134.    Public ReadOnly Property PreservedLastModifyDate As Date
  135.        Get
  136.            Return Me._PreservedLastModifyDate
  137.        End Get
  138.    End Property
  139.    Private _PreservedLastModifyDate As Date
  140.  
  141. #End Region
  142.  
  143. #Region " Enumerations "
  144.  
  145.    ''' <summary>
  146.    ''' Contains a FileDate flag.
  147.    ''' </summary>
  148.    <FlagsAttribute>
  149.    Public Enum DateType As Integer
  150.  
  151.        ''' <summary>
  152.        ''' The date when the file was created.
  153.        ''' </summary>
  154.        Created = 1I
  155.  
  156.        ''' <summary>
  157.        ''' The date when the file was accessed by last time.
  158.        ''' </summary>
  159.        Accessed = 2I
  160.  
  161.        ''' <summary>
  162.        ''' The date when the file was modified by last time.
  163.        ''' </summary>
  164.        Modified = 4I
  165.  
  166.    End Enum
  167.  
  168. #End Region
  169.  
  170. #Region " Constructors "
  171.  
  172.    ''' <summary>
  173.    ''' Initializes a new instance of the <see cref="FileDater"/> class.
  174.    ''' </summary>
  175.    ''' <param name="File">Indicates the <see cref="FileInfo"/> instance.</param>
  176.    ''' <exception cref="System.Exception"></exception>
  177.    Public Sub New(ByVal [File] As FileInfo)
  178.  
  179.        If Not InstancedFiles.Contains([File]) Then
  180.            Me._File = [File]
  181.            InstancedFiles.Add([File])
  182.  
  183.        Else
  184.            Throw New Exception(String.Format("Another instance of the '{0}' class is using the same file.", MyBase.GetType.Name))
  185.  
  186.        End If
  187.  
  188.    End Sub
  189.  
  190.    ''' <summary>
  191.    ''' Initializes a new instance of the <see cref="FileDater"/> class.
  192.    ''' </summary>
  193.    ''' <param name="File">Indicates the file.</param>
  194.    Public Sub New(ByVal [File] As String)
  195.        Me.New(New FileInfo([File]))
  196.    End Sub
  197.  
  198.    ''' <summary>
  199.    ''' Prevents a default instance of the <see cref="FileDater"/> class from being created.
  200.    ''' </summary>
  201.    Private Sub New()
  202.    End Sub
  203.  
  204. #End Region
  205.  
  206. #Region " Hidden Methods "
  207.  
  208.    ''' <summary>
  209.    ''' Serves as a hash function for a particular type.
  210.    ''' </summary>
  211.    <EditorBrowsable(EditorBrowsableState.Never)>
  212.    Public Shadows Sub GetHashCode()
  213.    End Sub
  214.  
  215.    ''' <summary>
  216.    ''' Determines whether the specified System.Object instances are considered equal.
  217.    ''' </summary>
  218.    <EditorBrowsable(EditorBrowsableState.Never)>
  219.    Public Shadows Sub Equals()
  220.    End Sub
  221.  
  222.    ''' <summary>
  223.    ''' Determines whether the specified System.Object instances are the same instance.
  224.    ''' </summary>
  225.    <EditorBrowsable(EditorBrowsableState.Never)>
  226.    Private Shadows Sub ReferenceEquals()
  227.    End Sub
  228.  
  229.    ''' <summary>
  230.    ''' Returns a String that represents the current object.
  231.    ''' </summary>
  232.    <EditorBrowsable(EditorBrowsableState.Never)>
  233.    Public Shadows Sub ToString()
  234.    End Sub
  235.  
  236. #End Region
  237.  
  238. #Region " Public Methods "
  239.  
  240.    ''' <summary>
  241.    ''' Preserves the specified dates of the file to restore them later at any time.
  242.    ''' Note: Dates can be preserved again at any time.
  243.    ''' </summary>
  244.    ''' <param name="DateType">Indicates the type of dates to preserve.</param>
  245.    Public Sub Preserve(ByVal DateType As DateType)
  246.  
  247.        Me.DisposedCheck()
  248.  
  249.        ' Creation
  250.        If DateType.HasFlag(FileDater.DateType.Created) Then
  251.            Me._PreservedCreationDate = Me._File.CreationTime
  252.        End If
  253.  
  254.        ' Accessed
  255.        If DateType.HasFlag(FileDater.DateType.Accessed) Then
  256.            Me._PreservedLastAccessDate = Me._File.LastAccessTime
  257.        End If
  258.  
  259.        ' Modified
  260.        If DateType.HasFlag(FileDater.DateType.Modified) Then
  261.            Me._PreservedLastModifyDate = Me._File.LastWriteTime
  262.        End If
  263.  
  264.        Me._PreservedTypes = DateType
  265.  
  266.    End Sub
  267.  
  268.    ''' <summary>
  269.    ''' Preserves at once all the dates of the file to restore them later at any time.
  270.    ''' Note: Dates can be preserved again at any time.
  271.    ''' </summary>
  272.    Public Sub Preserve()
  273.  
  274.        Me.DisposedCheck()
  275.  
  276.        Me._PreservedCreationDate = Me._File.CreationTime
  277.        Me._PreservedLastAccessDate = Me._File.LastAccessTime
  278.        Me._PreservedLastModifyDate = Me._File.LastWriteTime
  279.  
  280.        Me._PreservedTypes = DateType.Created Or DateType.Accessed Or DateType.Modified
  281.  
  282.    End Sub
  283.  
  284.    ''' <summary>
  285.    ''' Restores the specified preserved dates on the file.
  286.    ''' Note: Calling this method does not cause the deletion of any preserved date.
  287.    ''' </summary>
  288.    ''' <param name="DateType">Indicates the type of dates to restore on the file.</param>
  289.    ''' <exception cref="System.Exception">Any date was preserved.</exception>
  290.    Public Sub Restore(ByVal DateType As DateType)
  291.  
  292.        Me.DisposedCheck()
  293.  
  294.        ' Creation
  295.        If DateType.HasFlag(FileDater.DateType.Created) _
  296.        AndAlso Me._PreservedTypes.HasFlag(FileDater.DateType.Created) Then
  297.  
  298.            Me._File.CreationTime = Me._PreservedCreationDate
  299.  
  300.        ElseIf DateType.HasFlag(FileDater.DateType.Created) _
  301.        AndAlso Not Me._PreservedTypes.HasFlag(FileDater.DateType.Created) Then
  302.  
  303.            Throw New Exception(String.Format("The specified date was not preserved.")) With {
  304.                .Source = FileDater.DateType.Created.ToString
  305.            }
  306.  
  307.        End If
  308.  
  309.        ' Accessed
  310.        If DateType.HasFlag(FileDater.DateType.Accessed) _
  311.        AndAlso Me._PreservedTypes.HasFlag(FileDater.DateType.Accessed) Then
  312.  
  313.            Me._File.LastAccessTime = Me._PreservedLastAccessDate
  314.  
  315.        ElseIf DateType.HasFlag(FileDater.DateType.Accessed) _
  316.        AndAlso Not Me._PreservedTypes.HasFlag(FileDater.DateType.Accessed) Then
  317.  
  318.            Throw New Exception(String.Format("The specified date was not preserved.")) With {
  319.                .Source = FileDater.DateType.Accessed.ToString
  320.            }
  321.  
  322.        End If
  323.  
  324.        ' Modified
  325.        If DateType.HasFlag(FileDater.DateType.Modified) _
  326.        AndAlso Me._PreservedTypes.HasFlag(FileDater.DateType.Modified) Then
  327.  
  328.            Me._File.LastWriteTime = Me._PreservedLastModifyDate
  329.  
  330.        ElseIf DateType.HasFlag(FileDater.DateType.Modified) _
  331.        AndAlso Not Me._PreservedTypes.HasFlag(FileDater.DateType.Modified) Then
  332.  
  333.            Throw New Exception(String.Format("The specified date was not preserved.")) With {
  334.                .Source = FileDater.DateType.Modified.ToString
  335.            }
  336.  
  337.        End If
  338.  
  339.    End Sub
  340.  
  341.    ''' <summary>
  342.    ''' Restores at once all the preserved dates on the file.
  343.    ''' Note: Calling this method does not cause the deletion of any preserved date.
  344.    ''' </summary>
  345.    Public Sub Restore()
  346.  
  347.        Me.DisposedCheck()
  348.  
  349.        ' Creation
  350.        If Me._PreservedTypes.HasFlag(FileDater.DateType.Created) Then
  351.            Me._File.CreationTime = Me._PreservedCreationDate
  352.        End If
  353.  
  354.        ' Accessed
  355.        If Me._PreservedTypes.HasFlag(FileDater.DateType.Accessed) Then
  356.            Me._File.LastAccessTime = Me._PreservedLastAccessDate
  357.        End If
  358.  
  359.        ' Modified
  360.        If Me._PreservedTypes.HasFlag(FileDater.DateType.Modified) Then
  361.            Me._File.LastWriteTime = Me._PreservedLastModifyDate
  362.        End If
  363.  
  364.    End Sub
  365.  
  366.    ''' <summary>
  367.    ''' Sets the specified dates on the file.
  368.    ''' Note:
  369.    ''' Calling this method does not cause the deletion of any preserved date.
  370.    ''' After setting a date, must call once the <see cref="Preserve"/> method if want to preserve any new date established.
  371.    ''' </summary>
  372.    ''' <param name="DateType">Indicates the type of dates to set on the file.</param>
  373.    ''' <param name="Date">Indicates the date.</param>
  374.    Public Sub [Set](ByVal DateType As DateType, ByVal [Date] As Date)
  375.  
  376.        Me.DisposedCheck()
  377.  
  378.        ' Creation
  379.        If DateType.HasFlag(FileDater.DateType.Created) Then
  380.            Me._File.CreationTime = [Date]
  381.        End If
  382.  
  383.        ' Accessed
  384.        If DateType.HasFlag(FileDater.DateType.Accessed) Then
  385.            Me._File.LastAccessTime = [Date]
  386.        End If
  387.  
  388.        ' Modified
  389.        If DateType.HasFlag(FileDater.DateType.Modified) Then
  390.            Me._File.LastWriteTime = [Date]
  391.        End If
  392.  
  393.    End Sub
  394.  
  395.    ''' <summary>
  396.    ''' Sets at once all the dates on the file.
  397.    ''' Note:
  398.    ''' Calling this method does not cause the deletion of any preserved date.
  399.    ''' After setting a date, must call once the <see cref="Preserve"/> method if want to preserve any new date established.
  400.    ''' </summary>
  401.    ''' <param name="Date">Indicates the date.</param>
  402.    Public Sub [Set](ByVal [Date] As Date)
  403.  
  404.        Me.DisposedCheck()
  405.  
  406.        Me._File.CreationTime = [Date]
  407.        Me._File.LastAccessTime = [Date]
  408.        Me._File.LastWriteTime = [Date]
  409.  
  410.    End Sub
  411.  
  412. #End Region
  413.  
  414. #Region " IDisposable "
  415.  
  416.    ''' <summary>
  417.    ''' To detect redundant calls when disposing.
  418.    ''' </summary>
  419.    Private IsDisposed As Boolean = False
  420.  
  421.    ''' <summary>
  422.    ''' Prevent calls to methods after disposing.
  423.    ''' </summary>
  424.    ''' <exception cref="System.ObjectDisposedException"></exception>
  425.    Private Sub DisposedCheck()
  426.  
  427.        If Me.IsDisposed Then
  428.            Throw New ObjectDisposedException(Me.GetType().FullName)
  429.        End If
  430.  
  431.    End Sub
  432.  
  433.    ''' <summary>
  434.    ''' Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
  435.    ''' </summary>
  436.    Public Sub Dispose() Implements IDisposable.Dispose
  437.        Dispose(True)
  438.        GC.SuppressFinalize(Me)
  439.    End Sub
  440.  
  441.    ''' <summary>
  442.    ''' Releases unmanaged and - optionally - managed resources.
  443.    ''' </summary>
  444.    ''' <param name="IsDisposing">
  445.    ''' <c>true</c> to release both managed and unmanaged resources;
  446.    ''' <c>false</c> to release only unmanaged resources.
  447.    ''' </param>
  448.    Protected Sub Dispose(ByVal IsDisposing As Boolean)
  449.  
  450.        If Not Me.IsDisposed Then
  451.  
  452.            If IsDisposing Then
  453.                InstancedFiles.Remove(Me._File)
  454.            End If
  455.  
  456.        End If
  457.  
  458.        Me.IsDisposed = True
  459.  
  460.    End Sub
  461.  
  462. #End Region
  463.  
  464. End Class
  465.  
  466. #End Region
6963  Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Multimedia Playlist Editor (M3U y PLS) en: 22 Julio 2014, 02:04 am
Aquí tienen la Class:

Código
  1. ' ***********************************************************************
  2. ' Author   : Elektro
  3. ' Modified : 07-21-2014
  4. ' ***********************************************************************
  5. ' <copyright file="PlaylistEditor.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. Imports System.Text
  15.  
  16. #End Region
  17.  
  18. #Region " PlaylistEditor "
  19.  
  20. ''' <summary>
  21. ''' Contains methods to manage the contents of a multimedia playlist file.
  22. ''' This class cannot be inherited.
  23. ''' </summary>
  24. Public NotInheritable Class PlaylistEditor
  25.  
  26. #Region " Properties "
  27.  
  28.    ''' <summary>
  29.    ''' Gets the playlist filepath.
  30.    ''' </summary>
  31.    ''' <value>The playlist filepath.</value>
  32.    Public ReadOnly Property FilePath As String
  33.        Get
  34.            Return Me._FilePath
  35.        End Get
  36.    End Property
  37.    Private _FilePath As String
  38.  
  39.    ''' <summary>
  40.    ''' Gets the playlist type.
  41.    ''' </summary>
  42.    ''' <value>The playlist type.</value>
  43.    Public ReadOnly Property Type
  44.        Get
  45.            Return Me._Type
  46.        End Get
  47.    End Property
  48.    Private _Type As PlaylistType
  49.  
  50.    ''' <summary>
  51.    ''' Gets the playlist file encoding.
  52.    ''' </summary>
  53.    ''' <value>The playlist file encoding.</value>
  54.    Public ReadOnly Property FileEncoding As Encoding
  55.        Get
  56.            Return Me._Encoding
  57.        End Get
  58.    End Property
  59.    Private _Encoding As Encoding
  60.  
  61.    ''' <summary>
  62.    ''' Gets a value indicating whether the append mode is activated.
  63.    ''' </summary>
  64.    ''' <value><c>true</c> if append mode is activated; otherwise, <c>false</c>.</value>
  65.    Public ReadOnly Property Append As Boolean
  66.        Get
  67.            Return Me._Append
  68.        End Get
  69.    End Property
  70.    Private _Append As Boolean
  71.  
  72. #End Region
  73.  
  74. #Region " Enumerations "
  75.  
  76.    ''' <summary>
  77.    ''' Indicates the type of a playlist.
  78.    ''' </summary>
  79.    <Description("Enumeration used as 'PlaylistType' parameter of 'New' constructor.")>
  80.    Public Enum PlaylistType As Integer
  81.  
  82.        ''' <summary>
  83.        ''' M3U Playlist.
  84.        ''' Documentation: http://en.wikipedia.org/wiki/M3U
  85.        ''' </summary>
  86.        M3U = 0I
  87.  
  88.        ''' <summary>
  89.        ''' PLS Playlist.
  90.        ''' Documentation: http://en.wikipedia.org/wiki/PLS_%28file_format%29
  91.        ''' </summary>
  92.        PLS = 1I
  93.  
  94.    End Enum
  95.  
  96. #End Region
  97.  
  98. #Region " Types "
  99.  
  100.    ''' <summary>
  101.    ''' Contains extended info of a playlist track.
  102.    ''' </summary>
  103.    Public Class TrackInfo
  104.  
  105. #Region " Properties "
  106.  
  107.        ''' <summary>
  108.        ''' Gets the track index.
  109.        ''' Don't set this value manually.
  110.        ''' This value is automatically set by some of the <see cref="PlaylistEditor"/> methods,
  111.        ''' and has any effect for other purposes.
  112.        ''' </summary>
  113.        ''' <value>The track index.</value>
  114.        Public Property Index As Integer
  115.  
  116.        ''' <summary>
  117.        ''' Gets or sets the track filepath.
  118.        ''' </summary>
  119.        ''' <value>The track filepath.</value>
  120.        Public Property Path As String
  121.  
  122.        ''' <summary>
  123.        ''' Gets or sets the track title.
  124.        ''' </summary>
  125.        ''' <value>The track title.</value>
  126.        Public Property Title As String
  127.  
  128.        ''' <summary>
  129.        ''' Gets or sets the track length.
  130.        ''' </summary>
  131.        ''' <value>The track length.</value>
  132.        Public Property Length As TimeSpan
  133.  
  134. #End Region
  135.  
  136. #Region " Hidden Methods "
  137.  
  138.        ''' <summary>
  139.        ''' Serves as a hash function for a particular type.
  140.        ''' </summary>
  141.        <EditorBrowsable(EditorBrowsableState.Never)>
  142.        Public Shadows Sub GetHashCode()
  143.        End Sub
  144.  
  145.        ''' <summary>
  146.        ''' Determines whether the specified System.Object instances are considered equal.
  147.        ''' </summary>
  148.        <EditorBrowsable(EditorBrowsableState.Never)>
  149.        Public Shadows Sub Equals()
  150.        End Sub
  151.  
  152.        ''' <summary>
  153.        ''' Determines whether the specified System.Object instances are the same instance.
  154.        ''' </summary>
  155.        <EditorBrowsable(EditorBrowsableState.Never)>
  156.        Private Shadows Sub ReferenceEquals()
  157.        End Sub
  158.  
  159.        ''' <summary>
  160.        ''' Returns a String that represents the current object.
  161.        ''' </summary>
  162.        <EditorBrowsable(EditorBrowsableState.Never)>
  163.        Public Shadows Sub ToString()
  164.        End Sub
  165.  
  166. #End Region
  167.  
  168.    End Class
  169.  
  170. #End Region
  171.  
  172. #Region " Constructors "
  173.  
  174.    ''' <summary>
  175.    ''' Prevents a default instance of the <see cref="PlaylistEditor"/> class from being created.
  176.    ''' </summary>
  177.    Private Sub New()
  178.    End Sub
  179.  
  180.    ''' <summary>
  181.    ''' Initializes a new instance of the <see cref="PlaylistEditor"/> class.
  182.    ''' </summary>
  183.    ''' <param name="PlaylistFile">Indicates the playlist filepath.</param>
  184.    ''' <param name="PlaylistType">Indicates the type of the playlist.</param>
  185.    ''' <param name="Append">
  186.    ''' If set to <c>true</c> the <see cref="PlaylistEditor"/> instance will assume that the playlist file already exist,
  187.    ''' and will append any new entries in the existing file.
  188.    ''' If set to <c>false</c> the <see cref="PlaylistEditor"/> instance will assume that the playlist file does not exist,
  189.    ''' and will create the file.
  190.    ''' </param>
  191.    ''' <param name="FileEncoding">
  192.    ''' Optionally indicates the file encoding to write/read the playlist content.
  193.    ''' The default value is <see cref="Encoding.Default"/>
  194.    ''' </param>
  195.    Public Sub New(ByVal PlaylistFile As String,
  196.                   ByVal PlaylistType As PlaylistType,
  197.                   ByVal Append As Boolean,
  198.                   Optional ByVal FileEncoding As Encoding = Nothing)
  199.  
  200.        Me._FilePath = PlaylistFile
  201.        Me._Type = PlaylistType
  202.        Me._Encoding = If(FileEncoding IsNot Nothing, FileEncoding, Encoding.Default)
  203.        Me._Append = Append
  204.  
  205.        If Not _Append Then
  206.            Me.AddHeaders()
  207.        End If
  208.  
  209.    End Sub
  210.  
  211. #End Region
  212.  
  213. #Region " Hidden Methods "
  214.  
  215.    ''' <summary>
  216.    ''' Serves as a hash function for a particular type.
  217.    ''' </summary>
  218.    <EditorBrowsable(EditorBrowsableState.Never)>
  219.    Public Shadows Sub GetHashCode()
  220.    End Sub
  221.  
  222.    ''' <summary>
  223.    ''' Determines whether the specified System.Object instances are considered equal.
  224.    ''' </summary>
  225.    <EditorBrowsable(EditorBrowsableState.Never)>
  226.    Public Shadows Sub Equals()
  227.    End Sub
  228.  
  229.    ''' <summary>
  230.    ''' Determines whether the specified System.Object instances are the same instance.
  231.    ''' </summary>
  232.    <EditorBrowsable(EditorBrowsableState.Never)>
  233.    Private Shadows Sub ReferenceEquals()
  234.    End Sub
  235.  
  236.    ''' <summary>
  237.    ''' Returns a String that represents the current object.
  238.    ''' </summary>
  239.    <EditorBrowsable(EditorBrowsableState.Never)>
  240.    Public Shadows Sub ToString()
  241.    End Sub
  242.  
  243. #End Region
  244.  
  245. #Region " Private Methods "
  246.  
  247.    ''' <summary>
  248.    ''' Adds the playlist headers in the playlist file.
  249.    ''' This method should be called first before add any entry in the playlist.
  250.    ''' </summary>
  251.    Private Sub AddHeaders()
  252.  
  253.        Dim sb As New StringBuilder
  254.  
  255.        Select Case Me._Type
  256.  
  257.            Case PlaylistType.M3U
  258.                sb.AppendLine("#EXTM3U")
  259.  
  260.            Case PlaylistType.PLS
  261.                With sb
  262.                    .AppendLine("[playlist]")
  263.                    .AppendLine("NumberOfEntries=0")
  264.                    .AppendLine("Version=2")
  265.                End With
  266.  
  267.        End Select
  268.  
  269.        File.WriteAllText(Me._FilePath, sb.ToString, Me._Encoding)
  270.        sb.Clear()
  271.  
  272.    End Sub
  273.  
  274.    ''' <summary>
  275.    ''' Gets the amount of total entries of a PLS playlist file.
  276.    ''' </summary>
  277.    ''' <returns>The current number of total entries.</returns>
  278.    Private Function GetPLSNumberOfEntries() As Integer
  279.  
  280.        Dim PlaylistContent As String = File.ReadAllText(Me._FilePath, Me._Encoding)
  281.  
  282.        Dim StartIndex As Integer =
  283.            PlaylistContent.IndexOf("=") + 1I
  284.  
  285.        Dim EndIndex As Integer =
  286.            PlaylistContent.IndexOf(ControlChars.NewLine, StartIndex) - StartIndex
  287.  
  288.        Return PlaylistContent.Substring(StartIndex, PlaylistContent.IndexOf(String.Empty, EndIndex))
  289.  
  290.    End Function
  291.  
  292.    ''' <summary>
  293.    ''' Fixes the track index count of a PLS playlist file.
  294.    ''' This method shoould be called after remove a track from the playlist.
  295.    ''' </summary>
  296.    Private Sub FixPLSTrackIndex()
  297.  
  298.        Dim PlaylistContent As List(Of String) = File.ReadAllLines(Me._FilePath, Me._Encoding).ToList
  299.        Dim TrackCount As Integer = 0I
  300.  
  301.        For Index As Integer = 0 To (PlaylistContent.Count - 1I)
  302.  
  303.            If PlaylistContent(Index).StartsWith("File", StringComparison.OrdinalIgnoreCase) Then
  304.  
  305.                TrackCount += 1I
  306.  
  307.                PlaylistContent(Index) = String.Format("File{0}={1}",
  308.                                                       CStr(TrackCount),
  309.                                                       PlaylistContent(Index).Substring(PlaylistContent(Index).IndexOf("="c) + 1I))
  310.  
  311.            ElseIf PlaylistContent(Index).StartsWith("Title", StringComparison.OrdinalIgnoreCase) Then
  312.                PlaylistContent(Index) = String.Format("Title{0}={1}",
  313.                                                       CStr(TrackCount),
  314.                                                       PlaylistContent(Index).Substring(PlaylistContent(Index).IndexOf("="c) + 1I))
  315.  
  316.            ElseIf PlaylistContent(Index).StartsWith("Length", StringComparison.OrdinalIgnoreCase) Then
  317.                PlaylistContent(Index) = String.Format("Length{0}={1}",
  318.                                                       CStr(TrackCount),
  319.                                                       PlaylistContent(Index).Substring(PlaylistContent(Index).IndexOf("="c) + 1I))
  320.  
  321.            End If
  322.  
  323.        Next Index
  324.  
  325.        Dim NumberOfEntriesEntryIndex As Integer =
  326.            PlaylistContent.FindIndex(Function(Item As String)
  327.                                          Return Item.ToLower Like "numberofentries=#*"
  328.                                      End Function)
  329.  
  330.        PlaylistContent(NumberOfEntriesEntryIndex) =
  331.            String.Format("NumberOfEntries={0}", CStr(TrackCount))
  332.  
  333.        File.WriteAllLines(Me._FilePath, PlaylistContent, Me._Encoding)
  334.  
  335.    End Sub
  336.  
  337. #End Region
  338.  
  339. #Region " Public Methods "
  340.  
  341.    ''' <summary>
  342.    ''' Adds a new track entry in the playlist.
  343.    ''' </summary>
  344.    ''' <param name="Path">Indicates the track path to add.</param>
  345.    ''' <param name="AllowDuplicate">
  346.    ''' If set to <c>true</c> an exception will be thrown if the track already exists in the playlist.
  347.    ''' </param>
  348.    ''' <exception cref="System.Exception">The TrackPath already exist in the playlist.</exception>
  349.    Public Sub Add(ByVal [Path] As String,
  350.                   Optional ByVal AllowDuplicate As Boolean = False)
  351.  
  352.        If Not AllowDuplicate AndAlso Me.Exist([Path]) Then
  353.            Throw New Exception("The TrackPath already exist in the playlist.") With {.Source = [Path]}
  354.        End If
  355.  
  356.        Dim sb As New StringBuilder
  357.  
  358.        Select Case Me._Type
  359.  
  360.            Case PlaylistType.M3U
  361.  
  362.                With sb
  363.                    .AppendLine()
  364.                    .AppendLine([Path])
  365.                    File.AppendAllText(Me._FilePath, .ToString, Me._Encoding)
  366.                    .Clear()
  367.  
  368.                End With
  369.  
  370.            Case PlaylistType.PLS
  371.  
  372.                Dim EntryCount As Integer = Me.GetPLSNumberOfEntries()
  373.  
  374.                With sb
  375.  
  376.                    .AppendLine(File.ReadAllText(Me._FilePath, Me._Encoding).
  377.                                     Replace("NumberOfEntries=" & CStr(EntryCount),
  378.                                             "NumberOfEntries=" & CStr(EntryCount + 1I)))
  379.  
  380.                    .AppendLine(String.Format("File{0}={1}", CStr(EntryCount + 1I), [Path].Replace("\", "/")))
  381.  
  382.                    File.WriteAllText(Me._FilePath, .ToString, Me._Encoding)
  383.                    .Clear()
  384.  
  385.                End With
  386.  
  387.        End Select
  388.  
  389.    End Sub
  390.  
  391.    ''' <summary>
  392.    ''' Adds a new track entry in the playlist, with extended track information.
  393.    ''' </summary>
  394.    ''' <param name="Path">Indicates the track to add.</param>
  395.    ''' <param name="Title">Indicates the track title.</param>
  396.    ''' <param name="Length">Indicates the track length.</param>
  397.    Public Sub Add(ByVal [Path] As String,
  398.                   ByVal Title As String,
  399.                   ByVal Length As TimeSpan,
  400.                   Optional ByVal AllowDuplicate As Boolean = False)
  401.  
  402.        If Not AllowDuplicate AndAlso Me.Exist([Path]) Then
  403.            Throw New Exception("The TrackPath already exist in the playlist.") With {.Source = [Path]}
  404.        End If
  405.  
  406.        Dim sb As New StringBuilder
  407.  
  408.        Select Case Me._Type
  409.  
  410.            Case PlaylistType.M3U
  411.  
  412.                With sb
  413.  
  414.                    .AppendLine()
  415.                    .AppendLine(String.Format("#EXTINF:{0},{1}",
  416.                                                CStr(Math.Truncate(Length.TotalSeconds)),
  417.                                                Title))
  418.                    .AppendLine([Path])
  419.  
  420.                    File.AppendAllText(Me._FilePath, .ToString, Me._Encoding)
  421.                    .Clear()
  422.  
  423.                End With
  424.  
  425.            Case PlaylistType.PLS
  426.  
  427.                Dim EntryCount As Integer = Me.GetPLSNumberOfEntries()
  428.  
  429.                With sb
  430.  
  431.                    .AppendLine(File.ReadAllText(Me._FilePath, Me._Encoding).
  432.                                     Replace("NumberOfEntries=" & CStr(EntryCount),
  433.                                             "NumberOfEntries=" & CStr(EntryCount + 1I)))
  434.  
  435.                    .AppendLine(String.Format("File{0}={1}", CStr(EntryCount + 1I), [Path].Replace("\", "/")))
  436.                    .AppendLine(String.Format("Title{0}={1}", CStr(EntryCount + 1I), Title))
  437.                    .AppendLine(String.Format("Length{0}={1}", CStr(EntryCount + 1I), CStr(Math.Truncate(Length.TotalSeconds))))
  438.  
  439.                    File.WriteAllText(Me._FilePath, .ToString, Me._Encoding)
  440.                    .Clear()
  441.  
  442.                End With
  443.  
  444.        End Select
  445.  
  446.    End Sub
  447.  
  448.    ''' <summary>
  449.    ''' Adds a new track entry in the playlist, with extended track information.
  450.    ''' </summary>
  451.    ''' <param name="TrackInfo">A <see cref="TrackInfo"/> instance containing the extended track information.</param>
  452.    Public Sub Add(ByVal TrackInfo As TrackInfo,
  453.                   Optional ByVal AllowDuplicate As Boolean = False)
  454.  
  455.        Me.Add(TrackInfo.Path, TrackInfo.Title, TrackInfo.Length, AllowDuplicate)
  456.  
  457.    End Sub
  458.  
  459.    ''' <summary>
  460.    ''' Removes the specified track entry from the playlist.
  461.    ''' </summary>
  462.    ''' <param name="Path">Indicates the track path to remove it's entry.</param>
  463.    ''' <exception cref="System.Exception">The TrackPath was not found in the playlist.</exception>
  464.    Public Sub Remove(ByVal [Path] As String)
  465.  
  466.        If Not Me.Exist([Path]) Then
  467.            Throw New Exception("The TrackPath was not found in the playlist.") With {.Source = [Path]}
  468.        End If
  469.  
  470.        Dim PlaylistContent As List(Of String) = File.ReadAllLines(Me._FilePath, Me._Encoding).ToList
  471.  
  472.        Select Case Me._Type
  473.  
  474.            Case PlaylistType.M3U
  475.  
  476.                Dim EntryIndex As Integer =
  477.                    PlaylistContent.FindIndex(Function(Item As String)
  478.                                                  Return Item.Equals([Path], StringComparison.OrdinalIgnoreCase)
  479.                                              End Function)
  480.  
  481.                PlaylistContent.RemoveAt(EntryIndex)
  482.  
  483.                If PlaylistContent(EntryIndex - 1).StartsWith("#EXTINF", StringComparison.OrdinalIgnoreCase) Then
  484.                    PlaylistContent.RemoveAt(EntryIndex - 1)
  485.                End If
  486.  
  487.                File.WriteAllLines(Me._FilePath, PlaylistContent, Me._Encoding)
  488.  
  489.            Case PlaylistType.PLS
  490.  
  491.                Dim EntryIndex As Integer =
  492.                    PlaylistContent.FindIndex(Function(Item As String)
  493.                                                  Return Item.ToLower Like "file#*" & [Path].Replace("\", "/").ToLower
  494.                                              End Function)
  495.  
  496.                Dim TrackIndexDelimStartIndex As Integer =
  497.                    PlaylistContent(EntryIndex).IndexOf("e", StringComparison.OrdinalIgnoreCase) + 1I
  498.  
  499.                Dim TrackIndexDelimEndIndex As Integer =
  500.                    PlaylistContent(EntryIndex).IndexOf("=", StringComparison.OrdinalIgnoreCase)
  501.  
  502.                Dim TrackIndex As Integer =
  503.                    PlaylistContent(EntryIndex).Substring(TrackIndexDelimStartIndex,
  504.                                                          TrackIndexDelimEndIndex - TrackIndexDelimStartIndex)
  505.  
  506.                PlaylistContent.RemoveAt(EntryIndex)
  507.  
  508.                Dim TitleEntryIndex As Integer =
  509.                    PlaylistContent.FindIndex(Function(Item As String)
  510.                                                  Return Item.ToLower Like String.Format("title{0}=*", CStr(TrackIndex))
  511.                                              End Function)
  512.  
  513.                If TitleEntryIndex <> -1I Then
  514.                    PlaylistContent.RemoveAt(TitleEntryIndex)
  515.                End If
  516.  
  517.                Dim LengthEntryIndex As Integer =
  518.                    PlaylistContent.FindIndex(Function(Item As String)
  519.                                                  Return Item.ToLower Like String.Format("length{0}=*", CStr(TrackIndex))
  520.                                              End Function)
  521.  
  522.                If LengthEntryIndex <> -1I Then
  523.                    PlaylistContent.RemoveAt(LengthEntryIndex)
  524.                End If
  525.  
  526.                Dim NumberOfEntriesEntryIndex As Integer =
  527.                    PlaylistContent.FindIndex(Function(Item As String)
  528.                                                  Return Item.ToLower Like "numberofentries=#*"
  529.                                              End Function)
  530.  
  531.                PlaylistContent(NumberOfEntriesEntryIndex) =
  532.                    String.Format("NumberOfEntries={0}", CStr(Me.GetPLSNumberOfEntries() - 1I))
  533.  
  534.                File.WriteAllLines(Me._FilePath, PlaylistContent, Me._Encoding)
  535.  
  536.                Me.FixPLSTrackIndex()
  537.  
  538.        End Select
  539.  
  540.    End Sub
  541.  
  542.    ''' <summary>
  543.    ''' Removes the specified track entry from the playlist.
  544.    ''' </summary>
  545.    ''' <param name="TrackIndex">Indicates the track index to remove it's entry.</param>
  546.    ''' <exception cref="System.IndexOutOfRangeException">TrackIndex is out of range</exception>
  547.    Public Sub Remove(ByVal TrackIndex As Integer)
  548.  
  549.        Dim Track = Me.GetTrack(TrackIndex)
  550.  
  551.        If Track IsNot Nothing Then
  552.            Me.Remove(Track.Path)
  553.        Else
  554.            Throw New IndexOutOfRangeException("TrackIndex is out of range") With {.Source = TrackIndex}
  555.        End If
  556.  
  557.    End Sub
  558.  
  559.    ''' <summary>
  560.    ''' Sets the extended track info of the specified track.
  561.    ''' </summary>
  562.    ''' <param name="Path">Indicates the track path to set its extended track info.</param>
  563.    ''' <param name="TrackInfo">A <see cref="TrackInfo" /> instance containing the extended info to set.</param>
  564.    ''' <exception cref="System.Exception">The TrackPath was not found in the playlist.</exception>
  565.    Public Sub [Set](ByVal [Path] As String,
  566.                     ByVal TrackInfo As TrackInfo)
  567.  
  568.        If Not Me.Exist([Path]) Then
  569.            Throw New Exception("The TrackPath was not found in the playlist.") With {.Source = [Path]}
  570.        End If
  571.  
  572.        Dim Track As TrackInfo = Me.GetTrack([Path])
  573.        With Track
  574.            .Path = TrackInfo.Path
  575.            .Title = TrackInfo.Title
  576.            .Length = TrackInfo.Length
  577.        End With
  578.  
  579.        Dim PlaylistContent As List(Of String) = File.ReadAllLines(Me._FilePath, Me._Encoding).ToList
  580.  
  581.        Select Case Me._Type
  582.  
  583.            Case PlaylistType.M3U
  584.  
  585.                Dim EntryIndex As Integer =
  586.                    PlaylistContent.FindIndex(Function(Item As String)
  587.                                                  Return Item.Equals([Path], StringComparison.OrdinalIgnoreCase)
  588.                                              End Function)
  589.  
  590.                PlaylistContent(EntryIndex) = String.Format("#EXTINF:{0},{1}",
  591.                                                            CStr(Math.Truncate(Track.Length.TotalSeconds)),
  592.                                                            Track.Title) & Environment.NewLine & Track.Path
  593.  
  594.                If PlaylistContent(EntryIndex - 1I).StartsWith("#EXTINF", StringComparison.OrdinalIgnoreCase) Then
  595.                    PlaylistContent.RemoveAt(EntryIndex - 1I)
  596.                End If
  597.  
  598.                File.WriteAllLines(Me._FilePath, PlaylistContent, Me._Encoding)
  599.  
  600.            Case PlaylistType.PLS
  601.  
  602.                Track.Path = Track.Path.Replace("\", "/")
  603.  
  604.                Dim EntryIndex As Integer =
  605.                    PlaylistContent.FindIndex(Function(Item As String)
  606.                                                  Return Item.ToLower Like "file#*" & [Path].Replace("\", "/").ToLower
  607.                                              End Function)
  608.  
  609.                PlaylistContent(EntryIndex) = String.Format("File{0}={1}", CStr(Track.Index), Track.Path) & Environment.NewLine &
  610.                                              String.Format("Title{0}={1}", CStr(Track.Index), Track.Title) & Environment.NewLine &
  611.                                              String.Format("Length{0}={1}", CStr(Track.Index), CStr(Math.Truncate(Track.Length.TotalSeconds)))
  612.  
  613.                If PlaylistContent.Count > (EntryIndex + 1) Then
  614.  
  615.                    If PlaylistContent(EntryIndex + 2I).StartsWith("Title", StringComparison.OrdinalIgnoreCase) _
  616.                    OrElse PlaylistContent(EntryIndex + 2I).StartsWith("Length", StringComparison.OrdinalIgnoreCase) Then
  617.  
  618.                        PlaylistContent.RemoveAt(EntryIndex + 2I)
  619.  
  620.                    End If
  621.  
  622.                End If
  623.  
  624.                If PlaylistContent.Count > EntryIndex Then
  625.  
  626.                    If PlaylistContent(EntryIndex + 1I).StartsWith("Title", StringComparison.OrdinalIgnoreCase) _
  627.                    OrElse PlaylistContent(EntryIndex + 1I).StartsWith("Length", StringComparison.OrdinalIgnoreCase) Then
  628.  
  629.                        PlaylistContent.RemoveAt(EntryIndex + 1I)
  630.  
  631.                    End If
  632.  
  633.                End If
  634.  
  635.                File.WriteAllLines(Me._FilePath, PlaylistContent, Me._Encoding)
  636.  
  637.        End Select
  638.  
  639.    End Sub
  640.  
  641.    ''' <summary>
  642.    ''' Sets the extended track info of the specified track.
  643.    ''' </summary>
  644.    ''' <param name="TrackIndex">Indicates the track index to set its extended track info.</param>
  645.    ''' <param name="TrackInfo">A <see cref="TrackInfo" /> instance containing the extended info to set.</param>
  646.    ''' <exception cref="System.IndexOutOfRangeException">TrackIndex is out of range</exception>
  647.    Public Sub [Set](ByVal TrackIndex As Integer,
  648.                     ByVal TrackInfo As TrackInfo)
  649.  
  650.        If Not Me.Exist(TrackIndex) Then
  651.            Throw New IndexOutOfRangeException("TrackIndex is out of range") With {.Source = TrackIndex}
  652.        End If
  653.  
  654.        Me.[Set](Me.GetTrack(TrackIndex).Path, TrackInfo)
  655.  
  656.    End Sub
  657.  
  658.    ''' <summary>
  659.    ''' Gets the extended track information (if any) of the specified track in the playlist.
  660.    ''' </summary>
  661.    ''' <param name="Path">Indicates the track path.</param>
  662.    ''' <returns>
  663.    ''' If the track contains extended iformation,
  664.    ''' the return value is a <see cref="TrackInfo"/> instance containing the track info.
  665.    ''' Otherwise, the return value is an emptiness <see cref="TrackInfo"/> instance.
  666.    ''' </returns>
  667.    Public Function GetTrack(ByVal Path As String) As TrackInfo
  668.  
  669.        Dim PlaylistContent As List(Of String) = File.ReadAllLines(Me._FilePath, Me._Encoding).ToList
  670.        Dim TInfo As New TrackInfo
  671.  
  672.        Select Case Me._Type
  673.  
  674.            Case PlaylistType.M3U
  675.  
  676.                Dim EntryIndex As Integer = PlaylistContent.FindIndex(Function(Item As String)
  677.                                                                          Return Item.Equals([Path], StringComparison.OrdinalIgnoreCase)
  678.                                                                      End Function) - 1I
  679.  
  680.                If PlaylistContent(EntryIndex).StartsWith("#EXTINF", StringComparison.OrdinalIgnoreCase) Then
  681.  
  682.                    Dim TitleDelimIndex As Integer = PlaylistContent(EntryIndex).IndexOf(","c) + 1I
  683.                    Dim LengthDelimIndex As Integer = PlaylistContent(EntryIndex).IndexOf(":"c) + 1I
  684.  
  685.                    With TInfo
  686.  
  687.                        '.Index = EntryIndex
  688.                        .Path = [Path]
  689.                        .Title = PlaylistContent(EntryIndex).Substring(TitleDelimIndex)
  690.                        .Length = TimeSpan.FromSeconds(PlaylistContent(EntryIndex).Substring(LengthDelimIndex,
  691.                                                                                             (TitleDelimIndex - LengthDelimIndex)))
  692.                    End With
  693.  
  694.                End If
  695.  
  696.            Case PlaylistType.PLS
  697.  
  698.                [Path] = [Path].Replace("\", "/")
  699.  
  700.                Dim Entry As String = (From Item As String In PlaylistContent
  701.                                       Where Item.ToLower Like String.Format("file#*={0}", [Path].ToLower)).FirstOrDefault
  702.  
  703.                If Not String.IsNullOrEmpty(Entry) Then
  704.  
  705.                    Dim IndexDelimStartIndex As Integer =
  706.                        Entry.IndexOf("e", StringComparison.OrdinalIgnoreCase) + 1I
  707.  
  708.                    Dim IndexDelimEndIndex As Integer =
  709.                        Entry.IndexOf("=", StringComparison.OrdinalIgnoreCase)
  710.  
  711.                    Dim EntryIndex As Integer = Entry.Substring(IndexDelimStartIndex,
  712.                                                                IndexDelimEndIndex - IndexDelimStartIndex)
  713.  
  714.                    Dim TitleEntry As String = (From Item As String In PlaylistContent
  715.                                                Where Item.StartsWith(String.Format("Title{0}=", CStr(EntryIndex)), StringComparison.OrdinalIgnoreCase)).
  716.                                                FirstOrDefault
  717.  
  718.                    Dim LengthEntry As String = (From Item As String In PlaylistContent
  719.                                                 Where Item.StartsWith(String.Format("Length{0}=", CStr(EntryIndex)), StringComparison.OrdinalIgnoreCase)).
  720.                                                 FirstOrDefault
  721.  
  722.                    With TInfo
  723.  
  724.                        .Index = EntryIndex
  725.  
  726.                        .Path = [Path]
  727.  
  728.                        .Title = If(Not String.IsNullOrEmpty(TitleEntry),
  729.                                    TitleEntry.Substring(TitleEntry.IndexOf("=") + 1I),
  730.                                    Nothing)
  731.  
  732.                        .Length = If(Not String.IsNullOrEmpty(TitleEntry),
  733.                                     TimeSpan.FromSeconds(LengthEntry.Split("=").LastOrDefault),
  734.                                     Nothing)
  735.  
  736.                    End With
  737.  
  738.                End If
  739.  
  740.        End Select
  741.  
  742.        Return TInfo
  743.  
  744.    End Function
  745.  
  746.    ''' <summary>
  747.    ''' Gets the track path and its extended track information (if any) of the specified track index in the playlist.
  748.    ''' </summary>
  749.    ''' <param name="TrackIndex">Indicates the track index.</param>
  750.    ''' <returns>
  751.    ''' If the track index exist,
  752.    ''' the return value is a <see cref="TrackInfo"/> instance containing the track path and its extended info (if any).
  753.    ''' Otherwise, the return value is <c>Nothing</c>.
  754.    ''' </returns>
  755.    Public Function GetTrack(ByVal TrackIndex As Integer) As TrackInfo
  756.  
  757.        Dim PlaylistContent As List(Of String) = File.ReadAllLines(Me._FilePath, Me._Encoding).ToList
  758.  
  759.        Select Case Me._Type
  760.  
  761.            Case PlaylistType.M3U
  762.  
  763.                Dim TrackCount As Integer = 0I
  764.  
  765.                For Index As Integer = 0I To (PlaylistContent.Count - 1I)
  766.  
  767.                    If Not String.IsNullOrEmpty(PlaylistContent(Index)) _
  768.                       AndAlso Not PlaylistContent(Index).StartsWith("#EXT", StringComparison.OrdinalIgnoreCase) Then
  769.  
  770.                        TrackCount += 1I
  771.  
  772.                        If TrackCount = TrackIndex Then
  773.  
  774.                            Dim TInfo As TrackInfo = Me.GetTrack(PlaylistContent(Index))
  775.                            With TInfo
  776.                                .Index = TrackIndex
  777.                                .Path = PlaylistContent(Index)
  778.                            End With
  779.  
  780.                            Return TInfo
  781.  
  782.                        End If
  783.  
  784.                    End If
  785.  
  786.                Next Index
  787.  
  788.            Case PlaylistType.PLS
  789.  
  790.                For Index As Integer = 0I To (PlaylistContent.Count - 1I)
  791.  
  792.                    If PlaylistContent(Index).StartsWith(String.Format("File{0}=", CStr(TrackIndex)),
  793.                                                         StringComparison.OrdinalIgnoreCase) Then
  794.  
  795.                        Return Me.GetTrack(PlaylistContent(Index).Substring(PlaylistContent(Index).IndexOf("="c) + 1I))
  796.  
  797.                    End If
  798.  
  799.                Next Index
  800.  
  801.        End Select
  802.  
  803.        Return Nothing
  804.  
  805.    End Function
  806.  
  807.    ''' <summary>
  808.    ''' Gets all the tracks and its extended track information (if any) in the playlist.
  809.    ''' </summary>
  810.    ''' <returns>
  811.    ''' A <see cref="List(Of TrackInfo)"/> object containing the track entries and its extended info (if any).
  812.    ''' </returns>
  813.    Public Function GetTracks() As List(Of TrackInfo)
  814.  
  815.        Dim PlaylistContent As List(Of String) = File.ReadAllLines(Me._FilePath, Me._Encoding).ToList
  816.        Dim TInfo As New List(Of TrackInfo)
  817.        Dim TrackCount As Integer = 0I
  818.  
  819.        Select Case Me._Type
  820.  
  821.            Case PlaylistType.M3U
  822.  
  823.                For Index As Integer = 0I To (PlaylistContent.Count - 1I)
  824.  
  825.                    If Not String.IsNullOrEmpty(PlaylistContent(Index)) _
  826.                       AndAlso Not PlaylistContent(Index).StartsWith("#EXT", StringComparison.OrdinalIgnoreCase) Then
  827.  
  828.                        TrackCount += 1
  829.                        TInfo.Add(Me.GetTrack(TrackCount))
  830.  
  831.                    End If
  832.  
  833.                Next
  834.  
  835.            Case PlaylistType.PLS
  836.  
  837.                For Index As Integer = 0I To (PlaylistContent.Count - 1I)
  838.  
  839.                    If PlaylistContent(Index).StartsWith("File", StringComparison.OrdinalIgnoreCase) Then
  840.  
  841.                        TrackCount += 1I
  842.                        TInfo.Add(Me.GetTrack(TrackCount))
  843.  
  844.                    End If
  845.  
  846.                Next Index
  847.  
  848.        End Select
  849.  
  850.        Return TInfo
  851.  
  852.    End Function
  853.  
  854.    ''' <summary>
  855.    ''' Determines whether the specified track exists in the playlist.
  856.    ''' </summary>
  857.    ''' <param name="Path">Indicates the track path.</param>
  858.    ''' <returns>
  859.    ''' <c>true</c> if the track already exists in the playlist, <c>false</c> otherwise.
  860.    ''' </returns>
  861.    Public Function Exist(ByVal [Path] As String) As Boolean
  862.  
  863.        Dim ReturnValue As Boolean = False
  864.  
  865.        Select Case Me._Type
  866.  
  867.            Case PlaylistType.M3U
  868.  
  869.                ReturnValue = (From Item As String In File.ReadAllLines(Me._FilePath, Me._Encoding)
  870.                               Where Item.StartsWith([Path], StringComparison.OrdinalIgnoreCase)).
  871.                               Any()
  872.  
  873.            Case PlaylistType.PLS
  874.  
  875.                ReturnValue = (From Item As String In File.ReadAllLines(Me._FilePath, Me._Encoding)
  876.                               Where Item.ToLower Like "file#*" & [Path].Replace("\", "/").ToLower).
  877.                               Any()
  878.  
  879.        End Select
  880.  
  881.        Return ReturnValue
  882.  
  883.    End Function
  884.  
  885.    ''' <summary>
  886.    ''' Determines whether the specified track exists in the playlist.
  887.    ''' </summary>
  888.    ''' <param name="TrackIndex">Indicates the track index.</param>
  889.    ''' <returns><c>true</c> if the track already exists in the playlist, <c>false</c> otherwise.</returns>
  890.    ''' <exception cref="System.IndexOutOfRangeException">TrackIndex should be greater than 0.</exception>
  891.    Public Function Exist(ByVal TrackIndex As Integer) As Boolean
  892.  
  893.        If TrackIndex <= 0 Then
  894.            Throw New IndexOutOfRangeException("TrackIndex should be greater than 0.") With {.Source = TrackIndex}
  895.        End If
  896.  
  897.        Return (Me.Count >= TrackIndex)
  898.  
  899.    End Function
  900.  
  901.    ''' <summary>
  902.    ''' Counts the amount of track entries in the playlist.
  903.    ''' </summary>
  904.    ''' <returns>
  905.    ''' The amount of track entries in the playlist.
  906.    ''' </returns>
  907.    Public Function Count() As Integer
  908.  
  909.        Return Me.GetTracks.Count
  910.  
  911.    End Function
  912.  
  913. #End Region
  914.  
  915. End Class
  916.  
  917. #End Region
  918.  
6964  Programación / .NET (C#, VB.NET, ASP) / [APORTE] Multimedia Playlist Editor (M3U y PLS) en: 22 Julio 2014, 02:04 am
Hola

Comparto esta Class cuya finalidad es la de administrar las pistas de una lista multimedia.

Para quien no sepa lo que es una lista multimedia, son unos archivos de texto plano que utilizan los reproductores de archivos multimedia (Video/Audio) para crear listas de reproducción.

Estas son ejemplos de los tipos de listas que soporta mi Class:

M3U:
Código:
#EXTM3U

#EXTINF:330,Track1 Title
C:\Track1.avi

C:\Track2.mp4

#EXTINF:5720,Track3 Title
C:\Track3.mp3

PLS:
Código:
[playlist]
NumberOfEntries=3
Version=2

File1=C:/Track1.avi

File2=C:/Track2.mp4
Title2=My Track2 Title!
Length2=5720

File3=C:/Track3.mp3
Title3=My Track3 Title!
Length3=330

Características del código:
· Se puede trabajar con dos tipos de listas, M3U y PLS.
· Se puede añadir entradas de pistas con o sin información extendida, así como editar una entrada, eliminar, determinar si existe, o buscar para obtener la información extendida de una pista.
· La mayoría de los métodos que desarrollé tienen overloads para trabajar pasandole o bien la ruta de la pista, o el índice de la pista (primero hay que conocer el índice, claro).

El código en general no creo que me haya quedado muy optimizado, de echo tengo que evitar la recursividad de algún que otro método, pero por el momento está bien y hace su función, aunque si encuentran cualquier fallo o cualquier sugerencia que quieran hacer entonces porfavor comenten.

PD: No he añadido muchos controles de errores, ya que he supuesto que si se le da el uso correcto no debería dar errores (más hallá de los que sí están controlados).

PD2: Al principio me propuse hacerlo todo mediante FileStreams y manteniendo el archivo abierto para denegar el acceso manual al archivo, pero el formato PLS me lo puso muy complicado porque hay que hacer operaciones constantes de búsqueda y modificar un valor tras cada operación así que para no comerme mucho más la cabeza decidí usar un StringBuilder y también listas de Strings, sin más, dejando un poco de lado los permisos de lectura/escritura del archivo del playlist y tambien el rendimiento en general ...los tiempos de ejecución, pero de todas formas recordemos que se trataría de un simple archivo de texto que no debería tener muchas lineas, aunque se optimizase el código no creo que se apreciase la diferencia (en milisegundos xD)...





Estos son algunos ejemplos de uso:

Código
  1.        ' **********************************
  2.        ' Instance the PlaylistEditor Class
  3.        ' **********************************
  4.        Dim Playlist As New PlaylistEditor(PlaylistFile:="C:\Playlist.m3u",
  5.                                           PlaylistType:=PlaylistEditor.PlaylistType.M3U,
  6.                                           Append:=False,
  7.                                           FileEncoding:=System.Text.Encoding.Default)
  8.  
  9.        ' ************************************
  10.        ' Retrieve the instanced object info
  11.        ' ************************************
  12.        MessageBox.Show(Playlist.FilePath)
  13.        MessageBox.Show(Playlist.Type.ToString)
  14.        MessageBox.Show(CStr(Playlist.Append))
  15.        MessageBox.Show(String.Format("Encoding: {0}, CodePage: {1}",
  16.                                      Playlist.FileEncoding.BodyName,
  17.                                      Playlist.FileEncoding.CodePage))
  18.  
  19.        ' ***************************
  20.        ' Instance a TrackInfo Class
  21.        ' ***************************
  22.        Dim TInfo As New PlaylistEditor.TrackInfo
  23.        With TInfo
  24.            .Path = "C:\Track1.ext"
  25.            .Title = "Track1 Title"
  26.            .Length = TimeSpan.Parse("00:05:30")
  27.        End With
  28.  
  29.        ' ***************
  30.        ' Add a new track
  31.        ' ***************
  32.        Playlist.Add(TrackInfo:=TInfo)
  33.        Playlist.Add(Path:="C:\Track2.ext", AllowDuplicate:=False)
  34.        Playlist.Add(Path:="C:\Track3.ext", Title:="Track3 Title", Length:=TimeSpan.Parse("01:35:20"))
  35.  
  36.        ' *************************************************
  37.        ' Sets the extended track info of an existing track
  38.        ' *************************************************
  39.        Dim OldTrackPath As String = "C:\Track3.ext"
  40.  
  41.        Dim TInfoSet As New PlaylistEditor.TrackInfo
  42.        With TInfoSet
  43.            .Path = "C:\Modified Track3.ext"
  44.            .Title = "My modified Track3 title"
  45.            .Length = Playlist.GetTrack(OldTrackPath).Length
  46.        End With
  47.  
  48.        Playlist.Set(Path:=OldTrackPath, TrackInfo:=TInfoSet)
  49.  
  50.        ' ************************
  51.        ' Remove an existing track
  52.        ' ************************
  53.        Playlist.Remove(Path:="C:\Track3.ext")
  54.        Playlist.Remove(TrackIndex:=2I)
  55.  
  56.        ' ********************************
  57.        ' Determine whether a track exists
  58.        ' ********************************
  59.        MessageBox.Show(Playlist.Exist(Path:="C:\Track3.ext"))
  60.        MessageBox.Show(Playlist.Exist(TrackIndex:=3I))
  61.  
  62.        ' ************************************************
  63.        ' Count the total amount of tracks in the playlist
  64.        ' ************************************************
  65.        MessageBox.Show(Playlist.Count)
  66.  
  67.        ' ************************************
  68.        ' Get extended track info from a track
  69.        ' ************************************
  70.        Dim TrackInfo1 As PlaylistEditor.TrackInfo = Playlist.GetTrack(Path:="C:\Track1.ext")
  71.        Dim TrackInfo2 As PlaylistEditor.TrackInfo = Playlist.GetTrack(TrackIndex:=2I)
  72.  
  73.        ' ******************************************
  74.        ' Get all tracks and its extended track info
  75.        ' ******************************************
  76.        Dim sb As New System.Text.StringBuilder
  77.        Dim Tracks As List(Of PlaylistEditor.TrackInfo) = Playlist.GetTracks()
  78.  
  79.        For Each Track As PlaylistEditor.TrackInfo In Tracks
  80.  
  81.            With sb
  82.                .Clear()
  83.                .AppendLine(String.Format("Track Index : {0}", CStr(Track.Index)))
  84.                .AppendLine(String.Format("Track Path  : {0}", Track.Path))
  85.                .AppendLine(String.Format("Track Title : {0}", Track.Title))
  86.                .AppendLine(String.Format("Track Length: {0}", Convert.ToString(Track.Length)))
  87.            End With
  88.  
  89.            MessageBox.Show(sb.ToString)
  90.  
  91.        Next Track
6965  Sistemas Operativos / Windows / Re: [TUTORIAL] Formatear windows 7 + Drivers + Configuracion y Seguridad en: 21 Julio 2014, 19:51 pm
me quedo mejor creo jejeje
Yo considero que así está mucho mejor :P

comentar y agradecer eso me ayuda a seguir!! :silbar:

En el paso 2, pusiste 2 videos que se supone son distintos, pero son el mismo video.

PD: Gracias por compartir.
6966  Sistemas Operativos / Windows / Re: [TUTORIAL] Formatear windows 7 + Drivers + Configuración en: 21 Julio 2014, 16:19 pm
con que opción puedo añadirle el fondo negro? por que no me sale la opcion Glow

Es el botón que dice "Pulsante", a la derecha del botón de "Tachar".

Ejemplo:
         Deposite su texto aquí          

Raw:
Código:
[glow=black,2,300][color=red][b]Deposite su texto aquí[/b][/color][/glow]

Saludos!
6967  Sistemas Operativos / Windows / Re: Problemas con lo DLL en: 21 Julio 2014, 15:28 pm
¿Has intentado reinstalar DirectX para reemplazar las dll "dañadas"?.

· http://www.microsoft.com/en-us/download/details.aspx?id=35 (online installer)
· http://www.microsoft.com/en-us/download/details.aspx?id=8109 (offline installer)

Saludos!
6968  Sistemas Operativos / Windows / Re: [TUTORIAL] Formatear windows 7 + Drivers + Configuración en: 21 Julio 2014, 01:50 am
Me parece un aporte genial para la gente que ande un poco perdida en el tema.

PD: 2 cosas que podrías tener en cuenta:
    · Al redactar un post, en el "panel" de botones, hay un botón para insertar videos de Youtube, quedaría mucho mejor el tuto.
    · No todos los usuarios usan el mismo tema visual del foro, por ejemplo yo uso un theme oscuro y el rojo me daña la vista xD.
      (Yo lo que hago en esas ocasiones es añadirle una etiqueta "Glow" negra (un fondo negro) al texto, y así todos contentos.)

Saludos
6969  Programación / Scripting / Re: [AYUDA] Batch por horario, limita el uso de un programa en una hora específica en: 20 Julio 2014, 22:17 pm
Citar
Código:
if %time% GEQ 19:00:00.0 goto :morning
if %time% LEQ 7:00:00.0 goto :later

Estás haciendo comparación de String, deberías comprar un valor numérico.

Ejemplo para que lo veas tu mismo:
Código
  1. if "20" GTR "100" (Echo 20 es mayor que 100)
  2. if  20  GTR  100  (Echo 20 es mayor que 100)
(El segundo caso nunca dará positivo, el primero sí.)

Quítale los ":" a los strings, haz comparaciones con números:
Código
  1. If %Time:~0,2%%Time:~3,2% GEQ 1900 ()
  2. If %Time:~0,2%%Time:~3,2% LEQ  700 ()

Saludos.
6970  Programación / Scripting / Re: Se podra bypassear en VSB? en: 19 Julio 2014, 18:13 pm
Hola

Se puede desactivar la supervisión del UAC de forma automatizada, si, pero si no recuerdo mal esto requiere un reinicio del sistema/sesión para aplicar los cambios, es la única manera que se me ocurre:

Código
  1. Echo [+] Desactivar UserAccountControl UAC
  2. REG.exe ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /V "ConsentPromptBehaviorAdmin" /T "REG_DWORD" /D "0x00000000" /F 1>NUL
  3. REG.exe ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /V "EnableLUA" /T "REG_DWORD" /D "0x00000000" /F 1>NUL

PD: El código de arriba siempre lo he usado en un RunOnce.bat cuando toca reinstalar el SO, y lo hago con la cuenta oculta de "Administrador", así que no me he preocupado por los privilegios de usuario que pueda tener asignados esa clave, lo digo por si en tu caso no funcionase y requiriese tomar privilegios de la clave para añadir/modificar valores, cosa que puedes hacer con el comando RegINI, pero si además necesitases modificar el propietario actual de la clave para administrar los privilegios de usuario entonces RegINI no te servirá y te sugiero que en ese caso utilices la aplicación 'SetACL'.

Saludos
Páginas: 1 ... 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 [697] 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines