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

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Temas
Páginas: 1 ... 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 [85] 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ... 105
841  Programación / .NET (C#, VB.NET, ASP) / (Solucionado) separar un string en varias cadenas (Split) en: 22 Noviembre 2012, 00:46 am
Hola,

En mi form, creo una variable que contiene un string, que más tarde usaré en un botón para lanzar una app externa con los argumentos que previamente estan guardados en mi variable.

El contenido de la variable es este:
Código
  1. Winamp.exe "Argumento 1" "argumento 2" "argumento 3" "más argumentos"

PD: Los argumentos son rutas de carpetas.

Y lo que quisiera hacer es un split para obtener cada argumento, osea, cada carpeta que está encerrada en comillas,y hacer algo así:

Código:
' Pseudocode
For each folder in var.split(ControlChars.Quote)
    for each file in get.folder.files
     appendline.(archivo_de_Texto, file.Name)
  Next

¿Como puedo hacer ese split en VB?

EDITO:
He intentadoe sto, pero me dice que hay caracteres ilegales... :S

Código
  1.            Dim entries = playerargs.Split(" "c)
  2.            For n As Integer = 1 To entries.Length - 1
  3.                Dim files As String() = Directory.GetFiles(entries(n))
  4.            Next


842  Programación / .NET (C#, VB.NET, ASP) / Como aplicar cambios al registro y refrescar el sistema sin tener que reiniciar? en: 21 Noviembre 2012, 19:17 pm
Hola,

Como sabreis.. hay muchisimos programas que hacen cambios en el registro (TuneUp por ejemplo) y los cambios tienen efecto enseguida sin necesidad de reiniciar el PC,
Si algunos de esos cambios se hicieran manualmente (batch, o añadiendo la clave desde el regedit) habría que reiniciar la sesión del usuario o el pc para que los cambios surgieran efecto...

Pues yo necesito añadir esta clave al registro:
Código
  1. My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideDrivesWithNoMedia", 1, Microsoft.Win32.RegistryValueKind.DWord)


Y lo que me gustaría es hacer un "system refresh" para que los cambios de esa clave tengan efecto sin tener que reiniciar...



Encontré este ejemplo en C# pero no tengo ni idea de lo que hace, ni tampoco sé si esto sirve para mi propósito.


Código
  1. static class SafeNativeMethods
  2. {
  3. public static IntPtr HWND_BROADCAST = (IntPtr)0xffff;
  4. public static int WM_WININICHANGE = 0x001A;
  5.  
  6. [DllImport("User32.Dll")]
  7. public static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int
  8. lParam);
  9. }
  10.  
  11. public static class Refresher
  12. {
  13. public static void ReloadSettings()
  14. {
  15. SafeNativeMethods.PostMessage(SafeNativeMethods.HWND_BROADCAST,
  16. SafeNativeMethods.WM_WININICHANGE, 0, 5000);
  17. }
  18. }
  19.  
  20. static void ExWin()
  21. {
  22. Form form = new Form();
  23. Refresher.ReloadSettings();
  24. Application.Run(form);
  25. }
843  Programación / .NET (C#, VB.NET, ASP) / (solucionado) La carpeta bin se me llena de dll's que mi app no utiliza en: 21 Noviembre 2012, 17:02 pm


Todas esas dlls controles en realidad mi app no las utiliza, las añadí a mi form para ver lo que hacian y si me podian servir para algún propósito, pero después de eso las eliminé (usando el botón eliminar)

¿Donde debo borrar los rastros que quedan de esas dll's?

¿Hay alguna extensión para VS2012 que haga esto automáticamente por mi?

Saludos
844  Programación / .NET (C#, VB.NET, ASP) / Cuando compilo mi aplicación, no funciona. en: 21 Noviembre 2012, 16:27 pm
Cuando compilo la app y la ejecuto me sale esto:



Pero cuando ejecuto la app desde el IDE no me sale ningún error (Bueno, menos en la consola, me sale una excepción en rojo) pero el programa funciona perfectamente apesar de esa excepción...

¿Hay alguna manera de evitar que salga esa ventana sin tener que investigar dentro del código del form?
845  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) AllowDrop... como narices usarlo? en: 21 Noviembre 2012, 15:01 pm
Hola,

¿Alguien podría darme un ejemplo de como se puede arrastrar una carpeta a un textbox en un winform?

Parece que no es suficiente con la propiedad AllowDrop = True ... y esto tampoco:
Código
  1.       ' Start a drag.
  2.        foldertextbox.DoDragDrop( _
  3.            foldertextbox.Text, _
  4.            DragDropEffects.Copy)

Muchas gracias
846  Programación / .NET (C#, VB.NET, ASP) / (solucionado) Buscar control dentro del form... en: 21 Noviembre 2012, 12:41 pm
He probado así:

Código
  1. If Me.FindControl("Checkbox1") IsNot Nothing Then
'FindControl' is not a member of 'WindowsApplication19.Form1'

Y así:
Código
  1. If Me.Panel1.Contains("Checkbox1") = False Then
Value of type 'String' cannot be converted to 'System.Windows.Forms.Control'.

EDITO: Es un winform

¿Soluciones porfavor?
847  Programación / .NET (C#, VB.NET, ASP) / (Solucionado) Como darle focus a un item al abrir el form en: 21 Noviembre 2012, 10:11 am
Hola,




Los checkboxes de ese form los tengo dentro de un panel, y lo que quiero es que al ejecutar la app poder usar el scroll del mouse para bajar/subir la barra del scroll sin tener que pinchar en un checkbox primero.

No se si lo que debo cambiar es lo del focus, o el tabindex, o las dos cosas, pero he intentado cambiandole el tabindex a los checkboxes y no me funciona:

Código
  1.            With mcheck(i)
  2.                .AutoSize = True
  3.                .TabIndex = 0
  4.                .Location = New Point(0, i * 20)
  5.                .Name = "CheckBox" & i + 1
  6.                .Text = folder.Name
  7.            End With

¿O quizás a lo que debo darle focus/tabindex es al panel y no a los checkboxes? De todas formas el tabindex del panel también lo puse a "0"

No se si el problema es que le doy un valor de "0" a todos los elementos y por eso no me funciona...

EDITO: Cuando abro mi form, y le doy a la tecla "TAB", se pone el foco en el primer checkbox de todos, así que creo que no debo ir por muy mal camino... pero algo me falta.

EDITO 2: la scrollbar del panel no la he creado yo, la hago con la propiedad "autoscroll" del panel...

Un saludo
848  Programación / .NET (C#, VB.NET, ASP) / (solucionado) ¿clonar evento para varios elementos? ¿FOR? en: 18 Noviembre 2012, 12:39 pm
Hola,

Tengo un panel con casi 50 checkboxes (todos siguen un orden de nombre bien enumerado), y por ejemplo este es el sub del chekbox1:

Código
  1.    Public Sub C1CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles C1CheckBox1.CheckedChanged
  2.        If C1CheckBox1.Checked = True Then My.Settings.box1_selected = "Y" Else My.Settings.box1_selected = "N"
  3.        Dim checkedpath1 = C1CheckBox1.Text
  4.    End Sub

Lo que quisiera poder hacer es que ese mismo evento afecte a todos los checkboxes, eso se que se puede hacer añadiendo los checkboxes al "handle", vale, pero no es suficiente, ya que lo que hay dentro del sub del ejemplo solo afectará al checkbox 1 aunque yo añada todos al handle, ¿entienden lo que quiero decir?

Hay alguna forma de no escribir el mismo evento para los 50 checkboxes?

es decir, yo necesito hacer esto:

(Pseudocode)

Public Sub TODOS_LOS_CHECKBOXES_CheckedChanged(sender As Object, e As EventArgs) Handles TODOS_LOS_CHECKBOXES.CheckedChanged
If CUALQUIER_CHECKBOX.Checked = True Then My.Settings.NÚMERO_DEL_CHECKBOX_SELECCIONADO_selected = "Y" Else My.Settings.boxNÚMERO_DEL_CHECKBOX_SELECCIONADO_selected = "N"
Dim checkedpathNÚMERO_DEL_CHECKBOX _SELECCIONADO = C1CheckBoxNÚMERO_DEL_CHECKBOX _SELECCIONADO.Text
End Sub


Gracias y un saludo...
849  Programación / Scripting / [RUBY] MP3Crank Leecher v0.2 en: 18 Noviembre 2012, 08:27 am
MP3Crank es una página web que actualizan constantemente con albums de muchos estilos... pop, rock, dance, electro, heavy metal, indie, folk, hiphop, r&b etc...
Yo personalmente descargo musica casi todos los días en esta página porque los enlaces están en "potload" y se descargan enseguida usando JDownloader.

La cuestión es que para acceder a un link de descarga primer hay que pasar por 3 páginas, así que para evitar ese tiempo de espera tán incómodo he decidido hacer este pequeño script que parsea las "X" primeras páginas de la página web y guarda los links en un archivo de texto...

Los enlaces que se listen se registran en un archivo log para que no se vuelvan a listar en el próximo uso del script.











- Se puede configurar el máximo de páginas a parsear.
- Se pueden excluir los albumes por "tags", en la configuración del script. por ejemplo si excluimos el tag "pop" no se listará ningún album de estilo pop.
NOTA: Tener en cuenta que muchos albumes de la página tienen varios tags, por ejemplo "pop, rock, indie", si el tag "pop" lo hemos excluido, ese album se omitirá tenga los otros tags que tenga.

- El archivo de salida que obtendremos es algo parecido a este:

Código:
Title   : Layo & Bushwacka! - Rising & Falling
Genre   : House, Techno
Year    : 2012
Page    : http://www.mp3crank.com/layo-bushwacka/rising-falling.htm
Download: http://potload.com/w34j2fem2bra


Title   : Press Gang Metropol - Checkpoint
Genre   : New Wave, Post-punk
Year    : 2012
Page    : http://www.mp3crank.com/press-gang-metropol/checkpoint.htm
Download: http://potload.com/dizvwuf3m3sy


Title   : Porcupine Tree - Octane Twisted (Live) (2CD)
Genre   : Progressive, Rock
Year    : 2012
Page    : http://www.mp3crank.com/porcupine-tree/octane-twisted-live-2cd.htm
Download: http://potload.com/7h1rld0rfz03


Title   : Nightwish - Imaginaerum (The Score)
Genre   : Symphonic Metal
Year    : 2012
Page    : http://www.mp3crank.com/nightwish/imaginaerum-the-score.htm
Download: http://potload.com/eqznab8d44uk


EXECUTABLE: http://exoshare.com/download.php?uid=1Z1TPBQO

MP3Crank.rb:
Código
  1. # -*- coding: UTF-8 -*-
  2.  
  3.  
  4. # MP3Crank Leecher v0.2
  5. #
  6. # By Elektro H@cker
  7.  
  8.  
  9. # Description:
  10. # -----------
  11. #
  12. # MP3Crank Leecher it's a tool that helps you to keep updated your music collection.
  13. #
  14. # This tool is intended for (almost) daily use.
  15. #
  16. # The script retreives all the downloadable links of the first "X" pages from the MP3Crank website,
  17. # And then list the links into a text file for use it with a download managaer like "JDownloader".
  18. #
  19. # All the links are stored permanently into a log file to be excluded at the next use,
  20. # (that's the reason why this tool is intended for daily use).
  21. #
  22. #
  23. # The pass for the links is: mp3crank.com
  24.  
  25.  
  26. require 'net/http'
  27. require 'win32/registry'
  28. require "highline/system_extensions"
  29. include HighLine::SystemExtensions
  30.  
  31.  
  32. exit if Object.const_defined?(:Ocra)
  33.  
  34.  
  35. def logo()
  36. puts "
  37. MP3CRANK Leecher v0.2
  38. By Elektro H@cker"
  39. end
  40.  
  41.  
  42. def main()
  43. puts "\n\n(Remember, the password for the links is: \"mp3crank.com\")\n\n[+] Press \"C\" to config or press any other key to start leeching..."
  44. key = get_character
  45. config("") if key.to_s =~ /^67$|^99$/
  46. get_downloads_list()
  47. puts "\n\n\n[+] All links are stored in: #{$mp3crank_leecherfile}\n\n(Remember, the password for the links is: \"mp3crank.com\")"
  48. exit
  49. end
  50.  
  51.  
  52. def get_settings()
  53. begin
  54. $mp3crank_logfile = regread("LOGFILEPATH")
  55. rescue
  56. $mp3crank_logfile = "#{ENV['WINDIR']}\\MP3Crank Leecher LOG.txt"
  57. end
  58.  
  59. begin
  60. $mp3crank_leecherfile = regread("LEECHERFILEPATH") +  "MP3Crank Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
  61. rescue
  62. $mp3crank_leecherfile = "#{ENV['USERPROFILE']}\\Desktop\\MP3Crank Leecher #{Time.new.strftime("%Y-%m-%d")}.txt"
  63. end
  64.  
  65. begin
  66. $max_pages = regread("MAXPAGES")
  67. $max_pages = $max_pages.to_i
  68. rescue
  69. $max_pages = 10
  70. end
  71.  
  72. begin
  73. $excluded_tags = regread("EXCLUDED TAGNAMES")
  74. rescue
  75. $excluded_tags = ""
  76. end
  77.  
  78. end
  79.  
  80.  
  81. def config(errorcode)
  82.  
  83. puts "
  84. º---------------------------------º---------------------------------º
  85. | [1] Set the log file path       | [S] Show the current settings   |
  86. | [2] Set the leecher file path   | [R] Reset the settings          |
  87. | [3] Delete the log file         | [Z] Backup all the settings     |
  88. |---------------------------------|---------------------------------|
  89. | [M] Max. Pages to parse         |                                 |
  90. | [T] Tagnames to exclude         | [E] Exit                        |
  91. º---------------------------------º---------------------------------º
  92. "
  93. get_settings()
  94. puts errorcode
  95.  
  96. keystr = "NOTHING"
  97. until keystr =~ /^49$|^50$|^51$|^69$|^80$|^82|^83$|^84$|^90$|^101$|^112$|^114$|^115$|^116$|^122$/
  98. print "\nChoose an option >> "
  99. key = get_character
  100. keystr = key.to_s
  101. end
  102.  
  103. # Log file path
  104. if key == 49
  105. logfilepath = "NOTHING"
  106. until File.directory?(logfilepath)
  107. print "\n\nEnter the path to an existing directory for the logfile: "
  108. logfilepath = STDIN.gets.chomp
  109. end
  110. if logfilepath[-1] == '\\' then logfilepath = logfilepath[0..-2] end
  111. regwrite("LOGFILEPATH", logfilepath + "\\MP3Crank Leecher LOG.txt")
  112. config("[+] Operation completed.")
  113. end
  114.  
  115. # Leecher file path
  116. if key == 50
  117. leecherfile = "NOTHING"
  118. until File.directory?(leecherfile)
  119. print "\n\Enter the path to an existing directory for the leecher file: "
  120. leecherfile = STDIN.gets.chomp
  121. end
  122. if not leecherfile[-1] == '\\' then leecherfile = leecherfile+"\\" end
  123. regwrite("LEECHERFILEPATH", leecherfile)
  124. config("[+] Operation completed.")
  125. end
  126.  
  127. # delete log file
  128. if key == 51
  129. filedel = "NOTHING"
  130. while not filedel =~ /^78$|^89$|^110$|^121$/
  131. print "\n\nWant to delete the log file, Are you sure? [Y/N]: "
  132. filedel = get_character.to_s
  133. end
  134. begin
  135. if filedel =~ /^89$|^121$/ then File.delete($mp3crank_logfile) end
  136. config("[+] Operation completed.")
  137. rescue
  138. config("\n\nERROR\n\nCan't find the logfile.")
  139. end
  140. end
  141.  
  142. # Max pages
  143. if key == 80 or key == 112
  144. maxpages = "NOTHING"
  145. puts "\n\nThis option lets you configure the maximum pages to leech..."
  146. until not maxpages[/[a-z]/i]
  147. print "\nEnter a number for the max pages value: "
  148. maxpages = STDIN.gets.chomp
  149. end
  150. regwrite("MAXPAGES", maxpages)
  151. config("[+] Operation completed.")
  152. end
  153.  
  154. # exclude tagnames
  155. if key == 84 or key == 116
  156. addtag = "NOTHING"
  157. puts "\n\nThis option lets you exclude albums by their genre tagnames..."
  158. until not addtag == "NOTHING"
  159. print "\n\nEnter a tagname (Example: \"Hip Hop\") \nor enter the word \"none\" to reset the exclusions: "
  160. addtag = STDIN.gets.chomp
  161. end
  162. begin
  163. tags=regread("EXCLUDED TAGNAMES")
  164. rescue
  165. tags=""
  166. end
  167. if addtag =~ /^none$/i then regwrite("EXCLUDED TAGNAMES", "") else regwrite("EXCLUDED TAGNAMES", "#{tags};#{addtag}") end
  168. config("[+] Operation completed.")
  169. end
  170.  
  171. # show the current settings
  172. if key == 83 or key == 115
  173. config("
  174.  
  175. Log file path       : #{$mp3crank_logfile}
  176.  
  177. Leecher file path   : #{$mp3crank_leecherfile}
  178.  
  179. Max. pages to parse : #{$max_pages} pages
  180.  
  181. Excluded tagnames   : #{$excluded_tags.gsub(";","|")}
  182.  
  183. ")
  184. end
  185.  
  186. # reset the settings
  187. if key == 114 or key == 82
  188. resetkey = "NOTHING"
  189. while not resetkey =~ /^78$|^89$|^110$|^121$/
  190. print "\n\nWant to reset all the settings, Are you sure? [Y/N]: "
  191. resetkey = get_character.to_s
  192. end
  193. if resetkey =~ /^89$|^121$/
  194. Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\MP3Crank Leecher\\", Win32::Registry::KEY_ALL_ACCESS) do |reg|
  195. reg['LOGFILEPATH'] = 'DELETE'
  196. reg.delete_value("LOGFILEPATH")
  197. reg['LEECHERFILEPATH'] = 'DELETE'
  198. reg.delete_value("LEECHERFILEPATH")
  199. reg['MAXPAGES'] = 'DELETE'
  200. reg.delete_value("MAXPAGES")
  201. reg['EXCLUDED TAGNAMES'] = 'DELETE'
  202. reg.delete_value("EXCLUDED TAGNAMES")
  203. end
  204. config("[+] Operation completed.")
  205. end
  206. end
  207.  
  208. # backup the settings
  209. if key == 90 or key == 122
  210. system %[ regedit /e \"%USERPROFILE%\\Desktop\\MP3Crank Leecher settings %DATE:/=-%.reg\" \"HKEY_CURRENT_USER\\Software\\MP3Crank Leecher\" ]
  211. config("\n\n[+] Settings stored in #{ENV['USERPROFILE']}\\Desktop\\MP3Crank Leecher settings.reg")
  212. end
  213.  
  214. # exit
  215. if key == 69 or key == 101 then main() end
  216.  
  217. end
  218.  
  219.  
  220. def show_info()
  221.  @info = "
  222.  
  223. Title   : #{@album_title}
  224. Genre   : #{@album_tags.to_s.gsub('\\t','').gsub(']','').gsub('[','').gsub('"','').gsub('nil','').gsub(', , ','')}
  225. Year    : #{@year}
  226. Page    : #{@album_page}
  227. Download: #{@potload_url}
  228.  
  229. "
  230.  puts @info
  231. end
  232.  
  233.  
  234. def get_downloads_list()
  235. @page = 0
  236. print "\n\n[+] Leeching pages "
  237. for i in 1..$max_pages do
  238. @page = @page+1
  239. @url  = "http://www.mp3crank.com/page/#{@page}"
  240. print "#{@page}/#{$max_pages}..."
  241. Net::HTTP.get_response(URI.parse(@url)).body.split('<!--/centercol -->').first.split('<div id="centercol">').last.each_line do |line|
  242.  
  243. if (line['class="release"']) then @downloadable = "yes" end
  244.  
  245. if line['class="year"'] then @year = line.split('</').first.split('>').last end
  246.  
  247. if line['class="genres"']
  248. for tag in line.split('rel="tag">').each do
  249. @album_tags = @album_tags, tag.split('<').first.gsub('&amp;','&')
  250. for excluded_tag in $excluded_tags.split(";").each do
  251. if not excluded_tag == "" and tag.split('<').first.to_s.chomp[/^#{Regexp.escape(excluded_tag)}$/i] then @downloadable = "no" end
  252. end
  253. end
  254. end
  255.  
  256. if line['class="album"']
  257. @album_title   = line.split('title="').last.split('">').first.gsub('Free MP3 download ','').gsub('&amp;','&')
  258. @album_page    = line.split('" rel=').first.split('"').last
  259. @download_page = Net::HTTP.get_response(URI.parse(@album_page)).body[/http:\/\/www.mp3crank.com\/download\/album\/[0-9]+/i]
  260. @potload_url   = Net::HTTP.get_response(URI.parse(@download_page)).body[/http:\/\/potload.com\/[a-z0-9]+/i]
  261. if @downloadable == "yes"
  262. filewrite()
  263. end
  264. @album_tags  = nil
  265. end
  266.  
  267. end
  268. end
  269. end
  270.  
  271.  
  272. def regread(keyname)
  273. Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\MP3Crank Leecher\\") do |reg| reg[keyname] end
  274. end
  275.  
  276.  
  277. def regwrite(keyname, value)
  278. Win32::Registry::HKEY_CURRENT_USER.create("SOFTWARE\\MP3Crank Leecher\\") do |reg| reg[keyname, Win32::Registry::REG_SZ] = value end
  279. end
  280.  
  281.  
  282. def filewrite()
  283. if not File.exist?($mp3crank_logfile) then File.open($mp3crank_logfile, "w") do |write| write.puts "MP3Crack leeched URLs\n\n(Remember, the password for the links is: \"mp3crank.com\")\n\n" end end
  284. if not File.open($mp3crank_logfile, "r").read[@album_page]
  285. show_info()
  286. File.open($mp3crank_logfile,     "a+") do |write| write.puts @album_page end
  287. File.open($mp3crank_leecherfile, "a+") do |write| write.puts @info end
  288. end
  289. end
  290.  
  291.  
  292. logo()
  293. get_settings()
  294. main()
  295.  
  296.  
  297.  
850  Media / Multimedia / Necesito los nombres.exe de Reproductores multimedia conocidos en: 15 Noviembre 2012, 22:06 pm
Hola,

Busco el nombre de los ejecutables de reproductores de audio, es para una mini aplicación que estoy haciendo en VS.

De momento solo tengo estos:

mpc.exe
mpc-hc.exe
mpc-hc64.exe
vlc.exe
winamp.exe
wmp.exe


una ayudita?  :P
Páginas: 1 ... 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 [85] 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ... 105
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines