Page options

e


/*
链接转换实现原理?
*/
/*
By:DieJian
Email:bibcc@qq.com
09.4.11
*/

#NoTrayIcon
#NoEnv
#SingleInstance,force
Chars=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

;Menu, Tray, Icon, D:\i.ico
Gui, font,, Arial
Gui, font,,微软雅黑
Gui, Add, Edit, x3 y3 w300 h77 +Multi +Wrap Vurl,
Gui, Add, Button, x306 y3 w24 h37 Gpaste, 粘贴
Gui, Add, Button, x306 y43 w24 h37 Gcopy, 复制
Gui, Add, Button, x3 y83 w90 h30 Gdo, 转换
Gui, Add, Button, x99 y83 w90 h30 Gabout, 关于
Gui, Add, Button, x195 y83 w90 h30 GGuiClose, 退出
Gui, Add, Checkbox, x289 y83 w40 h30 Vtop Gctop, 置顶
Gui, Show, center w333 h116 ,专用链转换V1.0
Return

ctop:
Gui,Submit,NoHide
If top = 1
{
Gui +AlwaysOnTop
}
else
{
Gui -AlwaysOnTop
}
return

GuiEscape:
GuiClose:
exitapp

about:
Gui +OwnDialogs
msgbox,,By DieJian,支持(迅雷,快车,旋风,rayfile)
return

paste:
decodeurl:=Clipboard
GuiControl,, url, %decodeurl%
return

copy:
Gui,Submit,NoHide
Clipboard:=url
return

do:
Gui,Submit,NoHide
StringReplace, url, url,%A_space%,,All
StringReplace, url, url,`n,,All
decodeurl =
If url contains ://
{
  cut:=InStr(url,"://",false,1)-1
  StringLeft, type, url,%cut%

  If type not in thunder,qqdl,flashget,fs2you,http
  {
    decodeurl =
  }
  else
  {
    If(type="http"){
      decodeurl:=url
    }
    If(type="thunder"){
      StringReplace, url, url,thunder://,,All
      StringReplace, url, url, /,,All
      IfInString, url,=
      {
        cut:=StrLen(url)-InStr(url,"=",false,1)+1
        StringTrimRight, url, url, %cut%
      }
      url:=Base64Decode(url)
      StringTrimLeft, url, url, 2
      StringTrimRight, decodeurl, url, 2
    }
    If(type="qqdl"){
      StringReplace, url, url,qqdl://,,All
      StringReplace, url, url, /,,All
      IfInString, url,=
      {
        cut:=StrLen(url)-InStr(url,"=",false,1)+1
        StringTrimRight, url, url, %cut%
      }
      decodeurl:=Base64Decode(url)
    }
    If(type="flashget"){
      StringReplace, url, url,flashget://,,All
      StringReplace, url, url, /,,All
      IfInString, url,=
      {
        cut:=StrLen(url)-InStr(url,"=",false,1)+1
        StringTrimRight, url, url, %cut%
      }
      IfInString, url,&
      {
        cut:=StrLen(url)-InStr(url,"&",false,1)+1
        StringTrimRight, url, url, %cut%
      }
      url:=Base64Decode(url)
      StringTrimLeft, url, url, 10
      StringTrimRight, decodeurl, url, 10
    }
    If(type="fs2you"){
      StringReplace, url, url,fs2you://,,All
      StringReplace, url, url, /,,All
      IfInString, url,=
      {
        cut:=StrLen(url)-InStr(url,"=",false,1)+1
        StringTrimRight, url, url, %cut%
      }
      url:=Base64Decode(url)
      IfInString, url,|
      {
        cut:=StrLen(url)-InStr(url,"|",false,0)+1
        StringTrimRight, url, url, %cut%
      }
      decodeurl:="http://"url
    }
  }
}
end:
GuiControl,, url, %decodeurl%
return


DeCode(c) { ; c = a char in Chars ==> position [0,63]
   Global Chars
   Return InStr(Chars,c,1) - 1
}
Base64Decode(code) {
   StringReplace, code, code, `r,,All
   StringReplace, code, code, `n,,All
   Loop Parse, code
   {
      m := A_Index & 3 ; mod 4
      IfEqual m,0, {
         buffer += DeCode(A_LoopField)
         out := out Chr(buffer>>16) Chr(255 & buffer>>8) Chr(255 & buffer)
      }
      Else IfEqual m,1, SetEnv buffer, % DeCode(A_LoopField) << 18
      Else buffer += DeCode(A_LoopField) << 24-6*m
   }
   IfEqual m,0, Return out
   IfEqual m,2, Return out Chr(buffer>>16)
   Return out Chr(buffer>>16) Chr(255 & buffer>>8)
}

    Post a comment

    Your Name or E-mail ID (mandatory)

    Note: Your comment will be published after approval of the owner.

    No Attachments Found. Click here to upload new file.




     RSS of this page

    Written by:   Version:   Edited By:   Modified