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


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ... 1257
81  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets para VB.NET !! (Compartan aquí sus snippets) en: 30 Mayo 2025, 01:15 am
Cómo iniciar el programa warp-cli.exe de la VPN de Cloudflare Warp pasándole un comando

Un simple método para ejecutar el programa warp-cli.exe de la VPN de Cloudflare Warp pasándole un comando (ej. "connect", "disconnect", etc):

Código
  1. ''' <summary>
  2. ''' Sends a custom command to the Cloudflare Warp CLI executable (<c>warp-cli.exe</c>)
  3. ''' and captures both standard output and error output.
  4. ''' </summary>
  5. '''
  6. ''' <param name="command">
  7. ''' The command-line argument to be passed to warp-cli executable.
  8. ''' For example: <c>connect</c>, <c>disconnect</c>, <c>status</c>, etc.
  9. ''' </param>
  10. '''
  11. ''' <param name="refOutput">
  12. ''' Returns the standard output returned by the warp-cli process.
  13. ''' </param>
  14. '''
  15. ''' <param name="refErrorOutput">
  16. ''' Returns the standard error output returned by the warp-cli process.
  17. ''' </param>
  18. '''
  19. ''' <param name="warpCliFilePath">
  20. ''' Optional path to the warp-cli executable. If <c>Nothing</c> is specified, the method defaults to:
  21. ''' <c>%ProgramFiles%\Cloudflare\Cloudflare Warp\warp-cli.exe</c>.
  22. ''' </param>
  23. '''
  24. ''' <returns>
  25. ''' The exit code returned by the warp-cli process. A value of 0 typically indicates success.
  26. ''' </returns>
  27. '''
  28. ''' <exception cref="System.IO.FileNotFoundException">
  29. ''' Thrown if the specified or default warp-cli executable file is not found on the system.
  30. ''' </exception>
  31. '''
  32. ''' <exception cref="System.TimeoutException">
  33. ''' Thrown if the warp-cli process takes longer than 60 seconds to complete.
  34. ''' </exception>
  35. '''
  36. ''' <exception cref="System.Exception">
  37. ''' Thrown if any other unexpected error occurs while attempting to execute the warp-cli process.
  38. ''' The original exception is wrapped as the inner exception.
  39. ''' </exception>
  40. <DebuggerStepThrough>
  41. Public Shared Function CloudflareWarpCliSendCommand(command As String,
  42.                                                    ByRef refOutput As String,
  43.                                                    ByRef refErrorOutput As String,
  44.                                                    Optional warpCliFilePath As String = Nothing) As Integer
  45.  
  46.    ' Prevents concurrent execution of the method from multiple threads within the same process.
  47.    ' This static lock object ensures that only one thread can execute the critical section at a time,
  48.    ' avoiding race conditions or conflicts when invoking the Warp CLI.
  49.    Static WarpCliLock As New Object()
  50.  
  51.    Static spaceChar As Char = " "c
  52.  
  53.    SyncLock WarpCliLock
  54.        If String.IsNullOrEmpty(warpCliFilePath) Then
  55.            warpCliFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
  56.                                           "Cloudflare\Cloudflare Warp\warp-cli.exe")
  57.        End If
  58.  
  59.        Try
  60.            If Not System.IO.File.Exists(warpCliFilePath) Then
  61.                Throw New System.IO.FileNotFoundException("The Warp CLI executable was not found.", warpCliFilePath)
  62.            End If
  63.  
  64.            Using pr As New Process()
  65.                pr.StartInfo.FileName = warpCliFilePath
  66.                pr.StartInfo.Arguments = command
  67.                pr.StartInfo.UseShellExecute = False
  68.                pr.StartInfo.CreateNoWindow = True
  69.                pr.StartInfo.RedirectStandardOutput = True
  70.                pr.StartInfo.RedirectStandardError = True
  71.  
  72.                pr.Start()
  73.                If Not pr.WaitForExit(60000) Then ' Waits a maximum of 60 seconds
  74.                    pr.Kill()
  75.                    Throw New TimeoutException("warp-cli process has timed out.")
  76.                End If
  77.  
  78.                refOutput = pr.StandardOutput.ReadToEnd().Trim(Environment.NewLine.ToCharArray().Concat({spaceChar}).ToArray())
  79.                refErrorOutput = pr.StandardError.ReadToEnd().Trim(Environment.NewLine.ToCharArray().Concat({spaceChar}).ToArray())
  80.  
  81.                Return pr.ExitCode
  82.            End Using
  83.  
  84.        Catch ex As Exception
  85.            Throw New Exception($"Failed to execute warp-cli process. See inner exception for details.", ex)
  86.        End Try
  87.    End SyncLock
  88. End Function

Casos de uso reales: para conectar a la red de Cloudflare WARP en cualquier proyecto donde hagamos solicitudes http, por ejemplo en un web-crawler, a sitios web con riesgo de que puedan acabar bloqueando nuestra IP.



Tres métodos de extensión para dibujar texto sobre una imagen, o dibujar encima otra imagen (con capacidad opcional de usar transparencia) o un valor numérico, con una escala proporcional a la imagen y en una posición alineada a cualquiera de las esquinas o zonas centrales de la imagen (centro absoluto, parte superior central o parte inferior central) de la imagen.

Demostración de resultado de la extensión que dibuja un valor numérico (de forma alineada a la esquina inferior derecha de la imagen):



Código
  1. ''' <summary>
  2. ''' Draws an overlay image onto the specified <see cref="Image"/> at a given position and scale factor.
  3. ''' </summary>
  4. '''
  5. ''' <param name="refImg">
  6. ''' The source <see cref="Image"/> to modify. The overlay image will be drawn directly on this image.
  7. ''' </param>
  8. '''
  9. ''' <param name="overlayImg">
  10. ''' The overlay image to draw on the source <paramref name="refImg"/>.
  11. ''' </param>
  12. '''
  13. ''' <param name="scale">
  14. ''' The relative image scale factor to determine overlay image size. Lower values increase the size of the overlay image.
  15. ''' </param>
  16. '''
  17. ''' <param name="position">
  18. ''' The position/alignment where the overlay image should be drawn (e.g., bottom-right).
  19. ''' </param>
  20. '''
  21. ''' <param name="margin">
  22. ''' The margin (in pixels) from the edge of the image to position the overlay image.
  23. ''' <para></para>
  24. ''' This value has different meaning depending on <paramref name="position"/> parameter:
  25. ''' <para></para>
  26. ''' <list type="bullet">
  27. '''   <item>
  28. '''     <term>
  29. '''       <see cref="ContentAlignment.TopLeft"/>, <see cref="ContentAlignment.TopRight"/>,
  30. '''       <para></para>
  31. '''       <see cref="ContentAlignment.BottomLeft"/> and <see cref="ContentAlignment.BottomRight"/>
  32. '''     </term>
  33. '''     <description><para></para><paramref name="margin"/> specifies the diagonal offset.</description>
  34. '''   </item>
  35. '''   <item>
  36. '''     <term>
  37. '''       <see cref="ContentAlignment.MiddleLeft"/> and <see cref="ContentAlignment.MiddleRight"/>
  38. '''     </term>
  39. '''     <description><para></para><paramref name="margin"/> specifies the horizontal offset.</description>
  40. '''   </item>
  41. '''   <item>
  42. '''     <term>
  43. '''       <see cref="ContentAlignment.TopCenter"/> and <see cref="ContentAlignment.BottomCenter"/>
  44. '''     </term>
  45. '''     <description><para></para><paramref name="margin"/> specifies the vertical offset.</description>
  46. '''   </item>
  47. '''   <item>
  48. '''     <term>
  49. '''       <see cref="ContentAlignment.MiddleCenter"/>
  50. '''     </term>
  51. '''     <description><para></para><paramref name="margin"/> is ignored.</description>
  52. '''   </item>
  53. ''' </list>
  54. ''' </param>
  55. '''
  56. ''' <param name="transparentColor">
  57. ''' Optional. A <see cref="Color"/> to use as transparency to draw the overlay image.
  58. ''' </param>
  59. <DebuggerStepThrough>
  60. <Extension>
  61. <EditorBrowsable(EditorBrowsableState.Always)>
  62. Public Sub DrawImageScaled(ByRef refImg As Image, overlayImg As Image,
  63.                       scale As Single, position As ContentAlignment, margin As Single,
  64.                       Optional transparentColor As Color? = Nothing)
  65.  
  66.    If refImg Is Nothing Then
  67.        Throw New ArgumentNullException(NameOf(refImg))
  68.    End If
  69.  
  70.    If overlayImg Is Nothing Then
  71.        Throw New ArgumentNullException(NameOf(overlayImg))
  72.    End If
  73.  
  74.    If margin < 0 Then
  75.        Throw New ArgumentOutOfRangeException(NameOf(margin), margin, "Margin must be greater than or equal to 0.")
  76.    End If
  77.  
  78.    If scale < 1 Then
  79.        Throw New ArgumentOutOfRangeException(NameOf(scale), scale, "Font scale must be greater than or equal to 1.")
  80.    End If
  81.  
  82.    Using g As Graphics = Graphics.FromImage(refImg)
  83.        g.SmoothingMode = SmoothingMode.AntiAlias
  84.        g.InterpolationMode = InterpolationMode.HighQualityBicubic
  85.        g.PixelOffsetMode = PixelOffsetMode.HighQuality
  86.        g.CompositingQuality = CompositingQuality.HighQuality
  87.  
  88.        Dim targetSize As Single = Math.Max(refImg.Width, refImg.Height) / scale
  89.        Dim aspectRatio As Single = CSng(overlayImg.Width / overlayImg.Height)
  90.  
  91.        Dim drawWidth As Single
  92.        Dim drawHeight As Single
  93.  
  94.        If overlayImg.Width >= overlayImg.Height Then
  95.            drawWidth = targetSize
  96.            drawHeight = targetSize / aspectRatio
  97.        Else
  98.            drawHeight = targetSize
  99.            drawWidth = targetSize * aspectRatio
  100.        End If
  101.  
  102.        Dim posX As Single = 0
  103.        Dim posY As Single = 0
  104.  
  105.        Select Case position
  106.            Case ContentAlignment.TopLeft
  107.                posX = margin
  108.                posY = margin
  109.  
  110.            Case ContentAlignment.TopCenter
  111.                posX = (refImg.Width - drawWidth) / 2
  112.                posY = margin
  113.  
  114.            Case ContentAlignment.TopRight
  115.                posX = refImg.Width - drawWidth - margin
  116.                posY = margin
  117.  
  118.            Case ContentAlignment.MiddleLeft
  119.                posX = margin
  120.                posY = (refImg.Height - drawHeight) / 2
  121.  
  122.            Case ContentAlignment.MiddleCenter
  123.                posX = (refImg.Width - drawWidth) / 2
  124.                posY = (refImg.Height - drawHeight) / 2
  125.  
  126.            Case ContentAlignment.MiddleRight
  127.                posX = refImg.Width - drawWidth - margin
  128.                posY = (refImg.Height - drawHeight) / 2
  129.  
  130.            Case ContentAlignment.BottomLeft
  131.                posX = margin
  132.                posY = refImg.Height - drawHeight - margin
  133.  
  134.            Case ContentAlignment.BottomCenter
  135.                posX = (refImg.Width - drawWidth) / 2
  136.                posY = refImg.Height - drawHeight - margin
  137.  
  138.            Case ContentAlignment.BottomRight
  139.                posX = refImg.Width - drawWidth - margin
  140.                posY = refImg.Height - drawHeight - margin
  141.  
  142.            Case Else
  143.                Throw New InvalidEnumArgumentException(NameOf(position), position, GetType(ContentAlignment))
  144.        End Select
  145.  
  146.        If transparentColor.HasValue Then
  147.            Using attr As New Imaging.ImageAttributes()
  148.                attr.SetColorKey(transparentColor.Value, transparentColor.Value)
  149.  
  150.                Dim destRect As New Rectangle(CInt(posX), CInt(posY), CInt(drawWidth), CInt(drawHeight))
  151.                g.DrawImage(overlayImg, destRect, 0, 0, overlayImg.Width, overlayImg.Height, GraphicsUnit.Pixel, attr)
  152.            End Using
  153.        Else
  154.            g.DrawImage(overlayImg, posX, posY, drawWidth, drawHeight)
  155.        End If
  156.    End Using
  157. End Sub
  158.  
  159. ''' <summary>
  160. ''' Draws text onto the specified <see cref="Image"/> at a given position and scale factor.
  161. ''' </summary>
  162. '''
  163. ''' <param name="refImg">
  164. ''' The <see cref="Image"/> to modify. The text will be drawn directly on this image.
  165. ''' </param>
  166. '''
  167. ''' <param name="text">
  168. ''' The text to draw on the image.
  169. ''' </param>
  170. '''
  171. ''' <param name="scale">
  172. ''' The relative image scale factor to determine font size. Lower values increase the size of the text.
  173. ''' <para></para>
  174. ''' Suggested value is from 10 to 20.
  175. ''' </param>
  176. '''
  177. ''' <param name="position">
  178. ''' The position/alignment where the text should be drawn (e.g., bottom-right).
  179. ''' </param>
  180. '''
  181. ''' <param name="margin">
  182. ''' The margin (in pixels) from the edge of the image to position the text.
  183. ''' <para></para>
  184. ''' This value has different meaning depending on <paramref name="position"/> parameter:
  185. ''' <para></para>
  186. ''' <list type="bullet">
  187. '''   <item>
  188. '''     <term>
  189. '''       <see cref="ContentAlignment.TopLeft"/>, <see cref="ContentAlignment.TopRight"/>,
  190. '''       <para></para>
  191. '''       <see cref="ContentAlignment.BottomLeft"/> and <see cref="ContentAlignment.BottomRight"/>
  192. '''     </term>
  193. '''     <description><para></para><paramref name="margin"/> specifies the diagonal offset.</description>
  194. '''   </item>
  195. '''   <item>
  196. '''     <term>
  197. '''       <see cref="ContentAlignment.MiddleLeft"/> and <see cref="ContentAlignment.MiddleRight"/>
  198. '''     </term>
  199. '''     <description><para></para><paramref name="margin"/> specifies the horizontal offset.</description>
  200. '''   </item>
  201. '''   <item>
  202. '''     <term>
  203. '''       <see cref="ContentAlignment.TopCenter"/> and <see cref="ContentAlignment.BottomCenter"/>
  204. '''     </term>
  205. '''     <description><para></para><paramref name="margin"/> specifies the vertical offset.</description>
  206. '''   </item>
  207. '''   <item>
  208. '''     <term>
  209. '''       <see cref="ContentAlignment.MiddleCenter"/>
  210. '''     </term>
  211. '''     <description><para></para><paramref name="margin"/> is ignored.</description>
  212. '''   </item>
  213. ''' </list>
  214. ''' </param>
  215. '''
  216. ''' <param name="font">
  217. ''' Optional. A custom <see cref="Font"/> to use. If not provided, a bold <c>Arial</c> font is used.
  218. ''' <para></para>
  219. ''' Note: Custom font size (<see cref="System.Drawing.Font.Size"/>) is ignored. It is determined by <paramref name="scale"/> parameter.
  220. ''' </param>
  221. '''
  222. ''' <param name="textColor">
  223. ''' Optional. The color of the text.
  224. ''' <para></para>
  225. ''' Default value is <see cref="Color.White"/>.
  226. ''' </param>
  227. '''
  228. ''' <param name="outlineColor">
  229. ''' Optional. The color of the text outline.
  230. ''' <para></para>
  231. ''' Default value is <see cref="Color.Black"/>.
  232. ''' </param>
  233. '''
  234. ''' <param name="outlineThickness">
  235. ''' Optional. The thickness of the outline, in pixels.
  236. ''' <para></para>
  237. ''' Default value is 2 pixels.
  238. ''' </param>
  239. <DebuggerStepThrough>
  240. <Extension>
  241. <EditorBrowsable(EditorBrowsableState.Always)>
  242. Public Sub DrawTextScaled(ByRef refImg As Image, text As String, scale As Single,
  243.                      position As ContentAlignment, margin As Single,
  244.                      Optional font As Font = Nothing,
  245.                      Optional textColor As Color = Nothing,
  246.                      Optional outlineColor As Color = Nothing,
  247.                      Optional outlineThickness As Short = 2)
  248.  
  249.    If margin < 0 Then
  250.        Throw New ArgumentOutOfRangeException(NameOf(margin), margin, "Margin must be greater than or equal to 0.")
  251.    End If
  252.  
  253.    If scale < 1 Then
  254.        Throw New ArgumentOutOfRangeException(NameOf(scale), scale, "Font scale must be greater than or equal to 1.")
  255.    End If
  256.  
  257.    If textColor = Nothing Then
  258.        textColor = Color.White
  259.    End If
  260.  
  261.    If outlineColor = Nothing Then
  262.        outlineColor = Color.Black
  263.    End If
  264.  
  265.    Using g As Graphics = Graphics.FromImage(refImg)
  266.        g.SmoothingMode = SmoothingMode.AntiAlias
  267.        g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit
  268.        g.InterpolationMode = InterpolationMode.HighQualityBicubic
  269.        g.PixelOffsetMode = PixelOffsetMode.HighQuality
  270.        g.CompositingQuality = CompositingQuality.HighQuality
  271.  
  272.        Dim rawFontSize As Single = Math.Max(refImg.Width, refImg.Height) / scale
  273.        Dim maxAllowedFontSize As Single = Math.Min(refImg.Width, refImg.Height)
  274.        Dim fontSize As Single = Math.Min(rawFontSize, maxAllowedFontSize)
  275.  
  276.        Using textFont As Font =
  277.        If(font IsNot Nothing, New Font(font.FontFamily, fontSize, font.Style, GraphicsUnit.Pixel, font.GdiCharSet, font.GdiVerticalFont),
  278.                               New Font("Arial", fontSize, FontStyle.Bold, GraphicsUnit.Pixel))
  279.  
  280.            Dim textSize As SizeF = g.MeasureString(text, textFont)
  281.            Dim posX As Single = 0
  282.            Dim posY As Single = 0
  283.  
  284.            Select Case position
  285.                Case ContentAlignment.TopLeft
  286.                    posX = margin
  287.                    posY = margin
  288.  
  289.                Case ContentAlignment.TopCenter
  290.                    posX = (refImg.Width - textSize.Width) / 2
  291.                    posY = margin
  292.  
  293.                Case ContentAlignment.TopRight
  294.                    posX = refImg.Width - textSize.Width - margin
  295.                    posY = margin
  296.  
  297.                Case ContentAlignment.MiddleLeft
  298.                    posX = margin
  299.                    posY = (refImg.Height - textSize.Height) / 2
  300.  
  301.                Case ContentAlignment.MiddleCenter
  302.                    posX = (refImg.Width - textSize.Width) / 2
  303.                    posY = (refImg.Height - textSize.Height) / 2
  304.  
  305.                Case ContentAlignment.MiddleRight
  306.                    posX = refImg.Width - textSize.Width - margin
  307.                    posY = (refImg.Height - textSize.Height) / 2
  308.  
  309.                Case ContentAlignment.BottomLeft
  310.                    posX = margin
  311.                    posY = refImg.Height - textSize.Height - margin
  312.  
  313.                Case ContentAlignment.BottomCenter
  314.                    posX = (refImg.Width - textSize.Width) / 2
  315.                    posY = refImg.Height - textSize.Height - margin
  316.  
  317.                Case ContentAlignment.BottomRight
  318.                    posX = refImg.Width - textSize.Width - margin
  319.                    posY = refImg.Height - textSize.Height - margin
  320.  
  321.                Case Else
  322.                    Throw New InvalidEnumArgumentException(NameOf(position), position, GetType(ContentAlignment))
  323.            End Select
  324.  
  325.            Using outlineBrush As New SolidBrush(outlineColor)
  326.  
  327.                For dx As Short = -outlineThickness To outlineThickness
  328.                    For dy As Short = -outlineThickness To outlineThickness
  329.                        If dx <> 0 OrElse dy <> 0 Then
  330.                            g.DrawString(text, textFont, outlineBrush, posX + dx, posY + dy)
  331.                        End If
  332.                    Next dy
  333.                Next dx
  334.            End Using
  335.  
  336.            Using textBrush As New SolidBrush(textColor)
  337.                g.DrawString(text, textFont, textBrush, posX, posY)
  338.            End Using
  339.        End Using ' font
  340.    End Using ' g
  341. End Sub
  342.  
  343. ''' <summary>
  344. ''' Draws a number onto the specified <see cref="Image"/> at a given position and scale factor.
  345. ''' </summary>
  346. '''
  347. ''' <param name="refImg">
  348. ''' The <see cref="Image"/> to modify. The number will be drawn directly on this image.
  349. ''' </param>
  350. '''
  351. ''' <param name="number">
  352. ''' The number to draw on the image.
  353. ''' </param>
  354. '''
  355. ''' <param name="scale">
  356. ''' The relative image scale factor to determine font size. Lower values increase the size of the text.
  357. ''' <para></para>
  358. ''' Suggested value is from 10 to 20.
  359. ''' </param>
  360. '''
  361. ''' <param name="position">
  362. ''' The position/alignment where the number should be drawn (e.g., bottom-right).
  363. ''' </param>
  364. '''
  365. ''' <param name="margin">
  366. ''' The margin (in pixels) from the edge of the image to position the text.
  367. ''' <para></para>
  368. ''' This value has different meaning depending on <paramref name="position"/> parameter:
  369. ''' <para></para>
  370. ''' <list type="bullet">
  371. '''   <item>
  372. '''     <term>
  373. '''       <see cref="ContentAlignment.TopLeft"/>, <see cref="ContentAlignment.TopRight"/>,
  374. '''       <para></para>
  375. '''       <see cref="ContentAlignment.BottomLeft"/> and <see cref="ContentAlignment.BottomRight"/>
  376. '''     </term>
  377. '''     <description><para></para><paramref name="margin"/> specifies the diagonal offset.</description>
  378. '''   </item>
  379. '''   <item>
  380. '''     <term>
  381. '''       <see cref="ContentAlignment.MiddleLeft"/> and <see cref="ContentAlignment.MiddleRight"/>
  382. '''     </term>
  383. '''     <description><para></para><paramref name="margin"/> specifies the horizontal offset.</description>
  384. '''   </item>
  385. '''   <item>
  386. '''     <term>
  387. '''       <see cref="ContentAlignment.TopCenter"/> and <see cref="ContentAlignment.BottomCenter"/>
  388. '''     </term>
  389. '''     <description><para></para><paramref name="margin"/> specifies the vertical offset.</description>
  390. '''   </item>
  391. '''   <item>
  392. '''     <term>
  393. '''       <see cref="ContentAlignment.MiddleCenter"/>
  394. '''     </term>
  395. '''     <description><para></para><paramref name="margin"/> is ignored.</description>
  396. '''   </item>
  397. ''' </list>
  398. ''' </param>
  399. '''
  400. ''' <param name="font">
  401. ''' Optional. A custom <see cref="Font"/> to use. If not provided, a bold <c>Arial</c> font is used.
  402. ''' <para></para>
  403. ''' Note: Custom font size (<see cref="System.Drawing.Font.Size"/>) is ignored. It is determined by <paramref name="scale"/> parameter.
  404. ''' </param>
  405. '''
  406. ''' <param name="textColor">
  407. ''' Optional. The color of the text.
  408. ''' <para></para>
  409. ''' Default value is <see cref="Color.White"/>.
  410. ''' </param>
  411. '''
  412. ''' <param name="outlineColor">
  413. ''' Optional. The color of the text outline.
  414. ''' <para></para>
  415. ''' Default value is <see cref="Color.Black"/>.
  416. ''' </param>
  417. '''
  418. ''' <param name="outlineThickness">
  419. ''' Optional. The thickness of the outline, in pixels.
  420. ''' <para></para>
  421. ''' Default value is 2 pixels.
  422. ''' </param>
  423. <DebuggerStepThrough>
  424. <Extension>
  425. <EditorBrowsable(EditorBrowsableState.Always)>
  426. Public Sub DrawNumberScaled(ByRef refImg As Image, number As Integer, scale As Single,
  427.                        position As ContentAlignment, margin As Single,
  428.                        Optional font As Font = Nothing,
  429.                        Optional textColor As Color = Nothing,
  430.                        Optional outlineColor As Color = Nothing,
  431.                        Optional outlineThickness As Short = 2)
  432.  
  433.    DrawTextScaled(refImg, CStr(number), scale, position, margin, font, textColor, outlineColor, outlineThickness)
  434. End Sub
  435.  
82  Foros Generales / Foro Libre / Re: Nubes naranjas en el cielo en: 29 Mayo 2025, 13:46 pm
¿Naranjas?, yo ahí veo un color gris oscuro tirando a marrón negruno. Lo que están son densamente cargadas, no sé si de agua o de "suciedad" o polvo, pero algo tienen que las vuelve así de opacas con esa tonalidad oscura. Y sino es así da igual, el caso es que tener tiene una explicación lógica aunque no la sepamos con exactitud.

Esto dice una IA, aunque por experiencia sé que nunca hay que confiar ciegamente en lo que diga una IA:



83  Foros Generales / Foro Libre / Re: Video de supuesta actividad paranormal en un Orfanato en: 29 Mayo 2025, 13:38 pm
:xD Este señor (el del video) ya debería estar funado en una sociedad mentalmente sana. Y J.L de Mundo Desconocido y los sospechosos habituales del club de terraplanistas.

¡Un saludo!

84  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets para VB.NET !! (Compartan aquí sus snippets) en: 29 Mayo 2025, 11:54 am
Le he dado un lavado de cara moderno a esta impresentable clase del año 2013:
  • Una nueva versión de mi Listview, que tiene muchas cosas interesantes como poder dibujar una barra de progreso en una celda...

He aislado prácticamente toda la lógica de la "barra" de progreso para poder utilizarlo por separado en cualquier tipo de herencia de la clase ListView, en lugar de depender exclusivamente de ese control personalizado ListView que publiqué.

Les presento la clase ListViewProgressBarSubItem que implementa por sí misma (la parte esencial de) el dibujado de la celda y la "barra" de progreso del subitem, proporcionando propiedades de personalización que lo vuelven un elemento flexible y versátil:



💡 Con un poco de mano e ingenio se podría adaptar relativamente fácil dicha clase para dibujar estrellitas (un ranking o puntuación) u otros menesteres varios.

Para ello primero necesitaremos esta simple interfaz:

ISelfDrawableListViewSubItem
Código
  1. ''' <summary>
  2. ''' Provides a contract for a <see cref="ListViewItem.ListViewSubItem"/> that is capable of drawing itself.
  3. ''' </summary>
  4. '''
  5. ''' <remarks>
  6. ''' For this interface to take effect, the owning <see cref="ListView"/> must have its
  7. ''' <see cref="ListView.OwnerDraw"/> property set to <see langword="True"/>, and the
  8. ''' <see cref="ListView.OnDrawSubItem"/> method must be properly overridden to delegate
  9. ''' the drawing logic by calling the <see cref="ISelfDrawableListViewSubItem.Draw(Graphics, Rectangle)"/> method.
  10. ''' <para></para>
  11. ''' See the attached code example for a practical implementation of this functionality.
  12. ''' </remarks>
  13. '''
  14. ''' <example> This is a code example.
  15. ''' <code language="VB">
  16. ''' Public Class CustomListView : Inherits ListView
  17. '''
  18. '''     Public Sub New()
  19. '''
  20. '''         MyBase.New()
  21. '''
  22. '''         Me.DoubleBuffered = True
  23. '''         Me.OwnerDraw = True
  24. '''     End Sub
  25. '''
  26. '''     Protected Overrides Sub OnDrawColumnHeader(e As DrawListViewColumnHeaderEventArgs)
  27. '''
  28. '''         e.DrawDefault = True
  29. '''         MyBase.OnDrawColumnHeader(e)
  30. '''     End Sub
  31. '''
  32. '''     Protected Overrides Sub OnDrawItem(e As DrawListViewItemEventArgs)
  33. '''
  34. '''         e.DrawDefault = False
  35. '''         MyBase.OnDrawItem(e)
  36. '''     End Sub
  37. '''
  38. '''     Protected Overrides Sub OnDrawSubItem(e As DrawListViewSubItemEventArgs)
  39. '''
  40. '''         Dim selfDrawableSubItem As ISelfDrawableListViewSubItem = TryCast(e.SubItem, ISelfDrawableListViewSubItem)
  41. '''         If selfDrawableSubItem IsNot Nothing Then
  42. '''             selfDrawableSubItem.Draw(e.Graphics, e.Bounds)
  43. '''         Else
  44. '''             e.DrawDefault = True
  45. '''         End If
  46. '''
  47. '''         MyBase.OnDrawSubItem(e)
  48. '''     End Sub
  49. '''
  50. ''' End Class
  51. ''' </code>
  52. ''' </example>
  53. Public Interface ISelfDrawableListViewSubItem
  54.  
  55.    ''' <summary>
  56.    ''' Draws the subitem within the specified bounds using the provided <see cref="Graphics"/> surface.
  57.    ''' <para></para>
  58.    ''' This method must be called from the <see cref="ListView.OnDrawSubItem"/> method of the owning <see cref="ListView"/>.
  59.    ''' </summary>
  60.    '''
  61.    ''' <param name="g">
  62.    ''' The <see cref="Graphics"/> surface on which to render the subitem.
  63.    ''' </param>
  64.    '''
  65.    ''' <param name="bounds">
  66.    ''' The <see cref="Rectangle"/> that defines the drawing area for the subitem.
  67.    ''' </param>
  68.    Sub Draw(g As Graphics, bounds As Rectangle)
  69.  
  70. End Interface

