Example #1
0
//取得所有的文件版本信息,各信息间以\n分隔 
CString HFileVersion::GetFullVersion() 
{ 
	CString strRet; 
	/* 
	szRet = "文件版本: " + GetFileVersion() + "\n"; 
	szRet += "说明: " + GetFileDescription() +"\n"; 
	szRet += "版权: " + GetLegalCopyright() +"\n"; 
	szRet += "备注: " + GetComments() + "\n"; 
	szRet += "产品版本: " + GetProductVersion() +"\n"; 
	szRet += "产品名称: " + GetProductName() +"\n"; 
	szRet += "个人用内部版本说明: " + GetPrivateBuild() +"\n"; 
	szRet += "公司名称: " + GetCompanyName() +"\n"; 
	szRet += "合法商标: " + GetLegalTrademarks() +"\n"; 
	szRet += "内部名称: " + GetInternalName() +"\n"; 
	szRet += "特殊内部版本说明: " + GetSpecialBuild() +"\n"; 
	szRet += "源文件名: " + GetOriginalFilename() +"\n"; 
	*/ 
	strRet = "FileVersion: " + GetFileVersion() + "\n"; 
	strRet += "FileDescription: " + GetFileDescription() +"\n"; 
	strRet += "CopyRight: " + GetLegalCopyright() +"\n"; 
	strRet += "Comments: " + GetComments() + "\n"; 
	strRet += "ProductVersion: " + GetProductVersion() +"\n"; 
	strRet += "ProductName: " + GetProductName() +"\n"; 
	strRet += "PrivateBuild: " + GetPrivateBuild() +"\n"; 
	strRet += "CompanyName: " + GetCompanyName() +"\n"; 
	strRet += "TradeMarks: " + GetLegalTrademarks() +"\n"; 
	strRet += "InternalName: " + GetInternalName() +"\n"; 
	strRet += "SpecialBuild: " + GetSpecialBuild() +"\n"; 
	strRet += "OriginalFileName: " + GetOriginalFilename() +"\n"; 
	return strRet; 
} 
Example #2
0
std::map<Language, std::string> CVolumeDirectory::GetLongNames() const
{
  std::string name = GetInternalName();
  if (name.empty())
    return {{}};
  return {{Language::LANGUAGE_UNKNOWN, name}};
}
Example #3
0
/********************************************************************************************

>	TemplateAttribute::TemplateAttribute(	const StringBase& InternalName,
											const StringBase& Question,
											const StringBase& Param)
 	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	27/06/97

	Purpose:	Default constructor for TemplateAttribute

	Inputs:		InternalName 
				Question
				Param

	Notes:		Currently forms a UserAttribute with a LongKey of
				WizOp\InternalName/Param

********************************************************************************************/
TemplateAttribute::TemplateAttribute(	const StringBase& InternalName,
										const StringBase& Question,
										const StringBase& Param)
{
	// Copy as much of the question as we can.
	SetWizOpNameAndParam(InternalName, Param);

	// Cache this test for faster Attribute gallery scans.
	m_fIsAnObjectName = (GetInternalName() == TA_NAME);

	if (Question.Length() > 0)
	{
		String_256 NewValue;
		INT32 LengthToCopy = (NewValue.MaxLength() < Question.Length())
								? TRACE( _T("TemplateAttribute::TemplateAttribute: Q truncated\n")),
								  NewValue.MaxLength()
								: Question.Length();
		if (LengthToCopy > 0)
		{
			String_256 TruncatedQuestion;
			Question.Left(&TruncatedQuestion, LengthToCopy);

			if (!Value.Value.Alloc(TruncatedQuestion.Length()))
			{
				ERROR1RAW(_R(IDE_NOMORE_MEMORY));
				return;
			}

			Value.Value = TruncatedQuestion;
		}
	}
}
Example #4
0
std::map<IVolume::ELanguage, std::string> CVolumeDirectory::GetNames(bool prefer_long) const
{
	std::map<IVolume::ELanguage, std::string> names;
	std::string name = GetInternalName();
	if (!name.empty())
		names[IVolume::ELanguage::LANGUAGE_UNKNOWN] = name;
	return names;
}
	CExecutablePtr CBioSIMProject::FindItem(const string& iName)
	{
		ASSERT(m_pMyself);
		//we check if it's the project itself...
		if (GetInternalName() == iName)
			return *m_pMyself;

		return CExecutableGroup::FindItem(iName);
	}
Example #6
0
/********************************************************************************************

>	VisibleAttribute* TemplateAttribute::CreateVisibleAttribute() const

	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	09/06/97
	
	Purpose:	Creates a template attribute the user can play with. This is all wrong
				(arrggghh)

	Returns:	A pointer to the UI equivalent of this attribute

********************************************************************************************/
VisibleAttribute* TemplateAttribute::CreateVisibleAttribute() const
{
	VisibleAttribute* pVisibleAttribute = NULL;	// return this

	WizOp* pHandler = GetWizOps().FindWizOpFromInternalName(GetInternalName());

	if (pHandler != NULL)
	{
		pVisibleAttribute = new VisibleTemplateAttribute(*pHandler, GetQuestion(), GetParam());
	}

	return pVisibleAttribute;
}
Example #7
0
/********************************************************************************************

>	virtual BOOL TemplateAttribute::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

 	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	27/06/97

	Purpose:	Writes the TemplateAttribute to the filter

	Inputs:		pFilter = ptr to the filter
	Returns:	TRUE if record is written, FALSE if not

********************************************************************************************/
BOOL TemplateAttribute::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
{
#ifdef DO_EXPORT
	ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");

	// Add a description of the TAG_WIZOP record for older importers
	pFilter->AddTagDescription(TAG_WIZOP, _R(IDS_TAG_WIZOP));

	CamelotFileRecord Rec(pFilter, TAG_WIZOP, CXF_UNKNOWN_SIZE);

	BOOL ok = Rec.Init();

	if (ok)
	{
		String_64 InternalName = GetInternalName();
		ok = Rec.WriteUnicode((TCHAR*)InternalName);
	}
	if (ok)
	{
		String_256 Question = GetQuestion();
		ok = Rec.WriteUnicode((TCHAR*)Question);
	}
	if (ok)
	{
		String_64 Param = GetParam();
		ok = Rec.WriteUnicode((TCHAR*)Param);
	}
	if (ok)
	{
		// Write out some patch space
		String_8 NonConstNullString = NullString;
		ok = Rec.WriteUnicode((TCHAR*)NonConstNullString);
	}

	if (ok)
	{
		ok = pFilter->Write(&Rec);
	}

	if (!ok)
	{
		pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
	}

	return ok;
#else
	return FALSE;
#endif
}
Example #8
0
/********************************************************************************************

>	virtual AttributeIdentifier	TemplateAttribute::GetAttributeClassID() const

	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	09/06/97
	
	Purpose:	Generates an AttributeIdentifier for this Attribute.
				Since the RuntimeClass is inadequate for dynamically generated Atrributes
				(read Nodes), we need to provide an ID that can be created dynamically too.
				This is what an AttributeIdentifier is supposed to be.
				In the case of a TemplateAttribute it returns a pointer to a template
				handler.

********************************************************************************************/
AttributeIdentifier	TemplateAttribute::GetAttributeClassID() const
{
#ifdef _DEBUG
	String_128			ConstructedKey( s_TemplateKey );
	ConstructedKey += s_KeyDelimiter;
	ConstructedKey += GetInternalName();
	if (!GetParam().IsEmpty())
	{
		ConstructedKey += s_ParamDelimiter;
		ConstructedKey += GetParam();
	}
	ERROR3IF(ConstructedKey != Value.LongKey,
				"TemplateAttribute::GetAttributeClassID: ConstructedKey != LongKey");
#endif

	return Value.LongKey;
}
Example #9
0
void wxTarEntry::SetName(const wxString& name, wxPathFormat format)
{
    bool isDir;
    m_Name = GetInternalName(name, format, &isDir);
    SetIsDir(isDir);
}
Example #10
0
int main(int argc, char* argv[]) {
    if (argc < 2) {
        doHelp(argv[0]);
        return 1;
    }

    OperationMode mode = kModeUpdate;
    std::list<plString> addPaths;
    std::list<plString> delPaths;
    std::list<plString> sumFiles;

    for (int i = 1; i < argc; i++) {
        if (argv[i][0] == '-') {
            if (strcmp(argv[i], "-L") == 0) {
                mode = kModeList;
            } else if (strcmp(argv[i], "-i") == 0) {
                mode = kModeManual;
                if (++i >= argc) {
                    fprintf(stderr, "Error: Expected filename\n");
                    return 1;
                }
                addPaths.push_back(argv[i]);
            } else if (strcmp(argv[i], "-d") == 0) {
                mode = kModeManual;
                if (++i >= argc) {
                    fprintf(stderr, "Error: Expected filename\n");
                    return 1;
                }
                delPaths.push_back(argv[i]);
            } else if (strcmp(argv[i], "-c") == 0) {
                s_createFile = true;
            } else if (strcmp(argv[i], "-y") == 0) {
                s_autoYes = true;
            } else if (strcmp(argv[i], "-old") == 0) {
                s_oldFormat = true;
            } else if (strcmp(argv[i], "--help") == 0) {
                doHelp(argv[0]);
                return 0;
            } else {
                fprintf(stderr, "Error: Unrecognized option %s\n", argv[i]);
                return 1;
            }
        } else {
            sumFiles.push_back(argv[i]);
        }
    }

    if (sumFiles.empty()) {
        fprintf(stderr, "Error: No sum files specified\n");
        return 1;
    }
    if (s_createFile && mode == kModeList) {
        fprintf(stderr, "Error: -c and -L options cannot be combined\n");
        return 1;
    }

    switch (mode) {
    case kModeUpdate:
        for (std::list<plString>::iterator fn = sumFiles.begin(); fn != sumFiles.end(); fn++) {
            if (UpdateSums(*fn))
                printf("Successfully updated %s\n", fn->cstr());
        }
        break;
    case kModeList:
        for (std::list<plString>::iterator fn = sumFiles.begin(); fn != sumFiles.end(); fn++) {
            printf("%s:\n", fn->cstr());
            try {
                plEncryptedStream S;
                if (!S.open(*fn, fmRead, plEncryptedStream::kEncAuto)) {
                    fprintf(stderr, "Could not open file %s\n", fn->cstr());
                    continue;
                }
                SumFile sum;
                sum.read(&S);
                S.close();

                std::vector<SumEntry>::iterator it;
                for (it = sum.fEntries.begin(); it != sum.fEntries.end(); it++)
                    PrintFile(*it, ' ');
                printf("\n");
            } catch (hsException& e) {
                fprintf(stderr, "%s:%ld: %s\n", e.File(), e.Line(), e.what());
                return 1;
            } catch (...) {
                fprintf(stderr, "An unknown error occured\n");
                return 1;
            }
        }
        break;
    case kModeManual:
        if (sumFiles.size() != 1) {
            fprintf(stderr, "Error: You must specify exactly ONE sumfile for\n");
            fprintf(stderr, "-i and -d operations\n");
            return 1;
        }
        try {
            bool isUpdated = false;
            SumFile sum;
            plEncryptedStream S;
            plEncryptedStream::EncryptionType eType = plEncryptedStream::kEncXtea;
            if (!s_createFile) {
                if (!S.open(sumFiles.front(), fmRead, plEncryptedStream::kEncAuto)) {
                    fprintf(stderr, "Could not open file %s\n", sumFiles.front().cstr());
                    return 1;
                }
                eType = S.getEncType();
                sum.read(&S);
                S.close();
            } else {
                isUpdated = true;
            }

            std::list<plString>::iterator pi;
            std::vector<SumEntry>::iterator it;
            for (pi = delPaths.begin(); pi != delPaths.end(); pi++) {
                bool found = false;
                it = sum.fEntries.begin();
                while (it != sum.fEntries.end()) {
                    if (it->fPath == *pi) {
                        PrintFile(*it, '-');
                        it = sum.fEntries.erase(it);
                        found = true;
                        isUpdated = true;
                    } else {
                        ++it;
                    }
                }
                if (!found)
                    fprintf(stderr, "Warning: path '%s' not found\n", pi->cstr());
            }

            for (pi = addPaths.begin(); pi != addPaths.end(); pi++) {
                hsFileStream* IS = FindFilePath(*pi, "");
                if (IS == NULL) {
                    fprintf(stderr, "Warning: path '%s' not found\n", pi->cstr());
                    continue;
                }

                SumEntry ent;
                ent.fPath = GetInternalName(*pi);
                ent.fHash = plMD5::hashStream(IS);
                ent.fTimestamp = IS->getModTime();
                bool found = false;
                it = sum.fEntries.begin();
                while (it != sum.fEntries.end()) {
                    if (it->fPath == *pi) {
                        found = true;
                        if (it->fHash != ent.fHash) {
                            PrintFile(*it, '*');
                            it->fHash = ent.fHash;
                            it->fTimestamp = ent.fTimestamp;
                            isUpdated = true;
                        } else {
                            PrintFile(*it, ' ');
                        }
                    }
                    ++it;
                }
                if (!found) {
                    PrintFile(ent, '+');
                    sum.fEntries.push_back(ent);
                    if (IS != NULL)
                        delete IS;
                    isUpdated = true;
                }
            }

            if (isUpdated) {
                if (!S.open(sumFiles.front(), fmWrite, eType)) {
                    fprintf(stderr, "Error: Could not open %s for writing!\n",
                            sumFiles.front().cstr());
                    return 1;
                }
                sum.write(&S);
                S.close();
                printf("Successfully %s %s\n",
                       s_createFile ? "created" : "updated",
                       sumFiles.front().cstr());
            }
        } catch (hsException& e) {
            fprintf(stderr, "%s:%ld: %s\n", e.File(), e.Line(), e.what());
            return 1;
        } catch (...) {
            fprintf(stderr, "An unknown error occured\n");
            return 1;
        }
        break;
    }

    return 0;
}
Example #11
0
//
/// Retrieves the internal name of the module.
/// String version. [VH 2005-04-03]
//
tstring TModuleVersionInfo::GetInternalName(uint lang)
  {LPCTSTR v = _T(""); E = GetInternalName(v, lang); return v;}