Example #1
0
void Index::GetBatchFiles(String directory, String ext, std::vector<VFSFILE> *l)
{
	directory.ReplaceAll("/", "\\");
	unsigned long i = 0;
	while(i < (vfscount))
	{
		fIndex->Seek(offset[i]);
		fIndex->Skip((12)); // skip vfsinfo to read fileinfo
		bool isRoot = false;
		if(!vfsname[i].Compare("ROOT.VFS"))
		{
			isRoot = true;
		}
		unsigned long j = 0;
		while(j < vinfo[i]->filecount)
		{
			if(isRoot)
				break;
			unsigned long thisoffset = fIndex->Position();
			unsigned short len;
			fIndex->Read(len);
			char *tmp = new char[len];
			fIndex->ReadData(tmp, len);
			fIndex->Skip(12);
			bool del = false;
			fIndex->Read(del);
			fIndex->Skip(10);
			if(strstr(tmp, directory.Str()) && strstr(tmp, ext.Str()))
			{
				if(!del)
				{
					VFSFILE vfs;
					fIndex->Seek(thisoffset);
					vfs.vfs = vfsname[i].Str();
					fIndex->Read(vfs.strlen);
					vfs.path = new char[vfs.strlen];
					fIndex->ReadData(vfs.path, vfs.strlen);
					fIndex->Read(vfs.offset); // 4
					fIndex->Read(vfs.size); // 4
					fIndex->Read(vfs.blockSize); // 4
					fIndex->Read(vfs.deleted); // 1
					fIndex->Read(vfs.compressiontype); // 1
					fIndex->Read(vfs.encryptiontype); // 1
					fIndex->Read(vfs.version); // 4
					fIndex->Read(vfs.checksum); // 4
					l->push_back(vfs);
				}
			}
			SAFE_DELETE_ARRAY(tmp);
			j++;
		}
		i++;
	}
}
Example #2
0
MI_Result Context::Post(
    const Instance& indication, 
    MI_Uint32 subscriptionIDCount,
    const String& bookmark)
{
    return MI_PostIndication(m_context, indication.m_instance, 
        subscriptionIDCount, bookmark.Str());
}
Example #3
0
MI_Result Context::Post(MI_Result result, const String& message)
{
    if (NULL != m_result)
    {
        *m_result = result;
        return MI_RESULT_OK;
    }

    MI_Result r = MI_PostResultWithMessage(m_context, result, message.Str());

    // invalidate context, since PostResult must be the last operation on 
    // MI_Context
    m_context = 0;

    return r;
}
void  ParameterSearchBinaryCombo::ProcessCmdLineStr  (String  cmdLine)
{
  char*  arguments[60];
  int    argCount = 0;

  arguments[0] = strdup ("ParameterSearchBinaryCombo");
  argCount++;

  while  (!cmdLine.Empty ())
  {
    String  parmField = cmdLine.ExtractToken (" ");
    arguments[argCount] = strdup (parmField.Str ());
    argCount++;
  }

  ParseCommandLine (argCount, arguments);
}  /* CommandLineStr */
Example #5
0
ParameterJob::ParameterJob (RunLog&    _log,
                            String     _desc
                           ):
  log (_log)
{
  accuracy     = 0;
  startTime    = 0;

  _desc.TrimLeft ();

  curStatus = _desc.ExtractChar ();
 
  if  ((curStatus == '0')  ||  
       (curStatus == '1')  ||  
       (curStatus == '2')  ||  
       (curStatus == '3')
      )
  {
    // We Are Ok
  }
  else
  {
    log.Level (-1) << endl 
                   << "ParameterJob:  We have an invalid Cur Status."
                   << endl;
    osWaitForEnter ();
  }


  {
    String  processsNumField = _desc.ExtractToken (" ,\t");
    processNum = atoi (processsNumField.Str ());
  }


  {
    String  jobIdField = _desc.ExtractToken (" ,\t");
    jobId = atoi (jobIdField.Str ());
  }


  {
    String  cParmStr = _desc.ExtractToken (" ,\t");
    cParm = atoi (cParmStr.Str ());
  }


  {
    String  gammaParmStr = _desc.ExtractToken (" ,\t");
    gammaParm = atof (gammaParmStr.Str ());
  }


  {
    String  aParmStr = _desc.ExtractToken (" ,\t");
    aParm = atoi (aParmStr.Str ());
  }


  {
    String  accuracyField = _desc.ExtractToken (" ,\t");
    accuracy = atof (accuracyField.Str ());
  }
}
Example #6
0
ParameterProcess::ParameterProcess (RunLog&          _log,
                                    ImageClassList&  imageClasses,
                                    String           _desc
                                   ):
  log (_log)
{
  highestAccuracy  = (FFLOAT)0.0;
  startTime        = 0;

  _desc.TrimLeft ();

  curStatus = _desc.ExtractChar ();
 
  if  ((curStatus == '0')  ||  
       (curStatus == '1')  ||  
       (curStatus == '2')
      )
  {
    // We Are Ok
  }
  else
  {
    log.Level (-1) << endl 
                   << "ParameterProcess:  We have an invalid Cur Status[" << curStatus << "]."
                   << endl;
    exit (-1);
  }


  {
    String  processsNumField = _desc.ExtractToken (" ,\t");
    processNum = atoi (processsNumField.Str ());
  }


  {
    String  jobIdField = _desc.ExtractToken (" ,\t");
    jobId = atoi (jobIdField.Str ());
  }


  {
    // Lets get the two Classes that we are running for

    String  class0Name = _desc.ExtractToken (" ,\t");
    String  class1Name = _desc.ExtractToken (" ,\t");


    if  (class0Name == "NoName")
    {
      class0 = class1 = NULL;
    }
    else
    {
      class0 = imageClasses.LookUpByName (class0Name);
      class1 = imageClasses.LookUpByName (class1Name);

      if  (!class0)
      {
        cerr << endl
             << "*** ERROR ***   ParameterProcess,  Invalid Class0[" << class0Name << "]." << endl
             << endl;
        exit (-1);
      }

      if  (!class1)
      {
        cerr << endl
             << "*** ERROR ***   ParameterProcess,  Invalid Class0[" << class1Name << "]." << endl
             << endl;
        exit (-1);
      }
    }
  }


  {
    String  cParmStr = _desc.ExtractToken (" ,\t");
    cParm = atoi (cParmStr.Str ());
  }


  {
    String  gammaParmStr = _desc.ExtractToken (" ,\t");
    gammaParm = atof (gammaParmStr.Str ());
  }


  {
    String  aParmStr = _desc.ExtractToken (" ,\t");
    aParm = atoi (aParmStr.Str ());
  }


  {
    String  highestAccuracyField = _desc.ExtractToken (" ,\t");
    highestAccuracy = (FFLOAT)atof (highestAccuracyField.Str ());
  }
}
void  ParameterSearchBinaryCombo::UpdateCurrentStatusFile ()
{
  log.Level (20) << "ParameterSearchBinaryCombo::UpdateCurrentStatusFile - Updating  Current Status File." << endl;

  int  openAttempts = 0;

  statusFile = NULL;

  while  ((!statusFile)  &&  (openAttempts < 3))
  {
    openAttempts++;
    log.Level (50) << "UpdateCurrentStatusFile Oppen Attempt[" << openAttempts << "]." << endl;
    statusFile = fopen (statusFileName, "w");
    if  (!statusFile)
    {
      log.Level (0) << "UpdateCurrentStatusFile - *** WARNING ***  Can Not Open Status File[" 
                    << statusFileName << "]   -Will Retry-." 
                    << endl;
      #ifdef  WIN32
      Sleep (2000);
      #else
      sleep (2);
      #endif

    }
  }

  if  (!statusFile)
  {
     log.Level (-1) << "UpdateCurrentStatusFile - *** ERROR ***  Can not Create Status File[" 
                    << statusFileName << "]." 
                    << endl;
     EndBlock ();
     exit (1);
     osWaitForEnter ();
  }

  
  log.Level (50) << "UpdateCurrentStatusFile - Status File Opened Successfully." << endl;


  String  s;
  s = CommandLineStr ();
  fprintf (statusFile, "%s\n", s.Str ());

  fprintf (statusFile, "%d\t %f\n", 
                        numOfProcesses,
                        highestAccuracySoFar
          );


  {
    // Generate Master Class List Line.

    String  masterClassListLine;
    masterClassListLine << numOfClasses;

    for  (int idx = 0;   idx < numOfClasses;  idx++)
    {
      masterClassListLine << "\t" << masterClassList[idx]->Name ();
    }

    fprintf (statusFile, "%s\n", masterClassListLine.Str ());
  }


  {
    // Write Out Next Class IDX's
    fprintf (statusFile, "%d\t%d\n", nextClass0IDX, nextClass1IDX);
  }





  ParameterProcessListIterator  jIDX (*processes);
  ParameterProcessPtr           process;

  for  (jIDX.Reset ();  process = jIDX.CurPtr ();  ++ jIDX)
  {
    fprintf (statusFile, "%s\n", process->ToString ().Str ());
  }


  fclose  (statusFile);
  statusFile = NULL;

  log.Level (50) << "UpdateCurrentStatusFile - Exiting." << endl;
}  /* UpdateCurrentStatusFile */