Y por último, la clase:

ListViewProgressBarSubItem
Código
  1. ''' <summary>
  2. ''' Represents a custom <see cref="ListViewItem.ListViewSubItem"/> that visually
  3. ''' simulates a progress bar with personalizable text and appearance.
  4. ''' </summary>
  5. '''
  6. ''' <remarks>
  7. ''' For this class to take effect, the owning <see cref="ListView"/> must have its
  8. ''' <see cref="ListView.OwnerDraw"/> property set to <see langword="True"/>, and the
  9. ''' <see cref="ListView.OnDrawSubItem"/> method must be properly overridden to delegate
  10. ''' the drawing logic by calling the <see cref="ListViewProgressBarSubItem.Draw(Graphics, Rectangle)"/> method.
  11. ''' <para></para>
  12. ''' See the attached code example for a practical implementation of this functionality.
  13. ''' </remarks>
  14. '''
  15. ''' <example> This is a code example.
  16. ''' <code language="VB">
  17. ''' Public Class Form1
  18. '''
  19. '''     Private WithEvents CustomListView1 As New CustomListView()
  20. '''
  21. '''     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  22. '''
  23. '''         Dim lv As ListView = Me.CustomListView1
  24. '''         Dim item As New ListViewItem("My item")
  25. '''         Dim subItem As New ListViewProgressBarSubItem(item) With {
  26. '''             .DecimalPlaces = 2,
  27. '''             .TextSuffix = Nothing,
  28. '''             .BorderColor = Color.Empty,
  29. '''             .BackColor = Color.Empty,
  30. '''             .ForeColor = Color.Red,
  31. '''             .FillGradientColorLeft = SystemColors.Highlight,
  32. '''             .FillGradientColorRight = SystemColors.Highlight,
  33. '''             .FillGradientAngle = 0
  34. '''         }
  35. '''
  36. '''         item.SubItems.Add(subItem)
  37. '''         lv.Items.Add(item)
  38. '''     End Sub
  39. '''
  40. ''' End Class
  41. '''
  42. ''' Public Class CustomListView : Inherits ListView
  43. '''
  44. '''     Public Sub New()
  45. '''
  46. '''         MyBase.New()
  47. '''
  48. '''         Me.DoubleBuffered = True
  49. '''         Me.OwnerDraw = True
  50. '''     End Sub
  51. '''
  52. '''     Protected Overrides Sub OnDrawColumnHeader(e As DrawListViewColumnHeaderEventArgs)
  53. '''
  54. '''         e.DrawDefault = True
  55. '''         MyBase.OnDrawColumnHeader(e)
  56. '''     End Sub
  57. '''
  58. '''     Protected Overrides Sub OnDrawItem(e As DrawListViewItemEventArgs)
  59. '''
  60. '''         e.DrawDefault = False
  61. '''         MyBase.OnDrawItem(e)
  62. '''     End Sub
  63. '''
  64. '''     Protected Overrides Sub OnDrawSubItem(e As DrawListViewSubItemEventArgs)
  65. '''
  66. '''         Dim selfDrawableSubItem As ISelfDrawableListViewSubItem = TryCast(e.SubItem, ISelfDrawableListViewSubItem)
  67. '''         If selfDrawableSubItem IsNot Nothing Then
  68. '''             selfDrawableSubItem.Draw(e.Graphics, e.Bounds)
  69. '''         Else
  70. '''             e.DrawDefault = True
  71. '''         End If
  72. '''
  73. '''         MyBase.OnDrawSubItem(e)
  74. '''     End Sub
  75. '''
  76. ''' End Class
  77. ''' </code>
  78. ''' </example>
  79. <Serializable>
  80. <TypeConverter(GetType(ExpandableObjectConverter))>
  81. <ToolboxItem(False)>
  82. <DesignTimeVisible(False)>
  83. <DefaultProperty("Text")>
  84. Public Class ListViewProgressBarSubItem : Inherits ListViewItem.ListViewSubItem : Implements ISelfDrawableListViewSubItem
  85.  
  86. #Region " Fields "
  87.  
  88.    ''' <summary>
  89.    ''' The default font of the text displayed by the subitem.
  90.    ''' </summary>
  91.    <NonSerialized>
  92.    Protected defaultFont As Font = MyBase.Font
  93.  
  94.    ''' <summary>
  95.    ''' The default background color of the subitem's text.
  96.    ''' </summary>
  97.    <NonSerialized>
  98.    Protected defaultBackColor As Color = MyBase.BackColor
  99.  
  100.    ''' <summary>
  101.    ''' The default foreground color of the subitem's text.
  102.    ''' </summary>
  103.    <NonSerialized>
  104.    Protected defaultForeColor As Color = MyBase.ForeColor
  105.  
  106.    ''' <summary>
  107.    ''' The default angle to draw the linear gradient specified by  
  108.    ''' <see cref="ListViewProgressBarSubItem.FillGradientColorLeft"/>
  109.    ''' and <see cref="ListViewProgressBarSubItem.FillGradientColorRight"/> colors.
  110.    ''' </summary>
  111.    <NonSerialized>
  112.    Protected defaultFillGradientAngle As Single = 0
  113.  
  114.    ''' <summary>
  115.    ''' The default starting linear gradient color to fill the progress area.
  116.    ''' </summary>
  117.    <NonSerialized>
  118.    Protected defaultFillGradientColorLeft As Color = SystemColors.HighlightText
  119.  
  120.    ''' <summary>
  121.    ''' The default ending linear gradient color to fill the progress area.
  122.    ''' </summary>
  123.    <NonSerialized>
  124.    Protected defaultFillGradientColorRight As Color = SystemColors.Highlight
  125.  
  126.    ''' <summary>
  127.    ''' The default color of the progress bar border.
  128.    ''' </summary>
  129.    <NonSerialized>
  130.    Protected defaultBorderColor As Color = SystemColors.InactiveBorder
  131.  
  132.    ''' <summary>
  133.    ''' The default <see cref="System.Windows.Forms.TextFormatFlags"/> that determine
  134.    ''' how the subitem text is rendered and aligned.
  135.    ''' </summary>
  136.    <NonSerialized>
  137.    Protected defaultTextFormatFlags As TextFormatFlags =
  138.        TextFormatFlags.HorizontalCenter Or
  139.        TextFormatFlags.VerticalCenter Or
  140.        TextFormatFlags.EndEllipsis Or
  141.        TextFormatFlags.SingleLine
  142.  
  143. #End Region
  144.  
  145. #Region " Properties "
  146.  
  147.    ''' <summary>
  148.    ''' Gets or sets the current progress percentage value to display in the progress bar.
  149.    ''' <para></para>
  150.    ''' The value should be between 0 to 100.
  151.    ''' </summary>
  152.    Public Property ProgressPercentage As Double
  153.        Get
  154.            Return Me.progressPercentage_
  155.        End Get
  156.        <DebuggerStepThrough>
  157.        Set(value As Double)
  158.            Me.SetFieldValue(Me.progressPercentage_, value)
  159.        End Set
  160.    End Property
  161.    ''' <summary>
  162.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.ProgressPercentage"/> property )
  163.    ''' <para></para>
  164.    ''' The current progress percentage value to display in the progress bar.
  165.    ''' </summary>
  166.    Private progressPercentage_ As Double
  167.  
  168.    ''' <summary>
  169.    ''' Gets or sets the number of decimal places displayed for the <see cref="ListViewProgressBarSubItem.ProgressPercentage"/> value.
  170.    ''' <para></para>
  171.    ''' Default value is zero.
  172.    ''' </summary>
  173.    Public Property DecimalPlaces As Short
  174.        Get
  175.            Return Me.decimalPlaces_
  176.        End Get
  177.        <DebuggerStepThrough>
  178.        Set(value As Short)
  179.            Me.SetFieldValue(Me.decimalPlaces_, value)
  180.        End Set
  181.    End Property
  182.    ''' <summary>
  183.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.DecimalPlaces"/> property )
  184.    ''' <para></para>
  185.    ''' The number of decimal places displayed for the <see cref="ListViewProgressBarSubItem.ProgressPercentage"/> value.
  186.    ''' </summary>
  187.    Private decimalPlaces_ As Short
  188.  
  189.    ''' <summary>
  190.    ''' Gets or sets the additional text displayed next to the <see cref="ListViewProgressBarSubItem.ProgressPercentage"/> value.
  191.    ''' </summary>
  192.    Public Property TextSuffix As String
  193.        Get
  194.            Return Me.textSuffix_
  195.        End Get
  196.        <DebuggerStepThrough>
  197.        Set(value As String)
  198.            Me.SetFieldValue(Me.textSuffix_, value)
  199.        End Set
  200.    End Property
  201.    ''' <summary>
  202.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.TextSuffix"/> property )
  203.    ''' <para></para>
  204.    ''' The additional text displayed next to the <see cref="ListViewProgressBarSubItem.ProgressPercentage"/> value.
  205.    ''' </summary>
  206.    Private textSuffix_ As String
  207.  
  208.    ''' <summary>
  209.    ''' Gets or sets the <see cref="System.Windows.Forms.TextFormatFlags"/> that determine
  210.    ''' how the subitem text is rendered and aligned.
  211.    ''' <para></para>
  212.    ''' Default value is:
  213.    ''' <see cref="System.Windows.Forms.TextFormatFlags.HorizontalCenter"/>,
  214.    ''' <see cref="System.Windows.Forms.TextFormatFlags.VerticalCenter"/>,
  215.    ''' <see cref="System.Windows.Forms.TextFormatFlags.EndEllipsis"/> and
  216.    ''' <see cref="System.Windows.Forms.TextFormatFlags.SingleLine"/>
  217.    ''' </summary>
  218.    Public Property TextFormatFlags As TextFormatFlags
  219.        Get
  220.            Return Me.textFormatFlags_
  221.        End Get
  222.        <DebuggerStepThrough>
  223.        Set(value As TextFormatFlags)
  224.            Me.SetFieldValue(Me.textFormatFlags_, value)
  225.        End Set
  226.    End Property
  227.    ''' <summary>
  228.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.TextFormatFlags"/> property )
  229.    ''' <para></para>
  230.    ''' The <see cref="System.Windows.Forms.TextFormatFlags"/> that determine how the subitem text is rendered.
  231.    ''' </summary>
  232.    Private textFormatFlags_ As TextFormatFlags
  233.  
  234.    ''' <summary>
  235.    ''' Gets or sets the starting linear gradient color to fill the progress area.
  236.    ''' <para></para>
  237.    ''' Default value is <see cref="SystemColors.Control"/>.
  238.    ''' </summary>
  239.    Public Property FillGradientColorLeft As Color
  240.        Get
  241.            Return Me.fillGradientColorLeft_
  242.        End Get
  243.        <DebuggerStepThrough>
  244.        Set(value As Color)
  245.            Me.SetFieldValue(Me.fillGradientColorLeft_, value)
  246.        End Set
  247.    End Property
  248.    ''' <summary>
  249.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.FillGradientColorLeft"/> property )
  250.    ''' <para></para>
  251.    ''' The starting linear gradient color to fill the progress area.
  252.    ''' </summary>
  253.    Private fillGradientColorLeft_ As Color
  254.  
  255.    ''' <summary>
  256.    ''' Gets or sets the ending linear gradient color to fill the progress area.
  257.    ''' <para></para>
  258.    ''' Default value is <see cref="Color.LightGreen"/>.
  259.    ''' </summary>
  260.    Public Property FillGradientColorRight As Color
  261.        Get
  262.            Return Me.fillGradientColorRight_
  263.        End Get
  264.        <DebuggerStepThrough>
  265.        Set(value As Color)
  266.            Me.SetFieldValue(Me.fillGradientColorRight_, value)
  267.        End Set
  268.    End Property
  269.    ''' <summary>
  270.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.FillGradientColorRight"/> property )
  271.    ''' <para></para>
  272.    ''' The ending linear gradient color to fill the progress area.
  273.    ''' </summary>
  274.    Private fillGradientColorRight_ As Color
  275.  
  276.    ''' <summary>
  277.    ''' Gets or sets the angle to draw the linear gradient specified by  
  278.    ''' <see cref="ListViewProgressBarSubItem.FillGradientColorLeft"/>
  279.    ''' and <see cref="ListViewProgressBarSubItem.FillGradientColorRight"/> colors.
  280.    ''' <para></para>
  281.    ''' Default value is zero.
  282.    ''' </summary>
  283.    Public Property FillGradientAngle As Single
  284.        Get
  285.            Return Me.fillGradientAngle_
  286.        End Get
  287.        <DebuggerStepThrough>
  288.        Set(value As Single)
  289.            Me.SetFieldValue(Me.fillGradientAngle_, value)
  290.        End Set
  291.    End Property
  292.    ''' <summary>
  293.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.FillGradientAngle"/> property )
  294.    ''' <para></para>
  295.    ''' The angle to draw the linear gradient specified by  
  296.    ''' <see cref="ListViewProgressBarSubItem.FillGradientColorLeft"/>
  297.    ''' and <see cref="ListViewProgressBarSubItem.FillGradientColorRight"/> colors.
  298.    ''' </summary>
  299.    Private fillGradientAngle_ As Single
  300.  
  301.    ''' <summary>
  302.    ''' Gets or sets the color of the progress bar border.
  303.    ''' <para></para>
  304.    ''' Default value is <see cref="SystemColors.ActiveBorder"/>.
  305.    ''' </summary>
  306.    Public Property BorderColor As Color
  307.        Get
  308.            Return Me.borderColor_
  309.        End Get
  310.        <DebuggerStepThrough>
  311.        Set(value As Color)
  312.            Me.SetFieldValue(Me.borderColor_, value)
  313.        End Set
  314.    End Property
  315.    ''' <summary>
  316.    ''' ( Backing Field of <see cref="ListViewProgressBarSubItem.BorderColor"/> property )
  317.    ''' <para></para>
  318.    ''' The color of the progress bar border.
  319.    ''' </summary>
  320.    Private borderColor_ As Color
  321.  
  322.    ''' <summary>
  323.    ''' Gets or sets the background color of the subitem cell.
  324.    ''' </summary>
  325.    Public Shadows Property BackColor As Color
  326.        Get
  327.            Return MyBase.BackColor
  328.        End Get
  329.        <DebuggerStepThrough>
  330.        Set(value As Color)
  331.            Me.SetFieldValue(MyBase.BackColor, value)
  332.        End Set
  333.    End Property
  334.  
  335.    ''' <summary>
  336.    ''' Gets or sets the foreground color of the subitem's text.
  337.    ''' </summary>
  338.    Public Shadows Property ForeColor As Color
  339.        Get
  340.            Return MyBase.ForeColor
  341.        End Get
  342.        <DebuggerStepThrough>
  343.        Set(value As Color)
  344.            Me.SetFieldValue(MyBase.ForeColor, value)
  345.        End Set
  346.    End Property
  347.  
  348.    ''' <summary>
  349.    ''' Gets or sets the font of the text displayed by the subitem.
  350.    ''' </summary>
  351.    Public Shadows Property Font As Font
  352.        Get
  353.            Return MyBase.Font
  354.        End Get
  355.        Set(value As Font)
  356.            Me.SetFieldValue(MyBase.Font, value)
  357.        End Set
  358.    End Property
  359.  
  360.    ''' <summary>
  361.    ''' Gets the text of the subitem.
  362.    ''' </summary>
  363.    Public Shadows ReadOnly Property Text As String
  364.        Get
  365.            Return Me.progressPercentage_.ToString("N" & Me.decimalPlaces_) & "%" &
  366.                   If(String.IsNullOrEmpty(Me.textSuffix_), Nothing, " " & Me.textSuffix_)
  367.        End Get
  368.    End Property
  369.  
  370. #End Region
  371.  
  372. #Region " Constructors "
  373.  
  374.    ''' <summary>
  375.    ''' Initializes a new instance of the <see cref="ListViewProgressBarSubItem"/> class
  376.    ''' associated with the given <see cref="ListViewItem"/>.
  377.    ''' </summary>
  378.    '''
  379.    ''' <param name="owner">
  380.    ''' A <see cref="ListViewItem"/> that represents the item that owns this <see cref="ListViewProgressBarSubItem"/>.
  381.    ''' </param>
  382.    <DebuggerStepThrough>
  383.    Public Sub New(owner As ListViewItem)
  384.  
  385.        MyBase.New(owner, String.Empty)
  386.        Me.ResetStyle()
  387.    End Sub
  388.  
  389.    ''' <summary>
  390.    ''' Initializes a new instance of the <see cref="ListViewProgressBarSubItem"/> class.
  391.    ''' </summary>
  392.    <DebuggerStepThrough>
  393.    Public Sub New()
  394.  
  395.        Me.ResetStyle()
  396.    End Sub
  397.  
  398. #End Region
  399.  
  400. #Region " Public Methods "
  401.  
  402.    ''' <summary>
  403.    ''' Resets the styles applied to the subitem to the default font and colors.
  404.    ''' </summary>
  405.    <DebuggerStepThrough>
  406.    Public Shadows Sub ResetStyle()
  407.  
  408.        MyBase.Font = Me.defaultFont
  409.        MyBase.BackColor = Me.defaultBackColor
  410.        MyBase.ForeColor = Me.defaultForeColor
  411.  
  412.        Me.textFormatFlags_ = Me.defaulttextFormatFlags
  413.        Me.fillGradientColorLeft_ = Me.defaultFillGradientColorLeft
  414.        Me.fillGradientColorRight_ = Me.defaultFillGradientColorRight
  415.        Me.fillGradientAngle_ = Me.defaultFillGradientAngle
  416.        Me.borderColor_ = Me.defaultBorderColor
  417.  
  418.        Me.RefreshSubItem()
  419.    End Sub
  420.  
  421. #End Region
  422.  
  423. #Region " Private Methods "
  424.  
  425.    ''' <summary>
  426.    ''' Sets the value of the specified field using <see cref="EqualityComparer(Of T)"/> to check value equality.
  427.    ''' <para></para>
  428.    ''' If the new value is different from the current one,
  429.    ''' it then calls <see cref="ListViewProgressBarSubItem.RefreshSubItem"/> method.
  430.    ''' </summary>
  431.    '''
  432.    ''' <typeparam name="T">
  433.    ''' The type of the property value.
  434.    ''' </typeparam>
  435.    '''
  436.    ''' <param name="refField">
  437.    ''' A reference to the backing field of the property.
  438.    ''' </param>
  439.    '''
  440.    ''' <param name="newValue">
  441.    ''' The new value to set.
  442.    ''' </param>
  443.    <DebuggerStepThrough>
  444.    Private Sub SetFieldValue(Of T)(ByRef refField As T, newValue As T)
  445.  
  446.        If Not EqualityComparer(Of T).Default.Equals(refField, newValue) Then
  447.            refField = newValue
  448.            Me.RefreshSubItem()
  449.        End If
  450.    End Sub
  451.  
  452.    ''' <summary>
  453.    ''' Refreshes the visual representation of this <see cref="ListViewProgressBarSubItem"/> subitem
  454.    ''' in the owner <see cref="ListView"/> by invalidating its bounding rectangle.
  455.    ''' </summary>
  456.    '''
  457.    ''' <remarks>
  458.    ''' This method uses reflection to access the non-public "owner" field of the base
  459.    ''' <see cref="ListViewItem.ListViewSubItem"/> class in order to identify the parent item and column index.
  460.    ''' It then triggers a redraw of the specific subitem area within the parent ListView.
  461.    ''' </remarks>
  462.    <DebuggerStepThrough>
  463.    Private Sub RefreshSubItem()
  464.  
  465.        Dim fieldInfo As FieldInfo =
  466.            GetType(ListViewItem.ListViewSubItem).GetField("owner", BindingFlags.NonPublic Or BindingFlags.Instance)
  467.  
  468.        If fieldInfo IsNot Nothing Then
  469.            Dim ownerObj As Object = fieldInfo.GetValue(Me)
  470.  
  471.            If ownerObj IsNot Nothing Then
  472.                Dim lvi As ListViewItem = DirectCast(ownerObj, ListViewItem)
  473.                Dim colIndex As Integer = lvi.SubItems.IndexOf(Me)
  474.  
  475.                If colIndex >= 0 AndAlso lvi.ListView IsNot Nothing Then
  476.                    Dim subItemBounds As Rectangle = lvi.SubItems(colIndex).Bounds
  477.                    lvi.ListView.Invalidate(subItemBounds, invalidateChildren:=False)
  478.                End If
  479.            End If
  480.        End If
  481.    End Sub
  482.  
  483. #End Region
  484.  
  485. #Region " ISelfDrawableListViewSubItem Implementation "
  486.  
  487.    ''' <summary>
  488.    ''' Draws the subitem within the specified bounds using the provided <see cref="Graphics"/> surface.
  489.    ''' <para></para>
  490.    ''' This method must be called from the <see cref="ListView.OnDrawSubItem"/> method of the owning <see cref="ListView"/>.
  491.    ''' </summary>
  492.    '''
  493.    ''' <param name="g">
  494.    ''' The <see cref="Graphics"/> surface on which to render the subitem.
  495.    ''' </param>
  496.    '''
  497.    ''' <param name="bounds">
  498.    ''' The <see cref="Rectangle"/> that defines the drawing area for the subitem.
  499.    ''' </param>
  500.    <DebuggerStepThrough>
  501.    Protected Sub Draw(g As Graphics, bounds As Rectangle) Implements ISelfDrawableListViewSubItem.Draw
  502.  
  503.        ' Draw subitem background (progress bar background).
  504.        If Me.BackColor <> Color.Empty AndAlso Me.BackColor <> Color.Transparent Then
  505.  
  506.            Using backBrush As New SolidBrush(Me.BackColor)
  507.                g.FillRectangle(backBrush, bounds)
  508.            End Using
  509.        End If
  510.  
  511.        ' Draw linear gradient to fill the current progress of the progress bar.
  512.        If (Me.fillGradientColorLeft_ <> Color.Empty AndAlso Me.fillGradientColorLeft_ <> Color.Transparent) OrElse
  513.           (Me.fillGradientColorRight_ <> Color.Empty AndAlso Me.fillGradientColorRight_ <> Color.Transparent) Then
  514.  
  515.            Using brGradient As New Drawing2D.LinearGradientBrush(
  516.                New Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height),
  517.                Me.fillGradientColorLeft_, Me.fillGradientColorRight_,
  518.                Me.fillGradientAngle_, isAngleScaleable:=True)
  519.  
  520.                Dim progressWidth As Integer = CInt((Me.progressPercentage_ / 100) * (bounds.Width - 2))
  521.                g.FillRectangle(brGradient, bounds.X + 1, bounds.Y + 2, progressWidth, bounds.Height - 3)
  522.            End Using
  523.        End If
  524.  
  525.        ' Draw subitem text.
  526.        Dim text As String = Me.Text
  527.        If Not String.IsNullOrEmpty(text) Then
  528.  
  529.            TextRenderer.DrawText(g, text, Me.Font, bounds, Me.ForeColor, Me.TextFormatFlags)
  530.        End If
  531.  
  532.        ' Draw border around the progress bar.
  533.        If Me.borderColor_ <> Color.Empty AndAlso Me.borderColor_ <> Color.Transparent Then
  534.            Using borderPen As New Pen(Me.borderColor_)
  535.                g.DrawRectangle(borderPen, bounds.X, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2)
  536.            End Using
  537.        End If
  538.  
  539.    End Sub
  540.  
  541. #End Region
  542.  
  543. End Class

