/** Extract certain elements of a log to a separate log file. */ void ExtractLog() { static const int kNoRange = -1; std::vector<std::string> types; Split(TrimQuotes(FLAGS_extract_types), ',', &types); int frame_min = kNoRange, frame_max = kNoRange; std::vector<int> frames; Split(TrimQuotes(FLAGS_extract_frame_range), ',', &frames); if (!frames.empty()) { CHECK_EQ(2, frames.size()) << "extract_frame_range must be frame PAIR"; frame_min = frames[0]; frame_max = frames[1]; CHECK_LE(frame_min, frame_max) << "Minimum frame index must be <= than max frame index."; } hal::Reader reader(FLAGS_in); if (FLAGS_extract_types.empty()) { reader.EnableAll(); } else { LOG(INFO) << "Extracting: "; for (const std::string& type : types) { LOG(INFO) << "\t" << type; reader.Enable(MsgTypeForString(type)); } } int idx = 0; std::unique_ptr<hal::Msg> msg; while (frame_min != kNoRange && idx < frame_min) { if ((msg = reader.ReadMessage()) && msg->has_camera()) { ++idx; } } hal::Logger logger; logger.LogToFile(FLAGS_out); const uint32_t max_buffer_size = 5000; // This is the default in logger. logger.SetMaxBufferSize(max_buffer_size); while ((frame_max == kNoRange || idx <= frame_max) && (msg = reader.ReadMessage())) { if (msg->has_camera()) { ++idx; } while (logger.buffer_size() == max_buffer_size) { LOG(INFO) << "Hit max buffer size. Waiting 100ms."; std::this_thread::sleep_for(std::chrono::milliseconds(100)); } if (!logger.LogMessage(*msg)) { break; } } }
/** IsValidE32Image: Checks whether the given file is E32 image @internalComponent @released @param aFile - Input file name */ TBool Sis2Iby::IsValidE32Image(String aFile) { std::ifstream aIfs; TInt8 aSig[5]; TUint32 e32SigOffset = 0x10, fileSize = 0; TBool validE32 = EFalse; TrimQuotes(aFile); aIfs.open(aFile.c_str(), std::ios::in | std::ios::binary); if( !aIfs.is_open() ) { throw SisUtilsException(aFile.c_str(),"Cannot open file"); } aIfs.seekg(0,std::ios::end); fileSize = aIfs.tellg(); if(fileSize > 20) { aIfs.seekg(e32SigOffset,std::ios::beg); aIfs.read((char*)aSig, 4); aSig[4] = '\0'; if(!strcmp((char*)aSig, "EPOC")) { validE32 = ETrue; } } aIfs.close(); return validE32; }
int GetOptArgs (int argc, char* argv[], char* Username, char* Password, char* Logfile) { int args; int i; args = argc; // Clear username and password strcpy (Username, ""); strcpy (Password, ""); Pause = 0; // Loop through all the arguments for (i=1;i<argc;i++) { // copy pointer to the appropriate string, removing leading and trailing quotes if (strncmp (argv[i], "/U=", 3) == 0 || strncmp (argv[i], "/u=", 3) == 0) { args--; TrimQuotes (Username, argv[i] + 3, NW_MAX_USER_NAME_LEN); } if (strncmp (argv[i], "/P=", 3) == 0 || strncmp (argv[i], "/p=", 3) == 0) { args--; TrimQuotes (Password, argv[i] + 3, 256); } if (strncmp (argv[i], "/LOG=", 5) == 0 || strncmp (argv[i], "/log=", 5) == 0) { args--; TrimQuotes (Logfile, argv[i] + 5, 256); } if (strncmp (argv[i], "/PAUSE", 6) == 0 || strncmp (argv[i], "/pause", 6) == 0) { args--; Pause = 1; } } return args; }
// TrimQuotedWhitespcExtd // Removes leading/trailing quotes and then any leading/trailing whitespace and // copies trimmed text back into original text buffer (pszText) char * CUtility::TrimQuotedWhitespcExtd(char *pszText) { if(pszText == NULL || pszText[0] == '\0') return(pszText); if(!TrimQuotes(pszText)) return(pszText); return(TrimWhitespcExtd(pszText)); }
/** AppendFileName: Appends file name to the given path @internalComponent @released @param aPath - Source path @param aFile - File name */ void Sis2Iby::AppendFileName(String& aPath, String aFile) { TUint pos = 0; TrimQuotes(aPath); TrimQuotes(aFile); pos = aPath.rfind(PATHSEPARATOR); if(pos == String::npos) { aPath.append(PATHSEPARATOR); } if(pos < (aPath.length()-1)) { aPath.append(PATHSEPARATOR); } GetFileName(aFile, aPath); return; }
//! @brief Initializes the application. //! //! It will open the main window and connect default to server or open the connect window. bool UpdaterApp::OnInit() { //this triggers the Cli Parser amongst other stuff if (!wxApp::OnInit()) return false; if ( m_paramcount == 5) { WaitForExit(m_pid); wxArrayString params; if (!StartUpdate(TrimQuotes(m_source_dir), TrimQuotes(m_destination_dir), true)) { //update failed, try as admin params.push_back(m_source_dir); params.push_back(m_destination_dir); RunProcess(m_updater_exe, params, false, true); params.clear(); } //start springlobby return RunProcess(m_springlobby_exe, params, true); } else if (m_paramcount != 2) { return false; } return StartUpdate(TrimQuotes(m_source_dir), TrimQuotes(m_destination_dir), false); }
/** * Parses a config file with lines of the form * * flag = value * * and sets flags as appropriate. */ Status ParseConfigFile() { Trace(); if (!g_configFile.wasSet()) { Log(LL::Trace) << "No flag config file specified."; return Status::ok(); } const std::string &filename = g_configFile.get(); Log(LL::Trace) << "Begining parse of config file: " << filename; std::ifstream ifile(filename.c_str()); if (!ifile.is_open()) { Log(LL::Trace) << "Config file " << filename << " not found."; return Status(Status::NOT_FOUND); } std::string line; int lineno = 0; while (std::getline(ifile, line)) { if (line.empty()) { lineno++; continue; } std::vector< std::string > argstr = Splitter().on('=').trimWhitespace().split(line, 2); RET_SM( argstr.size() == 2, Status::BAD_INPUT, "Error in config file \"" << filename << "\" " << "on line " << lineno << " is not a valid flag=value pair"); tFlagIter itr = GetGlobalFlags().find(argstr[0]); RET_SM( itr != GetGlobalFlags().end(), Status::BAD_INPUT, "Unknown flag: " << argstr[0] << " @ line " << lineno); iFlagBase *pFlag = itr->second; RET_SM( pFlag->fromString(TrimQuotes(argstr[1])), Status::BAD_INPUT, "Invalid flag value for " << argstr[0] << " at line " << lineno << ". can't parse: " << argstr[1]); lineno++; } return Status::ok(); }
/** * Concatenate all the messages from the 'cat' log files into a * single file. */ void CatLogs() { std::vector<std::string> in; Split(TrimQuotes(FLAGS_cat_logs), ',', &in); hal::Logger logger; logger.LogToFile(FLAGS_out); for (const std::string& log : in) { hal::Reader reader(log); reader.EnableAll(); std::unique_ptr<hal::Msg> msg; while ((msg = reader.ReadMessage())) { while (!logger.LogMessage(*msg)) {} } } }
/** Extracts single images out of a log file. */ void ExtractImages() { static const int kNoRange = -1; int frame_min = kNoRange, frame_max = kNoRange; std::vector<int> frames; Split(TrimQuotes(FLAGS_extract_frame_range), ',', &frames); if (!frames.empty()) { CHECK_EQ(2, frames.size()) << "extract_frame_range must be frame PAIR"; frame_min = frames[0]; frame_max = frames[1]; CHECK_LE(frame_min, frame_max) << "Minimum frame index must be <= than max frame index."; } hal::Reader reader(FLAGS_in); reader.Enable(hal::Msg_Type_Camera); int idx = 0; std::unique_ptr<hal::Msg> msg; while (frame_min != kNoRange && idx < frame_min) { if ((msg = reader.ReadMessage()) && msg->has_camera()) { ++idx; } } while ((frame_max == kNoRange || idx <= frame_max) && (msg = reader.ReadMessage())) { if (msg->has_camera()) { const hal::CameraMsg& cam_msg = msg->camera(); for (int ii = 0; ii < cam_msg.image_size(); ++ii) { const hal::ImageMsg& img_msg = cam_msg.image(ii); SaveImage(FLAGS_out, ii, idx, cam_msg.system_time(), img_msg); } ++idx; } } }
int wmain(int argc, wchar_t* argv[]) { if (argc < 2) { PrintUsage(); return 1; } bool doTrace = false; bool generateHash = false; bool generateClientManifest = false; std::wstring fileName; std::wstring outputFileName; std::wstring assemblyVersion; std::wstring assemblyName; std::wstring clientFileName; bool batchMode = false; std::wstring batchFileName; bool directoryMode = false; std::wstring directoryPath; // Get the command line arguments for (int i = 1; i < argc; ++i) { std::wstring arg = argv[i]; // Hopefully the filename doesn't start with - if (arg[0] != L'-') { fileName = arg; TrimQuotes(fileName); } else if (ToLower(arg.substr(1)) == L"trace") { doTrace = true; } else if (ToLower(arg.substr(1, 8)) == L"version") { assemblyVersion = arg.substr(10); } else if (ToLower(arg.substr(1, 4)) == L"name") { assemblyName = arg.substr(6); TrimQuotes(assemblyName); } else if (ToLower(arg.substr(1, 4)) == L"hash") { generateHash = true; } else if (ToLower(arg.substr(1, 6)) == L"client") { generateClientManifest = true; clientFileName = arg.substr(8) + L".manifest"; TrimQuotes(clientFileName); } else if (ToLower(arg.substr(1, 5)) == L"batch") { batchMode = true; batchFileName = arg.substr(7); } else if (ToLower(arg.substr(1, 3)) == L"dir") { directoryMode = true; directoryPath = arg.substr(5); TrimQuotes(directoryPath); } else { std::wcout << L"Parameter: " << arg << L" was not recognised" << std::endl;; } } // Processing and validation of command line arguments if (fileName.empty() && !batchMode && !directoryMode) { std::wcout << L"No com_dll was given!" << std::endl; return 1; } if (assemblyName.empty() && !batchMode && !directoryMode) { std::wstring localFile = fileName.substr(fileName.rfind(L'\\') + 1); assemblyName = localFile.substr(0, localFile.rfind(L'.')) + L".sxs"; } else if (assemblyName.empty() && directoryMode) { assemblyName = directoryPath.substr(directoryPath.rfind(L'\\') + 1); } else if (!assemblyName.empty() && directoryMode) { std::wcout << L"Directory mode: assemblyName cannot be used!" << std::endl; return 1; } if (!assemblyName.empty() && batchMode) { std::wcout << L"Batch mode: assemblyName cannot be used!" << std::endl; return 1; } std::wstring clientFileNamePath = clientFileName.substr(0, clientFileName.rfind(L'\\') + 1); if (clientFileName.empty()) { std::wstring fileNamePath = fileName.substr(0, fileName.rfind(L'\\') + 1); outputFileName = fileNamePath + assemblyName + L".manifest"; } else if (directoryMode) { outputFileName = assemblyName + L".manifest"; } else { outputFileName = clientFileNamePath + assemblyName + L".manifest"; } if (assemblyVersion.empty() && !batchMode) { assemblyVersion = L"1.0.0.0"; } else if (!assemblyVersion.empty() && batchMode) { std::wcout << L"Batch mode: assemblyVersion cannot be used!" << std::endl; return 1; } if (directoryMode && batchMode) { std::wcout << L"Batch mode and Directory mode cannot be used together!" << std::endl; return 1; } // Generation of the manifest files std::vector<DependencyInfo> depencencyList; if (batchMode) { std::wifstream file(batchFileName.c_str()); std::wstring line; while (std::getline(file, line)) { std::wistringstream wis; wis.str(line); std::getline(wis, fileName, L'|'); TrimSpaces(fileName); TrimQuotes(fileName); bool isDirectory = IsDirectory(fileName); if (!std::getline(wis, assemblyName, L'|') || isDirectory) { std::wstring localFile = fileName.substr(fileName.rfind(L'\\') + 1); assemblyName = localFile.substr(0, localFile.rfind(L'.')); if (!isDirectory) { assemblyName += + L".sxs"; } } if (!std::getline(wis, assemblyVersion, L'|')) { assemblyVersion = L"1.0.0.0"; } outputFileName = clientFileNamePath + assemblyName + L".manifest"; if (isDirectory) { CreateManifestForDirectory(fileName, doTrace, assemblyName, assemblyVersion, generateHash, outputFileName); } else { CreateManifestForModule(fileName, doTrace, assemblyName, assemblyVersion, generateHash, outputFileName); } depencencyList.push_back(DependencyInfo(assemblyName, assemblyVersion)); } } else if (directoryMode) { CreateManifestForDirectory(directoryPath, doTrace, assemblyName, assemblyVersion, generateHash, outputFileName); depencencyList.push_back(DependencyInfo(assemblyName, assemblyVersion)); } else { CreateManifestForModule(fileName, doTrace, assemblyName, assemblyVersion, generateHash, outputFileName); depencencyList.push_back(DependencyInfo(assemblyName, assemblyVersion)); } if (generateClientManifest) { ManifestWriter::WriteClientManifest(clientFileName, depencencyList); } return 0; }
int main (int argc, char* argv[]) { NWDSCCODE res; nstr8 UserName [NW_MAX_USER_NAME_LEN]; nstr8 Password [256]; nstr8 Object [MAX_DN_CHARS+1]; nstr8 FileName [256]; nstr8 Logfile [256]; nstr8 ServerName [50]; NWCONN_HANDLE ConnHandle; FILE* BackupFile; int NonOptArgs; BYTE OldNameSpace; // start off by auto destroying the screen AutoDestroyScreen = 0xF; // increment the thread counter ThreadCount++; // get the main thread group id MainThreadGroupId = GetThreadGroupID (); // set the signal handler, and disable CTRL-C signal (SIGTERM, SigHandler); SetCtrlCharCheckMode (FALSE); // make sure we've got something to do - i know, this would be more appropriately done in the switch below if (argc == 1) { Usage (); return 1; } clrscr (); gotoxy (28, 0); printf ("NetWare Rights Utility\n"); gotoxy (28, 1); printf ("(c) 2003 J. Gallimore\n"); printf ("\n\n"); // create a global context handle if ((res = NWDSCreateContextHandle (&NDSContext)) != 0) { printf ("NWDSCreateContextHandle returned: %d\n", res); return 1; } DoLogin = 0; // attempt to retrieve the username and password from the command line NonOptArgs = GetOptArgs (argc, argv, UserName, Password, Logfile); // login if we need to // ask for the username / password, if not specified on the command line // if user input is required, don't automatically close the screen if (!NWIsDSAuthenticated ()) { printf ("Login to NDS\nUsername:"******"") == 0) { AutoDestroyScreen = 0x0; AwaitingInput = TRUE; gets (UserName); AwaitingInput = FALSE; } else printf ("%s\n", UserName); // included if the nlm is unloaded whilst inputting details if (NlmExiting) { Cleanup (); return 1; } printf ("Password:"******"") == 0) { AutoDestroyScreen = 0x0; AwaitingInput = TRUE; GetPass (Password, 256); AwaitingInput = FALSE; } else printf ("*\n"); // included if the nlm is unloaded whilst inputting details if (NlmExiting) { Cleanup (); return 1; } if ((res = NWDSLogin (NDSContext, 0, UserName, Password, 0)) != 0) { printf ("NWDSLogin returned: %d\n", res); Cleanup (); return 1; } DoLogin = 1; // if we logged in, we must logout } // included if the nlm is unloaded whilst inputting details if (NlmExiting) { Cleanup (); return 1; } // open and authenticate a connection to the local box GetFileServerName (0, ServerName); if ((res = NWCCOpenConnByName (0, ServerName, NWCC_NAME_FORMAT_NDS, NWCC_OPEN_LICENSED, NWCC_RESERVED, &ConnHandle)) != 0) { printf ("NWDSOpenConnToNDSServer returned: %d\n", res); Cleanup (); return 1; } if ((res = NWDSAuthenticateConn (NDSContext, ConnHandle)) != 0) { printf ("NWDSAuthenticateConn returned: %d\n", res); Cleanup (); return 1; } // change to the [Root] context if ((res = NWDSSetContext (NDSContext, DCK_NAME_CONTEXT, "[Root]")) != 0) { printf ("NWDSSetContext returned: %d\n", res); Cleanup (); return 1; } // process the command line arguments switch (NonOptArgs) { case 0: Usage (); break; case 1: Usage (); break; case 2: if (strncmp (argv [1], "/R=", 3) == 0 || strncmp (argv [1], "/r=", 3) == 0) { if (TrimQuotes (FileName, argv [1] + 3, 256) == 0) { // perform a restore Restore (ConnHandle, FileName, Logfile); } } else { // display trustee rights, don't auto close screen AutoDestroyScreen = 0x0; GetTrustees (ConnHandle, 0, argv [1], NW_NS_LONG, 1, NULL); } break; case 3: if (strncmp (argv [2], "/B=", 3) == 0 || strncmp (argv [2], "/b=", 3) == 0) { // backup the trustee rights to a file if (TrimQuotes (FileName, argv[2] + 3, 256) == 0) { OldNameSpace = SetCurrentNameSpace (NW_NS_LONG); if ((BackupFile = fopen (FileName, "w")) != NULL) { fprintf (BackupFile, "cx [Root]\n"); GetTrustees (ConnHandle, 0, argv [1], NW_NS_LONG, 1, BackupFile); fclose (BackupFile); } } } break; case 4: // set trustee rights or IRF as appropriate if (strncmp ("/F", argv [3], 2) == 0 || strncmp ("/f", argv [3], 2) == 0) { // inherited rights filter InheritedRights (ConnHandle, 0, argv [1], NW_NS_LONG, argv [2]); } if (strncmp (argv[3], "/NAME=", 6) == 0 || strncmp (argv[3], "/name=", 6) == 0) { // get pointer to name, strip off leading and trailing " if (TrimQuotes (Object, argv [3] + 6, MAX_DN_CHARS+1) == 0) TrusteeRights (ConnHandle, 0, argv [1], NW_NS_LONG, Object, argv [2]); } break; default: Usage (); break; } // close local connection and cleanup if ((res = NWCCCloseConn (ConnHandle)) != 0) printf ("NWCCCloseConn returned: %d\n", res); Cleanup (); return 0; }
void Restore (NWCONN_HANDLE ConnHandle, char* FileName, char* Logfilename) { char Line [1024]; char* Next; char Buffer [512]; FILE* BackupFile; FILE* Logfile; char FirstParam [512]; char Rights [12]; char Object [300]; int ArgNo; char Op [8]; NWDSCCODE res; BYTE OldNameSpace; // save the default namespace OldNameSpace = SetCurrentNameSpace (NW_NS_LONG); // attempt to open the backup file if ((BackupFile = fopen (FileName, "r")) == NULL) printf ("Couldn\'t open file: %s\n", FileName); else { if (Logfilename) { if ((Logfile = fopen (Logfilename, "w")) == NULL) { printf ("Couldn't open %s\n", Logfilename); Logfile = NULL; } } else Logfile = NULL; // read file line by line - also, check that the NLM hasn't been terminated while ((!feof (BackupFile)) && (!NlmExiting)) { fgets (Line, 1024, BackupFile); if (!feof (BackupFile)) { Next = Line; ArgNo = 0; // use GetParams to iteratively get the equivalent argvs while (strcmp ((Next = GetParam (Next, Buffer, 512)), "") != 0 || strcmp (Buffer, "") != 0) { // copy string depending on the argument number ArgNo++; if (ArgNo == 1) { if (stricmp (Buffer, "RIGHTS") != 0 && stricmp (Buffer, "cx") != 0) break; else strncpy (Op, Buffer, 8); } else if (ArgNo == 2) strcpy (FirstParam, Buffer); else if (ArgNo == 3) { strncpy (Rights, Buffer, 12); Rights [11] = 0; } else if (ArgNo == 4) { if (strncmp (Buffer, "/NAME=", 6) == 0 || strncmp (Buffer, "/name=", 6) == 0) TrimQuotes (Object, Buffer, MAX_DN_CHARS); else if (stricmp (Buffer, "/F") == 0) strcpy (Object, "/F"); else strcpy (Object, ""); } else break; } // if the syntax is valid call the appropriate function to // set trustee rights or IRFs if (stricmp (Op, "RIGHTS") ==0 && ArgNo == 4) { if (strncmp (Object, "/F", 2) == 0 || strncmp (Object, "/f", 2) == 0) { // printf ("IRF: %s, %s\n", FirstParam, Rights); // if (Clear != 0) // InheritedRights (ConnHandle, 0, FirstParam, NW_NS_LONG, "RWCFEMA"); res = InheritedRights (ConnHandle, 0, FirstParam, NW_NS_LONG, Rights); DisplayOutput (FirstParam, Rights, "/F", res, Logfile); } if (strncmp (Object, "/NAME=", 6) == 0 || strncmp (Object, "/name=", 6) == 0) { // printf ("Rights: %s, %s, %s\n", FirstParam, Rights, Object); // if (Clear != 0) // TrusteeRights (ConnHandle, 0, FirstParam, NW_NS_LONG, Object+6, "REM"); res = TrusteeRights (ConnHandle, 0, FirstParam, NW_NS_LONG, Object+6, Rights); DisplayOutput (FirstParam, Rights, Object+6, res, Logfile); } } // code to change context if (stricmp (Op, "cx") == 0 && ArgNo == 2) { if ((res = NWDSSetContext (NDSContext, DCK_NAME_CONTEXT, FirstParam)) != 0) printf ("NWDSSetContext returned: %d\n", res); } } } // close the file and restore the original name space fclose (BackupFile); if (Logfile) fclose (Logfile); SetTargetNameSpace (OldNameSpace); } }
void LiveJobImpl::Set ( const char *_name, const char *_value ) { if ( strcasecmp ( _name, ATTR_JOB_SUBMISSION ) == 0 ) { std::string val = TrimQuotes( _value ); // TODO: grab the cluster from our key PROC_ID id = getProcByString(m_job->GetKey()); if (m_job) { m_job->SetSubmission ( val.c_str(), id.cluster ); } } // our status is changing...decrement for old one if ( strcasecmp ( _name, ATTR_JOB_STATUS ) == 0 ) { if ( m_job ) { m_job->SetStatus(this->GetStatus()); m_job->DecrementSubmission (); } } if ( strcasecmp ( _name, ATTR_OWNER ) == 0 ) { // need to leave an owner for this job // to be picked up soon // if we are in here, we don't have m_submission PROC_ID id = getProcByString(m_job->GetKey()); std::string val = TrimQuotes( _value ); g_ownerless_clusters[id.cluster] = val; m_job->UpdateSubmission(id.cluster,val.c_str()); } // parse the type ExprTree *expr; if ( ParseClassAdRvalExpr ( _value, expr ) ) { dprintf ( D_ALWAYS, "error: parsing %s[%s] = %s, skipping\n", m_job->GetKey(), _name, _value ); return; } // add this value to the classad classad::Value value; expr->Evaluate(value); switch ( value.GetType() ) { case classad::Value::INTEGER_VALUE: int i; from_string<int> ( i, std::string ( _value ), std::dec ); m_full_ad->Assign ( _name, i ); break; case classad::Value::REAL_VALUE: float f; from_string<float> ( f, std::string ( _value ), std::dec ); m_full_ad->Assign ( _name, f ); break; case classad::Value::STRING_VALUE: m_full_ad->Assign ( _name, _value ); break; default: m_full_ad->AssignExpr ( _name, _value ); break; } delete expr; expr = NULL; // our status has changed...increment for new one if ( strcasecmp ( _name, ATTR_JOB_STATUS ) == 0 ) { if ( m_job ) { m_job->SetStatus(this->GetStatus()); m_job->IncrementSubmission (); } } }
/** Extracts posys out of a log file. */ void ExtractPosys() { static const int kNoRange = -1; int frame_min = kNoRange, frame_max = kNoRange; std::vector<int> frames; Split(TrimQuotes(FLAGS_extract_frame_range), ',', &frames); if (!frames.empty()) { CHECK_EQ(2, frames.size()) << "extract_frame_range must be frame PAIR"; frame_min = frames[0]; frame_max = frames[1]; CHECK_LE(frame_min, frame_max) << "Minimum frame index must be <= than max frame index."; } hal::Reader reader(FLAGS_in); reader.Enable(hal::Msg_Type_Posys); int idx = 0; std::unique_ptr<hal::Msg> msg; while (frame_min != kNoRange && idx < frame_min) { if ((msg = reader.ReadMessage()) && msg->has_camera()) { ++idx; } } // A csv file is created per object with names object00.csv, object01.csv, etc // Each csv file contains these columns (depending on data): // 1. System timestamp // 2. Device timestamp // 3. Object id // 4. Pose type // 5. Size of pose data (this must be consistent with Pose type) // 6. Pose data (as many columns as previous field says) // 7. Size of covariance data (>= 0) // 8. Covariance data (as many columns as previous field says) // The redundancy in items 4 and 5 is due to the RAW pose type that can // contain any number of elements. // object id, csv file std::map<int, std::shared_ptr<std::ofstream>> files; while ((frame_max == kNoRange || idx <= frame_max) && (msg = reader.ReadMessage())) { if (msg->has_pose()) { const hal::PoseMsg& pose_msg = msg->pose(); std::shared_ptr<std::ofstream>& file = files[pose_msg.id()]; if (!file) { std::stringstream filename; filename << FLAGS_out << "/object" << std::setw(2) << std::setfill('0') << pose_msg.id() << ".csv"; file.reset(new std::ofstream(filename.str().c_str())); } *file << std::fixed << std::setprecision(9) << pose_msg.system_time() << ", " << std::setprecision(9) << pose_msg.device_time() << ", " << pose_msg.id() << ", " << pose_msg.type() << ", " << pose_msg.pose().data_size() << ","; for (int i = 0; i < pose_msg.pose().data_size(); ++i) *file << pose_msg.pose().data(i) << ","; *file << " " << pose_msg.covariance().data_size(); if (pose_msg.covariance().data_size() > 0) { for (int i = 0; i < pose_msg.covariance().data_size(); ++i) *file << "," << pose_msg.covariance().data(i); } *file << std::endl; } ++idx; } }
/** Extracts imu out of a log file. */ void ExtractImu() { std::ofstream accel_file(FLAGS_out + "/accel.txt", std::ios_base::trunc); std::ofstream gyro_file(FLAGS_out + "/gyro.txt", std::ios_base::trunc); std::ofstream mag_file(FLAGS_out + "/mag.txt", std::ios_base::trunc); std::ofstream timestamp_file(FLAGS_out + "/timestamp.txt", std::ios_base::trunc); static const int kNoRange = -1; int frame_min = kNoRange, frame_max = kNoRange; std::vector<int> frames; Split(TrimQuotes(FLAGS_extract_frame_range), ',', &frames); if (!frames.empty()) { CHECK_EQ(2, frames.size()) << "extract_frame_range must be frame PAIR"; frame_min = frames[0]; frame_max = frames[1]; CHECK_LE(frame_min, frame_max) << "Minimum frame index must be <= than max frame index."; } hal::Reader reader(FLAGS_in); reader.Enable(hal::Msg_Type_IMU); int idx = 0; std::unique_ptr<hal::Msg> msg; while (frame_min != kNoRange && idx < frame_min) { if ((msg = reader.ReadMessage()) && msg->has_camera()) { ++idx; } } while ((frame_max == kNoRange || idx <= frame_max) && (msg = reader.ReadMessage())) { if (msg->has_imu()) { const hal::ImuMsg& imu_msg = msg->imu(); if (imu_msg.has_accel()) { // Write the accel to the accel csv accel_file << imu_msg.accel().data(0) << ", " << imu_msg.accel().data(1) << ", " << imu_msg.accel().data(2) << std::endl; } else { accel_file << "0, 0, 0" << std::endl; } if (imu_msg.has_gyro()) { // Write the accel to the accel csv gyro_file << imu_msg.gyro().data(0) << ", " << imu_msg.gyro().data(1) << ", " << imu_msg.gyro().data(2) << std::endl; } else { gyro_file << "0, 0, 0" << std::endl; } if (imu_msg.has_mag()) { // Write the accel to the accel csv mag_file << imu_msg.mag().data(0) << ", " << imu_msg.mag().data(1) << ", " << imu_msg.mag().data(2) << std::endl; } else { mag_file << "0, 0, 0" << std::endl; } timestamp_file << std::fixed << std::setprecision(9) << imu_msg.system_time() << ", " << std::setprecision(9) << imu_msg.device_time() << std::endl; // WRITE THE IMU ++idx; } } }
int _tmain(int argc, char* argv[]) { // determine my process name _splitpath(argv[0],NULL,NULL,gszProcName,NULL); #else int main(int argc, const char** argv) { // determine my process name CUtility::splitpath((char *)argv[0],NULL,gszProcName); #endif int iScreenLogLevel; // level of screen diagnostics int iFileLogLevel; // level of file diagnostics char szLogFile[_MAX_PATH]; // write diagnostics to this file int Rslt; int iMode; char szOutputFile[_MAX_PATH]; char szInputFile[_MAX_PATH]; char szInSeqFile[_MAX_PATH]; char szInputBiobedFile[_MAX_PATH]; int iRegionsIn; int iRegionsOut; char szRegionsIn[128]; // regions to retain char szRegionsOut[128]; // regions to exclude int iRegLen; // command line args struct arg_lit *help = arg_lit0("hH","help", "print this help and exit"); struct arg_lit *version = arg_lit0("v","version,ver", "print version information and exit"); struct arg_int *FileLogLevel=arg_int0("f", "FileLogLevel", "<int>","Level of diagnostics written to logfile 0=fatal,1=errors,2=info,3=diagnostics,4=debug"); struct arg_int *ScreenLogLevel=arg_int0("S", "ScreenLogLevel", "<int>","Level of diagnostics written to logfile 0=fatal,1=errors,2=info,3=diagnostics,4=debug"); struct arg_file *LogFile = arg_file0("F","log","<file>", "diagnostics log file"); struct arg_int *Mode = arg_int0("m","procmode","<int>", "processing mode 0:default"); struct arg_int *RegLen = arg_int0("L","updnstream","<int>", "length of 5'up or 3'down stream regulatory region length (default = 2000) 0..1000000"); struct arg_file *InFile = arg_file1("i",NULL,"<file>", "input from loci csv file"); struct arg_file *OutFile = arg_file1("o",NULL,"<file>", "output to multifasta file"); struct arg_file *InSeqFile = arg_file1("a","assemb","<file>","get sequences fron this file"); struct arg_file *InBedFile = arg_file1("b","bed","<file>", "characterise regions from biobed file"); struct arg_str *RegionsOut = arg_str0("R","regionsout","<string>","Filter out random samples in any of these regions (space or comma delimit), 1: Intergenic, 2: US, 3: 5'UTR, 4: CDS, 5: Intron, 6: 3'UTR, 7: DS"); struct arg_str *RegionsIn = arg_str0("r","regionsin","<string>","Accept random samples in any of these exclusive regions (space or comma delimit), 1: Intergenic, 2: US, 3: 5'UTR, 4: CDS, 5: Intron, 6: 3'UTR, 7: DS"); struct arg_end *end = arg_end(20); void *argtable[] = {help,version,FileLogLevel,ScreenLogLevel,LogFile, Mode,RegLen,InFile,OutFile,InSeqFile,InBedFile,RegionsIn,RegionsOut, end}; char **pAllArgs; int argerrors; argerrors = CUtility::arg_parsefromfile(argc,(char **)argv,&pAllArgs); if(argerrors >= 0) argerrors = arg_parse(argerrors,pAllArgs,argtable); /* special case: '--help' takes precedence over error reporting */ if (help->count > 0) { printf("Usage: %s ", gszProcName); arg_print_syntax(stdout,argtable,"\n"); arg_print_glossary(stdout,argtable," %-25s %s\n"); exit(1); } /* special case: '--version' takes precedence error reporting */ if (version->count > 0) { printf("\n%s: Version: %d.%2.2d\n",gszProcName,cProgVer/100,cProgVer%100); exit(1); } if (!argerrors) { iScreenLogLevel = ScreenLogLevel->count ? ScreenLogLevel->ival[0] : eDLInfo; if(iScreenLogLevel < eDLNone || iScreenLogLevel > eDLDebug) { printf("\nError: ScreenLogLevel '-S%d' specified outside of range %d..%d",iScreenLogLevel,eDLNone,eDLDebug); exit(1); } if(FileLogLevel->count && !LogFile->count) { printf("\nError: FileLogLevel '-f%d' specified but no logfile '-F<logfile>'",FileLogLevel->ival[0]); exit(1); } iFileLogLevel = FileLogLevel->count ? FileLogLevel->ival[0] : eDLInfo; if(iFileLogLevel < eDLNone || iFileLogLevel > eDLDebug) { printf("\nError: FileLogLevel '-l%d' specified outside of range %d..%d",iFileLogLevel,eDLNone,eDLDebug); exit(1); } if(LogFile->count) { strncpy(szLogFile,LogFile->filename[0],_MAX_PATH); szLogFile[_MAX_PATH-1] = '\0'; } else { iFileLogLevel = eDLNone; szLogFile[0] = '\0'; } iMode = Mode->count ? Mode->ival[0] : eProcModeStandard; if(iMode < eProcModeStandard || iMode > eProcModeStandard) { printf("\nError: Requested processing mode '-x%d' not supported",iMode); exit(1); } if(RegionsIn->count) { strcpy(szRegionsIn,RegionsIn->sval[0]); TrimQuotes(szRegionsIn); if((iRegionsIn = ParseRegions(szRegionsIn)) < 0) { printf("Error: unable to parse '-r%s' into regions to retain",szRegionsIn); exit(1); } } else { szRegionsIn[0] = '\0'; iRegionsIn = (cFeatBitIG | cFeatBitUpstream | cFeatBit5UTR | cFeatBitCDS | cFeatBitIntrons | cFeatBit3UTR | cFeatBitDnstream); } if(RegionsOut->count) { strcpy(szRegionsOut,RegionsOut->sval[0]); TrimQuotes(szRegionsOut); if((iRegionsOut = ParseRegions(szRegionsOut)) < 0) { printf("Error: unable to parse '-R%s' into regions to remove",szRegionsOut); exit(1); } } else { szRegionsOut[0] = '\0'; iRegionsOut = 0; } iRegionsIn &= ~iRegionsOut; if(!iRegionsIn) { printf("Error: no regions to retain"); exit(1); } iRegLen = RegLen->count ? RegLen->ival[0] : cDfltRegLen; if(iRegLen < cMinRegLen) { printf("\nRegulatory region length '-L%d' less than minimum %d, assuming you meant to use '-L%d'",iRegLen,cMinRegLen,cMinRegLen); iRegLen = cMinRegLen; } else { if(iRegLen > cMaxRegLen) { printf("\nRegulatory region length '-L%d' more than maximum %d, assuming you meant to use '-L%d'",iRegLen,cMaxRegLen,cMaxRegLen); iRegLen = cMaxRegLen; } } strcpy(szInputFile,InFile->filename[0]); strcpy(szOutputFile,OutFile->filename[0]); strcpy(szInputBiobedFile,InBedFile->filename[0]); strcpy(szInSeqFile,InSeqFile->filename[0]); // now that command parameters have been parsed then initialise diagnostics log system if(!gDiagnostics.Open(szLogFile,(etDiagLevel)iScreenLogLevel,(etDiagLevel)iFileLogLevel,true)) { printf("\nError: Unable to start diagnostics subsystem."); if(szLogFile[0] != '\0') printf(" Most likely cause is that logfile '%s' can't be opened/created",szLogFile); exit(1); } gDiagnostics.DiagOut(eDLInfo,gszProcName,"Version: %d.%2.2d Processing parameters:",cProgVer/100,cProgVer%100); gDiagnostics.DiagOutMsgOnly(eDLInfo,"Loci file (.csv) file to process: '%s'",szInputFile); gDiagnostics.DiagOutMsgOnly(eDLInfo,"bio assembly (.seq) file to process: '%s'",szInSeqFile); gDiagnostics.DiagOutMsgOnly(eDLInfo,"where to write out fasta with random sequences: '%s'",szOutputFile); gDiagnostics.DiagOutMsgOnly(eDLInfo,"biobed file containing regional features: '%s'",szInputBiobedFile); gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing mode: %s",iMode == eProcModeStandard ? "standard" : iMode == eProcModeStandard ? "extended" : "summary"); gDiagnostics.DiagOutMsgOnly(eDLInfo,"Accept random samples in any of these regions: '%s'",Regions2Txt(iRegionsIn)); #ifdef _WIN32 SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); #endif Rslt = Process(iMode,iRegionsIn,iRegLen,szInputFile,szInputBiobedFile,szInSeqFile,szOutputFile); gStopWatch.Stop(); Rslt = Rslt < 0 ? 1 : 0; gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit Code: %d Total processing time: %s",Rslt,gStopWatch.Read()); exit(Rslt); } else { arg_print_errors(stdout,end,gszProcName); arg_print_syntax(stdout,argtable,"\nend of help\n"); exit(1); } }
int _tmain(int argc, char* argv[]) { // determine my process name _splitpath(argv[0],NULL,NULL,gszProcName,NULL); #else int main(int argc, const char** argv) { // determine my process name CUtility::splitpath((char *)argv[0],NULL,gszProcName); #endif int iScreenLogLevel; // level of screen diagnostics int iFileLogLevel; // level of file diagnostics char szLogFile[_MAX_PATH]; // write diagnostics to this file int Rslt; int Idx; int iProcMode; char Strand; // process features on this strand int MinLen; int JoinLen; int LenFileList; int NumIncludeChroms; char *pszIncludeChroms[cMaxIncludeChroms]; int NumExcludeChroms; char *pszExcludeChroms[cMaxExcludeChroms]; etBEDRegion Region; // process for this functional region only int NumInFiles; // number of control input files char *pszInFileSpecs[cMaxNumBedFiles]; // input (wildcards allowed) BED files char szOutFile[_MAX_PATH]; // write merged to this file // command line args struct arg_lit *help = arg_lit0("h","help", "print this help and exit"); struct arg_lit *version = arg_lit0("v","version,ver", "print version information and exit"); struct arg_int *FileLogLevel=arg_int0("f", "FileLogLevel", "<int>","Level of diagnostics written to screen and logfile 0=fatal,1=errors,2=info,3=diagnostics,4=debug"); struct arg_file *LogFile = arg_file0("F","log","<file>", "diagnostics log file"); struct arg_int *ProcMode = arg_int0("m","mode","<int>", "merge processing mode: 0 - Strand independent union, 1 - Strand dependent union"); struct arg_int *strand = arg_int0("s","strand","<int>", "filter for this strand: 0 - any, 1 - Watson '+', 2 - Crick '-' (default is any)"); struct arg_int *region = arg_int0("r","genomicregion","<int>", "Retain annotated regions 0:ALL,1:Intergenic,2:Exons,3:Introns,4:CDS,5:UTRs,6:5'UTR,7:3'UTR (default = ALL)"); struct arg_int *minlen = arg_int0("l","minlen","<int>", "generated merged features must be of at least this length (default is 20)"); struct arg_int *joinlen = arg_int0("j","joinlen","<int>", "merge features which are separated by at most this length, 0 if no merging (default is 1)"); struct arg_str *excludechroms = arg_strn("Z","chromexclude","<string>",0,cMaxExcludeChroms,"regular expressions defining chromosomes to always exclude"); struct arg_str *includechroms = arg_strn("z","chromeinclude","<string>",0,cMaxIncludeChroms,"regular expressions defining chromosomes to explicitly include if not already excluded"); struct arg_file *infiles = arg_filen("i","srcfiles","<file>",0, cMaxNumBedFiles,"merge features contained in these BED files (wildcards alllowed)"); struct arg_file *OutFile = arg_file1("o",NULL,"<file>", "output merged features to this BED file"); struct arg_end *end = arg_end(20); void *argtable[] = {help,version,FileLogLevel,LogFile, ProcMode,strand,minlen,joinlen,region,excludechroms,includechroms,infiles,OutFile, end}; char **pAllArgs; int argerrors; argerrors = CUtility::arg_parsefromfile(argc,(char **)argv,&pAllArgs); if(argerrors >= 0) argerrors = arg_parse(argerrors,pAllArgs,argtable); /* special case: '--help' takes precedence over error reporting */ if (help->count > 0) { printf("\n%s BED Merge Blocks, Version %s\nOptions ---\n", gszProcName,cpszProgVer); arg_print_syntax(stdout,argtable,"\n"); arg_print_glossary(stdout,argtable," %-25s %s\n"); printf("\nNote: Parameters can be entered into a parameter file, one parameter per line."); printf("\n To invoke this parameter file then precede its name with '@'"); printf("\n e.g. %s @myparams.txt\n",gszProcName); printf("\nPlease report any issues regarding usage of %s at https://github.com/csiro-crop-informatics/biokanga/issues\n\n",gszProcName); exit(1); } /* special case: '--version' takes precedence error reporting */ if (version->count > 0) { printf("\n%s Version %s\n",gszProcName,cpszProgVer); exit(1); } if (!argerrors) { if(FileLogLevel->count && !LogFile->count) { printf("\nError: FileLogLevel '-f%d' specified but no logfile '-F<logfile>'",FileLogLevel->ival[0]); exit(1); } iScreenLogLevel = iFileLogLevel = FileLogLevel->count ? FileLogLevel->ival[0] : eDLInfo; if(iFileLogLevel < eDLNone || iFileLogLevel > eDLDebug) { printf("\nError: FileLogLevel '-l%d' specified outside of range %d..%d",iFileLogLevel,eDLNone,eDLDebug); exit(1); } if(LogFile->count) { strncpy(szLogFile,LogFile->filename[0],_MAX_PATH); szLogFile[_MAX_PATH-1] = '\0'; } else { iFileLogLevel = eDLNone; szLogFile[0] = '\0'; } iProcMode = ProcMode->count ? ProcMode->ival[0] : ePMDefault; if(iProcMode < ePMDefault || iProcMode >= ePMplaceholder) { printf("Error: Processing mode '-p%d' is not in range 0..%d",iProcMode,ePMplaceholder-1); exit(1); } MinLen = minlen->count ? minlen->ival[0] : cDfltMergeLen; if(MinLen < cMinMergeLen || MinLen > cMaxMergeLen) { printf("Error: minimum length '-l%d' is not in range %d..%d",MinLen,cMinMergeLen,cMaxMergeLen); exit(1); } JoinLen = joinlen->count ? joinlen->ival[0] : 1; if(JoinLen < 0 || JoinLen > cMaxMergeLen) { printf("Error: Join length '-j%d' is not in range 0..%d",JoinLen,cMaxMergeLen); exit(1); } Strand = strand->count ? strand->ival[0] : 0; if(Strand < 0 || Strand > 2) { printf("\nError: Strand '-s%d' specified outside of range 0..2",Strand); exit(1); } switch(Strand) { case 1: Strand = (int)'+'; break; case 2: Strand = (int)'-'; break; case 0: Strand = (int)'*'; break; } Region = (etBEDRegion)(region->count ? region->ival[0] : eMEGRAny); // default as being any region if(Region < eMEGRAny || Region > eMEG3UTR) { printf("\nSpecified region '-g%d' outside of range 0..%d",Region,eMEG3UTR); exit(1); } NumIncludeChroms = includechroms->count; for(Idx=0;Idx < includechroms->count; Idx++) { LenFileList = (int)strlen(includechroms->sval[Idx]); pszIncludeChroms[Idx] = new char [LenFileList+1]; strcpy(pszIncludeChroms[Idx],includechroms->sval[Idx]); TrimQuotes(pszIncludeChroms[Idx]); } NumExcludeChroms = excludechroms->count; for(Idx=0;Idx < excludechroms->count; Idx++) { LenFileList = (int)strlen(excludechroms->sval[Idx]); pszExcludeChroms[Idx] = new char [LenFileList+1]; strcpy(pszExcludeChroms[Idx],excludechroms->sval[Idx]); TrimQuotes(pszExcludeChroms[Idx]); } if(!infiles->count) { printf("\nError: No input file(s) specified with with '-i<filespec>' option)"); exit(1); } for(NumInFiles=Idx=0;NumInFiles < cMaxNumBedFiles && Idx < infiles->count; Idx++) { pszInFileSpecs[Idx] = NULL; if(pszInFileSpecs[NumInFiles] == NULL) pszInFileSpecs[NumInFiles] = new char [_MAX_PATH]; strncpy(pszInFileSpecs[NumInFiles],infiles->filename[Idx],_MAX_PATH); pszInFileSpecs[NumInFiles][_MAX_PATH-1] = '\0'; CUtility::TrimQuotedWhitespcExtd(pszInFileSpecs[NumInFiles]); if(pszInFileSpecs[NumInFiles][0] != '\0') NumInFiles++; } if(!NumInFiles) { printf("\nError: After removal of whitespace, no input file(s) specified with '-i<filespec>' option)"); exit(1); } strncpy(szOutFile,OutFile->filename[0],_MAX_PATH); szOutFile[_MAX_PATH-1] = '\0'; // now that command parameters have been parsed then initialise diagnostics log system if(!gDiagnostics.Open(szLogFile,(etDiagLevel)iScreenLogLevel,(etDiagLevel)iFileLogLevel,true)) { printf("\nError: Unable to start diagnostics subsystem."); if(szLogFile[0] != '\0') printf(" Most likely cause is that logfile '%s' can't be opened/created",szLogFile); exit(1); } gDiagnostics.DiagOut(eDLInfo,gszProcName,"Version: %s Processing parameters:",cpszProgVer); gDiagnostics.DiagOutMsgOnly(eDLInfo,"Processing Mode: %d (%s)",iProcMode,ProcMode2Txt((etProcMode)iProcMode)); gDiagnostics.DiagOutMsgOnly(eDLInfo,"process for this strand only: '%c'",(char)Strand); gDiagnostics.DiagOutMsgOnly(eDLInfo,"generated merged features will be at least this length: %d",MinLen); if(JoinLen == 0) gDiagnostics.DiagOutMsgOnly(eDLInfo,"keep separate features, no merging"); else gDiagnostics.DiagOutMsgOnly(eDLInfo,"merge features separated by upto: %d",JoinLen); gDiagnostics.DiagOutMsgOnly(eDLInfo,"Retain Region: %s",Region2Txt((etBEDRegion)Region)); for(Idx = 0; Idx < NumIncludeChroms; Idx++) gDiagnostics.DiagOutMsgOnly(eDLInfo,"reg expressions defining chroms to include: '%s'",pszIncludeChroms[Idx]); for(Idx = 0; Idx < NumExcludeChroms; Idx++) gDiagnostics.DiagOutMsgOnly(eDLInfo,"reg expressions defining chroms to exclude: '%s'",pszExcludeChroms[Idx]); for(Idx=0;Idx < NumInFiles; Idx++) gDiagnostics.DiagOutMsgOnly(eDLInfo,"merge features from this input BED file (%d): '%s'",Idx+1,pszInFileSpecs[Idx]); gDiagnostics.DiagOutMsgOnly(eDLInfo,"Output merged features into BED file: '%s'",szOutFile); gStopWatch.Start(); #ifdef _WIN32 SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); #endif Rslt = Process((etProcMode)iProcMode,Strand,MinLen,JoinLen,Region, NumIncludeChroms, // number of chromosome regular expressions to include pszIncludeChroms, // array of include chromosome regular expressions NumExcludeChroms, // number of chromosome expressions to exclude pszExcludeChroms, // array of exclude chromosome regular expressions NumInFiles,pszInFileSpecs,szOutFile); gStopWatch.Stop(); Rslt = Rslt >=0 ? 0 : 1; gDiagnostics.DiagOut(eDLInfo,gszProcName,"Exit code: %d Total processing time: %s",Rslt,gStopWatch.Read()); exit(Rslt); } else { printf("\n%s BED Merge Blocks, Version %s\n",gszProcName,cpszProgVer); arg_print_errors(stdout,end,gszProcName); arg_print_syntax(stdout,argtable,"\nUse '-h' to view option and parameter usage\n"); exit(1); } }
bool FSubversionUpdateStatusWorker::Execute(FSubversionSourceControlCommand& InCommand) { // update using any special hints passed in via the operation check(InCommand.Operation->GetName() == GetName()); TSharedRef<FUpdateStatus, ESPMode::ThreadSafe> Operation = StaticCastSharedRef<FUpdateStatus>(InCommand.Operation); if(InCommand.Files.Num() > 0) { TArray<FXmlFile> ResultsXml; TArray<FString> Parameters; Parameters.Add(TEXT("--show-updates")); Parameters.Add(TEXT("--verbose")); TArray<FString> Files; if(Operation->ShouldCheckAllFiles() && InCommand.Files.Num() > 1) { // Prime the resultant states here depending on whether the files are under the // working copy or not. // This works because these states will be processed first when they come to be updated on // the main thread, before being updated with any later on in the array by any that were // returned from the svn status command. Files.Add(InCommand.WorkingCopyRoot); for(auto Iter(InCommand.Files.CreateConstIterator()); Iter; ++Iter) { FSubversionSourceControlState State(*Iter); if(State.GetFilename().StartsWith(InCommand.WorkingCopyRoot)) { State.WorkingCopyState = EWorkingCopyState::NotControlled; } else { State.WorkingCopyState = EWorkingCopyState::NotAWorkingCopy; } OutStates.Add(State); } } else { Files.Append(InCommand.Files); } InCommand.bCommandSuccessful = SubversionSourceControlUtils::RunCommand(TEXT("status"), Files, Parameters, ResultsXml, InCommand.ErrorMessages, InCommand.UserName); SubversionSourceControlUtils::ParseStatusResults(ResultsXml, InCommand.ErrorMessages, InCommand.UserName, InCommand.WorkingCopyRoot, OutStates); SubversionSourceControlUtils::RemoveRedundantErrors(InCommand, TEXT("' is not a working copy")); } else { InCommand.bCommandSuccessful = true; } if(Operation->ShouldUpdateHistory()) { for(auto Iter(InCommand.Files.CreateConstIterator()); Iter; Iter++) { TArray<FXmlFile> ResultsXml; TArray<FString> Parameters; //limit to last 100 changes Parameters.Add(TEXT("--limit 100")); // output all properties Parameters.Add(TEXT("--with-all-revprops")); // we want all the output! Parameters.Add(TEXT("--verbose")); TArray<FString> Files; Files.Add(*Iter); InCommand.bCommandSuccessful &= SubversionSourceControlUtils::RunCommand(TEXT("log"), Files, Parameters, ResultsXml, InCommand.ErrorMessages, InCommand.UserName); SubversionSourceControlUtils::ParseLogResults(Iter->TrimQuotes(), ResultsXml, InCommand.UserName, OutHistory); } } if(Operation->ShouldGetOpenedOnly()) { TArray<FXmlFile> ResultsXml; TArray<FString> Parameters; Parameters.Add(TEXT("--show-updates")); Parameters.Add(TEXT("--verbose")); TArray<FString> Files; Files.Add(FPaths::RootDir()); InCommand.bCommandSuccessful &= SubversionSourceControlUtils::RunCommand(TEXT("status"), Files, Parameters, ResultsXml, InCommand.ErrorMessages, InCommand.UserName); SubversionSourceControlUtils::ParseStatusResults(ResultsXml, InCommand.ErrorMessages, InCommand.UserName, InCommand.WorkingCopyRoot, OutStates); } // NOTE: we dont use the ShouldUpdateModifiedState() hint here as a normal svn status will tell us this information return InCommand.bCommandSuccessful; }