コード例 #1
0
ファイル: UMetaData.cs プロジェクト: zwywilliam/USharp
 /// <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));
     }
 }
コード例 #2
0
ファイル: FModuleManager.cs プロジェクト: yimengfan/USharp
 /// <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);
     }
 }
コード例 #3
0
 /// <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));
     }
 }
コード例 #4
0
ファイル: IConsoleObject.cs プロジェクト: zwywilliam/USharp
 public void SetHelp(string help)
 {
     using (FStringUnsafe helpUnsafe = new FStringUnsafe(help))
     {
         Native_IConsoleObject.SetHelp(Address, ref helpUnsafe.Array);
     }
 }
コード例 #5
0
ファイル: FModuleManager.cs プロジェクト: yimengfan/USharp
 /// <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));
     }
 }
コード例 #6
0
ファイル: FApp.cs プロジェクト: gitter-badger/USharp
 /// <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));
     }
 }
コード例 #7
0
ファイル: FApp.cs プロジェクト: gitter-badger/USharp
 /// <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);
     }
 }
コード例 #8
0
ファイル: IPluginManager.cs プロジェクト: zwywilliam/USharp
 /// <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);
     }
 }
コード例 #9
0
ファイル: IPluginManager.cs プロジェクト: zwywilliam/USharp
        // TODO: FNewPluginMountedEvent / OnNewPluginCreated / OnNewPluginMounted

        public void MountNewlyCreatedPlugin(string pluginName)
        {
            using (FStringUnsafe pluginNameUnsafe = new FStringUnsafe(pluginName))
            {
                Native_IPluginManager.MountNewlyCreatedPlugin(Address, ref pluginNameUnsafe.Array);
            }
        }
コード例 #10
0
ファイル: FFeedbackContext.cs プロジェクト: yimengfan/USharp
 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);
     }
 }
コード例 #11
0
ファイル: FFeedbackContext.cs プロジェクト: yimengfan/USharp
 public void StatusForceUpdate(int numerator, int denominator, string statusText)
 {
     using (FStringUnsafe statusTextUnsafe = new FStringUnsafe(statusText))
     {
         Native_FFeedbackContext.StatusForceUpdate(Address, numerator, denominator, ref statusTextUnsafe.Array);
     }
 }
コード例 #12
0
 /// <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);
     }
 }
コード例 #13
0
 /// <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);
     }
 }
コード例 #14
0
        /// <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);
        }
コード例 #15
0
ファイル: FApp.cs プロジェクト: gitter-badger/USharp
 /// <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);
     }
 }
コード例 #16
0
ファイル: UProperty.cs プロジェクト: yimengfan/USharp
 /// <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);
                     }
                 }
         }
     }
 }
コード例 #17
0
ファイル: FApp.cs プロジェクト: gitter-badger/USharp
 /// <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);
     }
 }
コード例 #18
0
 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);
     }
 }
コード例 #19
0
ファイル: FApp.cs プロジェクト: gitter-badger/USharp
 /// <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);
     }
 }
コード例 #20
0
 /// <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);
     }
 }
コード例 #21
0
 /// <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)));
     }
 }
コード例 #22
0
        /// <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);
        }
コード例 #23
0
ファイル: UObject.cs プロジェクト: OCEAN623/USharp
 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));
     }
 }
コード例 #24
0
        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);
                }
        }
コード例 #25
0
ファイル: FModuleManager.cs プロジェクト: yimengfan/USharp
 /// <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);
     }
 }
コード例 #26
0
 internal static void AssertIfInConstructor(IntPtr outer, string errorMessage)
 {
     using (FStringUnsafe errorMessageUnsafe = new FStringUnsafe(errorMessage))
     {
         Native_FObjectInitializer.AssertIfInConstructor(outer, ref errorMessageUnsafe.Array);
     }
 }
コード例 #27
0
ファイル: IConsoleVariable.cs プロジェクト: zwywilliam/USharp
 public void Set(string value, EConsoleVariableFlags setBy = EConsoleVariableFlags.SetByCode)
 {
     using (FStringUnsafe valueUnsafe = new FStringUnsafe(value))
     {
         Native_IConsoleVariable.SetString(Address, ref valueUnsafe.Array, setBy);
     }
 }
コード例 #28
0
        public static FStringUnsafe New(string value)
        {
            FStringUnsafe result = New();

            result.Value = value;
            return(result);
        }
コード例 #29
0
 /// <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));
     }
 }
コード例 #30
0
ファイル: UMetaData.cs プロジェクト: zwywilliam/USharp
 /// <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);
     }
 }