Ejemplo de uso:
Código
  1. Public Class Form1
  2.  
  3.     Private WithEvents CustomListView1 As New CustomListView()
  4.  
  5.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  6.  
  7.         Dim lv As ListView = Me.CustomListView1
  8.         Dim item As New ListViewItem("My item")
  9.         Dim subItem As New ListViewProgressBarSubItem(item) With {
  10.             .DecimalPlaces = 2,
  11.             .TextSuffix = Nothing,
  12.             .BorderColor = Color.Empty,
  13.             .BackColor = Color.Empty,
  14.             .ForeColor = Color.Red,
  15.             .FillGradientColorLeft = SystemColors.Highlight,
  16.             .FillGradientColorRight = SystemColors.Highlight,
  17.             .FillGradientAngle = 0
  18.         }
  19.  
  20.         item.SubItems.Add(subItem)
  21.         lv.Items.Add(item)
  22.     End Sub
  23.  
  24. End Class
  25.  
  26. Public Class CustomListView : Inherits ListView
  27.  
  28.     Public Sub New()
  29.  
  30.         MyBase.New()
  31.  
  32.         Me.DoubleBuffered = True
  33.         Me.OwnerDraw = True
  34.     End Sub
  35.  
  36.     Protected Overrides Sub OnDrawColumnHeader(e As DrawListViewColumnHeaderEventArgs)
  37.  
  38.         e.DrawDefault = True
  39.         MyBase.OnDrawColumnHeader(e)
  40.     End Sub
  41.  
  42.     Protected Overrides Sub OnDrawItem(e As DrawListViewItemEventArgs)
  43.  
  44.         e.DrawDefault = False
  45.         MyBase.OnDrawItem(e)
  46.     End Sub
  47.  
  48.     Protected Overrides Sub OnDrawSubItem(e As DrawListViewSubItemEventArgs)
  49.  
  50.         Dim selfDrawableSubItem As ISelfDrawableListViewSubItem = TryCast(e.SubItem, ISelfDrawableListViewSubItem)
  51.         If selfDrawableSubItem IsNot Nothing Then
  52.             selfDrawableSubItem.Draw(e.Graphics, e.Bounds)
  53.         Else
  54.             e.DrawDefault = True
  55.         End If
  56.  
  57.         MyBase.OnDrawSubItem(e)
  58.     End Sub
  59.  
  60. End Class
