Closed hksz closed 1 year ago
Rocket is open source project, you can edit source code and bundle you own rocketmod:/
Rocket is open source project, you can edit source code and bundle you own rocketmod:/
I know it can be edited, but I would prefer Nelson Sexton to add this feature
First, this repository is for Unturned and not LDM so you should ask it in the correct repository. Second you can obtain it using reflection.
First, this repository is for Unturned and not LDM so you should ask it in the correct repository. Second you can obtain it using reflection.
I've already asked a question on Legally Distinct Missile, but no one is paying attention to me I don't know much about reflexes, but I do now, thanks for your help!
Solutions
XMLFileAsset
Code replaced by the system? Use line 15 in RocketPermissionsHelperTest
Solutions
XMLFileAsset permissions = new XMLFileAsset(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Permissions.config.xml")); List groups = permissions.Instance.Groups;
Might not be good idea as it wont update on permissions reload
Solutions XMLFileAsset permissions = new XMLFileAsset(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Permissions.config.xml")); List groups = permissions.Instance.Groups;
Might not be good idea as it wont update on
permissions reload
It can be updated on reload, it will read the file in real time, and parsing XML may report an error if your changes are not completed.
Correction, replace Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Permissions.config.xml") with System.IO.Directory.GetCurrentDirectory() + "\Permissions.config.xml"
Why would u do that instead of using reflection
reflection
Because I still haven't figured out how to use
var helperField = typeof(RocketPermissionsManager).GetField("helper", BindingFlags.Instance | BindingFlags.NonPublic);
var helper = fieldInfo.GetValue(R.Permissions);
var permissionsField = helper.GetType().GetField("permissions", BindingFlags.Instance | BindingFlags.NonPublic);
var permissions = (Asset<RocketPermissions>)permissionsField.GetValue(helper);
var helperField = typeof(RocketPermissionsManager).GetField("helper", BindingFlags.Instance | BindingFlags.NonPublic); var helper = fieldInfo.GetValue(R.Permissions); var permissionsField = helper.GetType().GetField("permissions", BindingFlags.Instance | BindingFlags.NonPublic); var permissions = (Asset<RocketPermissions>)permissionsField.GetValue(helper);
This is very useful, thank you very much!
RocketPermissionsHelper Add public List GetAllGroup() { return this.permissions.Instance.Groups; }
RocketPermissionsManager Add public List GetAllGroup() { return helper.GetAllGroup(); }
IRocketPermissionsProvider Add List GetAllGroup();