Exemple #1
0
        public unsafe SwiftCharacter(string character) : this(SwiftNominalCtorArgument.None)
        {
            SwiftString swiftString = SwiftString.FromString(character);

            fixed(byte *src = swiftString.SwiftData)
            fixed(byte *dst = SwiftData)
            CreateCharacter(src, dst);
        }
Exemple #2
0
        public unsafe override string ToString()
        {
            SwiftString swiftString = new SwiftString(SwiftNominalCtorArgument.None);

            fixed(byte *source = SwiftData)
            {
                fixed(byte *dest = swiftString.SwiftData)
                {
                    GetCharacterValue(source, dest);
                    return(swiftString.ToString());
                }
            }
        }
        static string GetErrorDescription(IntPtr handle)
        {
            unsafe {
                using (var desc = new SwiftString(SwiftNominalCtorArgument.None))
                {
                    fixed(byte *p = desc.SwiftData)
                    {
                        GetErrorDescription(new IntPtr(p), handle);
                    }

                    return(desc.ToString());
                }
            }
        }
        public static SwiftError FromException(Exception e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }
            if (e is SwiftException)
            {
                return(((SwiftException)e).Error);
            }
            using (SwiftString message = (SwiftString)e.Message, className = (SwiftString)e.GetType().FullName) {
                unsafe
                {
                    fixed(byte *mess = message.SwiftData, cl = className.SwiftData)
                    {
                        var handle = DotNetErrorFactory(new IntPtr(mess), new IntPtr(cl));

                        return(new SwiftError(handle));
                    }
                }
            }
        }