< Summary

Class:SceneMessageUtilities
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Scene/Messaging/SceneMessageUtilitites.cs
Covered lines:0
Uncovered lines:18
Coverable lines:18
Total lines:45
Line coverage:0% (0 of 18)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
DecodePayloadChunk(...)0%6200%
DecodeSceneMessage(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Scene/Messaging/SceneMessageUtilitites.cs

#LineLine coverage
 1using DCL;
 2
 3public class SceneMessageUtilities
 4{
 5    public static bool DecodePayloadChunk(string chunk, out string sceneId, out string message, out string tag)
 6    {
 07        sceneId = message = tag = null;
 8
 09        var separatorPosition = chunk.IndexOf('\t');
 10
 011        if (separatorPosition == -1)
 12        {
 013            return false;
 14        }
 15
 016        sceneId = chunk.Substring(0, separatorPosition);
 17
 018        var lastPosition = separatorPosition + 1;
 019        separatorPosition = chunk.IndexOf('\t', lastPosition);
 20
 021        message = chunk.Substring(lastPosition, separatorPosition - lastPosition);
 022        lastPosition = separatorPosition + 1;
 23
 024        separatorPosition = chunk.IndexOf('\t', lastPosition);
 25
 026        message += '\t' + chunk.Substring(lastPosition, separatorPosition - lastPosition);
 027        lastPosition = separatorPosition + 1;
 28
 029        tag = chunk.Substring(lastPosition);
 30
 031        return true;
 32    }
 33
 34    public static QueuedSceneMessage_Scene DecodeSceneMessage(string sceneId, string message, string tag)
 35    {
 036        var queuedMessage = new QueuedSceneMessage_Scene()
 37            { type = QueuedSceneMessage.Type.SCENE_MESSAGE, sceneId = sceneId, message = message, tag = tag };
 38
 039        var queuedMessageSeparatorIndex = queuedMessage.message.IndexOf('\t');
 40
 041        queuedMessage.method = queuedMessage.message.Substring(0, queuedMessageSeparatorIndex);
 42
 043        return queuedMessage;
 44    }
 45}