/// <summary> /// Return whether or not the Key is in the meta data /// </summary> /// <param name="obj">the object to lookup the metadata for</param> /// <param name="key">The key to query for existence</param> /// <returns>true if found</returns> public bool HasValue(UObject obj, string key) { using (FStringUnsafe keyUnsafe = new FStringUnsafe(key)) { return(Native_UMetaData.HasValue(Address, obj == null ? IntPtr.Zero : obj.Address, ref keyUnsafe.Array)); } }
/// <summary> /// Set the game binaries directory /// </summary> /// <param name="inDirectory">The game binaries directory.</param> public void SetGameBinariesDirectory(string inDirectory) { using (FStringUnsafe inDirectoryUnsafe = new FStringUnsafe(inDirectory)) { Native_FModuleManager.SetGameBinariesDirectory(Address, ref inDirectoryUnsafe.Array); } }
/// <summary> /// Gets enum value by name, returns INDEX_NONE and optionally errors when name is not found. Handles full or short names /// </summary> public long GetValueByNameString(string searchString, EGetByNameFlags flags = EGetByNameFlags.None) { using (FStringUnsafe searchStringUnsafe = new FStringUnsafe(searchString)) { return(Native_UEnum.GetValueByNameString(Address, ref searchStringUnsafe.Array, flags)); } }
public void SetHelp(string help) { using (FStringUnsafe helpUnsafe = new FStringUnsafe(help)) { Native_IConsoleObject.SetHelp(Address, ref helpUnsafe.Array); } }
/// <summary> /// Determines if a module with the given name exists, regardless of whether it is currently loaded. /// </summary> /// <param name="moduleName">Name of the module to look for.</param> /// <returns>Whether the module exists.</returns> public bool ModuleExists(string moduleName) { using (FStringUnsafe moduleNameUnsafe = new FStringUnsafe(moduleName)) { return(Native_FModuleManager.ModuleExists(Address, ref moduleNameUnsafe.Array)); } }
/// <summary> /// Check whether the specified user is authorized to interact with this session. /// @see AuthorizeUser, DenyUser, DenyAllUsers /// </summary> /// <param name="userName">The name of the user to check.</param> /// <returns>true if the user is authorized, false otherwise.</returns> public static bool IsAuthorizedUser(string userName) { using (FStringUnsafe userNameUnsafe = FStringPool.New(userName)) { return(Native_FApp.IsAuthorizedUser(ref userNameUnsafe.Array)); } }
/// <summary> /// Set a new session owner. /// @see SetSessionName /// </summary> /// <param name="newOwner">The name of the new owner.</param> public static void SetSessionOwner(string newOwner) { using (FStringUnsafe newOwnerUnsafe = FStringPool.New(newOwner)) { Native_FApp.SetSessionOwner(ref newOwnerUnsafe.Array); } }
/// <summary> /// Stores the specified path, utilizing it in future search passes when /// searching for available plugins. Optionally refreshes the manager after /// the new path has been added. /// </summary> /// <param name="extraDiscoveryPath">The path you want searched for additional plugins.</param> /// <param name="refresh">Signals the function to refresh the plugin database after the new path has been added</param> public void AddPluginSearchPath(string extraDiscoveryPath, bool refresh = true) { using (FStringUnsafe extraDiscoveryPathUnsafe = new FStringUnsafe(extraDiscoveryPath)) { Native_IPluginManager.AddPluginSearchPath(Address, ref extraDiscoveryPathUnsafe.Array, refresh); } }
// TODO: FNewPluginMountedEvent / OnNewPluginCreated / OnNewPluginMounted public void MountNewlyCreatedPlugin(string pluginName) { using (FStringUnsafe pluginNameUnsafe = new FStringUnsafe(pluginName)) { Native_IPluginManager.MountNewlyCreatedPlugin(Address, ref pluginNameUnsafe.Array); } }
public void BeginSlowTask(string task, bool showProgressDialog, bool showCancelButton = false) { using (FStringUnsafe taskUnsafe = new FStringUnsafe(task)) { Native_FFeedbackContext.BeginSlowTask(Address, ref taskUnsafe.Array, showProgressDialog, showCancelButton); } }
public void StatusForceUpdate(int numerator, int denominator, string statusText) { using (FStringUnsafe statusTextUnsafe = new FStringUnsafe(statusText)) { Native_FFeedbackContext.StatusForceUpdate(Address, numerator, denominator, ref statusTextUnsafe.Array); } }
/// <summary> /// Set the value of any numeric type from a string point /// CAUTION: This routine does not do enum name conversion /// </summary> /// <param name="data">pointer to property data to set</param> /// <param name="value">Value (as a string) to set</param> public void SetNumericPropertyValueFromString(IntPtr data, string value) { using (FStringUnsafe valueUnsafe = new FStringUnsafe(value)) { Native_UNumericProperty.SetNumericPropertyValueFromString(Address, data, ref valueUnsafe.Array); } }
/// <summary> /// Sets asset path of this reference. /// </summary> /// <param name="path">The path to the asset.</param> public void SetPath(string path) { using (FStringUnsafe pathUnsafe = new FStringUnsafe(path)) { Native_FSoftObjectPath.SetPath(ref this, ref pathUnsafe.Array); } }
/// <summary> /// Checks if an element has already been added to the set /// </summary> /// <param name="inBaseAddress">The base address of the set</param> /// <param name="inElementValue">The element value to check for</param> /// <returns>True if the element is found in the set, false otherwise</returns> public bool HasElement(IntPtr inBaseAddress, string inElementValue) { for (int index = 0, itemsLeft = Num(); itemsLeft > 0; ++index) { if (IsValidIndex(index)) { --itemsLeft; IntPtr element = GetElementPtr(index); using (FStringUnsafe keyValueUnsafe = new FStringUnsafe()) { if (element != inBaseAddress && Native_UProperty.ExportText_Direct(elementProp, ref keyValueUnsafe.Array, element, element, IntPtr.Zero, 0, IntPtr.Zero)) { // Should this be case insensitive? (FString by default is case insensitive) if ((Native_UObjectBaseUtility.IsA(elementProp, Classes.UObjectProperty) && keyValueUnsafe.Value.Contains(inElementValue)) || inElementValue == keyValueUnsafe.Value) { return(true); } } } } } return(false); }
/// <summary> /// Sets the name of the current project. /// </summary> /// <param name="projectName">Name of the current project.</param> public static void SetProjectName(string projectName) { using (FStringUnsafe projectNameUnsafe = FStringPool.New(projectName)) { Native_FApp.SetProjectName(ref projectNameUnsafe.Array); } }
/// <summary> /// Returns the text to use for exporting this property to header file. /// </summary> /// <param name="extendedTypeText">for property types which use templates, will be filled in with the type</param> /// <param name="cppExportFlags">flags for modifying the behavior of the export</param> /// <returns></returns> public string GetCPPType(string extendedTypeText = null, uint cppExportFlags = 0) { if (extendedTypeText == null) { using (FStringUnsafe resultUnsafe = new FStringUnsafe()) { Native_UProperty.GetCPPType(Address, IntPtr.Zero, cppExportFlags, ref resultUnsafe.Array); return(resultUnsafe.Value); } } else { unsafe { using (FStringUnsafe extendedTypeTextUnsafe = new FStringUnsafe(extendedTypeText)) using (FStringUnsafe resultUnsafe = new FStringUnsafe()) { fixed(FScriptArray *extendedTypeTextUnsafePtr = &extendedTypeTextUnsafe.Array) { Native_UProperty.GetCPPType(Address, (IntPtr)extendedTypeTextUnsafePtr, cppExportFlags, ref resultUnsafe.Array); return(resultUnsafe.Value); } } } } }
/// <summary> /// Remove the specified user from the list of authorized session users. /// @see AuthorizeUser, DenyAllUsers, IsAuthorizedUser /// </summary> /// <param name="userName">The name of the user to remove.</param> public static void DenyUser(string userName) { using (FStringUnsafe userNameUnsafe = FStringPool.New(userName)) { Native_FApp.DenyUser(ref userNameUnsafe.Array); } }
public FName(string name, int number, EFindName findType = EFindName.Add) { using (FStringUnsafe nameUnsafe = new FStringUnsafe(name)) { Native_FName.FromStringNumber(out this, ref nameUnsafe.Array, number, findType); } }
/// <summary> /// Set a new session name. /// @see SetSessionOwner /// </summary> /// <param name="newName">The new session name.</param> public static void SetSessionName(string newName) { using (FStringUnsafe newNameUnsafe = FStringPool.New(newName)) { Native_FApp.SetSessionName(ref newNameUnsafe.Array); } }
/// <summary> /// Add a native function to the internal native function table /// </summary> /// <param name="name">name of the function</param> /// <param name="pointer">pointer to the function</param> public void AddNativeFunction(string name, IntPtr pointer) { using (FStringUnsafe nameUnsafe = new FStringUnsafe(name)) { Native_UClass.AddNativeFunction(Address, ref nameUnsafe.Array, pointer); } }
/// <summary> /// Find an existing package by name or create it if it doesn't exist /// </summary> /// <param name="outer">The Outer object to search inside</param> /// <param name="packageName"></param> /// <returns>The existing package or a newly created one</returns> public static UPackage CreatePackage(ObjectOuter outer, string packageName) { using (FStringUnsafe packageNameUnsafe = new FStringUnsafe(packageName)) { return(GCHelper.Find <UPackage>(Native_UObjectGlobals.CreatePackage(outer.Address, ref packageNameUnsafe.Array))); } }
/// <summary> /// Checks if a key in the map matches the specified key /// </summary> /// <param name="inBaseAddress">The base address of the map</param> /// <param name="inKeyValue">The key to find within the map</param> /// <returns>True if the key is found, false otherwise</returns> public bool HasKey(IntPtr inBaseAddress, string inKeyValue) { for (int index = 0, itemsLeft = Num(); itemsLeft > 0; ++index) { if (IsValidIndex(index)) { --itemsLeft; IntPtr pairPtr = GetPairPtr(index); IntPtr keyPtr = Native_UProperty.ContainerVoidPtrToValuePtr(keyProp, pairPtr, 0); using (FStringUnsafe keyValueUnsafe = new FStringUnsafe()) { if (keyPtr != inBaseAddress && Native_UProperty.ExportText_Direct(keyProp, ref keyValueUnsafe.Array, keyPtr, keyPtr, IntPtr.Zero, 0, IntPtr.Zero)) { // Should this be case insensitive? (FString by default is case insensitive) if ((Native_UObjectBaseUtility.IsA(keyProp, Classes.UObjectProperty) && keyValueUnsafe.Value.Contains(inKeyValue)) || inKeyValue == keyValueUnsafe.Value) { return(true); } } } } } return(false); }
public bool CallFunctionByNameWithArguments(string cmd, UObject executor, bool forceCallWithNonExec = false) { using (FStringUnsafe cmdUnsafe = new FStringUnsafe(cmd)) { return(Native_UObject.CallFunctionByNameWithArguments(Address, ref cmdUnsafe.Array, IntPtr.Zero, executor.Address, forceCallWithNonExec)); } }
public static void Log(string category, ELogVerbosity verbosity, string message) { if (verbosity == ELogVerbosity.Fatal) { string callstack = null; try { callstack = Environment.StackTrace; } catch { } FMessage.OpenDialog("Fatal error from C# (USharp):" + Environment.NewLine + Environment.NewLine + message + Environment.NewLine + Environment.NewLine + "Callstack:" + Environment.NewLine + Environment.NewLine + callstack); } if (string.IsNullOrEmpty(category)) { category = "USharp"; } using (FStringUnsafe messageUnsafe = new FStringUnsafe(message)) using (FStringUnsafe categoryUnsafe = new FStringUnsafe(category)) { Native_FMessageDialog.Log(ref messageUnsafe.Array, ref categoryUnsafe.Array, verbosity); } }
/// <summary> /// Adds an engine binaries directory. /// </summary> public void AddBinariesDirectory(string inDirectory, bool isGameDirectory) { using (FStringUnsafe inDirectoryUnsafe = new FStringUnsafe(inDirectory)) { Native_FModuleManager.AddBinariesDirectory(Address, ref inDirectoryUnsafe.Array, isGameDirectory); } }
internal static void AssertIfInConstructor(IntPtr outer, string errorMessage) { using (FStringUnsafe errorMessageUnsafe = new FStringUnsafe(errorMessage)) { Native_FObjectInitializer.AssertIfInConstructor(outer, ref errorMessageUnsafe.Array); } }
public void Set(string value, EConsoleVariableFlags setBy = EConsoleVariableFlags.SetByCode) { using (FStringUnsafe valueUnsafe = new FStringUnsafe(value)) { Native_IConsoleVariable.SetString(Address, ref valueUnsafe.Array, setBy); } }
public static FStringUnsafe New(string value) { FStringUnsafe result = New(); result.Value = value; return(result); }
/// <summary> /// Checks if a enum name is fully qualified name. /// </summary> /// <param name="inEnumName">Name to check.</param> /// <returns>true if the specified name is full enum name, false otherwise.</returns> public static bool IsFullEnumName(string inEnumName) { using (FStringUnsafe inEnumNameUnsafe = new FStringUnsafe(inEnumName)) { return(Native_UEnum.IsFullEnumName(ref inEnumNameUnsafe.Array)); } }
/// <summary> /// Remove any entry with the supplied Key form the Property's metadata /// </summary> /// <param name="obj">the object to clear the metadata for</param> /// <param name="key">A key to clear the data for</param> public void RemoveValue(UObject obj, string key) { using (FStringUnsafe keyUnsafe = new FStringUnsafe(key)) { Native_UMetaData.RemoveValue(Address, obj == null ? IntPtr.Zero : obj.Address, ref keyUnsafe.Array); } }