HRESULT __stdcall CArchiveOpenCallback::SetCompleted (const UInt64 *files, const UInt64 *bytes) { if ( CheckForEsc() ) return E_FAIL; if ( !(*files & 0x1f) && (GetTickCount ()-m_dwStartTime > 500) ) { m_bProgressMessage = true; } return S_OK; }
void ProgressAction::ShowProgress() { DWORD dwTicks1 = GetTickCount(); if(dwTicks1-dwTicks > TICK_INTERVAL_TO_SHOW) { TCHAR buf[80]; ProgressMessage(buf); const TCHAR *Items[]={ProgressTitle(),buf}; Message(0,NULL,Items,_countof(Items),0); if(CheckForEsc()) { AbortAction(); SetLastError(ERROR_CANCELLED); throw WinExcept(ERROR_CANCELLED); } dwTicks = dwTicks1; } }
void FileList::ReadFileNames(int KeepSelection, int IgnoreVisible, int DrawMessage) { TPreRedrawFuncGuard preRedrawFuncGuard(PR_ReadFileNamesMsg); TaskBar TB(false); strOriginalCurDir=strCurDir; if (!IsVisible() && !IgnoreVisible) { UpdateRequired=TRUE; UpdateRequiredMode=KeepSelection; return; } UpdateRequired=FALSE; AccessTimeUpdateRequired=FALSE; DizRead=FALSE; FAR_FIND_DATA_EX fdata; FileListItem *CurPtr=0,**OldData=0; string strCurName, strNextCurName; int OldFileCount=0; StopFSWatcher(); if (this!=CtrlObject->Cp()->LeftPanel && this!=CtrlObject->Cp()->RightPanel) return; string strSaveDir; apiGetCurrentDirectory(strSaveDir); { string strOldCurDir = strCurDir; if (!SetCurPath()) { FlushInputBuffer(); // Очистим буффер ввода, т.к. мы уже можем быть в другом месте... if (!StrCmp(strCurDir, strOldCurDir)) //?? i?? { GetPathRoot(strOldCurDir,strOldCurDir); if (!apiIsDiskInDrive(strOldCurDir)) IfGoHome(strOldCurDir.At(0)); /* При смене каталога путь не изменился */ } return; } } SortGroupsRead=FALSE; if (GetFocus()) CtrlObject->CmdLine->SetCurDir(strCurDir); LastCurFile=-1; Panel *AnotherPanel=CtrlObject->Cp()->GetAnotherPanel(this); AnotherPanel->QViewDelTempName(); size_t PrevSelFileCount=SelFileCount; SelFileCount=0; SelFileSize=0; TotalFileCount=0; TotalFileSize=0; CacheSelIndex=-1; CacheSelClearIndex=-1; if (Opt.ShowPanelFree) { unsigned __int64 TotalSize,TotalFree; if (!apiGetDiskSize(strCurDir,&TotalSize,&TotalFree,&FreeDiskSize)) FreeDiskSize=0; } if (FileCount>0) { strCurName = ListData[CurFile]->strName; if (ListData[CurFile]->Selected) { for (int i=CurFile+1; i < FileCount; i++) { CurPtr = ListData[i]; if (!CurPtr->Selected) { strNextCurName = CurPtr->strName; break; } } } } if (KeepSelection || PrevSelFileCount>0) { OldData=ListData; OldFileCount=FileCount; } else DeleteListData(ListData,FileCount); ListData=nullptr; int ReadOwners=IsColumnDisplayed(OWNER_COLUMN); int ReadNumLinks=IsColumnDisplayed(NUMLINK_COLUMN); int ReadNumStreams=IsColumnDisplayed(NUMSTREAMS_COLUMN); int ReadStreamsSize=IsColumnDisplayed(STREAMSSIZE_COLUMN); string strComputerName; if (ReadOwners) { CurPath2ComputerName(strCurDir, strComputerName); // сбросим кэш SID`ов SIDCacheFlush(); } SetLastError(ERROR_SUCCESS); int AllocatedCount=0; FileListItem *NewPtr; // сформируем заголовок вне цикла wchar_t Title[2048]; int TitleLength=Min((int)X2-X1-1,(int)(ARRAYSIZE(Title))-1); //wmemset(Title,0x0CD,TitleLength); //BUGBUG //Title[TitleLength]=0; MakeSeparator(TitleLength, Title, 9, nullptr); BOOL IsShowTitle=FALSE; BOOL NeedHighlight=Opt.Highlight && PanelMode != PLUGIN_PANEL; if (!Filter) Filter=new FileFilter(this,FFT_PANEL); //Рефреш текущему времени для фильтра перед началом операции Filter->UpdateCurrentTime(); CtrlObject->HiFiles->UpdateCurrentTime(); bool bCurDirRoot = false; ParsePath(strCurDir, nullptr, &bCurDirRoot); PATH_TYPE Type = ParsePath(strCurDir, nullptr, &bCurDirRoot); bool NetRoot = bCurDirRoot && (Type == PATH_REMOTE || Type == PATH_REMOTEUNC); FileCount = 0; string strFind = strCurDir; AddEndSlash(strFind); strFind+=L'*'; ::FindFile Find(strFind, true); DWORD FindErrorCode = ERROR_SUCCESS; bool UseFilter=Filter->IsEnabledOnPanel(); bool ReadCustomData=IsColumnDisplayed(CUSTOM_COLUMN0)!=0; DWORD StartTime = GetTickCount(); while (Find.Get(fdata)) { FindErrorCode = GetLastError(); if ((Opt.ShowHidden || !(fdata.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) && (!UseFilter || Filter->FileInFilter(fdata, nullptr, &fdata.strFileName))) { if (FileCount>=AllocatedCount) { AllocatedCount+=4096; FileListItem **pTemp; if (!(pTemp=(FileListItem **)xf_realloc(ListData,AllocatedCount*sizeof(*ListData)))) break; ListData=pTemp; } ListData[FileCount] = new FileListItem; ListData[FileCount]->Clear(); NewPtr=ListData[FileCount]; NewPtr->FileAttr = fdata.dwFileAttributes; NewPtr->CreationTime = fdata.ftCreationTime; NewPtr->AccessTime = fdata.ftLastAccessTime; NewPtr->WriteTime = fdata.ftLastWriteTime; NewPtr->ChangeTime = fdata.ftChangeTime; NewPtr->FileSize = fdata.nFileSize; NewPtr->AllocationSize = fdata.nAllocationSize; NewPtr->strName = fdata.strFileName; NewPtr->strShortName = fdata.strAlternateFileName; NewPtr->Position=FileCount++; NewPtr->NumberOfLinks=1; if (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { NewPtr->ReparseTag=fdata.dwReserved0; //MSDN } if (!(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { TotalFileSize += NewPtr->FileSize; if (ReadNumLinks) NewPtr->NumberOfLinks=GetNumberOfLinks(fdata.strFileName); } else { NewPtr->AllocationSize = 0; } NewPtr->SortGroup=DEFAULT_SORT_GROUP; if (ReadOwners) { string strOwner; GetFileOwner(strComputerName, NewPtr->strName,strOwner); NewPtr->strOwner = strOwner; } NewPtr->NumberOfStreams=NewPtr->FileAttr&FILE_ATTRIBUTE_DIRECTORY?0:1; NewPtr->StreamsSize=NewPtr->FileSize; if (ReadNumStreams||ReadStreamsSize) { EnumStreams(TestParentFolderName(fdata.strFileName)?strCurDir:fdata.strFileName,NewPtr->StreamsSize,NewPtr->NumberOfStreams); } if (ReadCustomData) CtrlObject->Plugins->GetCustomData(NewPtr); if (!(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) TotalFileCount++; //memcpy(ListData+FileCount,&NewPtr,sizeof(NewPtr)); // FileCount++; DWORD CurTime = GetTickCount(); if (CurTime - StartTime > RedrawTimeout) { StartTime = CurTime; if (IsVisible()) { if (!IsShowTitle) { if (!DrawMessage) { Text(X1+1,Y1,ColorIndexToColor(COL_PANELBOX),Title); IsShowTitle=TRUE; SetColor(Focus ? COL_PANELSELECTEDTITLE:COL_PANELTITLE); } } LangString strReadMsg(MReadingFiles); strReadMsg << FileCount; if (DrawMessage) { ReadFileNamesMsg(strReadMsg); } else { TruncStr(strReadMsg,TitleLength-2); int MsgLength=(int)strReadMsg.GetLength(); GotoXY(X1+1+(TitleLength-MsgLength-1)/2,Y1); FS<<L" "<<strReadMsg<<L" "; } } if (CheckForEsc()) { break; } } } } if (!(FindErrorCode==ERROR_SUCCESS || FindErrorCode==ERROR_NO_MORE_FILES || FindErrorCode==ERROR_FILE_NOT_FOUND)) Message(MSG_WARNING|MSG_ERRORTYPE,1,MSG(MError),MSG(MReadFolderError),MSG(MOk)); if ((Opt.ShowDotsInRoot || !bCurDirRoot) || (NetRoot && CtrlObject->Plugins->FindPlugin(Opt.KnownIDs.Network))) // NetWork Plugin { if (FileCount>=AllocatedCount) { FileListItem **pTemp; if ((pTemp=(FileListItem **)xf_realloc(ListData,(FileCount+1)*sizeof(*ListData)))) ListData=pTemp; } if (ListData) { ListData[FileCount] = new FileListItem; string TwoDotsOwner; if (ReadOwners) { GetFileOwner(strComputerName,strCurDir,TwoDotsOwner); } FILETIME TwoDotsTimes[4]={}; if(apiGetFindDataEx(strCurDir,fdata)) { TwoDotsTimes[0]=fdata.ftCreationTime; TwoDotsTimes[1]=fdata.ftLastAccessTime; TwoDotsTimes[2]=fdata.ftLastWriteTime; TwoDotsTimes[3]=fdata.ftChangeTime; } AddParentPoint(ListData[FileCount],FileCount,TwoDotsTimes,TwoDotsOwner); FileCount++; } } if (IsColumnDisplayed(DIZ_COLUMN)) ReadDiz(); if (NeedHighlight) { CtrlObject->HiFiles->GetHiColor(ListData, FileCount); } if (AnotherPanel->GetMode()==PLUGIN_PANEL) { HANDLE hAnotherPlugin=AnotherPanel->GetPluginHandle(); PluginPanelItem *PanelData=nullptr; string strPath; size_t PanelCount=0; strPath = strCurDir; AddEndSlash(strPath); if (CtrlObject->Plugins->GetVirtualFindData(hAnotherPlugin,&PanelData,&PanelCount,strPath)) { FileListItem **pTemp; if ((pTemp=(FileListItem **)xf_realloc(ListData,(FileCount+PanelCount)*sizeof(*ListData)))) { ListData=pTemp; for (size_t i=0; i < PanelCount; i++) { CurPtr = ListData[FileCount+i]; PluginPanelItem &pfdata=PanelData[i]; PluginToFileListItem(&PanelData[i],CurPtr); CurPtr->Position=FileCount; TotalFileSize += pfdata.FileSize; CurPtr->PrevSelected=CurPtr->Selected=0; CurPtr->ShowFolderSize=0; CurPtr->SortGroup=CtrlObject->HiFiles->GetGroup(CurPtr); if (!TestParentFolderName(pfdata.FileName) && !(CurPtr->FileAttr & FILE_ATTRIBUTE_DIRECTORY)) TotalFileCount++; } // цветовую боевую раскраску в самом конце, за один раз CtrlObject->HiFiles->GetHiColor(&ListData[FileCount],PanelCount); FileCount+=static_cast<int>(PanelCount); } CtrlObject->Plugins->FreeVirtualFindData(hAnotherPlugin,PanelData,PanelCount); } } InitFSWatcher(false); CorrectPosition(); if (KeepSelection || PrevSelFileCount>0) { MoveSelection(ListData,FileCount,OldData,OldFileCount); DeleteListData(OldData,OldFileCount); } if (SortGroups) ReadSortGroups(false); if (!KeepSelection && PrevSelFileCount>0) { SaveSelection(); ClearSelection(); } SortFileList(FALSE); if (CurFile>=FileCount || StrCmpI(ListData[CurFile]->strName,strCurName)) if (!GoToFile(strCurName) && !strNextCurName.IsEmpty()) GoToFile(strNextCurName); /* $ 13.02.2002 DJ SetTitle() - только если мы текущий фрейм! */ if (CtrlObject->Cp() == FrameManager->GetCurrentFrame()) SetTitle(); FarChDir(strSaveDir); //??? }
int FTP::GetFindData(PluginPanelItem **pPanelItem, int *pItemsNumber, int OpMode) { PROC(("FTP::GetFindData",NULL)) DWORD b,e; char *Data[3]; *pPanelItem = NULL; *pItemsNumber = 0; //Hosts if(ShowHosts) { EnumHost Enum(HostsPath); FP_SizeItemList il(FALSE); PluginPanelItem tmp; FTPHost h; if(!IS_SILENT(OpMode)) { memset(&tmp, 0, sizeof(tmp)); strcpy(tmp.FindData.cFileName,".."); tmp.FindData.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; if(!IS_SILENT(OpMode)) { tmp.Description = (char *)".."; tmp.CustomColumnNumber = 3; tmp.CustomColumnData = Data; tmp.CustomColumnData[0] = (char *)".."; tmp.CustomColumnData[1] = (char *)".."; tmp.CustomColumnData[2] = (char *)".."; } if(!il.Add(&tmp)) return FALSE; } while(true) { if(!Enum.GetNextHost(&h)) break; if(!h.Read(NULL)) continue; memset(&tmp, 0, sizeof(tmp)); /* Panel item MUST have name the save as file saved to disk in case you want to copy between panels work. */ h.MkINIFile(tmp.FindData.cFileName,NULL,""); tmp.FindData.ftLastWriteTime = h.LastWrite; tmp.FindData.dwFileAttributes = h.Folder ? FILE_ATTRIBUTE_DIRECTORY : 0; tmp.Flags = PPIF_USERDATA; tmp.PackSizeHigh = FTP_HOSTID; tmp.UserData = (DWORD_PTR)&h; if(!IS_SILENT(OpMode)) { tmp.Description = h.HostDescr; tmp.CustomColumnNumber = 3; tmp.CustomColumnData = Data; tmp.CustomColumnData[0] = h.Host; //C0 tmp.CustomColumnData[1] = h.Home; //C1 tmp.CustomColumnData[2] = h.User; //C2 } if(!il.Add(&tmp)) return FALSE; Log(("Item[%d]=[%s] attr=%08X", il.Count()-1, FTP_FILENAME(il.Item(il.Count()-1)), il.Item(il.Count()-1)->FindData.dwFileAttributes)); } *pPanelItem = il.Items(); *pItemsNumber = il.Count(); return TRUE; } //FTP FP_Screen _scr; FTPFileInfo FileInfo; if(!hConnect) { goto AskConnect; } Restart: if(!FtpFindFirstFile(hConnect, "*", &FileInfo, &ResetCache)) { if(GetLastError() == ERROR_NO_MORE_FILES) { *pItemsNumber = 0; return TRUE; } if(SwitchingToFTP && GetLastError() == ERROR_CANCELLED) { ; } else { if(CurrentState == fcsExpandList) { FreeFindData(*pPanelItem,*pItemsNumber); *pPanelItem = NULL; *pItemsNumber = 0; return FALSE; } //Query reconnect do { if(!hConnect) break; if(GetLastError() == ERROR_CANCELLED) break; if(!hConnect->ConnectMessageTimeout(MConnectionLost,Host.HostName,-MRestore)) { Log(("WaitMessage cancelled")); break; } if(FtpCmdLineAlive(hConnect) && FtpKeepAlive(hConnect)) goto Restart; if(SelectFile.Length() && CurrentState != fcsExpandList) SaveUsedDirNFile(); AskConnect: if(Connect()) goto Restart; else break; } while(true); } if(!ShowHosts) BackToHosts(); FreeFindData(*pPanelItem, *pItemsNumber); return GetFindData(pPanelItem,pItemsNumber,OpMode); } GET_TIME(b); do { if(Opt.ShowIdle) { char str[ 200 ]; GET_TIME(e); if(CMP_TIME(e,b) > 0.5) { _snprintf(str,ARRAYSIZE(str),"%s%d", FP_GetMsg(MReaded), *pItemsNumber); SetLastError(ERROR_SUCCESS); IdleMessage(str,Opt.ProcessColor); b = e; if(CheckForEsc(FALSE)) { SetLastError(ERROR_CANCELLED); return FALSE; } } } PluginPanelItem *NewPanelItem=*pPanelItem; if((*pItemsNumber % 1024) == 0) { if(!NewPanelItem) NewPanelItem = (PluginPanelItem *)malloc((1024+1)*sizeof(PluginPanelItem)); else NewPanelItem = (PluginPanelItem *)realloc(NewPanelItem,(*pItemsNumber+1024+1)*sizeof(PluginPanelItem)); if(NewPanelItem == NULL) { /*-*/Log(("GetFindData(file)::!reallocate plugin panels items %d -> %d",*pItemsNumber,*pItemsNumber+1024+1)); return FALSE; } *pPanelItem=NewPanelItem; } PluginPanelItem *CurItem = &NewPanelItem[*pItemsNumber]; memset(CurItem, 0, sizeof(PluginPanelItem)); CurItem->FindData = FileInfo.FindData; if(!IS_SILENT(OpMode)) { CurItem->CustomColumnNumber = FTP_COL_MAX; CurItem->Owner = FileInfo.FTPOwner[0] ? strdup(FileInfo.FTPOwner) : NULL; CurItem->CustomColumnData = (LPSTR*)malloc(sizeof(LPSTR*)*FTP_COL_MAX); CurItem->CustomColumnData[FTP_COL_MODE] = strdup(FileInfo.UnixMode); CurItem->CustomColumnData[FTP_COL_LINK] = strdup(FileInfo.Link); hConnect->ToOEM(CurItem->CustomColumnData[FTP_COL_LINK]); } (*pItemsNumber)++; } while(FtpFindNextFile(hConnect,&FileInfo)); return TRUE; }
void DizList::Read(const string& Path, const string* DizName) { Reset(); TPreRedrawFuncGuard preRedrawFuncGuard(DizList::PR_ReadingMsg); const wchar_t *NamePtr=Opt.Diz.strListNames; for (;;) { if (DizName) { strDizFileName = *DizName; } else { strDizFileName = Path; if (!PathCanHoldRegularFile(strDizFileName)) break; string strArgName; if (!(NamePtr=GetCommaWord(NamePtr,strArgName))) break; AddEndSlash(strDizFileName); strDizFileName += strArgName; } File DizFile; if (DizFile.Open(strDizFileName,GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING)) { GetFileString GetStr(DizFile); wchar_t *DizText; int DizLength; clock_t StartTime=clock(); uintptr_t CodePage=CP_DEFAULT; bool bSigFound=false; if (!GetFileFormat(DizFile,CodePage,&bSigFound,false) || !bSigFound) CodePage = Opt.Diz.AnsiByDefault ? CP_ACP : CP_OEMCP; while (GetStr.GetString(&DizText, CodePage, DizLength) > 0) { if (!(DizCount & 127) && clock()-StartTime>1000) { SetCursorType(FALSE,0); PR_ReadingMsg(); if (CheckForEsc()) break; } RemoveTrailingSpaces(DizText); if (*DizText) AddRecord(DizText); } OrigCodePage=CodePage; Modified=false; DizFile.Close(); return; } if (DizName) break; } Modified=false; strDizFileName.Clear(); }
void FileList::ReadFileNames(int KeepSelection, int UpdateEvenIfPanelInvisible, int DrawMessage) { SCOPED_ACTION(TPreRedrawFuncGuard)(std::make_unique<FileListPreRedrawItem>()); SCOPED_ACTION(TaskBar)(false); strOriginalCurDir = strCurDir; if (!IsVisible() && !UpdateEvenIfPanelInvisible) { UpdateRequired=TRUE; UpdateRequiredMode=KeepSelection; return; } UpdateRequired=FALSE; AccessTimeUpdateRequired=FALSE; DizRead=FALSE; api::FAR_FIND_DATA fdata; decltype(ListData) OldData; string strCurName, strNextCurName; StopFSWatcher(); if (this!=Global->CtrlObject->Cp()->LeftPanel && this!=Global->CtrlObject->Cp()->RightPanel) return; string strSaveDir; api::GetCurrentDirectory(strSaveDir); { string strOldCurDir(strCurDir); if (!SetCurPath()) { FlushInputBuffer(); // Очистим буффер ввода, т.к. мы уже можем быть в другом месте... if (strCurDir == strOldCurDir) //?? i?? { GetPathRoot(strOldCurDir,strOldCurDir); if (!api::IsDiskInDrive(strOldCurDir)) IfGoHome(strOldCurDir.front()); /* При смене каталога путь не изменился */ } return; } } SortGroupsRead=FALSE; if (GetFocus()) Global->CtrlObject->CmdLine->SetCurDir(strCurDir); LastCurFile=-1; Panel *AnotherPanel=Global->CtrlObject->Cp()->GetAnotherPanel(this); AnotherPanel->QViewDelTempName(); size_t PrevSelFileCount=SelFileCount; SelFileCount=0; SelFileSize=0; TotalFileCount=0; TotalFileSize=0; CacheSelIndex=-1; CacheSelClearIndex=-1; FreeDiskSize = -1; if (Global->Opt->ShowPanelFree) { api::GetDiskSize(strCurDir, nullptr, nullptr, &FreeDiskSize); } if (!ListData.empty()) { strCurName = ListData[CurFile].strName; if (ListData[CurFile].Selected && !ReturnCurrentFile) { for (size_t i=CurFile+1; i < ListData.size(); i++) { if (!ListData[i].Selected) { strNextCurName = ListData[i].strName; break; } } } } if (KeepSelection || PrevSelFileCount>0) { OldData.swap(ListData); } else DeleteListData(ListData); DWORD FileSystemFlags = 0; string PathRoot; GetPathRoot(strCurDir, PathRoot); api::GetVolumeInformation(PathRoot, nullptr, nullptr, nullptr, &FileSystemFlags, nullptr); ListData.clear(); bool ReadOwners = IsColumnDisplayed(OWNER_COLUMN); bool ReadNumLinks = IsColumnDisplayed(NUMLINK_COLUMN); bool ReadNumStreams = IsColumnDisplayed(NUMSTREAMS_COLUMN); bool ReadStreamsSize = IsColumnDisplayed(STREAMSSIZE_COLUMN); if (!(FileSystemFlags&FILE_SUPPORTS_HARD_LINKS) && IsWindows7OrGreater()) { ReadNumLinks = false; } if(!(FileSystemFlags&FILE_NAMED_STREAMS)) { ReadNumStreams = false; ReadStreamsSize = false; } string strComputerName; if (ReadOwners) { string strTemp; CurPath2ComputerName(strCurDir, strComputerName, strTemp); } SetLastError(ERROR_SUCCESS); // сформируем заголовок вне цикла string Title = MakeSeparator(X2-X1-1, 9, nullptr); BOOL IsShowTitle=FALSE; BOOL NeedHighlight=Global->Opt->Highlight && PanelMode != PLUGIN_PANEL; if (!Filter) Filter = std::make_unique<FileFilter>(this,FFT_PANEL); //Рефреш текущему времени для фильтра перед началом операции Filter->UpdateCurrentTime(); Global->CtrlObject->HiFiles->UpdateCurrentTime(); bool bCurDirRoot = false; ParsePath(strCurDir, nullptr, &bCurDirRoot); PATH_TYPE Type = ParsePath(strCurDir, nullptr, &bCurDirRoot); bool NetRoot = bCurDirRoot && (Type == PATH_REMOTE || Type == PATH_REMOTEUNC); string strFind(strCurDir); AddEndSlash(strFind); strFind+=L'*'; api::FindFile Find(strFind, true); DWORD FindErrorCode = ERROR_SUCCESS; bool UseFilter=Filter->IsEnabledOnPanel(); bool ReadCustomData=IsColumnDisplayed(CUSTOM_COLUMN0)!=0; DWORD StartTime = GetTickCount(); std::all_of(CONST_RANGE(Find, fdata) -> bool { Global->CatchError(); FindErrorCode = Global->CaughtError(); if ((Global->Opt->ShowHidden || !(fdata.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) && (!UseFilter || Filter->FileInFilter(fdata, nullptr, &fdata.strFileName))) { if (ListData.size() == ListData.capacity()) ListData.reserve(ListData.size() + 4096); ListData.emplace_back(VALUE_TYPE(ListData)()); auto& NewItem = ListData.back(); NewItem.FileAttr = fdata.dwFileAttributes; NewItem.CreationTime = fdata.ftCreationTime; NewItem.AccessTime = fdata.ftLastAccessTime; NewItem.WriteTime = fdata.ftLastWriteTime; NewItem.ChangeTime = fdata.ftChangeTime; NewItem.FileSize = fdata.nFileSize; NewItem.AllocationSize = fdata.nAllocationSize; NewItem.strName = fdata.strFileName; NewItem.strShortName = fdata.strAlternateFileName; NewItem.Position = ListData.size() - 1; NewItem.NumberOfLinks=1; if (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) { NewItem.ReparseTag=fdata.dwReserved0; //MSDN } if (!(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { TotalFileSize += NewItem.FileSize; if (ReadNumLinks) NewItem.NumberOfLinks = GetNumberOfLinks(fdata.strFileName, true); } else { NewItem.AllocationSize = 0; } NewItem.SortGroup=DEFAULT_SORT_GROUP; if (ReadOwners) { string strOwner; GetFileOwner(strComputerName, NewItem.strName,strOwner); NewItem.strOwner = strOwner; } NewItem.NumberOfStreams=NewItem.FileAttr&FILE_ATTRIBUTE_DIRECTORY?0:1; NewItem.StreamsSize=NewItem.FileSize; if (ReadNumStreams||ReadStreamsSize) { EnumStreams(TestParentFolderName(fdata.strFileName)? strCurDir : fdata.strFileName, NewItem.StreamsSize, NewItem.NumberOfStreams); } if (ReadCustomData) NewItem.strCustomData = Global->CtrlObject->Plugins->GetCustomData(NewItem.strName); if (!(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) TotalFileCount++; DWORD CurTime = GetTickCount(); if (CurTime - StartTime > (DWORD)Global->Opt->RedrawTimeout) { StartTime = CurTime; if (IsVisible()) { if (!IsShowTitle) { if (!DrawMessage) { Text(X1+1,Y1,ColorIndexToColor(COL_PANELBOX),Title); IsShowTitle=TRUE; SetColor(Focus ? COL_PANELSELECTEDTITLE:COL_PANELTITLE); } } LangString strReadMsg(MReadingFiles); strReadMsg << ListData.size(); if (DrawMessage) { ReadFileNamesMsg(strReadMsg); } else { TruncStr(strReadMsg,static_cast<int>(Title.size())-2); int MsgLength=(int)strReadMsg.size(); GotoXY(X1+1+(static_cast<int>(Title.size())-MsgLength-1)/2,Y1); Global->FS << L" "<<strReadMsg<<L" "; } } Global->CtrlObject->Macro.SuspendMacros(true); bool check = CheckForEsc(); Global->CtrlObject->Macro.SuspendMacros(false); if (check) { // break loop return false; } } } return true; });
int PluginClass::ReadArchive(char *Name) { bGOPIFirstCall=true; FreeArcData(); DizPresent=FALSE; HANDLE ArcFindHandle; ArcFindHandle=FindFirstFile(ArcName,&ArcFindData); FindClose(ArcFindHandle); if (ArcFindHandle==INVALID_HANDLE_VALUE) return FALSE; if (!ArcPlugin->OpenArchive(ArcPluginNumber,Name,&ArcPluginType)) return FALSE; memset(&ItemsInfo,0,sizeof(ItemsInfo)); memset(&CurArcInfo,0,sizeof(CurArcInfo)); TotalSize=PackedSize=0; HANDLE hScreen=Info.SaveScreen(0,0,-1,-1); DWORD StartTime=GetTickCount();//clock(); int WaitMessage=FALSE; int AllocatedCount=0; int GetItemCode; while (1) { struct PluginPanelItem CurArcData; struct ArcItemInfo CurItemInfo; memset(&CurArcData,0,sizeof(CurArcData)); memset(&CurItemInfo,0,sizeof(CurItemInfo)); GetItemCode=ArcPlugin->GetArcItem(ArcPluginNumber,&CurArcData,&CurItemInfo); if (GetItemCode!=GETARC_SUCCESS) break; if ((ArcDataCount & 0x1f)==0) { if (CheckForEsc()) { FreeArcData(); ArcPlugin->CloseArchive(ArcPluginNumber,&CurArcInfo); Info.RestoreScreen(NULL); Info.RestoreScreen(hScreen); return -1; } if (GetTickCount()-StartTime>1000) { char FilesMsg[100]; char NameMsg[NM]; FSF.sprintf(FilesMsg,GetMsg(MArcReadFiles),ArcDataCount); const char *MsgItems[]={GetMsg(MArcReadTitle),GetMsg(MArcReading),NameMsg,FilesMsg}; FSF.TruncPathStr(lstrcpyn(NameMsg,Name,sizeof(NameMsg)),MAX_WIDTH_MESSAGE); Info.Message(Info.ModuleNumber,WaitMessage ? FMSG_KEEPBACKGROUND:0,NULL,MsgItems, ARRAYSIZE(MsgItems),0); WaitMessage=TRUE; } } if (*CurItemInfo.Description) { CurArcData.Description=new char[lstrlen(CurItemInfo.Description)+1]; if (CurArcData.Description) lstrcpy(CurArcData.Description,CurItemInfo.Description); DizPresent=TRUE; } if (lstrcmp(ItemsInfo.HostOS,CurItemInfo.HostOS)!=0) lstrcpy(ItemsInfo.HostOS,(*ItemsInfo.HostOS?GetMsg(MSeveralOS):CurItemInfo.HostOS)); ItemsInfo.Solid|=CurItemInfo.Solid; ItemsInfo.Comment|=CurItemInfo.Comment; ItemsInfo.Encrypted|=CurItemInfo.Encrypted; if (CurItemInfo.Encrypted) CurArcData.Flags|=F_ENCRYPTED; if (CurItemInfo.DictSize>ItemsInfo.DictSize) ItemsInfo.DictSize=CurItemInfo.DictSize; if (CurItemInfo.UnpVer>ItemsInfo.UnpVer) ItemsInfo.UnpVer=CurItemInfo.UnpVer; CurArcData.NumberOfLinks=1; *CurArcData.FindData.cAlternateFileName=0; NormalizePath(CurArcData.FindData.cFileName,CurArcData.FindData.cFileName); char *NamePtr=CurArcData.FindData.cFileName; for (int I=0; *NamePtr ;I++, NamePtr++) if (*NamePtr=='/') *NamePtr='\\'; struct ArcItemUserData *aud=NULL; char *Pref=NULL; NamePtr=CurArcData.FindData.cFileName; char *EndPos=NamePtr; while(*EndPos == '.') EndPos++; if(*EndPos == '\\') while(*EndPos == '\\') EndPos++; else EndPos=NamePtr; if(EndPos != NamePtr) { Pref=(char *)malloc((int)(EndPos-NamePtr)+1); if(Pref) { memcpy(Pref,NamePtr,(int)(EndPos-NamePtr)); Pref[(int)(EndPos-NamePtr)]=0; } } if(CurArcData.UserData || Pref) { if((aud=(struct ArcItemUserData*)malloc(sizeof(struct ArcItemUserData))) != NULL) { CurArcData.Flags |= PPIF_USERDATA; aud->SizeStruct=sizeof(struct ArcItemUserData); aud->Prefix=Pref; aud->LinkName=CurArcData.UserData?(char *)CurArcData.UserData:NULL; CurArcData.UserData=(DWORD_PTR)aud; } else CurArcData.UserData=0; } if(!CurArcData.UserData && Pref) free(Pref); if (EndPos!=CurArcData.FindData.cFileName) memmove(CurArcData.FindData.cFileName,EndPos,lstrlen(EndPos)+1); int Length=lstrlen(CurArcData.FindData.cFileName); if (Length>0 && (CurArcData.FindData.cFileName[Length-1]=='\\')) { CurArcData.FindData.cFileName[Length-1]=0; CurArcData.FindData.dwFileAttributes|=FILE_ATTRIBUTE_DIRECTORY; } struct PluginPanelItem *NewArcData=ArcData; if (ArcDataCount>=AllocatedCount) { AllocatedCount=AllocatedCount+256+AllocatedCount/4; NewArcData=(PluginPanelItem *)realloc(ArcData,AllocatedCount*sizeof(*ArcData)); } if (NewArcData==NULL) break; TotalSize+=(((__int64)CurArcData.FindData.nFileSizeHigh)<<32)|(__int64)CurArcData.FindData.nFileSizeLow; PackedSize+=(((__int64)CurArcData.PackSizeHigh)<<32)|(__int64)CurArcData.PackSize; ArcData=NewArcData; ArcData[ArcDataCount]=CurArcData; ArcDataCount++; } Info.RestoreScreen(NULL); Info.RestoreScreen(hScreen); if (ArcDataCount>0) ArcData=(PluginPanelItem *)realloc(ArcData,ArcDataCount*sizeof(*ArcData)); ArcPlugin->CloseArchive(ArcPluginNumber,&CurArcInfo); if(GetItemCode != GETARC_EOF && GetItemCode != GETARC_SUCCESS) { switch(GetItemCode) { case GETARC_BROKEN: GetItemCode=MBadArchive; break; case GETARC_UNEXPEOF: GetItemCode=MUnexpEOF; break; case GETARC_READERROR: GetItemCode=MReadError; break; } char NameMsg[NM]; const char *MsgItems[]={GetMsg(MError),NameMsg,GetMsg(GetItemCode),GetMsg(MOk)}; FSF.TruncPathStr(lstrcpyn(NameMsg,Name,sizeof(NameMsg)),MAX_WIDTH_MESSAGE); Info.Message(Info.ModuleNumber,FMSG_WARNING,NULL,MsgItems,ARRAYSIZE(MsgItems),1); return FALSE; // Mantis#0001241 } //Info.RestoreScreen(NULL); //Info.RestoreScreen(hScreen); return TRUE; }
void Connection::recvrequestINT(char *cmd, char *local, char *remote, const char *mode) { int oldtype = 0, is_retr; FHandle fout; SOCKET din = INVALID_SOCKET; int ocode, oecode; BOOL oldBrk = FtpSetBreakable(this, -1); FTPCurrentStates oState = CurrentState; FTNNotify ni; if(type == TYPE_A) restart_point = 0; ni.Upload = FALSE; ni.Starting = TRUE; ni.Success = TRUE; ni.RestartPoint = restart_point; ni.Port = ntohs(portnum); ni.Password[0] = 0; //StrCpy( ni.Password, UserPassword, ARRAYSIZE(ni.Password)); StrCpy(ni.User, UserName, ARRAYSIZE(ni.User)); StrCpy(ni.HostName, hostname, ARRAYSIZE(ni.HostName)); StrCpy(ni.LocalFile, local, ARRAYSIZE(ni.LocalFile)); StrCpy(ni.RemoteFile, remote, ARRAYSIZE(ni.RemoteFile)); if(local[0] == '-' && local[1] == 0) { ; } else { fout.Handle = Fopen(local, mode, Opt.SetHiddenOnAbort ? FILE_ATTRIBUTE_HIDDEN : FILE_ATTRIBUTE_NORMAL); if(!fout.Handle) { ErrorCode = GetLastError(); SysError = TRUE; Log(("!Fopen [%s] %s",mode,__WINError())); if(!ConnectMessage(MErrorOpenFile,local,-MRetry)) ErrorCode = ERROR_CANCELLED; //goto abort; return; } Log(("recv file [%d] \"%s\"=%p",Host.IOBuffSize,local,fout.Handle)); if(restart_point != -1) { if(!Fmove(fout.Handle,restart_point)) { ErrorCode = GetLastError(); SysError = TRUE; if(!ConnectMessage(MErrorPosition,local,-MRetry)) ErrorCode = ERROR_CANCELLED; return; } } TrafficInfo->Resume(restart_point == -1 ? 0 : restart_point); } is_retr = StrCmp(cmd,Opt.cmdRetr) == 0; if(proxy && is_retr) { proxtrans(cmd, local, remote); return; } if(!initconn()) { Log(("!initconn")); return; } if(!is_retr) { if(type != TYPE_A) { oldtype = type; setascii(); } } else if(restart_point) { if(!ResumeSupport) { AddCmdLine(FMSG(MResumeRestart)); restart_point = 0; } else if(restart_point != -1) { if(command("%s %I64u",Opt.cmdRest,restart_point) != RPL_CONTINUE) { Log(("!restart SIZE")); return; } } } if(Host.PassiveMode) { din = dataconn(); if(din == INVALID_SOCKET) { Log(("!dataconn: PASV ent")); goto abort; } } if(remote) { if(command("%s %s", cmd, remote) != RPL_PRELIM) { if(oldtype) SetType(oldtype); Log(("!command [%s]",cmd)); fout.Close(); if(Fsize(local)) DeleteFile(local); return; } } else if(command("%s", cmd) != RPL_PRELIM) { if(oldtype) SetType(oldtype); return; } if(!Host.PassiveMode) { din = dataconn(); if(din == INVALID_SOCKET) { Log(("!dataconn: PASV ret")); goto abort; } } /**/ switch(type) { case TYPE_A: case TYPE_I: case TYPE_L: { FtpSetBreakable(this, FALSE); CurrentState = fcsProcessFile; if(fout.Handle && PluginAvailable(PLUGIN_NOTIFY)) FTPNotify().Notify(&ni); DWORD b,e,bw; __int64 totalValue; int b_done; DWORD ind; int b_ost = Host.IOBuffSize, wsz = get_cluster_size(local)*2; if(!wsz || (wsz > b_ost && (wsz /= 2) > b_ost)) wsz = 512; ind = Min(1024*1024, Max(4*wsz, 256*1024)); // 256K - 1M setsockopt(din, SOL_SOCKET, SO_RCVBUF, (char*)&ind, sizeof(ind)); b_done = ind = 0; totalValue = 0; bool unalign = false; GET_TIME(b); bw = b; while(true) { int c; if(wsz != 512 && b_done >= wsz) // pseudo ansync io { DWORD off = 0, rdy = 0, ost = b_done % wsz, top = b_done - ost; while(ioctlsocket(din, FIONREAD, &rdy) && !rdy) { if(Fwrite(fout.Handle,IOBuff+off,wsz) != wsz) goto write_error; if((off += wsz) >= top) break; } if(off) { b_done -= off; if(b_done) memmove(IOBuff, IOBuff+off, b_done); b_ost = Host.IOBuffSize - b_done; } } //Recv c = nb_recv(&din, IOBuff+b_done, b_ost, 0); if(c <= 0) { if(b_done && Fwrite(fout.Handle,IOBuff,b_done) != b_done) goto write_error; if(c < 0) { Log(("gf(%d,%s)=%I64u: !read buff",code,GetSocketErrorSTR(),totalValue)); code = RPL_TRANSFERERROR; goto NormExit; } Log(("gf(%d,%s)=%I64u: read zero",code,GetSocketErrorSTR(),totalValue)); break; } totalValue += c; GET_TIME(e); if(!fout.Handle) { //Add readed to buffer Log(("AddOutput: +%d bytes", c)); AddOutput((BYTE*)IOBuff,c); } else //Write to file { b_done += c; b_ost -= c; if(b_ost < wsz || CMP_TIME(e,bw) >= 3.0) { DWORD ost = 0; if(wsz == 512 || b_done <= wsz) // timeout or very small buffer { if(Fwrite(fout.Handle,IOBuff,b_done) != b_done) goto write_error; if(b_done < wsz) unalign = true; // flag of timeout witing (optimize) } else { // scatter-gatter for RAID in win32 is very bad on large buffer // and when work without RAID synchronous write speed is independ // if buffer size is >= 2*cluster size int off = 0; if(unalign) // was 'timeouted unaligned write' { unalign = false; off = (DWORD)(totalValue % wsz); if(off) { if(Fwrite(fout.Handle,IOBuff,off) != off) goto write_error; b_done -= off; if(b_done < wsz) { memmove(IOBuff, IOBuff+off, b_done); goto skip_sg; } } } ost = b_done % wsz; b_done -= ost; do if(Fwrite(fout.Handle,IOBuff+off,wsz) != wsz) goto write_error; while((off += wsz) < b_done); if(ost) memmove(IOBuff, IOBuff+off, ost); } b_done = ost; skip_sg: b_ost = Host.IOBuffSize - b_done; GET_TIME(e); bw = e; } } ind += c; if(CMP_TIME(e,b) >= 0.5) { b = e; c = ind; ind = 0; //Call user CB if(IOCallback) { if(!TrafficInfo->Callback(c)) { Log(("gf: canceled by CB")); do_cancel: ErrorCode = ERROR_CANCELLED; if(b_done && Fwrite(fout.Handle,IOBuff,b_done) != b_done) { write_error: SysError = TRUE; ErrorCode = GetLastError(); if(ErrorCode == ERROR_SUCCESS) ErrorCode = ERROR_WRITE_FAULT; // for non equal counter Log(("!write local")); } goto abort; } } else //Show Quite progressing if(Opt.ShowIdle && !remote) { char digit[ 20 ]; String str; str.printf("%s%s ", FP_GetMsg(MReaded), FCps(digit,(double)totalValue)); SetLastError(ERROR_SUCCESS); IdleMessage(str.c_str(),Opt.ProcessColor); if(CheckForEsc(FALSE)) goto do_cancel; } } } if(IOCallback) TrafficInfo->Callback(0); break; } } NormExit: FtpSetBreakable(this, oldBrk); ocode = code; oecode = ErrorCode; CurrentState = oState; scClose(data_peer,-1); if(getreply(FALSE) == RPL_ERROR || oldtype && !SetType(oldtype)) { lostpeer(); } else { code = ocode; ErrorCode = oecode; } if(fout.Handle && PluginAvailable(PLUGIN_NOTIFY)) { ni.Starting = FALSE; ni.Success = TRUE; FTPNotify().Notify(&ni); } return; abort: FtpSetBreakable(this, oldBrk); if(!cpend) { Log(("!!!cpend")); } ocode = code; oecode = ErrorCode; CurrentState = oState; if(!SendAbort(din) || (oldtype && !SetType(oldtype))) lostpeer(); else { code = ocode; ErrorCode = oecode; } scClose(data_peer,-1); if(fout.Handle && PluginAvailable(PLUGIN_NOTIFY)) { ni.Starting = FALSE; ni.Success = FALSE; FTPNotify().Notify(&ni); } return; }
void REProgress::Update(/*LPCTSTR asFileName = NULL*/) { // hScreen == NULL, если FAR в режиме DisableScreenOutput if (hScreen != NULL) { if (bGraphic) { _ASSERTE(hScreen!=NULL); int nCount = 0, nPercent = 0; if (nAllCount > 0 && nCurrent > 0) { if (nCurrent >= nAllCount) { _ASSERTE(nCurrent <= nAllCount); nCount = nProgressLen; nPercent = 100; } else { nCount = (int)((nCurrent * nProgressLen) / nAllCount); if (nCount < 0) { _ASSERTE(nCount >= 0); nCount = 0; } nPercent = (int)((nCurrent * 100) / nAllCount); if (nPercent < 0) nPercent = 0; } } for (int i = 0; i < nCount; i++) sProgress[i] = cFull; for (int i = nCount; i < nProgressLen; i++) sProgress[i] = cHollow; sProgress[nProgressLen] = 0; #ifdef _UNICODE #if FAR_UNICODE>=1900 #define PROGRESSVALUE ProgressValue #endif PROGRESSVALUE pv = {nCurrent,nAllCount}; #if FARMANAGERVERSION_BUILD>=2570 psi.AdvControl(PluginNumber, ACTL_SETPROGRESSSTATE, FADV1988 (void*)TBPS_NORMAL); #else psi.AdvControl(PluginNumber, ACTL_SETPROGRESSSTATE, FADV1988 (void*)PS_NORMAL); #endif psi.AdvControl(PluginNumber, ACTL_SETPROGRESSVALUE, FADV1988 (void*)&pv); #endif if (sFileInfo[0]) { pszMsg = sProgress; const TCHAR *MsgItems[]={pszTitle,sProgress,sFileInfo}; psi.Message(_PluginNumber(guid_PluginGuid),FMSG_LEFTALIGN,NULL,MsgItems,sizeof(MsgItems)/sizeof(MsgItems[0]),0); } else { Message(sProgress, FALSE); } if (!psPercentTitle) { _ASSERTE(psPercentTitle!=NULL); } else { TCHAR sDur[32]; sDur[0] = 0; DWORD nDelta = (GetTickCount() - nStartTick) / 1000; //if (nDelta && nPercent) { //unsigned __int64 nAllDuration = ((unsigned __int64)nElapsed) * 100 / nPercent; //nDelta = (DWORD)((nAllDuration - nElapsed) / 1000); DWORD nHours = nDelta / 3600; nDelta %= 3600; DWORD nMinutes = nDelta / 60; nDelta %= 60; DWORD nSeconds = nDelta; wsprintf(sDur, _T(" %i:%02i:%02i"), nHours, nMinutes, nSeconds); //} wsprintf(psPercentTitle, _T("{%3i%%%s} %s"), nPercent, sDur, pszTitle); SetConsoleTitle(psPercentTitle); } } else { wsprintf(sProgress, pszFormat, (DWORD)nCurrent, (DWORD)nAllCount); Message(sProgress, FALSE); } //TODO: Обновить заголовок консоли - процентики показать nLastTick = GetTickCount(); nCounter = 0; } // Проверить, не была ли нажата клавиша Esc? CheckForEsc(TRUE); }
void DizList::Read(const string& Path, const string* DizName) { Reset(); struct DizPreRedrawItem : public PreRedrawItem { DizPreRedrawItem() : PreRedrawItem(PR_ReadingMsg) {} }; SCOPED_ACTION(TPreRedrawFuncGuard)(std::make_unique<DizPreRedrawItem>()); const wchar_t *NamePtr=Global->Opt->Diz.strListNames.data(); for (;;) { if (DizName) { strDizFileName = *DizName; } else { strDizFileName = Path; if (!PathCanHoldRegularFile(strDizFileName)) break; string strArgName; NamePtr = GetCommaWord(NamePtr, strArgName); if (!NamePtr) break; AddEndSlash(strDizFileName); strDizFileName += strArgName; } os::fs::file DizFile; if (DizFile.Open(strDizFileName,GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING)) { clock_t StartTime=clock(); uintptr_t CodePage=CP_DEFAULT; bool bSigFound=false; if (!GetFileFormat(DizFile,CodePage,&bSigFound,false) || !bSigFound) CodePage = Global->Opt->Diz.AnsiByDefault ? CP_ACP : CP_OEMCP; GetFileString GetStr(DizFile, CodePage); auto LastAdded = DizData.end(); string DizText; while (GetStr.GetString(DizText)) { if (!(DizData.size() & 127) && clock() - StartTime > CLOCKS_PER_SEC) { SetCursorType(false, 0); PR_ReadingMsg(); if (CheckForEsc()) break; } RemoveTrailingSpaces(DizText); if (!DizText.empty()) { if(!IsSpace(DizText.front())) { LastAdded = AddRecord(DizText); } else { if (LastAdded != DizData.end()) { LastAdded->second.emplace_back(DizText); } } } } OrigCodePage=CodePage; Modified=false; DizFile.Close(); return; } if (DizName) break; } Modified=false; strDizFileName.clear(); }
int __stdcall Archive::OnProcessData (unsigned int uDataSize) { m_OS.uTotalProcessedSize += uDataSize; m_OS.uProcessedSize += uDataSize; static char szOldTitle[MAX_PATH] = {0}; ///if ( m_pCurrentItem ) { double div; char szPercents[MAX_PATH]; if ( m_OS.uFileSize ) div = (double)m_OS.uProcessedSize/(double)m_OS.uFileSize; else div = 1; if (div > 1) div = 1; dword dwPercent = (int)(div*40); dword dwRealPercent = (int)(div*100); if ( !OptionIsOn (m_nMode, OPM_SILENT) ) { doIndicator (c.X+5, c.Y+6, dwPercent); FSF.sprintf (szPercents, "%4u%%", dwRealPercent); Info.Text (c.X+45, c.Y+6, FarGetColor (COL_DIALOGTEXT), szPercents); } if ( m_OS.uTotalSize ) div = (double)m_OS.uTotalProcessedSize/(double)m_OS.uTotalSize; else div = 1; if (div > 1) div = 1; dwPercent = (int)(div*40); dwRealPercent = (int)(div*100); if ( !OptionIsOn (m_nMode, OPM_SILENT) ) { //MessageBox (0, "asd", "asd", MB_OK); doIndicator (c.X+5, c.Y+8, dwPercent); FSF.sprintf (szPercents, "%4u%%", dwRealPercent); Info.Text (c.X+45, c.Y+8, FarGetColor (COL_DIALOGTEXT), szPercents); Info.Text (0, 0, 0, 0); } char szTitle[MAX_PATH]; FSF.sprintf (szTitle, _M(MProcessDataWindowTitle), (int)(div*100)); if ( strcmp (szTitle, szOldTitle) != 0 ) { SetConsoleTitle (szTitle); strcpy (szOldTitle, szTitle); } } if ( CheckForEsc () ) { if ( !OptionIsOn (m_nMode, OPM_SILENT) ) { Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessDataOperationCanceled)); Info.Text (0, 0, 0, 0); } return FALSE; } return TRUE; }