📄 action.c
字号:
} hSaveCursor = SetCursor(hHourGlass); ShowCursor(TRUE); if (szUnzipToDirName[0]) lpDCL->lpszExtractDir = szUnzipToDirName; else lpDCL->lpszExtractDir = NULL; Unz_SingleEntryPoint(argc, argv, 0, NULL, lpDCL, lpUserFunctions); ShowCursor(FALSE); SetCursor(hSaveCursor); ShowCursor(TRUE); if (!uf.fUnzipToZipDir && szUnzipToDirName[0]) { lstrcpy(lpumb->szBuffer, lpumb->szDirName); /* OK to clobber szBuffer! */ } break; case 1: /* display to message window */ { int rc; /* return code */ bRealTimeMsgUpdate = FALSE; lpDCL->fQuiet = 2; // Kill all messages lpDCL->ncflag = 1; lpDCL->ntflag = 0; lpDCL->nvflag = 0; lpDCL->nUflag = 1; lpDCL->nzflag = 0; lpDCL->ndflag = 0; lpDCL->noflag = 0; lpDCL->naflag = TRUE; lpDCL->nZIflag = 0; lpDCL->lpszZipFN = lpumb->szFileName; argv = (char **)szFileList; hSaveCursor = SetCursor(hHourGlass); ShowCursor(TRUE); lpDCL->lpszExtractDir = NULL; rc = Unz_SingleEntryPoint(argc, argv, 0, NULL, lpDCL, lpUserFunctions); if (rc == IZ_UNSUP) BufferOut("%s is an encrypted file. Encryption not supported in this version", argv[0]); SetWindowText(hWndStatic, argv[0]); ShowCursor(FALSE); SetCursor(hSaveCursor); bRealTimeMsgUpdate = TRUE; /* Following extraction to status window, user will want * to scroll around, so put him/her in Edit/Status window. */ if (rc != IZ_UNSUP) PostMessage(hWnd, WM_COMMAND, IDM_SETFOCUS_ON_STATUS, 0L); fSpool = FALSE; } break; case 2: /* test */ lpDCL->ncflag = 0; lpDCL->fQuiet = 0; lpDCL->ntflag = 1; lpDCL->nvflag = 0; lpDCL->nUflag = 1; lpDCL->nzflag = 0; lpDCL->ndflag = 0; lpDCL->noflag = 0; lpDCL->naflag = 0; lpDCL->nZIflag = 0; lpDCL->lpszZipFN = lpumb->szFileName; argv = (char **)szFileList; hSaveCursor = SetCursor(hHourGlass); ShowCursor(TRUE); lpDCL->lpszExtractDir = NULL; Unz_SingleEntryPoint(argc, argv, 0, NULL, lpDCL, lpUserFunctions); ShowCursor(FALSE); SetCursor(hSaveCursor); break; case 3: /* Get Zip Information */ { lpDCL->fQuiet = 2; lpDCL->ncflag = 0; lpDCL->ntflag = 0; lpDCL->nvflag = 0; lpDCL->nUflag = 0; lpDCL->nzflag = 0; lpDCL->ndflag = 0; lpDCL->noflag = 0; lpDCL->naflag = 0; lpDCL->nZIflag = 1; lpDCL->lpszZipFN = lpumb->szFileName; argv = (char **)szFileList; hSaveCursor = SetCursor(hHourGlass); ShowCursor(TRUE); lpDCL->lpszExtractDir = NULL; Unz_SingleEntryPoint(argc, argv, 0, NULL, lpDCL, lpUserFunctions); ShowCursor(FALSE); SetCursor(hSaveCursor); lpDCL->nZIflag = 0; break; } case 4: /* Delete Archive Entries */ { int retcode; /* Save off zip flags */ BOOL fSuffix = ZpOpt.fSuffix; BOOL fEncrypt = ZpOpt.fEncrypt; BOOL fSystem = ZpOpt.fSystem; BOOL fVolume = ZpOpt.fVolume; BOOL fExtra = ZpOpt.fExtra; BOOL fNoDirEntries = ZpOpt.fNoDirEntries; BOOL fExcludeDate = ZpOpt.fExcludeDate; BOOL fVerbose = ZpOpt.fVerbose; BOOL fQuiet = ZpOpt.fQuiet; BOOL fCRLF_LF = ZpOpt.fCRLF_LF; BOOL fLF_CRLF = ZpOpt.fLF_CRLF; BOOL fJunkDir = ZpOpt.fJunkDir; BOOL fRecurse = ZpOpt.fRecurse; BOOL fGrow = ZpOpt.fGrow; BOOL fForce = ZpOpt.fForce; BOOL fMove = ZpOpt.fMove; BOOL fUpdate = ZpOpt.fUpdate; BOOL fFreshen = ZpOpt.fFreshen; BOOL fJunkSFX = ZpOpt.fJunkSFX; BOOL fLatestTime = ZpOpt.fLatestTime; BOOL fmakesfx = fMakeSFX; BOOL fComment = ZpOpt.fComment; BOOL fOffsets = ZpOpt.fOffsets; /* Set all zip flags to false */ ZpOpt.fSuffix = FALSE; ZpOpt.fEncrypt = FALSE; ZpOpt.fSystem = FALSE; ZpOpt.fVolume = FALSE; ZpOpt.fExtra = FALSE; ZpOpt.fNoDirEntries = FALSE; ZpOpt.fExcludeDate = FALSE; ZpOpt.fVerbose = FALSE; ZpOpt.fQuiet = FALSE; ZpOpt.fCRLF_LF = FALSE; ZpOpt.fLF_CRLF = FALSE; ZpOpt.fJunkDir = FALSE; ZpOpt.fRecurse = FALSE; ZpOpt.fGrow = FALSE; ZpOpt.fForce = FALSE; ZpOpt.fMove = FALSE; ZpOpt.fUpdate = FALSE; ZpOpt.fFreshen = FALSE; ZpOpt.fJunkSFX = FALSE; ZpOpt.fLatestTime = FALSE; ZpOpt.fComment = FALSE; ZpOpt.fOffsets = FALSE; fMakeSFX = FALSE; ZpOpt.fDeleteEntries = TRUE; ZpZCL.argc = argc; ZpZCL.lpszZipFN = lpumb->szFileName; ZpZCL.FNV = (char **)szFileList; retcode = MessageBox(hWndMain, "Are You Sure?", "Deleting Archive Entries", MB_OKCANCEL | MB_ICONEXCLAMATION); if (retcode == IDOK) { BufferOut( "Deleting Files From Archive: %s\n", lpumb->szFileName); hSaveCursor = SetCursor(hHourGlass); ShowCursor(TRUE); ZipSetOptions(ZpOpt); retcode = ZipArchive(ZpZCL); ShowCursor(FALSE); SetCursor(hSaveCursor); if (retcode == ZE_OK) UpdateListBox(); } else BufferOut( "Deleting Files from archive canceled\n"); /* Restore zip flags */ ZpOpt.fDeleteEntries = FALSE; ZpOpt.fSuffix = fSuffix; ZpOpt.fEncrypt = fEncrypt; ZpOpt.fSystem = fSystem; ZpOpt.fVolume = fVolume; ZpOpt.fExtra = fExtra; ZpOpt.fNoDirEntries = fNoDirEntries; ZpOpt.fExcludeDate = fExcludeDate; ZpOpt.fVerbose = fVerbose; ZpOpt.fQuiet = fQuiet; ZpOpt.fCRLF_LF = fCRLF_LF; ZpOpt.fLF_CRLF = fLF_CRLF; ZpOpt.fJunkDir = fJunkDir; ZpOpt.fRecurse = fRecurse; ZpOpt.fGrow = fGrow; ZpOpt.fForce = fForce; ZpOpt.fMove = fMove; ZpOpt.fUpdate = fUpdate; ZpOpt.fFreshen = fFreshen; ZpOpt.fJunkSFX = fJunkSFX; ZpOpt.fLatestTime = fLatestTime; ZpOpt.fComment = fComment; ZpOpt.fOffsets = fOffsets; fMakeSFX = fmakesfx; } break; case 5: /* Update Archive Entries */ { int retcode;#ifndef WIN32 FARPROC lpGetDirProc;#endif dwCommDlgHelpId = HELPID_ZIP_UPDATE_ARCHIVE; ZpZCL.argc = argc; ZpZCL.lpszZipFN = lpumb->szFileName; ZpZCL.FNV = (char **)szFileList; retcode = MessageBox(hWndMain, "Are You Sure?", "Update All Archive Entries", MB_OKCANCEL | MB_ICONEXCLAMATION); if (retcode == IDOK) { OPENFILENAME ofn; char szTemp[256];#ifndef WIN32 _fmemset(&ofn, '\0', sizeof(OPENFILENAME)); /* initialize struct */#else memset(&ofn, '\0', sizeof(OPENFILENAME)); /* initialize struct */#endif WinAssert(hWnd); szTemp[0] = '\0'; ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hWnd; ofn.hInstance = hInst; ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0"; ofn.nFilterIndex = 1; ofn.lpstrFile = szTemp; ofn.nMaxFile = PATH_MAX; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = PATH_MAX; /* ignored ! */ ofn.lpstrTitle = (LPSTR)"Set Reference Directory"; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_SHOWHELP | OFN_ENABLEHOOK | OFN_CREATEPROMPT | OFN_HIDEREADONLY|OFN_ENABLETEMPLATE;#ifndef WIN32 lpGetDirProc = MakeProcInstance((FARPROC)GetDirProc, hInst);# ifndef MSC (UINT CALLBACK *)ofn.lpfnHook = (UINT CALLBACK *)lpGetDirProc;# else ofn.lpfnHook = lpGetDirProc;# endif#else ofn.lpfnHook = (LPOFNHOOKPROC)GetDirProc;#endif ofn.lpTemplateName = "GETDIR"; /* see getfiles.dlg */ if ((GetOpenFileName(&ofn)) && (szRefDir[0] != '\0')) { BufferOut( "Updating Files in Archive: %s\n", lpumb->szFileName); hSaveCursor = SetCursor(hHourGlass); ShowCursor(TRUE); ZipSetOptions(ZpOpt); retcode = ZipArchive(ZpZCL); ShowCursor(FALSE); SetCursor(hSaveCursor); if (retcode == ZE_OK) UpdateListBox(); } } else BufferOut( "Updating archive canceled\n"); break; } } } while (iSelection < cSelLBItems); /* march through list box checking what's selected * and what is not. */done: if ( hMem ) { GlobalUnlock( hMem ); GlobalFree( hMem ); } if (hFileList) { GlobalUnlock(hFileList); GlobalFree(hFileList); } GlobalUnlock(hnd); GlobalFree(hnd); ShowCursor(FALSE); SetCursor(hSaveCursor); ReleaseCapture(); SoundAfter(); /* play sound afterward if requested */ if (!uf.fIconSwitched) /* if haven't already, switch icons */ { HANDLE hIcon; hIcon = LoadIcon(hInst,"unzipped"); /* load final icon */ WinAssert(hIcon);#ifndef WIN32 SetClassWord(hWndMain, GCW_HICON, hIcon);#else SetClassLong(hWndMain, GCL_HICON, (LONG)hIcon);#endif uf.fIconSwitched = TRUE; /* flag that we've switched it */ }}/* Display the archive comment using the Info-ZIP engine. */void DisplayComment(HWND hWnd){ SetCapture(hWnd); hSaveCursor = SetCursor(hHourGlass); ShowCursor(TRUE); bRealTimeMsgUpdate = FALSE; /* Called here when showing zipfile comment */ lpDCL->ncflag = 0; lpDCL->fQuiet = 0; lpDCL->ntflag = 0; lpDCL->nvflag = 0; lpDCL->nUflag = 1; lpDCL->nzflag = 1; lpDCL->ndflag = 0; lpDCL->noflag = 0; lpDCL->naflag = 0; argc = 0; lpDCL->lpszZipFN = lpumb->szFileName; argv = NULL; lpDCL->lpszExtractDir = NULL; Unz_SingleEntryPoint(argc, argv, 0, NULL, lpDCL, lpUserFunctions); ShowCursor(FALSE); SetCursor(hSaveCursor); bRealTimeMsgUpdate = TRUE; ReleaseCapture(); SoundAfter(); /* play sound during if requested */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -