Esempio n. 1
0
        internal static string ZStringToString(ZString zs)
        {
            byte[] managedArray = new byte[(int)zs.len];
            System.Runtime.InteropServices.Marshal.Copy(zs.val, managedArray, 0, (int)zs.len);
            string result = System.Text.Encoding.UTF8.GetString(managedArray, 0, (int)zs.len);

            // TODO Free ZString ???
            return(result);
        }
Esempio n. 2
0
        internal static Dictionary <string, string> ZStringToProperties(ZString zs)
        {
            var str = ZTypes.ZStringToString(zs);

            // Parse the properties from the string
            var properties = str.Split(_propSeparator, StringSplitOptions.RemoveEmptyEntries)
                             .Select(x => x.Split(_kvSeparator, 2))
                             .ToDictionary(x => x.First(), x => (x.Length == 2) ? x.Last() : "");

            return(properties);
        }