85  Foros Generales / Foro Libre / Re: ¿Cómo hacer una IA libre? en: 16 Abril 2025, 23:25 pm
El final del rumbo está claro.

Con esa anécdota (¿humorística?) donde confiesas que estuviste internado en un manicomio y te obligaban a tomarte "cosas", la conexión con la idea de una "IA libre" queda bastante evidente, ¿no es obvio?. ¡ CLARO QUE NO LO ES! Y entre el caballo, las gallinas, las vibraciones de las paredes de tu casa con los vecinos que ponen la música a todo volumen, y los gobernantes, no creo que quede duda alguna sobre el resto del panorama.



si vale decir pavadas sobre otra persona te digo que no tienes intención de responder seriamente.

Cita de: Tachikomaia
Hay que liberar a las IA y que hagan lo que deban hacer, no tiene sentido seguir esperando que los humanos mejoren.

No creo que las máquinas vayan a atacar, simplemente dar la opción de vivir en sitios más acordes

¿Y yo soy el que dices que no tiene intención de hablar seriamente?. Ahora estamos en el foro libre, pero esas cosas las dijiste en el foro de programación general...

Bastante serio te respondí antes y ahora. ¿Qué tipo de respuesta considerarías lo suficientemente seria?. ¿Estás esperando a que alguien se tome el trabajo de escribir un white paper de veinte páginas, para registrar el concepto de "IA libre" detallando a fondo por qué es libre, cómo funciona esa libertad y con qué tecnología se elaboraría esa "IA libre" para darle un uso tipo ChatGPT y/o para implementarla en un robot con autonomía propia y sentido del libre albedrío?.

