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

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


  Mostrar Mensajes
Páginas: 1 ... 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 [912] 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 ... 1236
9111  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 11 Mayo 2013, 11:45 am

Devuelve la dirección IP de un Host

Código
  1. #Region " HostName To IP "
  2.  
  3.    ' [ HostName To IP Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' MsgBox(HostName_To_IP("www.google.com")) ' Result: 173.194.41.6
  10.  
  11.    Public Function HostName_To_IP(ByVal HotsName As String) As String
  12.        Return System.Net.Dns.GetHostEntry(HotsName).AddressList(1).ToString()
  13.    End Function
  14.  
  15. #End Region



Devuelve el Hostname de una IP

Código
  1. #Region " IP To HostName "
  2.  
  3.    ' [ IP To HostName Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' MsgBox(IP_To_HostName("173.194.41.6")) ' Result: mad01s14-in-f6.1e100.net
  10.  
  11.    Public Function IP_To_HostName(ByVal IP As String) As String
  12.        Return system.net.Dns.GetHostEntry(IP).HostName.ToString
  13.    End Function
  14.  
  15. #End Region





Valida si un nombre de archivo o ruta contiene caracteres no permitidos por Windows

(Este snippet lo posteé hace tiempo pero tenía varios fallos, los he corregido.)

Código
  1. #Region " Validate Windows FileName "
  2.  
  3.    ' [ Validate Windows FileName Function ]
  4.    '
  5.    ' Examples :
  6.    ' MsgBox(Validate_Windows_FileName("C:\Test.txt"))  ' Result: True
  7.    ' MsgBox(Validate_Windows_FileName("C:\Te|st.txt")) ' Result: False
  8.  
  9.    Private Function Validate_Windows_FileName(ByRef FileName As String)
  10.        Dim Directory As String = Nothing
  11.        Dim File As String = Nothing
  12.  
  13.        Try
  14.            Directory = FileName.Substring(0, FileName.LastIndexOf("\")) & "\"
  15.            File = FileName.Split("\").Last
  16.        Catch
  17.            If Directory Is Nothing Then File = FileName
  18.        End Try
  19.  
  20.        If Directory Is Nothing AndAlso File Is Nothing Then Return False
  21.  
  22.        If Not Directory Is Nothing Then
  23.            For Each InvalidCharacter As Char In IO.Path.GetInvalidPathChars
  24.                If Directory.Contains(InvalidCharacter) Then
  25.                    ' MsgBox(InvalidCharacter)
  26.                    Return False
  27.                End If
  28.            Next
  29.        End If
  30.  
  31.        If Not File Is Nothing Then
  32.            For Each InvalidCharacter As Char In IO.Path.GetInvalidFileNameChars
  33.                If File.Contains(InvalidCharacter) Then
  34.                    ' MsgBox(InvalidCharacter)
  35.                    Return False
  36.                End If
  37.            Next
  38.        End If
  39.  
  40.        Return True ' FileName is valid
  41.    End Function
  42.  
  43. #End Region
9112  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 11 Mayo 2013, 08:28 am
Hacer Ping a una máquina:

Código
  1.    #Region " Ping "
  2.  
  3.       ' [ Ping Function ]
  4.       '
  5.       ' // By Elektro H@cker
  6.       '
  7.       ' Examples :
  8.       ' MsgBox(Ping("www.google.com"))
  9.       ' MsgBox(Ping("www.google.com", 500))
  10.       ' MsgBox(Ping("www.google.com", 500, New Byte(128) {}, False))
  11.       ' MsgBox(Ping("www.google.com", 500, System.Text.Encoding.ASCII.GetBytes("Hello"), True))
  12.       ' For X As Int32 = 1 To 10 : If Not Ping("www.google.com", 1000) Then : MsgBox("Ping try " & X & " failed") : End If : Next : MsgBox("Ping successfully")
  13.  
  14.       Public Function Ping(ByVal Address As String, _
  15.                              Optional ByVal TimeOut As Int64 = 200, _
  16.                              Optional ByVal BufferData As Byte() = Nothing, _
  17.                              Optional ByVal FragmentData As Boolean = False, _
  18.                              Optional ByVal TimeToLive As Int64 = 128) As Boolean
  19.  
  20.           Dim PingSender As New System.Net.NetworkInformation.Ping()
  21.           Dim PingOptions As New System.Net.NetworkInformation.PingOptions()
  22.  
  23.           If FragmentData Then PingOptions.DontFragment = False Else PingOptions.DontFragment = True
  24.           If BufferData Is Nothing Then BufferData = New Byte(31) {} ' Sets a BufferSize of 32 Bytes
  25.           PingOptions.Ttl = TimeToLive
  26.  
  27.           Dim Reply As System.Net.NetworkInformation.PingReply = PingSender.Send(Address, TimeOut, BufferData, PingOptions)
  28.  
  29.           If Reply.Status = System.Net.NetworkInformation.IPStatus.Success Then
  30.               ' MsgBox("Address: " & Reply.Address.ToString)
  31.               ' MsgBox("RoundTrip time: " & Reply.RoundtripTime)
  32.               ' MsgBox("Time to live: " & Reply.Options.Ttl)
  33.               ' MsgBox("Buffer size: " & Reply.Buffer.Length)
  34.               Return True
  35.           Else
  36.               Return False
  37.           End If
  38.  
  39.       End Function
  40.  
  41.    #End Region
9113  Programación / .NET (C#, VB.NET, ASP) / Re: Ejecutar .vbs con Vb.net en: 11 Mayo 2013, 08:10 am
@TMarmol

1. No es necesario que crees primero un bat y luego un vbs para ejecutar el bat oculto, pues no estás usando Batch, estás en un lenguaje de verdad, aquí puedes usar la Class Process para definir las opciones del proceso y ejecutar el bat oculto. (windowstyle.hidden)
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
http://msdn.microsoft.com/en-us/library/system.diagnostics.processwindowstyle.aspx

2. Debes tener en cuenta las comillas dobles y los nombres con espacio en los argumentos, como en Batch.

...Quizás eso es lo que te falla, si no muestras el código no lo sé, así que siguiendo el ejemplo de DanyFirex... sería así:
Código
  1. Process.Start("wscript.exe", """" & "C:\ruta con espacios\Script.vbs" & """")
O así, como prefieras:
Código
  1. Process.Start("wscript.exe", ControlChars.Quote & "C:\ruta con espacios\Script.vbs" & ControlChars.Quote)


De todas formas yo sólamente usaría la CMD si no hubiera otra alternativa, no sé exáctamente cuales son las intenciones de tu código Bat pero ...¿Has pensado en hacer ping usando los metodos del .NET?:

Esto es lo más sencillo:
Código
  1.        If My.Computer.Network.Ping("www.google.com") Then
  2.            MsgBox("success")
  3.        Else
  4.            MsgBox("no reply")
  5.        End If

Si quieres algo más customizable aquí tienes una función que acabo de codear:
Código
  1. #Region " Ping "
  2.  
  3.    ' [ Ping Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Ping("www.google.com"))
  9.    ' MsgBox(Ping("www.google.com", 500))
  10.    ' MsgBox(Ping("www.google.com", 500, New Byte(128) {}, False))
  11.    ' MsgBox(Ping("www.google.com", 500, System.Text.Encoding.ASCII.GetBytes("Hello"), True))
  12.    ' For X As Int32 = 1 To 10 : If Not Ping("www.google.com", 1000) Then : MsgBox("Ping try " & X & " failed") : End If : Next : MsgBox("Ping successfully")
  13.  
  14.    Public Function Ping(ByVal Address As String, _
  15.                           Optional ByVal TimeOut As Int64 = 200, _
  16.                           Optional ByVal BufferData As Byte() = Nothing, _
  17.                           Optional ByVal FragmentData As Boolean = False, _
  18.                           Optional ByVal TimeToLive As Int64 = 128) As Boolean
  19.  
  20.        Dim PingSender As New System.Net.NetworkInformation.Ping()
  21.        Dim PingOptions As New System.Net.NetworkInformation.PingOptions()
  22.  
  23.        If FragmentData Then PingOptions.DontFragment = False Else PingOptions.DontFragment = True
  24.        If BufferData Is Nothing Then BufferData = New Byte(31) {} ' Sets a BufferSize of 32 Bytes
  25.        PingOptions.Ttl = TimeToLive
  26.  
  27.        Dim Reply As System.Net.NetworkInformation.PingReply = PingSender.Send(Address, TimeOut, BufferData, PingOptions)
  28.  
  29.        If Reply.Status = System.Net.NetworkInformation.IPStatus.Success Then
  30.            ' MsgBox("Address: " & Reply.Address.ToString)
  31.            ' MsgBox("RoundTrip time: " & Reply.RoundtripTime)
  32.            ' MsgBox("Time to live: " & Reply.Options.Ttl)
  33.            ' MsgBox("Buffer size: " & Reply.Buffer.Length)
  34.            Return True
  35.        Else
  36.            Return False
  37.        End If
  38.  
  39.    End Function
  40.  
  41. #End Region

Saludos
9114  Programación / Scripting / Re: Script copiar ficheros escritorio en: 10 Mayo 2013, 11:25 am
Puedes empezar por intentar entender que hace cada comando y sus parámetros:
Código:
Copy /?
For /?
Dir /?
FINDSTR /?
y...  Tutorial extendido de aprendizaje Batch

Fíjate lo que pasa al usar este comando:
Código:
Dir /B "C:\Users\usuari\Desktop" | FINDSTR /V /I "\.lnk$"

Saludos.
9115  Media / Multimedia / Re: (consulta) Megui audio desincronizado x264+aac en: 10 Mayo 2013, 06:06 am
tengo K lite codepack 2 y 64 bits cada uno una instalacion aparte.

Yo hace años también pensaba como tú pero Songoku me ayudó a aclararme las ideas jeje.

Desinstálate esa ***** de k-lite, los dos, no los necesitas en tu PC.

1. Instálate AC3-File para reproducir audio AC3/DTS/etc: http://www.ac3filter.net/wiki/Download_AC3File
2. Instálate FFDShow tryouts para reproducir todo lo demás (Video/Audio): http://ffdshow-tryout.sourceforge.net/
3. Y opcionálmente instálate XVid o Divx si quieres codificar en ese formato: http://www.xvid.org/Downloads.15.0.html
9116  Programación / Scripting / Re: Script copiar ficheros escritorio en: 10 Mayo 2013, 06:04 am
Código
  1. @Echo OFF
  2.  
  3. For /F "Delims=" %%X in ('Dir /B ^| FINDSTR /V /I "\.lnk$"') Do (
  4. Echo %%X
  5. REM Copy "%%X" "C:\Carpeta\"
  6. )
  7.  
  8. Pause&Exit

Saludos.
9117  Programación / Programación General / Re: Ayuda, instalacion Visual Studio 2012 en: 9 Mayo 2013, 16:29 pm
Prueba con esto:

   [APORTE] MEGA-PACK para iniciarse en .NET (VS2012 + Recursos + Tools)
9118  Programación / Scripting / Re: Echo sin saltos de linea en Windows en: 9 Mayo 2013, 11:22 am
Hola WHK

Te hago un ejemplo:

Código
  1. @Echo OFF
  2.  
  3. Call :Append_Text "a"
  4. Call :Append_Text "b"
  5. Call :Append_Text "cdef"
  6.  
  7. Pause&Exit
  8.  
  9. :Append_Text
  10. :: Tomas la linea de texto que hay escrita en el archivo de texto [para hacer el "append"]
  11. For /F "usebackq delims=" %%X in ("archivo.txt") do (Set "Line=%%X")
  12. :: Escribes la linea que ya habia escrita + el argumento
  13. Set "Text=%~1"
  14. Echo %LINE%%Text%>"archivo.txt"
  15. :: Regresas
  16. Goto:EOF

Output:
Código:
abcdef

Saludos.
9119  Programación / Scripting / Re: Un renombrador en batch para imagenes en: 8 Mayo 2013, 21:04 pm
He vuelto a comprobar el code, la wapada funciona corréctamente.
Si has hecho alguna modificación al código... postéala.

saludos
9120  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 8 Mayo 2013, 20:34 pm
Con esta Class pueden manejar la aplicación BoxedAppPacker en tiempo de ejecución para empaquetar otros proyectos .NET (u otro tipo de executables) para virtualizarlos.
PD: Se necesita la aplicación BoxedAppPacker v3.XXX (versión de consola), la class no usa el SDK.

Código
  1. #Region " BoxedAppPacker "
  2.  
  3. ' [ BoxedAppPacker Functions ]
  4. '
  5. ' // By Elektro H@cker
  6. '
  7. ' Instructions:
  8. ' 1. Add the "BoxedAppPackerConsole.exe" to the project
  9. ' 2. Add the "BoxedAppPacker Class" Class to the project
  10. '
  11. ' Examples:
  12. '
  13. ' -----------------
  14. ' Pack Single File:
  15. ' -----------------
  16. ' BoxedAppPacker.Pack_Single_File("C:\Windows\Explorer.exe", "C:\Virtual Explorer.exe")
  17. ' BoxedAppPacker.Pack_Single_File("C:\Windows\Explorer.exe", "C:\Virtual Explorer.exe", True, True, True, True, True, BoxedAppPacker.BoxedAppPackerVariables.ExeDir)
  18. '
  19. ' ---------------------------------
  20. ' Pack File And Include More Files:
  21. ' ---------------------------------
  22. ' BoxedAppPacker.Pack_File_And_Include_More_Files("C:\Windows\Explorer.exe", {"C:\Windows\system32\shell32.dll", "C:\Windows\system32\notepad.exe"}, "C:\Virtual Explorer.exe", True, True, True)
  23.  
  24.  
  25. #Region " BoxedAppPacker Class "
  26.  
  27. Public Class BoxedAppPacker
  28.  
  29.    ''' <summary>
  30.    ''' The BoxedAppPackerConsole.exe location.
  31.    ''' </summary>
  32.    Public Shared BoxedAppPacker_Location As String = ".\BoxedAppPackerConsole.exe"
  33.  
  34.    ''' <summary>
  35.    ''' Boxed App Packer Variables To Override CommandLine.
  36.    ''' </summary>
  37.    Public Enum BoxedAppPackerVariables
  38.        ExeDir ' a directory that contains the packed exe.
  39.        CurDir ' current directory .
  40.        ProgramFiles ' ProgramFiles environment variable.
  41.        Temp ' Temp environment variable.
  42.        BoxedAppVar_ExeFileName ' exe's file name (for example, "notepad.exe")
  43.        BoxedAppVar_ExeFileExtension ' exe's file extension (for example, "exe")
  44.        BoxedAppVar_ExeFileNameWithoutExtension ' exe's file name without extension (for example, "notepad")
  45.        BoxedAppVar_ExeFullPath ' exe's full path (for example, "C_\notepad.exe")
  46.        BoxedAppVar_OldCmdLine ' a command line specified when the packed exe started, you can use it to add additional arguments, for example: <BoxedAppVar:OldCmdLine> /NewSwitch
  47.        BoxedAppVar_OldArgs ' a command line specified when the packed exe started without the exe path, for example "<BoxedAppVar:ExeFullPath>" /C virtual.cmd <BoxedAppVar:OldArgs>, Usage: packed.exe Arg1 Arg2, It works as: original.exe /C virtual.cmd Arg1 Arg2
  48.    End Enum
  49.  
  50.    ''' <summary>
  51.    ''' Virtualize a single executable.
  52.    ''' </summary>
  53.    Public Shared Function Pack_Single_File(ByVal File As String, ByVal OutputFile As String, _
  54.                                    Optional ByVal Make_All_File_And_Registry_Changes_Virtual As Boolean = True, _
  55.                                    Optional ByVal Hide_Virtual_Files_From_File_Dialog As Boolean = True, _
  56.                                    Optional ByVal Share_Virtual_Environment_With_Child_Processes As Boolean = False, _
  57.                                    Optional ByVal Enable_Virtual_Registry As Boolean = True, _
  58.                                    Optional ByVal Enable_CommandLine_Arguments As Boolean = True, _
  59.                                    Optional ByVal CommandLine_Variable As BoxedAppPackerVariables = BoxedAppPackerVariables.ExeDir
  60.                                    ) As Boolean
  61.  
  62.        If Not Check_InputExecutable(File) Then Return False
  63.  
  64.        Dim CommandLine_Variable_Formatted As String = CommandLine_Variable.ToString.Replace("_", ":")
  65.  
  66.        Dim BoxedProject_Options_Section As String = "<project project_version=""2"" src=""" _
  67.                                                     & File & _
  68.                                                     """ dest=""" _
  69.                                                     & OutputFile & _
  70.                                                     """ cmd_line_overridden=""" _
  71.                                                     & Enable_CommandLine_Arguments & _
  72.                                                     """ cmd_args=""&lt;" _
  73.                                                     & CommandLine_Variable_Formatted & _
  74.                                                     "&gt;"" share_virtual_environment_with_child_processes=""" _
  75.                                                     & Share_Virtual_Environment_With_Child_Processes & _
  76.                                                     """ enable_debug_log=""false"" " & _
  77.                                                     "enable_virtual_registry=""" _
  78.                                                     & Enable_Virtual_Registry & _
  79.                                                     """ hide_virtual_files_from_file_dialog=""" _
  80.                                                     & Hide_Virtual_Files_From_File_Dialog & _
  81.                                                     """ all_changes_are_virtual=""" _
  82.                                                     & Make_All_File_And_Registry_Changes_Virtual & """>"
  83.  
  84.        Dim BoxedProject_File_Section As String = <a><![CDATA[
  85.  
  86.  <files>
  87.    <file source_path="" name="&lt;ExeDir&gt;" virtual="false" virtually_deleted="false" dir="true" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="" register_as_typelib="false">
  88.      <files/>
  89.    </file>
  90.    <file source_path="" name="&lt;SystemRoot&gt;" virtual="false" virtually_deleted="false" dir="true" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="" register_as_typelib="false">
  91.      <files>
  92.        <file source_path="" name="System32" virtual="false" virtually_deleted="false" dir="true" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="" register_as_typelib="false">
  93.          <files/>
  94.        </file>
  95.      </files>
  96.    </file>
  97.  </files>
  98. ]]></a>.Value
  99.  
  100.        Dim BoxedProject_Registry_Section As String = <a><![CDATA[
  101.  <registry>
  102.    <keys>
  103.      <key name="HKEY_CLASSES_ROOT" virtual="false" virtually_deleted="false">
  104.        <values/>
  105.        <keys/>
  106.      </key>
  107.      <key name="HKEY_CURRENT_CONFIG" virtual="false" virtually_deleted="false">
  108.        <values/>
  109.        <keys/>
  110.      </key>
  111.      <key name="HKEY_CURRENT_USER" virtual="false" virtually_deleted="false">
  112.        <values/>
  113.        <keys/>
  114.      </key>
  115.      <key name="HKEY_LOCAL_MACHINE" virtual="false" virtually_deleted="false">
  116.        <values/>
  117.        <keys/>
  118.      </key>
  119.      <key name="HKEY_USERS" virtual="false" virtually_deleted="false">
  120.        <values/>
  121.        <keys/>
  122.      </key>
  123.    </keys>
  124.  </registry>
  125. </project>
  126. ]]></a>.Value
  127.  
  128.        Try
  129.            Using TextFile As New IO.StreamWriter(System.IO.Path.GetTempPath() & "BoxedAppPacker.boxedappproj", False, System.Text.Encoding.ASCII)
  130.                TextFile.WriteLine(BoxedProject_Options_Section)
  131.            End Using
  132.  
  133.            Using TextFile As New IO.StreamWriter(System.IO.Path.GetTempPath() & "BoxedAppPacker.boxedappproj", True, System.Text.Encoding.ASCII)
  134.                TextFile.WriteLine(BoxedProject_File_Section)
  135.                TextFile.WriteLine(BoxedProject_Registry_Section)
  136.            End Using
  137.  
  138.            Dim BoxedAppPacker_Console As New Process()
  139.            Dim BoxedAppPacker_Console_Info As New ProcessStartInfo()
  140.  
  141.            BoxedAppPacker_Console_Info.FileName = BoxedAppPacker_Location
  142.            BoxedAppPacker_Console_Info.Arguments = """" & System.IO.Path.GetTempPath() & "BoxedAppPacker.boxedappproj" & """"
  143.            BoxedAppPacker_Console_Info.CreateNoWindow = True
  144.            BoxedAppPacker_Console_Info.WindowStyle = ProcessWindowStyle.Hidden
  145.            BoxedAppPacker_Console_Info.UseShellExecute = False
  146.            BoxedAppPacker_Console.StartInfo = BoxedAppPacker_Console_Info
  147.            BoxedAppPacker_Console.Start()
  148.            BoxedAppPacker_Console.WaitForExit()
  149.  
  150.            If BoxedAppPacker_Console.ExitCode <> 0 Then
  151.                Return False
  152.            Else
  153.                Return True
  154.            End If
  155.        Catch ex As Exception
  156.            ' MsgBox(ex.Message)
  157.            Return False
  158.        End Try
  159.  
  160.    End Function
  161.  
  162.    ''' <summary>
  163.    ''' Virtualize a executable and include more files.
  164.    ''' </summary>
  165.    Public Shared Function Pack_File_And_Include_More_Files(ByVal File As String, ByVal SubFiles() As String, ByVal OutputFile As String, _
  166.                                Optional ByVal Make_All_File_And_Registry_Changes_Virtual As Boolean = True, _
  167.                                Optional ByVal Hide_Virtual_Files_From_File_Dialog As Boolean = True, _
  168.                                Optional ByVal Share_Virtual_Environment_With_Child_Processes As Boolean = False, _
  169.                                Optional ByVal Enable_Virtual_Registry As Boolean = True, _
  170.                                Optional ByVal Enable_CommandLine_Arguments As Boolean = True, _
  171.                                Optional ByVal CommandLine_Variable As BoxedAppPackerVariables = BoxedAppPackerVariables.ExeDir
  172.                                ) As Boolean
  173.  
  174.        If Not Check_InputExecutable(File) Then Return False
  175.  
  176.        Dim CommandLine_Variable_Formatted As String = CommandLine_Variable.ToString.Replace("_", ":")
  177.  
  178.        Dim BoxedProject_Options_Section As String = "<project project_version=""2"" src=""" _
  179.                                                     & File & _
  180.                                                     """ dest=""" _
  181.                                                     & OutputFile & _
  182.                                                     """ cmd_line_overridden=""" _
  183.                                                     & Enable_CommandLine_Arguments & _
  184.                                                     """ cmd_args=""&lt;" _
  185.                                                     & CommandLine_Variable_Formatted & _
  186.                                                     "&gt;"" share_virtual_environment_with_child_processes=""" _
  187.                                                     & Share_Virtual_Environment_With_Child_Processes & _
  188.                                                     """ enable_debug_log=""false"" " & _
  189.                                                     "enable_virtual_registry=""" _
  190.                                                     & Enable_Virtual_Registry & _
  191.                                                     """ hide_virtual_files_from_file_dialog=""" _
  192.                                                     & Hide_Virtual_Files_From_File_Dialog & _
  193.                                                     """ all_changes_are_virtual=""" _
  194.                                                     & Make_All_File_And_Registry_Changes_Virtual & """>"
  195.  
  196.        ' Generate File Section Start
  197.        Dim BoxedProject_File_Section_Start As String = <a><![CDATA[
  198.  
  199.  <files>
  200.    <file source_path="" name="&lt;ExeDir&gt;" virtual="false" virtually_deleted="false" dir="true" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="" register_as_typelib="false">
  201.      <files>
  202. ]]></a>.Value
  203.  
  204.        ' Generate SubFiles Tags Section
  205.        Dim FileCount As Int16 = 0
  206.        Dim SubFile_Tag As String = Nothing
  207.  
  208.        For SubFile As Integer = 1 To SubFiles.Count
  209.            Application.DoEvents()
  210.            FileCount += 1
  211.  
  212.            If FileCount = 1 Then
  213.                SubFile_Tag += <a><![CDATA[
  214.        <file source_path="]]></a>.Value & SubFiles(FileCount - 1) & <a><![CDATA[" name="]]></a>.Value & SubFiles(FileCount - 1).Split("\").Last & <a><![CDATA[" virtual="true" virtually_deleted="false" dir="false" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="/RegServer" register_as_typelib="false">
  215.          <files/>
  216. ]]></a>.Value
  217.            Else
  218.                SubFile_Tag += <a><![CDATA[
  219.        </file>
  220.        <file source_path="]]></a>.Value & SubFiles(FileCount - 1) & <a><![CDATA[" name="]]></a>.Value & SubFiles(FileCount - 1).Split("\").Last & <a><![CDATA[" virtual="true" virtually_deleted="false" dir="false" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="/RegServer" register_as_typelib="false">
  221.          <files/>
  222. ]]></a>.Value
  223.            End If
  224.  
  225.        Next
  226.  
  227.        ' Generate File Section End
  228.        Dim BoxedProject_File_Section_End As String = <a><![CDATA[
  229.        </file>
  230.      </files>
  231.    </file>
  232.    <file source_path="" name="&lt;SystemRoot&gt;" virtual="false" virtually_deleted="false" dir="true" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="" register_as_typelib="false">
  233.      <files>
  234.        <file source_path="" name="System32" virtual="false" virtually_deleted="false" dir="true" plugin="false" register_as_com_library="false" register_as_com_server="false" com_server_reg_cmd_line_args="" register_as_typelib="false">
  235.          <files/>
  236.        </file>
  237.      </files>
  238.    </file>
  239.  </files>
  240. ]]></a>.Value
  241.  
  242.        ' Generate Registry Section
  243.        Dim BoxedProject_Registry_Section As String = <a><![CDATA[
  244.  <registry>
  245.    <keys>
  246.      <key name="HKEY_CLASSES_ROOT" virtual="false" virtually_deleted="false">
  247.        <values/>
  248.        <keys/>
  249.      </key>
  250.      <key name="HKEY_CURRENT_CONFIG" virtual="false" virtually_deleted="false">
  251.        <values/>
  252.        <keys/>
  253.      </key>
  254.      <key name="HKEY_CURRENT_USER" virtual="false" virtually_deleted="false">
  255.        <values/>
  256.        <keys/>
  257.      </key>
  258.      <key name="HKEY_LOCAL_MACHINE" virtual="false" virtually_deleted="false">
  259.        <values/>
  260.        <keys/>
  261.      </key>
  262.      <key name="HKEY_USERS" virtual="false" virtually_deleted="false">
  263.        <values/>
  264.        <keys/>
  265.      </key>
  266.    </keys>
  267.  </registry>
  268. </project>
  269. ]]></a>.Value
  270.  
  271.        Try
  272.  
  273.            Using TextFile As New IO.StreamWriter(System.IO.Path.GetTempPath() & "BoxedAppPacker.boxedappproj", False, System.Text.Encoding.ASCII)
  274.                TextFile.WriteLine(BoxedProject_Options_Section)
  275.                TextFile.WriteLine(BoxedProject_File_Section_Start)
  276.                TextFile.WriteLine(SubFile_Tag)
  277.                TextFile.WriteLine(BoxedProject_File_Section_End)
  278.                TextFile.WriteLine(BoxedProject_Registry_Section)
  279.            End Using
  280.  
  281.            Dim BoxedAppPacker_Console As New Process()
  282.            Dim BoxedAppPacker_Console_Info As New ProcessStartInfo()
  283.  
  284.            BoxedAppPacker_Console_Info.FileName = BoxedAppPacker_Location
  285.            BoxedAppPacker_Console_Info.Arguments = """" & System.IO.Path.GetTempPath() & "BoxedAppPacker.boxedappproj" & """"
  286.            BoxedAppPacker_Console_Info.CreateNoWindow = True
  287.            BoxedAppPacker_Console_Info.WindowStyle = ProcessWindowStyle.Hidden
  288.            BoxedAppPacker_Console_Info.UseShellExecute = False
  289.            BoxedAppPacker_Console.StartInfo = BoxedAppPacker_Console_Info
  290.            BoxedAppPacker_Console.Start()
  291.            BoxedAppPacker_Console.WaitForExit()
  292.  
  293.            If BoxedAppPacker_Console.ExitCode <> 0 Then
  294.                Return False
  295.            Else
  296.                Return True
  297.            End If
  298.        Catch ex As Exception
  299.            ' MsgBox(ex.Message)
  300.            Return False
  301.        End Try
  302.  
  303.    End Function
  304.  
  305.    ' Checks if InputFile exist and also is a executable.
  306.    Private Shared Function Check_InputExecutable(ByVal File As String) As Boolean
  307.        If Not IO.File.Exists(File) Then
  308.            MsgBox("File don't exist.")
  309.            Return False
  310.        End If
  311.        If Not File.ToLower.EndsWith(".exe") Then
  312.            MsgBox("Not a valid executable file.")
  313.            Return False
  314.        End If
  315.        Return True
  316.    End Function
  317.  
  318. End Class
  319.  
  320. #End Region
  321.  
  322. #End Region
Páginas: 1 ... 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 [912] 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines