コード例 #1
0
        /// <summary>
        /// Enumerates each string from the array using the UTF-8 marshaler.
        /// </summary>
        public             String[] ReadStrings()
        {
            var count = checked ((int)Array.Count.ToUInt32());

            String[] toReturn = new String[count];

            for (int i = 0; i < count; i++)
            {
                toReturn[i] = LaxUtf8Marshaler.FromNative(Marshal.ReadIntPtr(Array.Strings, i * IntPtr.Size));
            }

            return(toReturn);
        }
コード例 #2
0
        private static unsafe void HandleError(int result)
        {
            string           errorMessage;
            GitErrorCategory errorCategory = GitErrorCategory.Unknown;
            GitError *       error         = NativeMethods.git_error_last();

            if (error == null)
            {
                errorMessage = "No error message has been provided by the native library";
            }
            else
            {
                errorMessage = LaxUtf8Marshaler.FromNative(error->Message);
            }

            Func <string, GitErrorCategory, GitException> exceptionBuilder;

            if (!GitErrorsToGitExceptions.TryGetValue((GitErrorCode)result, out exceptionBuilder))
            {
                exceptionBuilder = (m, c) => new GitException(m, c);
            }

            throw exceptionBuilder(errorMessage, errorCategory);
        }
コード例 #3
0
 public new static FilePath FromBuffer(byte[] buffer)
 {
     return(LaxUtf8Marshaler.FromBuffer(buffer));
 }
コード例 #4
0
 public new static unsafe FilePath FromNative(char *buffer)
 {
     return(LaxUtf8Marshaler.FromNative(buffer));
 }
コード例 #5
0
 public new static FilePath FromNative(IntPtr pNativeData)
 {
     return(LaxUtf8Marshaler.FromNative(pNativeData));
 }