I am currently adding and saving data to my data file:
Is there any way for me to locate a specific line in the data file and then remove it and save the file again?Code:readonly DynamicConfigFile dataFile = Interface.Oxide.DataFileSystem.GetFile( "Objects" ); Dictionary<string, ulong> objects = new Dictionary<string, ulong>();objects = dataFile.ReadObject<Dictionary<string, ulong>>();objects[output] = player.userID; dataFile.WriteObject( objects );
The file is full of objects/steamIDs, and I want the specific object/line to be removed in my file as a player removes it.
Deleting a single line from a data file?
Discussion in 'Rust Development' started by mvrb, Mar 29, 2016.
-
if (objects.ContainsKey("keyname")
objects.Remove("keyname")
Then resaveLast edited by a moderator: Mar 29, 2016 -
Oh, I didn't think about that, thanks!