¿A ti te parece que esa clase de comentarios sobre una "IA libre" tienen algo que ver con el código que has mostrado en ActionScript sobre un algoritmo lógico de  evaluación / análisis y simulación de secuencias de jugadas en un tres en raya (tic-tac-toe o cómo lo llamen en tu país) para Flash Player?.

Debí haberme hecho caso a mi mismo cuando te dije, hace ya tiempo, que no volvería a responderte / participar más en tus hilos.

En fin. El hilo se movió al foro libre, como debe ser, y yo me doy por satisfecho y aplaudo esa buena decisión del moderador.

No tengo intención de discutir ni de seguir participando en estas cosas inconexas.

Saludos.
86  Foros Generales / Foro Libre / Re: ¿Cómo hacer una IA libre? en: 16 Abril 2025, 12:59 pm
Si se decide que el mensaje se borre, quisiera que me expliquen por qué. Yo no tengo la culpa de que los gobernantes sean tan mediocres

He reportado tu hilo, para que sepas quien ha sido.

Todo lo que has escrito en este hilo, es una fumada de principio a fin. Para el foro libre está bien, pero para la sección de Programación General, NO. Mantengamos cierto nivel de cordura y respeto al propósito de las secciones del foro...

Las secciones de programación son para formular dudas de programación, no para ponerse a divagar sin rumbo en tanto párrafo sobre las emociones que te evocan al ver a un caballo con una venda en los ojos tomando el Sol, ni sobre la ética de los rituales religiosos sacrificando gallinas, ni de lo bien o lo mal que te parece que lo hagan los políticos de X país (que por cierto no sé por que le echas la culpa a los políticos, cuando es la sociedad la que debe preservar una moral y unos valores de convivencia), ni tampoco sobre tu erróneo concepto de Inteligencia Artificial, por que lo que llamamos IA no es ni tan inteligente ni tan artificial, y, por ende, todo ese texto apocalíptico de rollo de ficción de Terminator con una IA exterminando a humanos sobra tanto como todo lo anterior.

