Advertisement
westor

Hash table viewer

Feb 14th, 2016
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 7.64 KB | None | 0 0
  1. menu * {
  2.   -
  3.   Hash Tables:dialog -mv Hash Hash
  4. }
  5. dialog Hash {
  6.   title "Hash Dialog"
  7.   size -1 -1 294 171
  8.   option dbu
  9.   list 1, 8 11 83 107, size hsbar vsbar
  10.   box "Hash Tables", 2, 4 3 92 149
  11.   button "New Table", 3, 8 126 35 9
  12.   button "Del Table", 4, 55 126 35 9
  13.   box "Table Items", 5, 101 3 92 149
  14.   button "New Item", 6, 105 126 35 9
  15.   button "Del Item", 7, 152 126 35 9
  16.   list 8, 105 11 83 107, size hsbar vsbar
  17.   box "Item Data", 9, 198 3 92 149
  18.   list 10, 202 11 83 107, size hsbar vsbar
  19.   button "New Data", 11, 202 126 35 9
  20.   button "Del Data", 12, 249 126 35 9
  21.   button "Edit Table", 13, 31 139 35 9
  22.   button "Edit Item", 14, 129 139 35 9
  23.   button "Edit Data", 15, 226 139 35 9
  24.   button "...", 16, 181 155 11 12
  25.   edit "Input Search Term Here", 17, 4 155 135 12
  26.   button "Search", 18, 141 155 37 12
  27.   text "Hash Dialog Created by Zeta of SwiftIRC", 19, 194 157 99 8
  28.   button "OK", 20, 245 153 29 8
  29.   button "Cancel", 21, 245 161 29 8
  30.   edit "", 22, 173 155 68 10
  31.   edit "100", 23, 99 155 42 11, center
  32.   text "Number of Slots (Default of 100)", 24, 20 157 79 8
  33.   text "Table Name", 25, 142 157 29 8
  34.   text "New Data", 27, 142 157 25 8
  35.   edit "", 26, 70 155 68 10
  36.   text "New Item", 28, 43 157 25 8
  37. }
  38. on *:DIALOG:Hash:INIT:0:{
  39.   did -h Hash 20-28
  40.   var %Hget $hget(0)
  41.   var %X 1
  42.   while (%X <= %Hget) {
  43.     did -i Hash 1 %X $hget(%X)
  44.     inc %X
  45.   }
  46.   did -z Hash 1
  47.   did -b Hash 4,6,7,11,12,13,14,15
  48. }
  49. on *:DIALOG:Hash:SCLICK:1,8,10:{
  50.   if ($did == 1) {
  51.     if ($did(Hash, 1).sel) {
  52.       did -h Hash 20-28
  53.       did -v Hash 16-19
  54.       did -r Hash 8,10
  55.       did -e Hash 4,6,11,13
  56.       did -b Hash 7,14,12,15
  57.       var %Item $hget($did(Hash, 1).seltext,0).item
  58.       var %X 1
  59.       while (%X <= %Item) {
  60.         did -i Hash 8 %X $hget($did(Hash, 1).seltext,%X).item
  61.         did -i Hash 10 %X $hget($did(Hash, 1).seltext,%X).data
  62.         inc %X
  63.       }
  64.       did -z Hash 8,10
  65.     }
  66.   }
  67.   if ($did == 8) {
  68.     if ($did(Hash, 8).sel) {
  69.       did -h Hash 20-28
  70.       did -v Hash 16-19
  71.       did -c Hash 10 $did(Hash, 8).sel
  72.       did -e Hash 7,14,12,15
  73.     }
  74.   }
  75.   if ($did == 10) {
  76.     if ($did(Hash, 10).sel) {
  77.       did -h Hash 20-28
  78.       did -v Hash 16-19
  79.       did -c Hash 8 $did(Hash, 10).sel
  80.       did -e Hash 7,14,12,15
  81.     }
  82.   }
  83. }
  84. ;Numbers are so I wouldn't forget what $dids to put :>
  85. on *:DIALOG:Hash:SCLICK:3,4,6,7,11-16,18,20-25:{
  86.   if ($did == 3) {
  87.     did -h Hash 16-19,26-28
  88.     did -v Hash 20-25
  89.     did -r Hash 22
  90.     did -r Hash 23
  91.     did -a Hash 23 100
  92.   }
  93.   if ($did == 4) {
  94.     noop $input(Are you sure you would like to delete the table $+(',$did(Hash, 1).seltext,',?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
  95.     if ($! == $true) {
  96.       hfree $did(Hash, 1).seltext
  97.       did -d Hash 1 $did(Hash, 1).sel
  98.       did -b Hash 6,7,11-15
  99.       did -r Hash 8,10
  100.       did -z Hash 1
  101.     }
  102.   }
  103.   if ($did == 6) {
  104.     did -h Hash 16-25
  105.     did -v Hash 20-22,26-28
  106.   }
  107.   if ($did == 7) {
  108.     noop $input(Are you sure you would like to delete the item $+(',$did(Hash, 8).seltext,') from the $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) table $+(',$did(Hash, 1).seltext,'?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
  109.     if ($! == $true) {
  110.       hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
  111.       did -d Hash 8,10 $did(Hash, 8).sel
  112.       did -b Hash 7,11-15
  113.     }
  114.   }
  115.   if ($did == 11) {
  116.     did -h Hash 16-25
  117.     did -v Hash 20-22,26-28
  118.   }
  119.   if ($did == 12) {
  120.     noop $input(Are you sure you would like to delete the data $+(',$did(Hash, 10).seltext,') from the $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) table $+(',$did(Hash, 1).seltext,'?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
  121.     if ($! == $true) {
  122.       hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
  123.       did -d Hash 8,10 $did(Hash, 8).sel
  124.       did -b Hash 7,11-15
  125.     }  
  126.   }
  127.   if ($did == 13) {
  128.     did -h Hash 16-19,23,24,26-28
  129.     did -v Hash 20-22,25
  130.     did -r Hash 22
  131.     did -a Hash 22 $did(Hash, 1).seltext
  132.   }
  133.   if ($did == 14) {
  134.     did -h Hash 16-25
  135.     did -v Hash 20-22,26-28
  136.     did -r Hash 22,26
  137.     did -a Hash 22 $did(Hash, 10).seltext
  138.     did -a Hash 26 $did(Hash, 8).seltext
  139.   }
  140.   if ($did == 15) {
  141.     did -h Hash 16-25
  142.     did -v Hash 20-22,26-28
  143.     did -r Hash 22,26
  144.     did -a Hash 22 $did(Hash, 10).seltext
  145.     did -a Hash 26 $did(Hash, 8).seltext
  146.   }
  147.   if ($did == 16) {
  148.     did -z Hash 1
  149.     did -b Hash 4,6,7,11,12,13,14,15
  150.     did -r Hash 1,8,10
  151.     did -u Hash 1 $did(Hash, 1).sel
  152.     did -r Hash 17
  153.     did -a Hash 17 Input Search Term Here
  154.     var %Hget $hget(0)
  155.     var %Z 1
  156.     while (%Z <= %Hget) {
  157.       did -i Hash 1 %Z $hget(%Z)
  158.       inc %Z
  159.     }
  160.   }
  161.   if ($did == 18) {
  162.     if ($did(Hash, 17).edited) {
  163.       did -r Hash 1,8,10
  164.       var %X 1
  165.       var %Y $hget(0)
  166.       while (%X <= %Y) {
  167.         if ($replace($did(Hash, 17).text,$chr(32),_) isin $hget(%X)) {
  168.           did -a Hash 1 $hget(%X)
  169.           inc %X
  170.         }
  171.         else {
  172.           inc %X
  173.         }
  174.       }
  175.       did -z Hash 1
  176.     }
  177.   }
  178.   if ($did == 20) {
  179.     if ($did(Hash, 27).visible == $true) {
  180.       if (!$did(Hash, 8).sel) || (!$did(Hash, 10).sel) {
  181.         hadd $did(Hash, 1).seltext $replace($did(Hash, 26).text,$chr(32),_) $did(Hash, 22).text
  182.         did -i Hash 8 1 $replace($did(Hash, 26).text,$chr(32),_)
  183.         did -i Hash 10 1 $did(Hash, 22).text
  184.       }
  185.       elseif ($did(Hash, 22).edited) || ($did(Hash, 26).edited) {
  186.         if (!$did(Hash, 22).text) || (!$did(hash, 26).text) {
  187.           noop $input(Please put an item and data!,h,Error)
  188.         }
  189.         else {
  190.           hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
  191.           hadd $did(Hash, 1).seltext $replace($did(Hash, 22).text,$chr(32),_) $replace($did(Hash, 26).text,$chr(32),_)
  192.           did -d Hash 8,10 $did(Hash, 8).sel
  193.           did -i Hash 8 1 $replace($did(Hash, 22).text,$chr(32),_)
  194.           did -i Hash 10 1 $replace($did(Hash, 26).text,$chr(32),_)
  195.           did -h Hash 20-28
  196.           did -v Hash 1-19
  197.         }
  198.       }
  199.     }
  200.     if ($did(Hash, 24).visible != $true) && ($did(Hash, 25).visible == $true) {
  201.       if ($did(Hash, 22).edited) {
  202.         if (!$did(Hash, 22).text) {
  203.           noop $input(Please put a new table name!,h,Error)
  204.         }
  205.         else {
  206.           hsave -b $did(Hash, 1).seltext ht.temp
  207.           hfree $did(Hash, 1).seltext
  208.           hmake $replace($did(Hash, 22).text,$chr(32),_)
  209.           hload -b $replace($did(Hash, 22).text,$chr(32),_) ht.temp
  210.           remove ht.temp
  211.           did -d Hash 1 $did(Hash, 1).sel
  212.           did -i Hash 1 1 $replace($did(Hash, 22).text,$chr(32),_)
  213.           did -r Hash 8,10
  214.           did -h Hash 20-28
  215.           did -v Hash 1-19
  216.         }
  217.       }
  218.     }
  219.     if ($did(Hash, 24).visible == $true) && ($did(Hash, 25).visible == $true) {
  220.       if (!$did(Hash, 22).text) || (!$did(hash, 23).text) {
  221.         noop $input(Please put a table name and number of slots!,h,Error)
  222.       }
  223.       else {
  224.         hmake $did(Hash, 22).text $did(Hash, 23).text
  225.         did -r Hash 8,10
  226.         did -h Hash 20-28
  227.         did -v Hash 1-19
  228.         did -i Hash 1 1 $replace($did(Hash, 22).text,$chr(32),_)
  229.       }
  230.     }
  231.   }
  232.   if ($did == 21) {
  233.     did -h Hash 20-28
  234.     did -a Hash 22,26
  235.     did -v Hash 1-19
  236.   }
  237. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement