mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-02-01 00:24:14 -06:00
9.34
This commit is contained in:
committed by
Kornel Lesiński
parent
83f8ddcc5b
commit
f08f4dcc3c
Executable → Regular
+37
-13
@@ -2,24 +2,21 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../Common/IntToString.h"
|
||||
|
||||
#include "PropVariantUtils.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/IntToString.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static AString GetHex(UInt32 v)
|
||||
{
|
||||
char sz[32] = { '0', 'x' };
|
||||
ConvertUInt64ToString(v, sz + 2, 16);
|
||||
char sz[16];
|
||||
sz[0] = '0';
|
||||
sz[1] = 'x';
|
||||
ConvertUInt32ToHex(v, sz + 2);
|
||||
return sz;
|
||||
}
|
||||
|
||||
void StringToProp(const AString &s, NCOM::CPropVariant &prop)
|
||||
{
|
||||
prop = MultiByteToUnicodeString(s);
|
||||
}
|
||||
|
||||
AString TypePairToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 value)
|
||||
{
|
||||
AString s;
|
||||
@@ -34,12 +31,12 @@ AString TypePairToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 val
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NCOM::CPropVariant &prop)
|
||||
{
|
||||
StringToProp(TypePairToString(pairs, num, value), prop);
|
||||
prop = TypePairToString(pairs, num, value);
|
||||
}
|
||||
|
||||
|
||||
AString TypeToString(const char *table[], unsigned num, UInt32 value)
|
||||
{
|
||||
if (value < num)
|
||||
@@ -49,10 +46,37 @@ AString TypeToString(const char *table[], unsigned num, UInt32 value)
|
||||
|
||||
void TypeToProp(const char *table[], unsigned num, UInt32 value, NCOM::CPropVariant &prop)
|
||||
{
|
||||
StringToProp(TypeToString(table, num, value), prop);
|
||||
prop = TypeToString(table, num, value);
|
||||
}
|
||||
|
||||
|
||||
AString FlagsToString(const char **names, unsigned num, UInt32 flags)
|
||||
{
|
||||
AString s;
|
||||
for (unsigned i = 0; i < num; i++)
|
||||
{
|
||||
UInt32 flag = (UInt32)1 << i;
|
||||
if ((flags & flag) != 0)
|
||||
{
|
||||
const char *name = names[i];
|
||||
if (name != 0 && name[0] != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
s += name;
|
||||
flags &= ~flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flags != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
s += GetHex(flags);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags)
|
||||
{
|
||||
AString s;
|
||||
@@ -82,5 +106,5 @@ AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags)
|
||||
|
||||
void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NCOM::CPropVariant &prop)
|
||||
{
|
||||
StringToProp(FlagsToString(pairs, num, flags), prop);
|
||||
prop = FlagsToString(pairs, num, flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user