Ajout des 3règles SendFileRule.go, SendOkRule.go, SendErrorRule.go et corrections de bugs mineurs.
This commit is contained in:
@@ -17,7 +17,6 @@ type ProtocolRepository struct {
|
||||
// AddReader Permet d'ajouter une règle servant à lire une commande
|
||||
func (repo ProtocolRepository) AddReader(reader *protocol.IProtocolReader) {
|
||||
cmd := (*reader).GetCmd()
|
||||
|
||||
if cmd != "" && !repo.containsReader(cmd) {
|
||||
repo.protocolReaders[cmd] = reader
|
||||
}
|
||||
@@ -26,7 +25,6 @@ func (repo ProtocolRepository) AddReader(reader *protocol.IProtocolReader) {
|
||||
// AddWriter Permet d'ajouter une règle servant à construire une commande
|
||||
func (repo ProtocolRepository) AddWriter(writer *protocol.IProtocolWriter) {
|
||||
cmd := (*writer).GetCmd()
|
||||
|
||||
if cmd != "" && !repo.containsWriter(cmd) {
|
||||
repo.protocolWriters[cmd] = writer
|
||||
}
|
||||
@@ -49,10 +47,10 @@ func (repo ProtocolRepository) ExecuteReader(data string) (string, bool) {
|
||||
ExecuteReader Permet d'exécuter un Wrier et de récupérer la commande construite avec nos argument et un indicateur de réussite.
|
||||
*/
|
||||
func (repo ProtocolRepository) ExecuteWriter(ruleName string, data ...string) (string, bool) {
|
||||
protWriter, has := repo.protocolWriters[ruleName]
|
||||
protocolWriter, has := repo.protocolWriters[ruleName]
|
||||
if has {
|
||||
println("OHOH")
|
||||
return (*protWriter).Execute(data...)
|
||||
return (*protocolWriter).Execute(data...)
|
||||
} else {
|
||||
return "", false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user