< Summary

Class:DCL.MyAccount.ProfileAdditionalInfoValueListScriptableObjectEditor
Assembly:MyAccountHUDEditor
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/MyAccountHUD/Editor/ProfileAdditionalInfoValueListScriptableObjectEditor.cs
Covered lines:0
Uncovered lines:12
Coverable lines:12
Total lines:40
Line coverage:0% (0 of 12)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:3
Method coverage:0% (0 of 3)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnEnable()0%2100%
OnInspectorGUI()0%12300%
ConvertCsvToStringArray(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/MyAccountHUD/Editor/ProfileAdditionalInfoValueListScriptableObjectEditor.cs

#LineLine coverage
 1using System;
 2using UnityEditor;
 3using UnityEngine;
 4
 5namespace DCL.MyAccount
 6{
 7    [CustomEditor(typeof(ProfileAdditionalInfoValueListScriptableObject))]
 8    public class ProfileAdditionalInfoValueListScriptableObjectEditor : Editor
 9    {
 10        private SerializedProperty valuesProperty;
 11        private string csvTextContent;
 12
 13        private void OnEnable()
 14        {
 015            valuesProperty = serializedObject.FindProperty("values");
 016        }
 17
 18        public override void OnInspectorGUI()
 19        {
 020            base.OnInspectorGUI();
 21
 022            csvTextContent = EditorGUILayout.TextArea(csvTextContent);
 23
 024            if (GUILayout.Button("Generate from CSV"))
 25            {
 026                string[] values = ConvertCsvToStringArray(csvTextContent);
 27
 028                valuesProperty.arraySize = values.Length;
 29
 030                for (var i = 0; i < values.Length; i++)
 031                    valuesProperty.GetArrayElementAtIndex(i).stringValue = values[i];
 32
 033                serializedObject.ApplyModifiedProperties();
 34            }
 035        }
 36
 37        private string[] ConvertCsvToStringArray(string csvText) =>
 038            csvText.Split(new char[] { ',', '\n' }, StringSplitOptions.RemoveEmptyEntries);
 39    }
 40}