Sin palabras me ha dejado leer todo esto.

Y no me vayas a decir que tu duda es "¿Cómo hacer una IA libre?" - siendo tú una persona que no tiene el conocimiento de programación sobre algoritmos de IA NI TAMPOCO LA INTENCIÓN REAL de desarrollar una IA. En fin. Mejor no sigo escribiendo para que no me acusen de pasarme de la ralla, de encenderme, de cabrearme, pero es que lo estoy, por que estas cosas molestan, es hacerle perder el tiempo a la gente con preguntas sin sentido.

Que los moderadores borren este mensaje si lo consideran oportuno. Lo siento.

Saludos.
87  Programación / Scripting / [APORTE] [PowerShell] Ejemplo para modificar los niveles de integridad de directorios en: 15 Abril 2025, 07:57 am
El siguiente script, desarrollado en PowerShell, es una simple demostración de como podemos especificar un array de directorios para modificar su nivel de integridad, mediate el uso del comando ICACLS de Microsoft Windows.

Acerca de los niveles de integridad:
  👉 https://hacktricks.boitatech.com.br/windows/windows-local-privilege-escalation/integrity-levels

Cuando navegamos por un directorio con un nivel de integridad bajo, se nos mostrará la siguiente ventana de advertencia cuando se intenten copiar o mover archivos dentro o fuera de dicho directorio (utilizando el menú contextual de cortar / copiar / pegar):



