public static string GetConfigurationString (ConfStr name)
		{
			ulong len = Syscall.confstr (name, null, 0);
			if (len == 0)
				return "";
			StringBuilder buf = new StringBuilder ((int) len+1);
			len = Syscall.confstr (name, buf, len);
			return buf.ToString ();
		}
Beispiel #2
0
    private static void Deserialize(byte[] bytes)
    {
        int startIndex = 0;

        while (startIndex < bytes.Length)
        {
            var conf = new ConfStr();
            conf.Desearize(bytes, ref startIndex);
            Configs.Add(conf.Id, conf);
        }
    }
		public static extern ulong confstr (ConfStr name, [Out] StringBuilder buf, ulong len);
		public static bool TryToConfStr (Int32 value, out ConfStr rval)
		{
			return ToConfStr (value, out rval) == 0;
		}
		private static extern int ToConfStr (Int32 value, out ConfStr rval);
		public static Int32 FromConfStr (ConfStr value)
		{
			Int32 rval;
			if (FromConfStr (value, out rval) == -1)
				ThrowArgumentException (value);
			return rval;
		}
		public static bool TryFromConfStr (ConfStr value, out Int32 rval)
		{
			return FromConfStr (value, out rval) == 0;
		}
		private static extern int FromConfStr (ConfStr value, out Int32 rval);