public static List <LogInfo> IniDelete(EngineState s, CodeCommand cmd) { List <LogInfo> logs = new List <LogInfo>(); CodeInfo_IniDelete info = cmd.Info.Cast <CodeInfo_IniDelete>(); string fileName = StringEscaper.Preprocess(s, info.FileName); string sectionName = StringEscaper.Preprocess(s, info.Section); string key = StringEscaper.Preprocess(s, info.Key); Debug.Assert(fileName != null, $"{nameof(fileName)} != null"); Debug.Assert(sectionName != null, $"{nameof(sectionName)} != null"); Debug.Assert(key != null, $"{nameof(key)} != null"); if (sectionName.Length == 0) { return(LogInfo.LogErrorMessage(logs, "Section name cannot be empty")); } if (key.Length == 0) { return(LogInfo.LogErrorMessage(logs, "Key name cannot be empty")); } if (!StringEscaper.PathSecurityCheck(fileName, out string errorMsg)) { return(LogInfo.LogErrorMessage(logs, errorMsg)); } bool result; if (s.CompatAutoCompactIniWriteCommand) { result = IniReadWriter.DeleteCompactKey(fileName, sectionName, key); } else { result = IniReadWriter.DeleteKey(fileName, sectionName, key); } if (result) { logs.Add(new LogInfo(LogState.Success, $"Key [{key}] deleted from [{fileName}]", cmd)); } else { logs.Add(new LogInfo(LogState.Ignore, $"Could not delete key [{key}] from [{fileName}]", cmd)); } return(logs); }