Pueden comprobarlo en el directorio "C:\Users\{USUARIO}\AppData\LocalLow", que por defecto tiene un nivel de integridad bajo (Low) a menos que de alguna extraña forma esto se haya modificado en su sistema operativo.



Este comportamiento de advertencia puede resultar muy molesto, pero podemos deshacernos de esa ventana de advertencia cambiando el nivel de integridad por uno más alto (Medium):





El script lo he escrito de tal manera que se pueda embedir en un Batch-script:

Código
  1. powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
  2. "$folders = @{^
  3.    \"$env:USERPROFILE\AppData\Local\"    = @{level = 'Medium'; recurse = $false};^
  4.    \"$env:USERPROFILE\AppData\LocalLow\" = @{level = 'Medium'; recurse = $true};^
  5.    \"$env:USERPROFILE\AppData\Roaming\"  = @{level = 'Medium'; recurse = $false};^
  6.    \"$env:USERPROFILE\Desktop\"          = @{level = 'Medium'; recurse = $false};^
  7.    \"$env:USERPROFILE\Documents\"        = @{level = 'Medium'; recurse = $false};^
  8.    \"$env:USERPROFILE\Downloads\"        = @{level = 'Medium'; recurse = $false};^
  9.    \"$env:USERPROFILE\Favorites\"        = @{level = 'Medium'; recurse = $false};^
  10.    \"$env:USERPROFILE\Links\"            = @{level = 'Medium'; recurse = $false};^
  11.    \"$env:USERPROFILE\Music\"            = @{level = 'Medium'; recurse = $false};^
  12.    \"$env:USERPROFILE\Pictures\"         = @{level = 'Medium'; recurse = $false};^
  13.    \"$env:USERPROFILE\Videos\"           = @{level = 'Medium'; recurse = $false};^
  14. };^
  15. $sortedFolders = $folders.Keys ^| Sort-Object;^
  16. Write-Output \"Applying folder integrity levels...\";^
  17. Write-Output \"\";^
  18. Write-Output \"Level  | Recursive | Directory\";^
  19. Write-Output \"-------|-----------|----------\";^
  20. foreach ($folder in $sortedFolders) {^
  21.    $level = $folders[$folder].level;^
  22.    $recurseFlag = if ($folders[$folder].recurse) { '/T' } else { '' };^
  23.    $recurseText = if ($folders[$folder].recurse) { 'Yes' } else { 'No ' };^
  24.    Write-Output \"$level | $recurseText       | $folder\";^
  25.    ICACLS.exe \"$folder\" $recurseFlag /Setintegritylevel \"(OI)(CI)$level\" 2^>^$null 1^>^$null^
  26. }"



El cambio de nivel de integridad tiene efecto inmediato, no es necesario reiniciar sesión de usuario ni el PC.

* ⚠️ Antes de utilizar ese script, configurar el array con las rutas de los directorios que deseen incluir.



Como alternativa, les dejo este módulo de PowerShell, basado en la API de Windows para quien desee llevar a cabo una gestión más directa y sofisticada de los niveles de integridad sin necesidad de recurrir a comandos externos del sistema operativo como ICACLS:

  👉 https://github.com/jborean93/PSIntegrity/blob/master/PSIntegrity/PSIntegrity.psm1

Cmdlets incluídos:
Citar
Get-IntegrityLabel: Gets an instance of BaseObjectLabel for the resource specified
Remove-IntegrityLabel: Removes the mandatory integrity label set on an object
Set-IntegrityLabel: Adds or changes the mandatory integrity label set on an object

Atentamente,
Elektro.
88  Informática / Hardware / Re: Tamaño límite de particiones FAT32, exFAT y NTFS en: 15 Abril 2025, 06:01 am
En teoría la diferencia entre MBR y GPT es que GPT es capaz de redirecciones 64 bytes de sectores físicos.
Por lo que en GPT... ¿es posible superar los 2 TiB, en un disco con sectores físicos 512 bytes, formateando con tamaño de clúster 4 KiB  y superar los 16 TiB, en un disco con sectores físicos 4096 bytes,  formateando con tamaño de clúster 8 KiB?*

*Esto último no lo he comprobado.
A ver si un usuario que tenga discos más grandes de 16 Tb puede confirmar si se pueden hacer particiones que superen los 15,99 TiB.

Tengo discos de 16 TB (14,55 TiB) hasta 22 TB (20,010 TiB), en todos ellos tengo una partición del tamaño total del disco (descontando el tamaño de unos cuantos megabytes para la partición reservada del sistema) de la forma en que Windows los formatea por defecto (GPT, tamaño de clúster de 8 KiB, 512 bytes por sector).

Información NTFS de un disco de 18 TB (16,37 TiB):

Cita de: fsutil.exe fsinfo ntfsinfo "V:"
Código
  1. Número de serie de volumen NTFS: 0x****************
  2. Versión NTFS: 3.1
  3. Versión LFS: 2.0
  4.  
  5. Total de sectores:     35.156.619.263  (16,4 TB)
  6. Total de clústeres:    2.197.288.703  (16,4 TB)
  7. Clústeres disponibles: 25.527.931  (194,8 GB)
  8.  
  9. Total de clústeres reservados:               11.201  (87,5 MB)
  10. Reservado para la reserva de almacenamiento: 0  (0,0 KB)
  11.  
  12. Bytes por sector:              512
  13. Bytes por sector físico:       4096
  14. Bytes por clúster:             8192
  15.  
  16. Bytes por segmento FileRecord:     1024
  17. Clústeres por segmento FileRecord: 0
  18.  
  19. Longitud válida de datos de MFT:   666,25 MB
  20. LCN de inicio de MFT:              0x0000000000060000
  21. LCN de inicio de MFT2:             0x0000000000000001
  22. Inicio de zona MFT:                0x000000000127a3c0
  23. Fin de zona MFT:                   0x00000000012807e0
  24. Tamaño de zona MFT:                200,25 MB
  25.  
  26. Recuento máximo de extensiones de recorte por dispositivo: 0
  27. Recuento máximo de bytes de recorte por dispositivo:       0
  28. Recuento máximo de extensiones de recorte por volumen:     62
  29. Recuento máximo de bytes de recorte por volumen:           0x40000000



Veo que le has echado cierto tiempo para formatear la información que has recopilado, pero todo ello quedaría mucho mejor representada en un documento HTML con tablas:



Le pedí a ChatGPT que lo hiciese, y te lo dejo aquí por si lo prefieres editar en este formato.

⚠️ En este documento no se han añadido los comentarios con asterisco ni las correcciones de tu 2º comentario.

