Exemplo n.º 1
0
        private GoalDebugInfo FromProtobuf(GoalDebugInfoMsg msg)
        {
            var debugInfo = new GoalDebugInfo
            {
                Id          = msg.Id,
                Name        = msg.Name,
                Path        = msg.Path,
                InitActions = new List <ActionDebugInfo>(),
                ExitActions = new List <ActionDebugInfo>()
            };

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

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

            return(debugInfo);
        }
        private GoalDebugInfoMsg ToProtobuf(GoalDebugInfo debugInfo)
        {
            var msg = new GoalDebugInfoMsg
            {
                Id   = debugInfo.Id,
                Name = debugInfo.Name,
                Path = debugInfo.Path
            };

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

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

            return(msg);
        }