You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
4.9 KiB

// Copyright Epic Games, Inc. All Rights Reserved.
// This file is automatically generated. Changes to this file may be overwritten.
namespace Epic.OnlineServices
{
public sealed partial class ProductUserId : Handle
{
public ProductUserId()
{
}
public ProductUserId(System.IntPtr innerHandle) : base(innerHandle)
{
}
/// <summary>
/// A character buffer of this size is large enough to fit a successful output of <see cref="ToString" />. This length does not include the null-terminator.
/// </summary>
public const int ProductuseridMaxLength = 32;
/// <summary>
/// Retrieve an <see cref="ProductUserId" /> from a raw string representing an Epic Online Services Product User ID. The input string must be null-terminated.
/// NOTE: There is no validation on the string format, this should only be used with values serialized from legitimate sources such as <see cref="ToString" />
/// </summary>
/// <param name="productUserIdString">The stringified product user ID for which to retrieve the Epic Online Services Product User ID</param>
/// <returns>
/// The <see cref="ProductUserId" /> that corresponds to the ProductUserIdString
/// </returns>
public static ProductUserId FromString(Utf8String productUserIdString)
{
var productUserIdStringAddress = System.IntPtr.Zero;
Helper.Set(productUserIdString, ref productUserIdStringAddress);
var funcResult = Bindings.EOS_ProductUserId_FromString(productUserIdStringAddress);
Helper.Dispose(ref productUserIdStringAddress);
ProductUserId funcResultReturn;
Helper.Get(funcResult, out funcResultReturn);
return funcResultReturn;
}
public static explicit operator ProductUserId(Utf8String value)
{
return FromString(value);
}
/// <summary>
/// Check whether or not the given account unique ID is considered valid
/// NOTE: This will return true for any <see cref="ProductUserId" /> created with <see cref="FromString" /> as there is no validation
/// </summary>
/// <param name="accountId">The Product User ID to check for validity</param>
/// <returns>
/// <see langword="true" /> if the <see cref="ProductUserId" /> is valid, otherwise <see langword="false" />
/// </returns>
public bool IsValid()
{
var funcResult = Bindings.EOS_ProductUserId_IsValid(InnerHandle);
bool funcResultReturn;
Helper.Get(funcResult, out funcResultReturn);
return funcResultReturn;
}
/// <summary>
/// Retrieve a null-terminated stringified Product User ID from an <see cref="ProductUserId" />. This is useful for replication of Product User IDs in multiplayer games.
/// This string will be no larger than <see cref="ProductuseridMaxLength" /> + 1 and will only contain UTF8-encoded printable characters as well as the null-terminator.
/// </summary>
/// <param name="accountId">The Product User ID for which to retrieve the stringified version.</param>
/// <param name="outBuffer">The buffer into which the character data should be written</param>
/// <param name="inOutBufferLength">
/// The size of the OutBuffer in characters.
/// 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 including the null-termination character.
/// </param>
/// <returns>
/// An <see cref="Result" /> that indicates whether the Product User ID string was copied into the OutBuffer.
/// <see cref="Result.Success" /> - The OutBuffer was filled, and InOutBufferLength contains the number of characters copied into OutBuffer including the null-terminator.
/// <see cref="Result.InvalidParameters" /> - Either OutBuffer or InOutBufferLength were passed as <see langword="null" /> parameters.
/// <see cref="Result.InvalidUser" /> - The AccountId is invalid and cannot be stringified.
/// <see cref="Result.LimitExceeded" /> - The OutBuffer is not large enough to receive the Product User ID string. InOutBufferLength contains the required minimum length to perform the operation successfully.
/// </returns>
public Result ToString(out Utf8String outBuffer)
{
int inOutBufferLength = ProductuseridMaxLength + 1;
System.IntPtr outBufferAddress = Helper.AddAllocation(inOutBufferLength);
var funcResult = Bindings.EOS_ProductUserId_ToString(InnerHandle, outBufferAddress, ref inOutBufferLength);
Helper.Get(outBufferAddress, out outBuffer);
Helper.Dispose(ref outBufferAddress);
return funcResult;
}
public override string ToString()
{
Utf8String funcResult;
ToString(out funcResult);
return funcResult;
}
public override string ToString(string format, System.IFormatProvider formatProvider)
{
if (format != null)
{
return string.Format(format, ToString());
}
return ToString();
}
public static explicit operator Utf8String(ProductUserId value)
{
Utf8String result = null;
if (value != null)
{
value.ToString(out result);
}
return result;
}
}
}