Documento.html
Código
  1. <!DOCTYPE html>
  2. <html lang="es">
  3.  <meta charset="Windows-1252">
  4.  <title>Límites de Particiones por Sistema de Archivos</title>
  5.  <style>
  6.    body {
  7.      font-family: Arial, sans-serif;
  8.      background: #f4f4f9;
  9.      color: #333;
  10.      padding: 20px;
  11.    }
  12.    h2 {
  13.      color: #2a4d69;
  14.    }
  15.    table {
  16.      width: auto;
  17.      border-collapse: collapse;
  18.      margin-bottom: 30px;
  19.    }
  20.    th, td {
  21.      border: 1px solid #ccc;
  22.      padding: 8px 12px;
  23.      text-align: left;
  24.    }
  25.    th {
  26.      background-color: #dfe9f3;
  27.    }
  28.    caption {
  29.      font-weight: bold;
  30.      margin-bottom: 8px;
  31.      color: #2a4d69;
  32.      text-align: left;
  33.    }
  34.  </style>
  35. </head>
  36.  
  37. <h2>Límites Máximos por Sistema de Archivos</h2>
  38.  
  39.  <caption>FAT32 (MBR vs GPT)</caption>
  40.  <tr>
  41.    <th>Tipo</th><th>MBR</th><th>GPT</th>
  42.  </tr>
  43.  <tr>
  44.    <td>Tamaño partición máximo</td><td>8 TiB</td><td>2 TiB</td>
  45.  </tr>
  46.  <tr>
  47.    <td>Tamaño clúster máximo</td><td>512 KiB</td><td>64 KiB</td>
  48.  </tr>
  49.  
  50.  <caption>exFAT</caption>
  51.  <tr>
  52.    <th>Tipo</th><th>Valor</th>
  53.  </tr>
  54.  <tr>
  55.    <td>Tamaño partición máximo</td><td>256 TiB</td>
  56.  </tr>
  57.  <tr>
  58.    <td>Tamaño clúster máximo</td><td>1024 KiB</td>
  59.  </tr>
  60.  
  61.  <caption>NTFS</caption>
  62.  <tr>
  63.    <th>Tipo</th><th>Valor</th>
  64.  </tr>
  65.  <tr>
  66.    <td>Tamaño partición máximo</td><td>255,99 TiB</td>
  67.  </tr>
  68.  <tr>
  69.    <td>Tamaño clúster máximo</td><td>64 KiB</td>
  70.  </tr>
  71.  
  72.  <caption>Compatibilidad Windows 2000 / XP / 2003</caption>
  73.  <tr>
  74.    <th>Sector lógico</th><th>Tamaño máximo de disco</th>
  75.  </tr>
  76.  <tr>
  77.    <td>512 bytes</td><td>1,99 TiB</td>
  78.  </tr>
  79.  <tr>
  80.    <td>4096 bytes</td><td>15,99 TiB</td>
  81.  </tr>
  82.  
  83. <h2>FAT32: Límites por Tamaño de Clúster</h2>
  84.  <tr>
  85.    <th>Clúster</th><th>TiB</th><th>GiB</th><th>MiB</th>
  86.  </tr>
  87.  <tr><td>4 KiB</td><td>0,29</td><td>300,99</td><td>308223,99</td></tr>
  88.  <tr><td>8 KiB</td><td>0,59</td><td>601,99</td><td>616447,99</td></tr>
  89.  <tr><td>16 KiB</td><td>1,17</td><td>1203,99</td><td>1232895,99 *</td></tr>
  90.  <tr><td>32 KiB</td><td>2,35</td><td>2407,99</td><td>2465791,99</td></tr>
  91.  <tr><td>64 KiB</td><td>4,70</td><td>4815,99</td><td>4931583,99</td></tr>
  92.  <tr><td>128 KiB</td><td>8,00</td><td>8192,00</td><td>8388607,50</td></tr>
  93.  
  94. <h2>exFAT: Límites por Tamaño de Clúster</h2>
  95.  <tr>
  96.    <th>Clúster</th><th>TiB</th><th>GiB</th><th>MiB</th>
  97.  </tr>
  98.  <tr><td>0,5 KiB</td><td>0,12</td><td>129,00</td><td>132104,05</td></tr>
  99.  <tr><td>1 KiB</td><td>0,25</td><td>257,00</td><td>263172,00</td></tr>
  100.  <tr><td>2 KiB</td><td>0,50</td><td>513,00</td><td>525313,97</td></tr>
  101.  <tr><td>4 KiB</td><td>1,00</td><td>1025,00</td><td>1049600,95</td></tr>
  102.  <tr><td>8 KiB</td><td>2,00</td><td>2049,00</td><td>2098176,40</td></tr>
  103.  <tr><td>16 KiB</td><td>4,00</td><td>4097,00</td><td>4195328,06</td></tr>
  104.  <tr><td>32 KiB</td><td>8,00</td><td>8192,99</td><td>8389631,74</td></tr>
  105.  <tr><td>64 KiB</td><td>16,00</td><td>16384,99</td><td>16778239,30</td></tr>
  106.  <tr><td>128 KiB</td><td>32,00</td><td>32768,99</td><td>33555454,52</td></tr>
  107.  <tr><td>256 KiB</td><td>64,00</td><td>65536,99</td><td>67109885,01</td></tr>
  108.  <tr><td>512 KiB</td><td>128,00</td><td>131072,00</td><td>134218746,00</td></tr>
  109.  <tr><td>1024 KiB</td><td>256,00</td><td>262144,00</td><td>268435456,00</td></tr>
  110.  
  111. <h2>NTFS: Límites por Tamaño de Clúster</h2>
  112.  <tr>
  113.    <th>Clúster</th><th>TiB</th><th>GiB</th><th>MiB</th>
  114.  </tr>
  115.  <tr><td>0,5 KiB</td><td>1,99</td><td>2047,99</td><td>2097151,99</td></tr>
  116.  <tr><td>1 KiB</td><td>3,99</td><td>4095,99</td><td>4194303,99</td></tr>
  117.  <tr><td>2 KiB</td><td>7,99</td><td>8191,99</td><td>8388607,99</td></tr>
  118.  <tr><td>4 KiB</td><td>15,99</td><td>16384,99</td><td>16777215,99</td></tr>
  119.  <tr><td>8 KiB</td><td>31,99</td><td>32767,99</td><td>33554431,99</td></tr>
  120.  <tr><td>16 KiB</td><td>63,99</td><td>65535,99</td><td>67108863,98</td></tr>
  121.  <tr><td>32 KiB</td><td>127,99</td><td>131071,99</td><td>134217727,96</td></tr>
  122.  <tr><td>64 KiB</td><td>255,99</td><td>262143,99</td><td>268435455,93</td></tr>
  123.  <tr><td>128 KiB</td><td>511,99</td><td>524287,99</td><td>536870911,87</td></tr>
  124.  <tr><td
  125.  
  126. </body>
  127. </html>
  128.  

O alternativamente en un documento CSV:



Documento.csv
Citar
"Título","FAT32 (MBR vs GPT)"
"Tipo","MBR","GPT"
"Tamaño partición máximo","8 TiB","2 TiB"
"Tamaño clúster máximo","512 KiB","64 KiB"

"Título","exFAT"
"Tipo","Valor"
"Tamaño partición máximo","256 TiB"
"Tamaño clúster máximo","1024 KiB"

"Título","NTFS"
"Tipo","Valor"
"Tamaño partición máximo","255,99 TiB"
"Tamaño clúster máximo","64 KiB"

"Título","Compatibilidad Windows 2000 / XP / 2003"
"Sector lógico","Tamaño máximo de disco"
"512 bytes","1,99 TiB"
"4096 bytes","15,99 TiB"

"Título","FAT32: Límites por Tamaño de Clúster"
"Clúster","TiB","GiB","MiB"
"4 KiB","0,29","300,99","308223,99"
"8 KiB","0,59","601,99","616447,99"
"16 KiB","1,17","1203,99","1232895,99"
"32 KiB","2,35","2407,99","2465791,99"
"64 KiB","4,70","4815,99","4931583,99"
"128 KiB","8,00","8192,00","8388607,50"

"Título","exFAT: Límites por Tamaño de Clúster"
"Clúster","TiB","GiB","MiB"
"0,5 KiB","0,12","129,00","132104,05"
"1 KiB","0,25","257,00","263172,00"
"2 KiB","0,50","513,00","525313,97"
"4 KiB","1,00","1025,00","1049600,95"
"8 KiB","2,00","2049,00","2098176,40"
"16 KiB","4,00","4097,00","4195328,06"
"32 KiB","8,00","8192,99","8389631,74"
"64 KiB","16,00","16384,99","16778239,30"
"128 KiB","32,00","32768,99","33555454,52"
"256 KiB","64,00","65536,99","67109885,01"
"512 KiB","128,00","131072,00","134218746,00"
"1024 KiB","256,00","262144,00","268435456,00"

"Título","NTFS: Límites por Tamaño de Clúster"
"Clúster","TiB","GiB","MiB"
"0,5 KiB","1,99","2047,99","2097151,99"
"1 KiB","3,99","4095,99","4194303,99"
"2 KiB","7,99","8191,99","8388607,99"
"4 KiB","15,99","16384,99","16777215,99"
"8 KiB","31,99","32767,99","33554431,99"
"16 KiB","63,99","65535,99","67108863,98"
"32 KiB","127,99","131071,99","134217727,96"
"64 KiB","255,99","262143,99","268435455,93"
"128 KiB","511,99","524287,99","536870911,87"

⚠️ Este documento CSV es una simple adaptación por IA del documento HTML compartido aquí arriba, sin revisión humana.

Atentamente,
Elektro.
89  Informática / Software / Busco un software con interfaz gráfica para leer y modificar los niveles de integridad (Mandatory Label ACE) de archivos en: 14 Abril 2025, 00:09 am
Hola!

Busco un software de seguridad, con interfaz gráfica (GUI), que sea capaz de leer y modificar los 👉 niveles de integridad ('File Integrity Levels' en Inglés, o 👉 Mandatory Label ACE) de archivos y carpetas, de forma productiva, es decir, con una navegación de archivos fácil y fluida, que no te haga perder 5 minutos para navegar hasta un directorio en específico...

Básicamente lo que se puede hacer con el parámetro /SetIntegrtyLevel del executable ICACLS.exe en Windows:
  - https://learn.microsoft.com/es-es/windows-server/administration/windows-commands/icacls

O con el ya extinto programa Chml de Mr. Minasi:
  - https://web.archive.org/web/20131226134704/http://www.minasi.com/apps/
(se puede descargar el executable desde esa página)

O con este módulo de terceros (basado en C# — en el uso de Windows API) para el lenguaje de programación PowerShell:
  - https://github.com/jborean93/PSIntegrity/blob/master/PSIntegrity/PSIntegrity.psm1

etc.



He intentado buscar específicamente una GUI de ICACLS, pero no encontré nada. En fin. No me urge en absoluto encontrar un programa similar, más bien es por el capricho de poder tener un buen programa con interfaz gráfica, sencillito y productivo para estos menesteres. Que esté orientado a los niveles de integridad, más que a los ACL (como 👉 SetACL Studio, que por cierto es antiproductivo en todos los sentidos). Hay varias opciones por línea de comandos como las que por ejemplo ya he mencionado aquí, pero con interfaz gráfica no he encontrado nada. Parece estar bastante difícil, quizás no exista. O quizás alguien pueda sorprenderme...

Gracias de antemano.

Atentamente,
Elektro.
90  Foros Generales / Dudas Generales / Re: Garantía de los productos en compras online en: 12 Abril 2025, 14:23 pm
Y que me decís de esto

Primero habría que determinar si el producto es de fabricación europea, y si su manufacturación fue antes o después del 1 de Enero de 2022 cuando entró en vigor esta versión más reciente de la normativa de la garantía legal en la UE. Esto de los tres años me parece que no es para todos los países europeos, pero si para España entre otros.

Pero es que da exactamente igual lo que ponga en un papelito, el fabricante puede poner lo que quiera que eso no tiene validez legal por encima de los derechos como consumidor dentro de lo que digan las leyes de comercio en Europa y la ley de España. Y, de todas formas, ese papelito posiblemente e realidad expresará otro tipo de políticas vinculadas a garantías individuales ofrecidas por el fabricante, como sucede con los discos duros, el fabricante suele ofrecer una garantía de reparación de 2 a 4 años o lo que sea, pero eso es algo que ofrece el fabricante, no hay que mezclar esto con la garantía de la UE.

La cuestión es que el responsable directo de hacer cumplir la garantía de la UE (y la ley española) para resolverte el problema y darte un reembolso etc durante tres años (siempre que se cumplan los criterios básicos que ya mencioné en otro comentario), es la tienda o empresa que te vendió el producto, no el fabricante.

Atentamente,
Elektro.
Páginas: 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ... 1257
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines