[src] Merge two implementations of converting a FourCC to a string. (#12305)
This commit is contained in:
Родитель
3766cf8fa2
Коммит
ebee536ebb
|
@ -565,15 +565,6 @@ namespace CoreFoundation {
|
|||
|
||||
[DllImport (Constants.CoreFoundationLibrary)]
|
||||
extern static void CFBundleGetPackageInfo (IntPtr bundle, out uint packageType, out uint packageCreator);
|
||||
|
||||
static string FourCCToString (uint code)
|
||||
{
|
||||
return new string (new char [] {
|
||||
(char) (byte) (code >> 24),
|
||||
(char) (byte) (code >> 16),
|
||||
(char) (byte) (code >> 8),
|
||||
(char) (byte) code});
|
||||
}
|
||||
|
||||
public PackageInfo Info {
|
||||
get {
|
||||
|
@ -581,7 +572,7 @@ namespace CoreFoundation {
|
|||
uint creator = 0;
|
||||
|
||||
CFBundleGetPackageInfo (handle, out type, out creator);
|
||||
var creatorStr = FourCCToString (creator);
|
||||
var creatorStr = Runtime.ToFourCCString (creator);
|
||||
switch (type) {
|
||||
case 1095782476: // ""APPL
|
||||
return new PackageInfo (CFBundle.PackageType.Application, creatorStr);
|
||||
|
|
|
@ -26,15 +26,6 @@ namespace Foundation {
|
|||
|
||||
NSScriptCommandDescriptionDictionary description = null;
|
||||
|
||||
static string ToFourCCString (int value)
|
||||
{
|
||||
return new string (new char [] {
|
||||
(char) (byte) (value >> 24),
|
||||
(char) (byte) (value >> 16),
|
||||
(char) (byte) (value >> 8),
|
||||
(char) (byte) value });
|
||||
}
|
||||
|
||||
static int ToIntValue (string fourCC)
|
||||
{
|
||||
if (fourCC.Length != 4)
|
||||
|
@ -91,11 +82,11 @@ namespace Foundation {
|
|||
}
|
||||
|
||||
public string AppleEventClassCode {
|
||||
get { return ToFourCCString (FCCAppleEventClassCode); }
|
||||
get { return Runtime.ToFourCCString (FCCAppleEventClassCode); }
|
||||
}
|
||||
|
||||
public string AppleEventCode {
|
||||
get { return ToFourCCString (FCCAppleEventCode); }
|
||||
get { return Runtime.ToFourCCString (FCCAppleEventCode); }
|
||||
}
|
||||
|
||||
public string GetTypeForArgument (string name)
|
||||
|
@ -115,7 +106,7 @@ namespace Foundation {
|
|||
throw new ArgumentNullException (name);
|
||||
|
||||
using (var nsName = new NSString (name)) {
|
||||
return ToFourCCString (FCCAppleEventCodeForArgument (nsName));
|
||||
return Runtime.ToFourCCString (FCCAppleEventCodeForArgument (nsName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +118,7 @@ namespace Foundation {
|
|||
}
|
||||
|
||||
public string AppleEventCodeForReturnType {
|
||||
get { return ToFourCCString (FCCAppleEventCodeForReturnType); }
|
||||
get { return Runtime.ToFourCCString (FCCAppleEventCodeForReturnType); }
|
||||
}
|
||||
|
||||
public NSScriptCommand CreateCommand ()
|
||||
|
|
|
@ -1712,6 +1712,20 @@ namespace ObjCRuntime {
|
|||
{
|
||||
NSLog (string.Format (format, args));
|
||||
}
|
||||
|
||||
internal static string ToFourCCString (uint value)
|
||||
{
|
||||
return ToFourCCString (unchecked((int) value));
|
||||
}
|
||||
|
||||
internal static string ToFourCCString (int value)
|
||||
{
|
||||
return new string (new char [] {
|
||||
(char) (byte) (value >> 24),
|
||||
(char) (byte) (value >> 16),
|
||||
(char) (byte) (value >> 8),
|
||||
(char) (byte) value });
|
||||
}
|
||||
#endif // !COREBUILD
|
||||
|
||||
static int MajorVersion = -1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче