Tranformation d'une commande (chaine de char) en tableau. Il est donc désormais possible de lire une commande et l'interprêter
This commit is contained in:
@@ -15,7 +15,7 @@ type EraseFileRule struct {
|
||||
}
|
||||
|
||||
// CreateEraseFileRule Création d'une instance de EraseFileRule
|
||||
func CreateEraseFileRule(pattern string) *EraseFileRule {
|
||||
func CreateEraseFileRule(pattern string) protocol.IProtocolReader {
|
||||
return &EraseFileRule{
|
||||
Cmd: EraseFileRuleName,
|
||||
matcher: protocol.CreateRegexMatcher(pattern),
|
||||
@@ -26,12 +26,14 @@ func (rule EraseFileRule) GetCmd() string {
|
||||
return rule.Cmd
|
||||
}
|
||||
|
||||
func (rule EraseFileRule) Execute(data string) string {
|
||||
func (rule EraseFileRule) Execute(data string) (string, bool) {
|
||||
|
||||
if rule.Match(data) {
|
||||
return "Parsing : EraseFileRule command fichier supprimé"
|
||||
values := rule.matcher.Parse(data)
|
||||
println(values[1], " est le hash du fichier à supprimer")
|
||||
return "Parsing : Fichier avec le hash " + values[1] + " supprimé", true
|
||||
} else {
|
||||
return "Parsing : EraseFileRule command fichier non-supprimé"
|
||||
return "Parsing : EraseFileRule command incorrecte", false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user