示例#1
0
 public void Set(GetJoinInfoOptions other)
 {
     if (other != null)
     {
         m_ApiVersion = PresenceInterface.GetjoininfoApiLatest;
         LocalUserId  = other.LocalUserId;
         TargetUserId = other.TargetUserId;
     }
 }
        /// <summary>
        /// Gets a join info custom game-data string for a specific user. This is a helper function for reading the presence data related to how a user can be joined.
        /// Its meaning is entirely application dependent.
        ///
        /// This value will be valid only after a QueryPresence call has successfully completed.
        /// <seealso cref="PresenceModification.PresencemodificationJoininfoMaxLength" />
        /// </summary>
        /// <param name="options">Object containing an associated user</param>
        /// <param name="outBuffer">The buffer into which the character data should be written. The buffer must be long enough to hold a string of <see cref="PresenceModification.PresencemodificationJoininfoMaxLength" />.</param>
        /// <param name="inOutBufferLength">
        /// Used as an input to define the OutBuffer length.
        /// The input buffer should include enough space to be null-terminated.
        /// When the function returns, this parameter will be filled with the length of the string copied into OutBuffer.
        /// </param>
        /// <returns>
        /// An <see cref="Result" /> that indicates whether the location string was copied into the OutBuffer.
        /// <see cref="Result.Success" /> if the information is available and passed out in OutBuffer
        /// <see cref="Result.InvalidParameters" /> if you pass a null pointer for the out parameter
        /// <see cref="Result.NotFound" /> if there is user or the location string was not found.
        /// <see cref="Result.LimitExceeded" /> - The OutBuffer is not large enough to receive the location string. InOutBufferLength contains the required minimum length to perform the operation successfully.
        /// </returns>
        public Result GetJoinInfo(GetJoinInfoOptions options, out string outBuffer)
        {
            System.IntPtr optionsAddress = new System.IntPtr();
            Helper.TryMarshalSet <GetJoinInfoOptionsInternal, GetJoinInfoOptions>(ref optionsAddress, options);

            System.IntPtr outBufferAddress  = System.IntPtr.Zero;
            int           inOutBufferLength = PresenceModification.PresencemodificationJoininfoMaxLength + 1;

            Helper.TryMarshalAllocate(ref outBufferAddress, inOutBufferLength);

            var funcResult = EOS_Presence_GetJoinInfo(InnerHandle, optionsAddress, outBufferAddress, ref inOutBufferLength);

            Helper.TryMarshalDispose(ref optionsAddress);

            Helper.TryMarshalGet(outBufferAddress, out outBuffer);
            Helper.TryMarshalDispose(ref outBufferAddress);

            return(funcResult);
        }