コード例 #1
0
        private RuleDebugInfo FromProtobuf(RuleDebugInfoMsg msg)
        {
            var debugInfo = new RuleDebugInfo
            {
                Id                  = msg.Id,
                GoalId              = msg.GoalId,
                Name                = msg.Name,
                Variables           = new List <RuleVariableDebugInfo>(),
                Actions             = new List <ActionDebugInfo>(),
                ConditionsStartLine = msg.ConditionsStartLine,
                ConditionsEndLine   = msg.ConditionsEndLine,
                ActionsStartLine    = msg.ActionsStartLine,
                ActionsEndLine      = msg.ActionsEndLine
            };

            foreach (var variableMsg in msg.Variables)
            {
                var variable = FromProtobuf(variableMsg);
                debugInfo.Variables.Add(variable);
            }

            foreach (var action in msg.Actions)
            {
                debugInfo.Actions.Add(FromProtobuf(action));
            }

            return(debugInfo);
        }
コード例 #2
0
        private RuleDebugInfoMsg ToProtobuf(RuleDebugInfo debugInfo)
        {
            var msg = new RuleDebugInfoMsg
            {
                Id     = debugInfo.Id,
                GoalId = debugInfo.GoalId,
                Name   = debugInfo.Name,
                ConditionsStartLine = debugInfo.ConditionsStartLine,
                ConditionsEndLine   = debugInfo.ConditionsEndLine,
                ActionsStartLine    = debugInfo.ActionsStartLine,
                ActionsEndLine      = debugInfo.ActionsEndLine
            };

            foreach (var variable in debugInfo.Variables)
            {
                var varMsg = ToProtobuf(variable);
                msg.Variables.Add(varMsg);
            }

            foreach (var action in debugInfo.Actions)
            {
                var varAct = ToProtobuf(action);
                msg.Actions.Add(varAct);
            }

            return(msg);
        }