Skip to content

Commit

Permalink
Add ComplexModificationsRule.jsonString
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Sep 9, 2023
1 parent ba085fc commit 47e351a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ extension LibKrbn {
var id = UUID()
var index: Int
var description: String
var jsonString: String?

init(
_ index: Int,
_ description: String
_ description: String,
_ jsonString: String?
) {
self.index = index
self.description = description
self.jsonString = jsonString
}
}
}
11 changes: 10 additions & 1 deletion src/apps/share/swift/LibKrbn/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,22 @@ extension LibKrbn {
let size = libkrbn_core_configuration_get_selected_profile_complex_modifications_rules_size(
libkrbnCoreConfiguration)
for i in 0..<size {
var jsonString: String?
var buffer = [Int8](repeating: 0, count: 1024 * 1024) // 1MB
if libkrbn_core_configuration_get_selected_profile_complex_modifications_rule_json_string(
libkrbnCoreConfiguration, i, &buffer, buffer.count)
{
jsonString = String(cString: buffer)
}

let complexModificationsRule = ComplexModificationsRule(
i,
String(
cString:
libkrbn_core_configuration_get_selected_profile_complex_modifications_rule_description(
libkrbnCoreConfiguration, i
))
)),
jsonString
)
newComplexModificationsRules.append(complexModificationsRule)
}
Expand Down

0 comments on commit 47e351a

Please sign in to comment.