下载地址链接: https://pan.baidu.com/s/1UH4IfKqxcwJyharcgEqz1Q?pwd=t327(包含源码演示,仅17KB)
FBCN.EXE 1.0 (FAST BCN TOOL BY HAPPY)

摘要:
====================================================
FBCN快速第三方包管理工具,完全颠覆你对包管理的认识。内存运算查表,速度秒杀一
切类似工具。 独创YUM云序列号,每个第三方拥有唯一的云序列YUM-SN,依靠YUM-SN序
列号去管理本地包。如果已下载unrar,那么针对rar类型的包,会自动解压安装到本地
目录。爽快的击键查询让你终生难忘。
备注:个别电脑如无法运行,请下载msvcr100.dll放入fbcn.exe所在目录即可。
====================================================
传参:
----------------------------------------------------------------------------------
fbcn -y[下载源地址] -t[列表地址] -m[最大行数]
----------------------------------------------------------------------------------
-h 获取帮助信息
-y 指定下载源地址
-t 指定第三方列表地址
-m 指定最大展示行数目
----------------------------------------------------------------------------------
示例:
----------------------------------------------------------------------------------
fbcn -m20 -yhttp://batch-cn.qiniudn.com/tool/ -thttp://batch-cn.qiniudn.com/list/tool.@version.txt
----------------------------------------------------------------------------------
搜索:
(任意位置匹配)直接输入sed,将采取任意位置匹配模式,之会列出下表
>>sed
====================================================
NAME YUM-SN VERSION SIZE DESCRIPTION
====================================================
csed [0332] @2003-09-13 32KB 更小更快更轻量的sed
ESEDatabaseView [0485] @nircmd,1.37 94KB 读取并显示存储的可扩展存储引擎(ESE)数据库.edb文件中的数据(GUI)
minised [0958] @1.12 24KB 体积小巧的sed
onigsed [1103] @4.15 272KB 支持Oniguruma(ver.2.5.0)和Perl5正则表达式的sed
sed [1442] 4.0.7 92KB 流文本处理工具(此版本换行不含回车符)
sed [1443] GnuWin32,4.2.1 672KB 流文本处理工具
sed [1444] 4.2.2 150KB 流文本处理工具
sed [1445] msys2,4.2.2 1468KB 流文本处理工具
sed [1446] 4.3 204KB 流文本处理工具
sed [1447] @4.4 203KB 流文本处理工具
sedsed [1448] sedsed,1.0 1609KB 强大的sed调试工具,Python脚本打包exe
sedsed [1449] @pyinstaller,1.0 3873KB 强大的sed调试工具,pyinstaller打包exe
ssed [1534] @2.59 81KB super_sed,支持Perl正则
tr [1675] @5.97 26KB sed简化版
====================================================
下载:
(首位置匹配)输入^sed,会列出如下表,继续输入 :1446 下载对应的sed4.3版。
>>^sed:1446
====================================================
NAME YUM-SN VERSION SIZE DESCRIPTION
====================================================
sed [1442] 4.0.7 92KB 流文本处理工具(此版本换行不含回车符)
sed [1443] GnuWin32,4.2.1 672KB 流文本处理工具
sed [1444] 4.2.2 150KB 流文本处理工具
sed [1445] msys2,4.2.2 1468KB 流文本处理工具
sed [1446] 4.3 204KB 流文本处理工具
sed [1447] @4.4 203KB 流文本处理工具
====================================================
原创开源 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #include <stdio.h> | | #include <stdlib.h> | | #include <string.h> | | #include <windows.h> | | #include <wininet.h> | | #include<shellapi.h> | | #include <direct.h> | | #include <conio.h> | | #include <time.h> | | #include <math.h> | | #include <io.h> | | #pragma comment(lib, "wininet.lib") | | | | | | #define SAFE_SIZE 512 | | #define FILE_EXIST 0 | | | | | | #define HELP_INFORMATION "\ | | -----------------------------------------------------------------\n\ | | fbcn -y[yumsrc] -t[tabsrc] -m[maxlist]\n\ | | -----------------------------------------------------------------\n\ | | -h Show help information\n\ | | -y Set the yumsrc url\n\ | | -t Set the tabsrc url\n\ | | -m Set The max length of the list\n\ | | -----------------------------------------------------------------\n\ | | version 1.0\n" | | | | #define SEARCH_HEAD "\ | | =====================================================================================================================\n\ | | NAME YUM-SN VERSION SIZE DESCRIPTION\n\ | | =====================================================================================================================" | | | | #define SEARCH_LOGO "\ | | -----------------------------------------------------------------\n\ | | \n\ | | _ _ _ _ | The Batch Online Fast BCN Tool,\n\ | | \\ | | | \\ / | | Copyright@2017~2019 By Happy, fbcn.exe\n\ | | \\ \\| |_ _| |\\ /| | | Type \"-h\" for help.\n\ | | \\_| | | | | | \\/ | | |\n\ | | | | |_| | |\\ /| | | Version 1.0 (2017-04-26 21:15 UTC)\n\ | | _/ |\\__'_|_| VV |_| | Officil http://www.bathome.net/thread-\n\ | | |__/ | 43961-1-1.html\n\ | | \n\ | | -----------------------------------------------------------------\n" | | | | | | | | HWND hWND=NULL; | | | | | | char* OPTARG; | | int OPTIND=1, OPTOPT; | | | | | | static char tmpp[6][SAFE_SIZE]= {0}; | | | | | | static char tlist [SAFE_SIZE*SAFE_SIZE]; | | static char LCache[SAFE_SIZE*2]; | | | | | | static char yumsrcURL[SAFE_SIZE*2]; | | static char tabsrcURL[SAFE_SIZE*2]; | | | | | | static char yumSN[4]; | | | | static char yumURL[SAFE_SIZE*2]; | | | | static char shellTAI[SAFE_SIZE*2]; | | | | | | static char proGRESS[64]= {0}; | | clock_t preTime; | | ULONG preProgress; | | | | | | typedef HRESULT (WINAPI *PGETA)(LPUNKNOWN,LPCSTR,LPCSTR,DWORD,LPBINDSTATUSCALLBACK); | | PGETA PgetUrlToFileA; | | | | extern "C" HWND WINAPI GetConsoleWindow(); | | | | | | | | const char* stristr(const char* str, const char* subStr) | | { | | int len = strlen(subStr); | | if(len == 0) | | { | | return NULL; | | } | | | | while(*str) | | { | | if(_strnicmp(str, subStr, len) == 0) | | { | | return str; | | } | | str++; | | } | | return NULL; | | } | | | | BOOL DispyCursor(int size, BOOL mode) | | { | | CONSOLE_CURSOR_INFO cinfo = {(DWORD)size, mode}; | | return SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cinfo); | | } | | | | int ShellCls() | | { | | HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); | | CONSOLE_SCREEN_BUFFER_INFO csbi; | | COORD coPos; | | DWORD dwWritten; | | | | if (GetConsoleScreenBufferInfo(hOutput, &csbi)) | | { | | coPos.X = 0; | | coPos.Y = 0; | | FillConsoleOutputAttribute (hOutput, csbi.wAttributes, csbi.dwSize.X*csbi.dwSize.Y, coPos, &dwWritten); | | FillConsoleOutputCharacterA(hOutput, ' ', csbi.dwSize.X*csbi.dwSize.Y, coPos, &dwWritten); | | SetConsoleCursorPosition(hOutput, coPos); | | } | | | | return 0; | | } | | | | void GetWebSrcCode(const char *Url, char* tainer) | | { | | *tainer='\0'; | | HINTERNET hSession = InternetOpen("zwt", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); | | if (hSession != NULL) | | { | | HINTERNET hURL = InternetOpenUrl(hSession, Url, NULL, 0, INTERNET_FLAG_DONT_CACHE, 0); | | if (hURL != NULL) | | { | | char Temp[SAFE_SIZE*2] = {0}; | | ULONG Number = 1; | | | | while (Number >0) | | { | | InternetReadFile(hURL, Temp, SAFE_SIZE*2 - 1, &Number); | | strncat(tainer, Temp, Number); | | } | | | | InternetCloseHandle(hURL); | | hURL = NULL; | | } | | InternetCloseHandle(hSession); | | hSession = NULL; | | } | | return; | | } | | | | class DownloadProgress :public IBindStatusCallback | | { | | public: | | HRESULT __stdcall QueryInterface(const IID &, void **) | | { | | return E_NOINTERFACE; | | } | | ULONG STDMETHODCALLTYPE AddRef(void) | | { | | return 1; | | } | | ULONG STDMETHODCALLTYPE Release(void) | | { | | return 1; | | } | | HRESULT STDMETHODCALLTYPE OnStartBinding(DWORD dwReserved, IBinding *pib) | | { | | return E_NOTIMPL; | | } | | virtual HRESULT STDMETHODCALLTYPE GetPriority(LONG *pnPriority) | | { | | return E_NOTIMPL; | | } | | virtual HRESULT STDMETHODCALLTYPE OnLowResource(DWORD reserved) | | { | | return S_OK; | | } | | virtual HRESULT STDMETHODCALLTYPE OnStopBinding(HRESULT hresult, LPCWSTR szError) | | { | | return E_NOTIMPL; | | } | | virtual HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD *grfBINDF, BINDINFO *pbindinfo) | | { | | return E_NOTIMPL; | | } | | virtual HRESULT STDMETHODCALLTYPE OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed) | | { | | return E_NOTIMPL; | | } | | virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(REFIID riid, IUnknown *punk) | | { | | return E_NOTIMPL; | | } | | virtual HRESULT __stdcall OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) | | { | | if (ulProgressMax != 0) | | { | | | | | | int downloadSpeed, restTime; | | int i=(int)ulProgress * 100.0 / (int)ulProgressMax; | | int j=i/2, disTime=(int)(clock()-preTime); | | if(disTime > 100) | | { | | downloadSpeed=((int)ulProgress-(int)preProgress) * CLOCKS_PER_SEC / disTime / 1000; | | restTime=(downloadSpeed!=0) ?((int)ulProgressMax-(int)ulProgress) / downloadSpeed :99999; | | preProgress=ulProgress, preTime+=disTime; | | } | | else if(i <100) | | { | | return S_OK; | | } | | | | if(i==100) | | { | | downloadSpeed=restTime=0; | | } | | | | for(int n=1; n<=j; n++) | | { | | proGRESS[n]='='; | | } | | | | | | fprintf(stdout, "\r%s%3d%% %3dKB/s,%3dm%02ds ", proGRESS, i, downloadSpeed, restTime/1000/60, restTime/1000%60); | | fflush(stdout); | | } | | return S_OK; | | } | | }; | | | | int GetOpt(int nargc, char *nargv[], char *ostr) | | { | | static char* place=""; | | static char* lastostr=(char *) 0; | | register char* oli; | | char* index(); | | if(ostr!=lastostr) | | { | | lastostr=ostr; | | place=""; | | } | | if(!*place) | | { | | if( | | (OPTIND>=nargc) || | | (*(place=nargv[OPTIND])!='-')|| | | (!*(++place)) | | ) | | { | | place=""; | | return(EOF); | | } | | if (*place == '-' && place[1] == 0) | | { | | ++OPTIND; | | return(EOF); | | } | | } | | if ((OPTOPT=(int)*place++)==(int)':' || !(oli=strchr(ostr, OPTOPT))) | | { | | if(!*place) | | { | | ++OPTIND; | | } | | } | | | | if (oli != NULL && *(++oli) != ':') | | { | | OPTARG=NULL; | | if(!*place) | | { | | ++OPTIND; | | } | | } | | else | | { | | if(*place) | | { | | OPTARG=place; | | } | | else if(nargc<=++OPTIND) | | { | | place=""; | | } | | else | | { | | OPTARG=nargv[OPTIND]; | | } | | place=""; | | ++OPTIND; | | } | | return(OPTOPT); | | } | | | | int SearchStr(const char* tblist, const char* key, int maxLIST, int ynum) | | { | | BOOL kMARK=TRUE; | | int i=0, count=0, mode=0, kl=strlen(key); | | char* keywords=NULL; | | | | if(*key!='^' && *key!=0 && *(key+1)=='\0') | | { | | mode=1; | | keywords=(char*)key; | | | | } | | else if(*key=='^' && *(key+1)!='\0') | | { | | mode=2; | | keywords=(char*)key+1; | | | | } | | | | else if(*key!='^' && *key!='\0') | | { | | mode=4; | | keywords=(char*)key; | | } | | | | if(ynum>0) | | { | | mode=5; | | keywords=(char*)key; | | } | | | | | | char* Line=NULL; | | char* p=(char*)tblist; | | | | | | tlist[0]='\0'; | | char* strliu=tlist; | | | | while(*p) | | { | | char* tp=LCache; | | while(*p!='\n' && *p!='\0') | | { | | *tp++=*p++; | | } | | if(*p=='\n') | | { | | p++; | | } | | *tp='\0'; | | | | | | Line=LCache; | | | | | | while(*Line=='\t'|| *Line==' ') | | { | | Line++; | | } | | | | if(kMARK) | | { | | if(stristr(Line, "Rem ")==Line) | | { | | kMARK=FALSE; | | continue; | | } | | } | | | | if(!kMARK || *Line=='\0') | | { | | continue; | | } | | | | i++; | | | | if( | | (mode==5 && i==ynum) || | | (mode==1 && *keywords==*Line) || | | (mode==2 && stristr(Line, keywords)==Line) || | | (mode==4 && stristr(Line, keywords)) | | ) | | { | | char* textstrp=NULL; | | | | if(textstrp=strtok(Line, " ")) | | { | | strcpy(tmpp[0], textstrp); | | } | | | | for(int j=1; j<5; j++) | | { | | if(textstrp=strtok(NULL, " ")) | | { | | strcpy(tmpp[j], textstrp); | | } | | else | | { | | tmpp[j][0]=0; | | } | | } | | | | if (mode==5 && i==ynum) | | { | | | | DownloadProgress progress; | | IBindStatusCallback* callback=(IBindStatusCallback*)&progress; | | | | | | memset(proGRESS, ' ', 51); | | proGRESS[0]='[', proGRESS[51]=']'; | | | | preTime=clock(); | | preProgress=(ULONG)0; | | | | strcpy(yumURL, yumsrcURL); | | strcat(yumURL, (tmpp[1][0]=='@')?tmpp[1]+1:tmpp[1]); | | strcat(yumURL, "/"); | | strcat(yumURL, tmpp[0]); | | | | | | if(stricmp(strrchr(yumURL, '.'), ".rar")) | | { | | strcat(yumURL, ".exe"); | | } | | | | | | DeleteUrlCacheEntryA(yumURL); | | | | | | if (PgetUrlToFileA(NULL, yumURL, strrchr(yumURL, '/')+1, 0, static_cast<IBindStatusCallback*>(&progress)) != S_OK) | | { | | | | | | memset(proGRESS, ' ', 51); | | proGRESS[0]='[', proGRESS[51]=']'; | | | | preTime=clock(); | | preProgress=(ULONG)0; | | | | strcpy(yumURL, yumsrcURL); | | strcat(yumURL, tmpp[0]); | | | | if(stricmp(strrchr(yumURL, '.'), ".rar")) | | { | | strcat(yumURL, ".exe"); | | } | | | | DeleteUrlCacheEntryA(yumURL); | | | | if (PgetUrlToFileA(NULL, yumURL, strrchr(yumURL, '/')+1, 0, static_cast<IBindStatusCallback*>(&progress)) != S_OK) | | { | | fprintf(stdout, "DOWNLOAD \"%s\" ERROR.", tmpp[0]); | | Sleep(2800); | | return 0; | | } | | else | | { | | fprintf(stdout, "DOWNLOAD \"%s\" SUCCEED.", tmpp[0]); | | } | | } | | else | | { | | fprintf(stdout, "DOWNLOAD \"%s\" SUCCEED.", tmpp[0]); | | } | | | | if(!stricmp(strrchr(yumURL, '.'), ".rar") && _access("unrar.exe", FILE_EXIST)==0) | | { | | strcpy(shellTAI, "x -o+ -y "); | | strcat(shellTAI, tmpp[0]); | | ShellExecuteA(hWND, "runas", "unrar.exe", shellTAI, "", SW_NORMAL); | | } | | | | return 0; | | } | | | | if (mode==5) | | { | | continue; | | } | | | | | | sprintf(strliu, "%-20.20s [%04d] %-25.25s %7dKB %s\n", strtok(tmpp[0], "."), i, tmpp[1], atoi(tmpp[3])/1024, tmpp[2]); | | | | while(*strliu) | | { | | strliu++; | | } | | | | count++; | | | | if(count>maxLIST) | | { | | break; | | } | | } | | | | } | | | | if(mode==5) | | { | | fprintf(stdout, "DOWNLOAD \"[%d]\" ERROR.", ynum); | | Sleep(2800); | | } | | | | | | fprintf(stdout, "%s\n", tlist); | | | | | | fflush(stdout); | | | | return 0; | | } | | | | | | int main(int argc, char** argv) | | { | | if(argc<2) | | { | | | | fprintf(stdout, HELP_INFORMATION); | | exit(0); | | } | | | | int flag[2]= {0}, K, maxLISTSIZE=25; | | while((K=GetOpt(argc,argv,"hy:t:m:"))!=-1) | | { | | switch(K) | | { | | case 'h': | | case 'H': | | fprintf(stdout, HELP_INFORMATION); | | exit(0); | | | | case 'y': | | case 'Y': | | if(OPTARG !=NULL) | | { | | strcpy(yumsrcURL, OPTARG); | | flag[0]=1; | | } | | break; | | | | case 't': | | case 'T': | | if(OPTARG !=NULL) | | { | | strcpy(tabsrcURL, OPTARG); | | flag[1]=1; | | } | | break; | | | | case 'm': | | case 'M': | | if(OPTARG !=NULL) | | { | | maxLISTSIZE=atoi(OPTARG); | | } | | break; | | | | default: | | fprintf(stdout, "Unknown switch '-%c'\n", K); | | exit(1); | | } | | } | | | | if (!flag[0]) | | { | | fprintf(stdout, "Needs yumsrc URL.\n"); | | exit(1); | | } | | | | if (!flag[1]) | | { | | fprintf(stdout, "Needs tabsrc URL.\n"); | | exit(1); | | } | | | | | | char* tblist=(char*)malloc(SAFE_SIZE * SAFE_SIZE*2); | | | | | | fprintf(stdout, SEARCH_LOGO); | | GetWebSrcCode(tabsrcURL, tblist); | | if(!(*tblist)) | | { | | fprintf(stdout, "Get batch-cn-list failed.\n"); | | exit(1); | | } | | Sleep(30); | | | | | | HMODULE hLib=LoadLibraryW(L"URLMON"); | | if(hLib==NULL) | | { | | fprintf(stdout, "ERROR"); | | return 1; | | } | | | | PgetUrlToFileA=(PGETA)GetProcAddress(hLib, "URLDownloadToFileA"); | | | | | | HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE); | | | | | | CONSOLE_CURSOR_INFO cinfo = {(DWORD)25, FALSE}; | | SetConsoleCursorInfo(hOutput, &cinfo); | | | | | | COORD csi= {SAFE_SIZE, SAFE_SIZE}; | | SetConsoleScreenBufferSize(hOutput, csi); | | | | hWND=GetConsoleWindow(); | | | | | | ShellCls(); | | | | | | unsigned char str[SAFE_SIZE]= {0}; | | | | | | int i=-1, k=0; | | | | | | fprintf(stdout, ">>%s\n%s\n", str, SEARCH_HEAD); | | | | | | while(TRUE) | | { | | | | if(kbhit()) | | { | | | | k=getch(); | | | | if(k=='\r') | | { | | continue; | | } | | | | | | if(0<k && k<0x80) | | { | | | | if(k==':') | | { | | | | COORD nsi= {2+strlen((const char*)str),0}; | | SetConsoleCursorPosition(hOutput, nsi); | | fputc(':', stdout); | | | | | | for(int nu=0; nu<4; nu++) | | { | | yumSN[nu]=getch(); | | fputc(yumSN[nu], stdout); | | } | | | | | | SearchStr((const char*)tblist, (char*)str, maxLISTSIZE, atoi(yumSN)); | | | | } | | else if(k!='\b') | | { | | | | str[++i]=k; | | } | | else if(i>=0) | | { | | if(str[i]<0x80) | | { | | | | str[i--]=0; | | } | | else | | { | | | | str[i--]=0; | | str[i--]=0; | | } | | } | | } | | else if(str[i]<0xFE) | | { | | | | str[++i]=k; | | str[++i]=getch(); | | } | | | | | | ShellCls(); | | | | | | fprintf(stdout, ">>%s\n%s\n", str, SEARCH_HEAD); | | | | if(i>=0) | | { | | | | SearchStr((const char*)tblist, (char*)str, maxLISTSIZE, -1); | | | | COORD gsi= {0,0}; | | SetConsoleCursorPosition(hOutput, gsi); | | } | | | | } | | | | | | Sleep(1); | | } | | | | | | free(tblist); | | | | return 0; | | }COPY |
|