示例#1
0
文件: Plugin.cpp 项目: BIAINC/7Zip
static AString PropToString(const NCOM::CPropVariant &prop, PROPID propID)
{
  AString s;

  if (prop.vt == VT_BSTR)
    s = GetSystemString(prop.bstrVal, CP_OEMCP);
  else if (prop.vt == VT_BOOL)
  {
    int messageID = VARIANT_BOOLToBool(prop.boolVal) ?
      NMessageID::kYes : NMessageID::kNo;
    return g_StartupInfo.GetMsgString(messageID);
  }
  else if (prop.vt != VT_EMPTY)
  {
    if ((
        propID == kpidSize ||
        propID == kpidPackSize ||
        propID == kpidNumSubDirs ||
        propID == kpidNumSubFiles ||
        propID == kpidNumBlocks ||
        propID == kpidPhySize ||
        propID == kpidHeadersSize ||
        propID == kpidClusterSize
        ) && (prop.vt == VT_UI8 || prop.vt == VT_UI4))
      s = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
    else
      s = UnicodeStringToMultiByte(ConvertPropertyToString(prop, propID), CP_OEMCP);
  }
  s.Replace((char)0xA, ' ');
  s.Replace((char)0xD, ' ');
  return s;
}
示例#2
0
 AString GetName() const
 {
   AString dirName = GetDirName();
   const char kDirSeparator = CHAR_PATH_SEPARATOR; // '\\';
   // check kDirSeparator in Linux
   dirName.Replace((char)(unsigned char)0xFF, kDirSeparator);
   if (!dirName.IsEmpty() && dirName.Back() != kDirSeparator)
     dirName += kDirSeparator;
   return dirName + GetFileName();
 }
示例#3
0
AAboutForm* AAboutForm::CreateMe()
{
	afc_object<AMLBody> pBody(new AMLBody());
	AString xml;
	xml = g_szFormXML;
	xml.Replace(_T("@"),_T("\""));
	pBody->FromXML(xml);
	AAboutForm* p = dynamic_cast<AAboutForm*>( AControl::CreateInstance(&pBody,AApplication::Get()) );
	return p;
}
void AColorDialogForm::CreateFromXML()
{
	afc_object<AMLBody> pBody(new AMLBody());
	AString xml;
	xml = g_szDialogWnd;
	xml.Replace(_T("@"),_T("\""));
	pBody->FromXML(xml);
	this->FromXML(&pBody);
	this->CenterToScreen();
}
void AMessageForm::CreateFromXML(TDialogButton db)
{
	m_dbs = db;
	afc_object<AMLBody> pBody(new AMLBody());
	AString xml;
	xml = g_szDialogWnd;
	xml.Replace(_T("@"),_T("\""));
	pBody->FromXML(xml);
	this->FromXML(&pBody);
	this->CenterToScreen();
}
示例#6
0
bool ReadJPEGInfo(const char *filename, JPEG_INFO& info)
{
	EXIFINFO exinfo;
	Exif exif(&exinfo);
	FILE *fp;
	bool success = false;

	memset(&exinfo, 0, sizeof(exinfo));

	if ((fp = fopen(filename, "rb")) != NULL) {
		if (exif.DecodeExif(fp)) {
			info.CameraMake  = exinfo.CameraMake;
			info.CameraModel = exinfo.CameraModel;
			info.Width  	 = exinfo.Width;
			info.Height 	 = exinfo.Height;
			info.Orientation = exinfo.Orientation;
			info.bDateValid  = false;
			info.Comments    = exinfo.Comments;

			AString str = exinfo.DateTime;

			if (str.Valid()) {
				//printf("File '%s' has date '%s'\n", filename, str.str());

				str.Replace(":/-.", "    ");
				
				ADateTime& dt = info.DateTime;
				uint_t word = 0;
				
				uint16_t year   = str.Word(word++);
				uint8_t  month  = str.Word(word++);
				uint8_t  day    = str.Word(word++);
				uint8_t  hour   = str.Word(word++);
				uint8_t  minute = str.Word(word++);
				uint8_t  second = str.Word(word++);

				if ((year >= 1980) && RANGE(month, 1, 12) && RANGE(day, 1, 31) && (hour <= 23) && (minute <= 59) && (second <= 61)) {
					dt.Set(day, month, year, hour, minute, second);
					
					info.bDateValid = true;
				}
			}

			success = true;
		}
		
		fclose(fp);
	}

	return success;
}