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

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Temas
Páginas: 1 ... 68 69 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 ... 105
821  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Duda sobre los elementos que trabajan en segundo plano en: 17 Diciembre 2012, 09:14 am
Hola,

¿Cuales de estos elementos trabajan en segundo plano al llamarlos, y cuales NO (osea cuales congelan la class)?



Sub
Function
Module
Una class distinta a la actual
(No se me ocurren más elementos que preguntar...)



Por ejemplo un thread , all llamarlo trabaja en segundo plano sin congelar la app, pues a eso me refiero, ¿hay otros elementos que trabajen en segundo plano?

Muchas gracias
822  Programación / Scripting / [RUBY] [WINDOWS] Pastebin Uploader en: 10 Diciembre 2012, 21:02 pm


  ____        _  _
 (  _ \      / )( \
  ) __/      ) \/ (
 (__)astebin \____/ploader







Pastebin ha modificado la API así que el uploader de Doddy ya no funciona,
el programa "Click.to" es una muy buena alternativa si se quiere subir anónimamente a Pastebin, pero es muy limitad, así que he codeado esta versión en Ruby, para Windows.

PD: El formato del archivo se auto-reconoce (Ej. DOS), aunque aún faltan muchos formatos por añadir.


- Puedes configurar tu cuenta de Pastebin:



- Puedes subir varios archivos a la vez:



- Permite el uso del asterísco:



- Recomiendo encarecidamente usar una cuenta registrada en el script, porque el límite de uploads para "invitados" es de 10 archivos (mientras que para registrados son 25, y para premium 250):



Citar

 [Modo de empleo]
 
  PU (Opciones opcionales) (Archivo)
 
 [Opciones]
 
  -r  --raw
      Postea el código sin formato.
 
  -p  --private
      Marca el archivo como privado (Solo para usuarios registrados).

  -c  --config
      Establece los datos de acceso a una cuenta de Pastebin.

  /?   Muestra esta ayuda.


 [Ejemplos]
  
  • PU Archivo.txt
     Devuelve el enlace directo del archivo.
 
  
  • PU "C:\Archivo1.txt" "C:\Archivo2.bat" "C:\Archivo3.xml"
     Devuelve el enlace directo de varios archivos.
 
  
  • PU --raw Archivo.vbs
     Postea el código sin formato, y devuelve el enlace directo del archivo.

  
  • PU --private "C:\Archivo.txt"
     Marca el archivo como privado, y devuelve el enlace directo del archivo.

  
  • PU --config
     Muestra el menú de configuración de cuenta de acceso.






PU.exe
http://www.mediafire.com/?u967oeb4pc7m71y


Pastebin Uploader.exe (Instalador para el menú contextual del mouse)
http://www.mediafire.com/download.php?a9subk9tssu499l






PU.rb

Código
  1. # -*- coding: UTF-8 -*-
  2.  
  3.  
  4. require 'rest_client'
  5. require 'openssl'
  6. require 'win32/registry'
  7.  
  8.  
  9. exit if Object.const_defined?(:Ocra)
  10.  
  11.  
  12. $files   = ""
  13.  
  14.  
  15. def logo()
  16.  print '
  17.  ____        _  _
  18. (  _ \     / )( \           [v0.2] By Elektro H@cker
  19.  ) __/      ) \/ (
  20. (__)astebin \____/ploader
  21.  
  22. '
  23. end
  24.  
  25.  
  26. def help()
  27. print '
  28. [Modo de empleo]
  29.  
  30.  PU (Opciones opcionales) (Archivo)
  31.  
  32.  
  33.  
  34. [Opciones]
  35.  
  36.  -r  --raw
  37.      Postea el código sin formato.
  38.  
  39.  -p  --private
  40.      Marca el archivo como privado (Solo para usuarios registrados).
  41.  
  42.  -c  --config
  43.      Establece los datos de acceso a una cuenta de Pastebin.
  44.  
  45.  /?   Muestra esta ayuda.
  46.  
  47.  
  48.  
  49. [Ejemplos]
  50.  
  51.  [+] PU Archivo.txt
  52.      Devuelve el enlace directo del archivo.
  53.  
  54.  [+] PU "C:\Archivo1.txt" "C:\Archivo2.bat" "C:\Archivo3.xml"
  55.      Devuelve el enlace directo de varios archivos.
  56.  
  57.  [+] PU --raw Archivo.vbs
  58.      Postea el código sin formato, y devuelve el enlace directo del archivo.
  59.  
  60.  [+] PU --private "C:\Archivo.txt"
  61.      Marca el archivo como privado, y devuelve el enlace directo del archivo.
  62.  
  63.  [+] PU --config
  64.      Muestra el menú de configuración de cuenta de acceso.
  65.  
  66. '
  67. exit
  68. end
  69.  
  70.  
  71. def arguments()
  72.  
  73.  $privacity = 0
  74.  
  75.  # empty arguments
  76.  if (ARGV.empty?) then help() end
  77.  
  78.  ARGV.each do |arg|
  79.  
  80.  # /?
  81.    if arg == "/?" then help() end
  82.  
  83.  # -c --config
  84.    if arg =~ /-c\z/i or arg =~ /--config\z/i then configure() end
  85.  
  86.  # private
  87.    if arg =~ /-p\z/i or arg =~ /--private\z/i then $privacity = 2 end
  88.  
  89.  # -r --raw
  90.    if arg =~ /-r\z/i or arg =~ /--raw\z/i then $raw="yes" end
  91.  
  92.  # files to upload
  93.    if arg[/\.[a-z]+$\z/i]
  94.      if File.exist?(arg)
  95.        $files=$files + arg + "\n"
  96.      elsif
  97.        print "  [+] ERROR\n\n      El archivo #{arg} no existe...\n"
  98.      end
  99.    end
  100.  end # ARGV.each
  101.  
  102. end
  103.  
  104.  
  105. def formats(file)
  106.  if file[/\.arm$/i]   then $format = "arm" end
  107.  if file[/\.asm$/i]   then $format = "asm" end
  108.  if file[/\.asp$/i]   then $format = "asp" end
  109.  if file[/\.au3$/i]   then $format = "autoit" end
  110.  if file[/\.avs$/i]   then $format = "avisynth" end
  111.  if file[/\.bat$/i]   then $format = "dos" end
  112.  if file[/\.c$/i]     then $format = "c" end
  113.  if file[/\.cmake$/i] then $format = "cmake" end
  114.  if file[/\.cmd$/i]   then $format = "dos" end
  115.  if file[/\.cpp$/i]   then $format = "cpp" end
  116.  if file[/\.css$/i]   then $format = "css" end
  117.  if file[/\.diff$/i]  then $format = "diff" end
  118.  if file[/\.div$/i]   then $format = "div" end
  119.  if file[/\.html$/i]  then $format = "html5" end
  120.  if file[/\.ini$/i]   then $format = "ini" end
  121.  if file[/\.iss$/i]   then $format = "inno" end
  122.  if file[/\.lua$/i]   then $format = "lua" end
  123.  if file[/\.mxml$/i]  then $format = "mxml" end
  124.  if file[/\.nsis$/i]  then $format = "nsis" end
  125.  if file[/\.php$/i]   then $format = "php" end
  126.  if file[/\.pl$/i]    then $format = "perl" end
  127.  if file[/\.ps$/i]    then $format = "powershell" end
  128.  if file[/\.py$/i]    then $format = "python" end
  129.  if file[/\.pyc$/i]   then $format = "pycon" end
  130.  if file[/\.pyw$/i]   then $format = "python" end
  131.  if file[/\.rb$/i]    then $format = "ruby" end
  132.  if file[/\.rbw$/i]   then $format = "ruby" end
  133.  if file[/\.reg$/i]   then $format = "reg" end
  134.  if file[/\.sh$/i]    then $format = "bash" end
  135.  if file[/\.sql$/i]   then $format = "sql" end
  136.  if file[/\.tcl$/i]   then $format = "tcl" end
  137.  if file[/\.txt$/i]   then $format = "text" end    
  138.  if file[/\.vb$/i]    then $format = "vbnet" end
  139.  if file[/\.vhdl$/i]  then $format = "vhdl" end
  140.  if file[/\.vim$/i]   then $format = "vim" end
  141.  if file[/\.xml$/i]   then $format = "xml" end
  142.  if file[/\.yaml$/i]  then $format = "yaml" end
  143. end
  144.  
  145.  
  146. def configure()
  147.  $profile = "invalid login"
  148.    print "\n Puede configurar su cuenta de acceso de Pastebin para subir los archivos...\n\n"
  149.  
  150.    until not $profile["invalid login"]
  151.      print " [+] Escriba su nombre de usuario: "
  152.      $user=STDIN.gets
  153.      if $user == "\n" then $user="guest\n" end
  154.  
  155.      print " [+] Escriba su password: "
  156.      $pass=STDIN.gets
  157.      if $pass == "\n" then $pass="guest\n" end
  158.  
  159.      get_userkey()
  160.  
  161.      if $profile["invalid login"] and not $user+$pass=="guest\nguest\n"
  162.        print "\n [+] ERROR\n\n     El nombre de usuario o contraseña son incorrectos.\n\n"
  163.      elsif $user=="guest\n" and $pass=="guest\n"
  164.        $profile="guest"
  165.      end
  166.    end # until
  167.    userencrypted=cifrar($user, "DES-EDE3-CBC")
  168.    passencrypted=cifrar($pass, "DES-EDE3-CBC")
  169.    regwrite("USER", userencrypted)
  170.    regwrite("PASS", passencrypted)
  171.    puts "\n Datos configurados, vuelva a ejecutar el programa..."
  172.    exit
  173. end
  174.  
  175.  
  176. def get_userkey()
  177.  $profile = RestClient.post('http://pastebin.com/api/api_login.php',
  178.    :api_dev_key => "412c0f8eb27faf4feb80451ff06a2c56",
  179.    :api_user_name => $user.gsub("\n",""),
  180.    :api_user_password => $pass.gsub("\n",""),
  181.    :format => "xml")
  182.  $user_key = $profile
  183. end
  184.  
  185.  
  186. def cifrar(datos, cifrado)
  187.  encrypt = OpenSSL::Cipher::Cipher.new(cifrado)
  188.  encrypt.encrypt
  189.  encrypt.update(datos) + encrypt.final      
  190. end
  191.  
  192.  
  193. def descifrar(datos, cifrado)
  194.  decrypt = OpenSSL::Cipher::Cipher.new(cifrado)
  195.  decrypt.decrypt
  196.  decrypt.update(datos) + decrypt.final
  197. end
  198.  
  199.  
  200. def regwrite(keyname, value)
  201.  Win32::Registry::HKEY_CURRENT_USER.create("SOFTWARE\\PastebinUploader\\") do |reg|
  202.    reg[keyname, Win32::Registry::REG_SZ] = value
  203.  end
  204. end
  205.  
  206.  
  207. def regread(keyname)
  208.  Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\PastebinUploader\\") do |reg|
  209.    reg[keyname]
  210.  end
  211. end
  212.  
  213.  
  214. def subir(file)
  215.  begin
  216.    $link = RestClient.post('http://pastebin.com/api/api_post.php',
  217.    :api_option        => "paste",
  218.    :api_dev_key       => "412c0f8eb27faf4feb80451ff06a2c56",
  219.    :api_user_key      => $user_key,    
  220.    :api_user_name     => $user,
  221.    :api_user_password => $pass,
  222.    :api_paste_private => $privacity,
  223.    :api_paste_code    => File.read(file),
  224.    :api_paste_name    => file,
  225.    :api_paste_format  => $format)
  226.  rescue
  227.    print ' [+] ERROR
  228.  
  229.     El error puede ser debido a uno de los siguientes motivos:
  230.  
  231.     - La página esté offline.
  232.     - El tamaño del archivo supere los 500 KB, o 10 MB para usuarios premium.
  233.     - Haya superado el límite de 25 uploads al día, o 250 para usuarios premium.
  234.    '
  235.  exit
  236.  end # exception
  237. end
  238.  
  239.  
  240. logo()
  241. arguments()
  242.  
  243.  
  244. begin
  245.  $user=regread("USER")
  246.  $pass=regread("PASS")
  247.  $user=descifrar($user, "DES-EDE3-CBC").gsub("\n","")
  248.  $pass=descifrar($pass, "DES-EDE3-CBC").gsub("\n","")
  249.  get_userkey()
  250. rescue
  251.  $user="guest"
  252.  $pass="guest"
  253. end
  254. $files.each_line do |file|
  255.  $format = "text"
  256.  if not $raw == "yes" then formats(file) end
  257.  subir(file.gsub("\n",""))
  258.  puts "[+] #{file.chomp}: #{$link.to_s}"
  259. end
  260.  
  261.  
  262. __END__
  263.  
  264.  
823  Programación / Programación General / Ayudénme con estas extensiones desconocidas en: 10 Diciembre 2012, 18:40 pm
Necesito una ayuda para saber las extensiones de estos lenguajes conocidos:

por ejemplo:
Citar
   java = Java
Extensión: .jar

gracias y un saludo.

Citar
   4cs = 4CS
    6502acme = 6502 ACME Cross Assembler
    6502kickass = 6502 Kick Assembler
    6502tasm = 6502 TASM/64TASS
    abap = ABAP
    actionscript = ActionScript
    actionscript3 = ActionScript 3
    ada = Ada
    algol68 = ALGOL 68
    apache = Apache Log
    applescript = AppleScript
    apt_sources = APT Sources
    asymptote = Asymptote
    autoconf = autoconf
    autohotkey = Autohotkey
    awk = Awk
    bascomavr = BASCOM AVR
    basic4gl = Basic4GL
    bibtex = BibTeX
    blitzbasic = Blitz Basic
    bnf = BNF
    boo = BOO
    bf = BrainFuck
    c_mac = C for Macs
    cil = C Intermediate Language
    csharp = C#
    cpp-qt = C++ (with QT extensions)
    c_loadrunner = C: Loadrunner
    caddcl = CAD DCL
    cadlisp = CAD Lisp
    cfdg = CFDG
    chaiscript = ChaiScript
    clojure = Clojure
    klonec = Clone C
    klonecpp = Clone C++
    cmake = CMake
    cobol = COBOL
    coffeescript = CoffeeScript
    cfm = ColdFusion
    cuesheet = Cuesheet
    d = D
    dcl = DCL
    dcpu16 = DCPU-16
    dcs = DCS
    delphi = Delphi
    oxygene = Delphi Prism (Oxygene)
    dot = DOT
    e = E
    ecmascript = ECMAScript
    eiffel = Eiffel
    email = Email
    epc = EPC
    erlang = Erlang
    fsharp = F#
    falcon = Falcon
    fo = FO Language
    f1 = Formula One
    fortran = Fortran
    freebasic = FreeBasic
    freeswitch = FreeSWITCH
    gambas = GAMBAS
    gml = Game Maker
    gdb = GDB
    genero = Genero
    genie = Genie
    gettext = GetText
    go = Go
    groovy = Groovy
    gwbasic = GwBasic
    haskell = Haskell
    haxe = Haxe
    hicest = HicEst
    hq9plus = HQ9 Plus
    html4strict = HTML
    icon = Icon
    idl = IDL
    inno = Inno Script
    intercal = INTERCAL
    io = IO
    j = J
    java = Java
    java5 = Java 5
    javascript = javascript
    jquery = jQuery
    kixtart = KiXtart
    latex = Latex
    ldif = LDIF
    lb = Liberty BASIC
    lsl2 = Linden Scripting
    lisp = Lisp
    llvm = LLVM
    locobasic = Loco Basic
    logtalk = Logtalk
    lolcode = LOL Code
    lotusformulas = Lotus Formulas
    lotusscript = Lotus Script
    lscript = LScript
    m68k = M68000 Assembler
    magiksf = MagikSF
    make = Make
    mapbasic = MapBasic
    matlab = MatLab
    mirc = mIRC
    mmix = MIX Assembler
    modula2 = Modula 2
    modula3 = Modula 3
    68000devpac = Motorola 68000 HiSoft Dev
    mpasm = MPASM
    mysql = MySQL
    nagios = Nagios
    newlisp = newLISP
    oberon2 = Oberon 2
    objeck = Objeck Programming Langua
    objc = Objective C
    ocaml-brief = OCalm Brief
    ocaml = OCaml
    octave = Octave
    pf = OpenBSD PACKET FILTER
    glsl = OpenGL Shading
    oobas = Openoffice BASIC
    oracle11 = Oracle 11
    oracle8 = Oracle 8
    oz = Oz
    parasail = ParaSail
    parigp = PARI/GP
    pascal = Pascal
    pawn = PAWN
    pcre = PCRE
    per = Per
    perl6 = Perl 6
    php-brief = PHP Brief
    pic16 = Pic 16
    pike = Pike
    pixelbender = Pixel Bender
    plsql = PL/SQL
    postgresql = PostgreSQL
    povray = POV-Ray
    powershell = Power Shell
    powerbuilder = PowerBuilder
    proftpd = ProFTPd
    progress = Progress
   prolog = Prolog
    properties = Properties
    providex = ProvideX
    purebasic = PureBasic
    pys60 = Python for S60
    q = q/kdb+
    qbasic = QBasic
    rsplus = R
    rails = Rails
    rebol = REBOL
    rexx = Rexx
    robots = Robots
    rpmspec = RPM Spec
    gnuplot = Ruby Gnuplot
    sas = SAS
    scala = Scala
    scheme = Scheme
    scilab = Scilab
    sdlbasic = SdlBasic
    smalltalk = Smalltalk
    smarty = Smarty
    spark = SPARK
    sparql = SPARQL
    stonescript = StoneScript
    systemverilog = SystemVerilog
    tsql = T-SQL
    teraterm = Tera Term
    thinbasic = thinBasic
    typoscript = TypoScript
    unicon = Unicon
    uscript = UnrealScript
    ups = UPC
    urbi = Urbi
    vala = Vala
    vbnet = VB.NET
    vedit = Vedit
    verilog = VeriLog
    visualprolog = Visual Pro Log
    visualfoxpro = VisualFoxPro
    whitespace = WhiteSpace
    whois = WHOIS
    winbatch = Winbatch
    xbasic = XBasic
    xorg_conf = Xorg Config
    xpp = XPP
    yaml = YAML
    z80 = Z80 Assembler
    zxbasic = ZXBasic
824  Sistemas Operativos / Windows / Como cambiar la alineación por defecto del escritorio. en: 7 Diciembre 2012, 16:29 pm
Hola,

Llevo varios años buscando una solución a este problema, que es para verdaderos expertos y conocedores de las entrañas de Windows. En todos estos años no he encontrado respuesta ni solución alguna, y aquí vengo a volverlo a intentar.

Cuando creamos un archivo en el escritorio, la alineación por defecto de Windows es "de esquina superior izquierda hacia abajo", así:



Lo que yo siempre he pretendido hacer es modificar la alineación por defecto, por ejemplo si creo unos cuantos archivos en el escritorio, que la alineación por defecto séa de abajo-izquierda a derecha, así:



¿Alguien sabe si es posible? Algún valor de registro, algún recurso DLL que editar?

Sé que la versión China de Windows 7 tiene una alineación distinta, empieza desde la esquina arriba-derecha a abajo, por lo tanto esto Microsoft lo puede hacer sin problemas, lo que no sé es si un usuario puede hacerlo.

PD: Daros cuenta que no busco el típico programa que por ejemplo dibuja un "reloj" con los iconos del escritorio u otras figuras para organizar el escritorio... lo que yo quiero es cambiar la alineación por defecto.

PD2: Uso Windows 7
825  Programación / .NET (C#, VB.NET, ASP) / Mi form se cuelga al iniciar un thread... en: 29 Noviembre 2012, 19:36 pm
Para los que no lo sepan, estoy diseñando un programa, y tenía un problema, la app se colgaba al darle al botón "start", hasta que "el proceso" finalizaba no podía tocar nada.
...
...
Después de estar días para conseguir meter una función en un thread separado, ahora que lo he conseguido ...no hay ninguna diferencia... hasta que no finaliza "el proceso" no puedo mover el form por la pantalla, ni pulsar cualquier botón del form, ni nada, solo puedo esperar hasta que acabe...

...Espero alguna ayuda, porqué yo ya no sé que más intentar para que no se me cuelgue, no sé lo que he hecho mal.



Hasta que no se terminan de mostrar todas las líneas del richtextbox no me deja tocar NADA.

...Muchas gracias por leer.




El form:

Código
  1. Imports System.IO
  2. Imports System.Threading
  3. Imports System.Runtime.InteropServices
  4. Imports System.ComponentModel
  5. Imports Ookii.Dialogs
  6.  
  7. Public Class Form1
  8.  
  9. #Region "Declarations"
  10.  
  11.    ' MediaInfo
  12.    Dim MI As MediaInfo
  13.  
  14.    ' Others
  15.    Dim NameOfDirectory As String = Nothing
  16.    Dim aFile As FileInfo
  17.  
  18. #End Region
  19.  
  20. #Region "Properties"
  21. #End Region
  22.  
  23. #Region "Load / Close"
  24.  
  25.    ' Load
  26.    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  27.  
  28.        ' MediaInfo Instance
  29.        MI = New MediaInfo
  30.  
  31.    End Sub
  32.  
  33. #End Region
  34.  
  35. #Region "Get Total files Function"
  36. #End Region
  37.  
  38. #Region "Option checkboxes"
  39. #End Region
  40.  
  41. #Region "Folder buttons"
  42. #End Region
  43.  
  44.  
  45. #Region "Append text function"
  46.  
  47.    ' Append Text
  48.    Public Sub AppendText(box As RichTextBox, color As Color, text As String)
  49.  
  50.        Control.CheckForIllegalCrossThreadCalls = False
  51.  
  52.        Dim start As Integer = box.TextLength
  53.        box.AppendText(text)
  54.        Dim [end] As Integer = box.TextLength
  55.  
  56.        ' Textbox may transform chars, so (end-start) != text.Length
  57.        box.[Select](start, [end] - start)
  58.        If True Then
  59.            box.SelectionColor = color
  60.            ' could set box.SelectionBackColor, box.SelectionFont too.
  61.        End If
  62.        box.SelectionLength = 0
  63.        ' clear
  64.    End Sub
  65.  
  66. #End Region
  67.  
  68.  
  69. #Region "Thread"
  70.  
  71.    Public _WaitHandle_FirstThreadDone As New System.Threading.AutoResetEvent(False)
  72.  
  73.    Public Sub ThreadProc(ByVal aDir As DirectoryInfo)
  74.  
  75.        Dim aFile As FileInfo
  76.  
  77.        For Each aFile In aDir.GetFiles()
  78.  
  79.            If accepted_extensions.ToLower.Contains(aFile.Extension.ToLower) Then
  80.  
  81.                ' print output
  82.                AppendText(consolebox, Color.Yellow, "Processing: ")
  83.                AppendText(consolebox, Color.White, aFile.ToString() + vbNewLine)
  84.                consolebox.ScrollToCaret()
  85.                processedfiles += 1
  86.                totalfiles_label.Text = "Processed " + processedfiles.ToString() + " of " + totalfiles.ToString() + " total video files"
  87.  
  88.                ' Attributes
  89.                If attribs = True Then
  90.                    aFile.Attributes = (aFile.Attributes And Not FileAttributes.ReadOnly And Not FileAttributes.Hidden And Not FileAttributes.System And Not FileAttributes.Archive)
  91.                End If
  92.  
  93.                ' Rename to Word-Case
  94.                If wordcase = True Then
  95.                    Dim renamestr As String = StrConv(aFile.Name, VbStrConv.ProperCase)
  96.                    My.Computer.FileSystem.RenameFile(aFile.FullName, renamestr + "_FILMEN")
  97.                    My.Computer.FileSystem.RenameFile(aFile.FullName + "_FILMEN", renamestr)
  98.                End If
  99.  
  100.                ' Rename to Lower-Case
  101.                If lowercase = True Then
  102.                    Dim renamestr As String = StrConv(aFile.Name, VbStrConv.Lowercase)
  103.                    My.Computer.FileSystem.RenameFile(aFile.FullName, renamestr + "_FILMEN")
  104.                    My.Computer.FileSystem.RenameFile(aFile.FullName + "_FILMEN", renamestr)
  105.                End If
  106.  
  107.                ' Playlists
  108.                If playlist = True Then
  109.                    Using writer As StreamWriter = New StreamWriter(aFile.DirectoryName.ToString() & "\" & aDir.Name & ".m3u", True, System.Text.Encoding.UTF8)
  110.                        writer.WriteLine(aFile.FullName.ToString())
  111.                    End Using
  112.                End If
  113.  
  114.                ' MEDIAINFO:  (ac3, dts, wav and multitrack)
  115.                If ac3 = True Or dts = True Or wav = True Or multitrack = True Then
  116.  
  117.                    MI.Open(aFile.FullName)
  118.  
  119.                    Dim Pos As Integer = 0
  120.                    To_Display = Nothing
  121.  
  122.                    ' multitrack
  123.                    If multitrack = True Then
  124.                        If MI.Count_Get(StreamKind.Audio) > 1 Then
  125.                            results_box.AppendText("Multi Track: " + aFile.FullName.ToString() + vbNewLine)
  126.                            results_box.SelectionStart = results_box.Text.Length
  127.                            results_box.ScrollToCaret()
  128.                            problems += 1
  129.                            problems_label.Text = problems.ToString() + " problems found"
  130.                        End If
  131.                    End If
  132.  
  133.                    While Pos < MI.Count_Get(StreamKind.Audio)
  134.  
  135.                        ' AC-3
  136.                        If ac3 = True Then
  137.                            If MI.Get_(StreamKind.Audio, Pos, "Format").ToString() = "AC-3" Then
  138.                                results_box.AppendText("AC3 Track: " + aFile.FullName.ToString() + vbNewLine)
  139.                                results_box.SelectionStart = results_box.Text.Length
  140.                                results_box.ScrollToCaret()
  141.                                problems += 1
  142.                                problems_label.Text = problems.ToString() + " problems found"
  143.                            End If
  144.                        End If
  145.  
  146.                        ' DTS
  147.                        If dts = True Then
  148.                            If MI.Get_(StreamKind.Audio, Pos, "Format").Contains("DTS") Then
  149.                                results_box.AppendText("DTS Track: " + aFile.FullName.ToString() + vbNewLine)
  150.                                results_box.SelectionStart = results_box.Text.Length
  151.                                results_box.ScrollToCaret()
  152.                                problems += 1
  153.                                problems_label.Text = problems.ToString() + " problems found"
  154.                            End If
  155.                        End If
  156.  
  157.                        ' WAV
  158.                        If wav = True Then
  159.                            If MI.Get_(StreamKind.Audio, Pos, "Format").Contains("PCM") Then
  160.                                results_box.AppendText("WAV Track: " + aFile.FullName.ToString() + vbNewLine)
  161.                                results_box.SelectionStart = results_box.Text.Length
  162.                                results_box.ScrollToCaret()
  163.                                problems += 1
  164.                                problems_label.Text = problems.ToString() + " problems found"
  165.                            End If
  166.                        End If
  167.  
  168.                        System.Math.Max(System.Threading.Interlocked.Increment(Pos), Pos - 1)
  169.                    End While
  170.                End If
  171.  
  172.                If metadata = True Then
  173.                    Dim ffmpeg_process As New Process()
  174.                    Dim ffmpeg_startinfo As New ProcessStartInfo()
  175.                    ffmpeg_startinfo.FileName = "cmd.exe "
  176.                    ffmpeg_startinfo.Arguments = "/C ffmpeg.exe -y -i " & ControlChars.Quote & aFile.FullName.ToString() & ControlChars.Quote & " -f ffmetadata " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & " >NUL 2>&1 && Type " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & "| FINDSTR /I " & ControlChars.Quote & "^INAM ^title" & ControlChars.Quote & " >NUL && Echo FOUND && EXIT || Echo NOT FOUND && Exit"
  177.                    ffmpeg_startinfo.UseShellExecute = False
  178.                    ffmpeg_startinfo.CreateNoWindow = True
  179.                    ffmpeg_startinfo.RedirectStandardOutput = True
  180.                    ffmpeg_startinfo.RedirectStandardError = True
  181.                    ffmpeg_process.EnableRaisingEvents = True
  182.                    ffmpeg_process.StartInfo = ffmpeg_startinfo
  183.                    ffmpeg_process.Start()
  184.                    ffmpeg_process.WaitForExit()
  185.  
  186.                    Dim readerStdOut As IO.StreamReader = ffmpeg_process.StandardOutput
  187.                    Dim FINDstdOut As String = ffmpeg_process.StandardOutput.ReadToEnd
  188.  
  189.                    If FINDstdOut.Contains("FOUND") Then
  190.                        AppendText(consolebox, Color.Red, "TAGS FOUND! Removing tags, please wait..." & vbNewLine)
  191.                        Dim relative_dir As String = aDir.FullName.ToString().Replace(aDir.Root.ToString(), "\")
  192.                        Dim ffmpegconvert_process As New Process()
  193.                        Dim ffmpegconvert_startinfo As New ProcessStartInfo()
  194.                        ffmpegconvert_startinfo.FileName = "cmd.exe "
  195.                        ffmpegconvert_startinfo.Arguments = "/C MKDIR " & ControlChars.Quote & userSelectedFolderPathmetadata & relative_dir & ControlChars.Quote & " 2>NUL & ffmpeg.exe -y -i " & ControlChars.Quote & aFile.FullName.ToString() & ControlChars.Quote & " -c copy -map_metadata -1 " & ControlChars.Quote & userSelectedFolderPathmetadata & relative_dir & "\" & aFile.Name.ToString() & ControlChars.Quote & " >NUL 2>&1 & Exit"
  196.                        ffmpegconvert_startinfo.UseShellExecute = False
  197.                        ffmpegconvert_startinfo.CreateNoWindow = True
  198.                        ffmpegconvert_startinfo.RedirectStandardOutput = True
  199.                        ffmpegconvert_startinfo.RedirectStandardError = True
  200.                        ffmpegconvert_process.EnableRaisingEvents = True
  201.                        ffmpegconvert_process.StartInfo = ffmpegconvert_startinfo
  202.                        ffmpegconvert_process.Start()
  203.                        ffmpegconvert_process.WaitForExit()
  204.                        'Dim ffmpegconvertreaderStdOut As IO.StreamReader = ffmpegconvert_process.StandardOutput
  205.                    End If
  206.  
  207.                    Do While readerStdOut.EndOfStream = False
  208.                        consolebox.AppendText(readerStdOut.ReadLine() + vbNewLine)
  209.                        consolebox.SelectionStart = consolebox.Text.Length
  210.                        consolebox.ScrollToCaret()
  211.                    Loop
  212.  
  213.                End If
  214.            End If
  215.        Next
  216.  
  217.        _WaitHandle_FirstThreadDone.Set()
  218.    End Sub
  219.  
  220.  
  221. #End Region
  222.  
  223.  
  224. #Region "Organize function"
  225.  
  226.    Public Sub MediaInfo(Directory)
  227.        Dim MyDirectory As DirectoryInfo
  228.        MyDirectory = New DirectoryInfo(NameOfDirectory)
  229.        MediaInfoWorkWithDirectory(MyDirectory)
  230.    End Sub
  231.  
  232.    Public Sub MediaInfoWorkWithDirectory(ByVal aDir As DirectoryInfo)
  233.        Dim nextDir As DirectoryInfo
  234.        Dim t As New Threading.Thread(AddressOf ThreadProc)
  235.        t.Start(aDir)
  236.        _WaitHandle_FirstThreadDone.WaitOne()
  237.        For Each nextDir In aDir.GetDirectories
  238.            If playlist = True Then
  239.                Using writer As StreamWriter = New StreamWriter(aDir.FullName & "\" & nextDir.Name & "\" & nextDir.Name & ".m3u", False, System.Text.Encoding.UTF8)
  240.                    'overwrite existing playlist
  241.                End Using
  242.            End If
  243.            MediaInfoWorkWithDirectory(nextDir)
  244.        Next
  245.    End Sub
  246.  
  247. #End Region
  248.  
  249.  
  250. #Region "Action buttons"
  251.  
  252.    ' start button
  253.    Public Sub Button2_Click(sender As Object, e As EventArgs) Handles start_button.Click
  254.  
  255.        If metadata = True And metadatatextbox.Text = "Select a folder to save the converted videos without metadata..." Then
  256.            MsgBox("You must select a folder for the saved metadata videos...", , "Filmen v1.0")
  257.        Else
  258.            If ac3 = False And dts = False And wav = False And multitrack = False And playlist = False And attribs = False And wordcase = False And metadata = False And lowercase = False Then
  259.                MsgBox("You must select at least one option...", , "Filmen v1.0")
  260.            Else
  261.  
  262.                consolebox.Clear()
  263.  
  264.                ' pause / cancel button ON
  265.                pause_button.Enabled = True
  266.                cancel_button.Enabled = True
  267.  
  268.                ' Total files label
  269.                processedfiles = 0
  270.                totalfiles_label.Text = totalfiles.ToString() + " Total video files"
  271.  
  272.                ' Problems label
  273.                problems = 0
  274.                problems_label.Text = "0 problems found"
  275.  
  276.                ' Organization process
  277.                NameOfDirectory = userSelectedFolderPath
  278.                MediaInfo(NameOfDirectory)
  279.                consolebox.AppendText(vbNewLine + "[+] Organization finalized!" + vbNewLine)
  280.                consolebox.Refresh()
  281.                consolebox.SelectionStart = consolebox.Text.Length
  282.                consolebox.ScrollToCaret()
  283.  
  284.                ' pause / cancel button OFF
  285.                pause_button.Enabled = False
  286.                cancel_button.Enabled = False
  287.  
  288.            End If
  289.        End If
  290.    End Sub
  291.  
  292. #End Region
  293.  
  294. End Class
  295.  
826  Programación / .NET (C#, VB.NET, ASP) / [SOURCE] PlayLists en: 29 Noviembre 2012, 18:47 pm
Bueno,
es una caca de programa porqué es el segundo programa que he hecho, y no he conseguido dejar bien la transparencia del programa ni meter la barra de progreso en un thread, pero está decente para usarse y cumple las condiciones necesarias, y me quedo satisfecho al ver la diferencia entre Batch y Winform XD

El programa sirve para seleccionar una o varias carpetas y añadirlas a la lista de reproducción del reproductor multimedia, ni más, ni menos. (Buena tool para bindearla a un "hot-corner" de la pantalla del PC)

     


Source: http://exoshare.com/download.php?uid=EJJTGEXN





Aquí dejo el "boceto" en Batch por si le sirve a alguien:

Código
  1. @echo off
  2. Title Winamp Auto Playlist Menu v0.1
  3.  
  4. :: Auto-redimensionado
  5. color 07
  6. Nircmd win center ititle "Winamp Auto Playlist Menu" >NUL 2>&1
  7. PUSHD "%~dp0"
  8. Set /a Lines=5
  9. Mode con cols=50 lines=%LINES%
  10. For /D %%# in (*) Do (Call Set /A "Lines+=2" & call Mode con cols=60 lines=%%LINES%%)
  11.  
  12. :Menu
  13. CLS
  14. SET "SELECT=" & SET "NUM="
  15. For /D %%# in (*) Do (Call Set /A "Num+=1" & Call Set "Folder%%NUM%%=%%#" & Call Set "List=%%LIST%%!!%%NUM%%" & Call Echo [%%Num%%] %%# | MORE)
  16. Echo [0] * REPRODUCIR TODO * | MORE
  17. Echo: Seleccione una carpeta para reproducirla...
  18. Set /P select=^>^>
  19. Echo "%SELECT%" | FINDSTR /I "[A-Z]" >NUL && (Goto :Menu) || (Echo "%List%" | FIND ";%SELECT% " >NUL || (Goto :Menu))
  20. If "%SELECT%" equ "0" (Goto :todo)
  21.  
  22. :Play
  23. CLS
  24. Call Echo Carpeta seleccionada: "%%Folder%SELECT%%%" | MORE
  25. Call Echo: [+] Iniciando Winamp...
  26. Call Start /B /D "%ProgramFiles(x86)%\Winamp\" winamp.exe "%CD%\%%Folder%SELECT%%%"
  27. Timeout /T 5 & Exit
  28.  
  29. :TODO
  30. CLS
  31. Call Echo Carpeta seleccionada: * TODAS * | MORE
  32. Call Echo: [+] Iniciando Winamp...
  33. For /D %%# in (*) Do (Call Set "ARG=%%arg%% ^"%CD%\%%#^"")
  34. Call Start /B /D "%ProgramFiles(x86)%\Winamp\" winamp.exe %%arg%%
  35. Timeout /T 10 & Exit
827  Programación / .NET (C#, VB.NET, ASP) / (Solucionado) Problema con mi thread... en: 29 Noviembre 2012, 18:05 pm
EDITO: Lo he resuelto creando nuevas instancias del thread dentro del loop

Tengo este thread:

Código
  1. Public Sub ThreadProc(ByVal aDir As DirectoryInfo)
  2.    Dim i As Integer
  3.    For i = 1 To 3
  4.        MsgBox(i)
  5.        Thread.Sleep(500)
  6.    Next
  7.    _WaitHandle_FirstThreadDone.Set()
  8. End Sub
  9.  

Y tengo un búcle que hace esto:

Código
  1.   loop...
  2.    t.Start(aDir)
  3.    _WaitHandle_FirstThreadDone.WaitOne()
  4.   next...

El problema es que solo se ejecuta el thread una sola vez, cuando intenta iniciarse la siguiente vez me dice el debugger: "Subproceso en ejecución o terminado, no se pudo reiniciar",
y no lo entiendo, creo que le estoy indicando al thread que se "setee" como finalizado, y el loop espera a que finalize el thread.. así que no sé donde estará el problema, de verdad no lo entiendo!
828  Programación / .NET (C#, VB.NET, ASP) / (solucionado) Progressbar + label = ¿NO transparencia? en: 28 Noviembre 2012, 18:43 pm
Estoy harto del tema de las transparencias en los winforms...

aver si me podeis ayudar, el problema es sencillo, la solución...no lo sé.

un label "transparente" encima de una barra de progreso:


¿Como puedo hacerlo transparente de verdad?

Gracias...
829  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Cambiar el color de una línea en un richtextbox en: 27 Noviembre 2012, 12:31 pm
Pues eso, ¿Sería posible cambiar el color de UNA sola línea de este richtextbox para que la línea de "Processing: ..." saliera en amarillo por ejemplo?

Y otra pregunta relacionada, ¿Sería posible cambiar solamente UNA palabra de color?

Agradezco cualquier información!

830  Programación / .NET (C#, VB.NET, ASP) / (SOLUCIONADO) Como agarrar el error-output de un proceso? en: 27 Noviembre 2012, 09:52 am
Hola,

Necesito agarrar el error output de la CMD en este código, pero no sé como hacerlo, solo me agarra el output standard. ¿Me pueden indicar como se hace?

Muchas gracias!

PD: Ya sé que es una mala práctica usar comandos externos, pero no encuentro ninguna librería que sirva para buscar metadataos Y A LA VEZ convertir videos, eso es dificil, estoy aprendiendo!


Código
  1.                If metadata = True Then
  2.                    Dim ffmpeg_process As New Process()
  3.                    Dim ffmpeg_startinfo As New ProcessStartInfo()
  4.                    ffmpeg_startinfo.FileName = "cmd.exe "
  5.                    ffmpeg_startinfo.UseShellExecute = False
  6.                    ffmpeg_startinfo.CreateNoWindow = False
  7.                    ffmpeg_startinfo.Arguments = "/C ffmpeg.exe -y -i " & ControlChars.Quote & aFile.FullName.ToString() & ControlChars.Quote & " -f ffmetadata " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & " >NUL 2>&1 && Type " & ControlChars.Quote & "%TEMP%\" & aFile.Name.ToString() & "_metadata.txt" & ControlChars.Quote & "| FINDSTR /I " & ControlChars.Quote & "^INAM ^title" & ControlChars.Quote
  8.                    ffmpeg_startinfo.RedirectStandardOutput = True
  9.                    ffmpeg_process.EnableRaisingEvents = True
  10.                    ffmpeg_process.StartInfo = ffmpeg_startinfo
  11.                    ffmpeg_process.Start()
  12.                    Dim readerStdOut As IO.StreamReader = ffmpeg_process.StandardOutput
  13.                    Do While readerStdOut.EndOfStream = False
  14.                        consolebox.AppendText(readerStdOut.ReadLine() + vbNewLine)
  15.                        consolebox.SelectionStart = consolebox.Text.Length
  16.                        consolebox.ScrollToCaret()
  17.                    Loop
  18.                End If
Páginas: 1 ... 68 69 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 ... 105
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines