<commit_before>﻿using System;
using System.Windows.Forms;

namespace C3D.DataViewer.Controls
{
    public partial class ucAnalogLabels : UserControl
    {
        public ucAnalogLabels(C3DFile file)
        {
            InitializeComponent();

            UInt16 analogChannelCount = (file.Parameters.ContainsParameter("ANALOG", "USED") ? file.Parameters["ANALOG", "USED"].GetData<UInt16>() :
                (UInt16)(file.Header.AnalogSamplesPerFrame != 0 ? file.Header.AnalogMeasurementCount / file.Header.AnalogSamplesPerFrame : 0));

            String[] labels = this.LoadFromArray<String>(file.Parameters["ANALOG", "LABELS"], analogChannelCount);
            String[] descriptions = this.LoadFromArray<String>(file.Parameters["ANALOG", "DESCRIPTIONS"], analogChannelCount);

            Int16[] offset = this.LoadFromArray<Int16>(file.Parameters["ANALOG", "OFFSET"], analogChannelCount);
            Single[] scale = this.LoadFromArray<Single>(file.Parameters["ANALOG", "SCALE"], analogChannelCount);
            String[] units = this.LoadFromArray<String>(file.Parameters["ANALOG", "UNITS"], analogChannelCount);

            for (Int32 i = 0; i < analogChannelCount; i++)
            {
                this.lvItems.Items.Add(new ListViewItem(new String[] {
                    (i + 1).ToString(), labels[i].TrimEnd(), (descriptions != null && descriptions.Length > i ? descriptions[i].TrimEnd() : ""),
                    (offset != null && offset.Length > i ? offset[i].ToString() : ""),<commit_msg>fix crash in dataviewer when file analog labels does not exist<commit_after>﻿using System;
using System.Windows.Forms;

namespace C3D.DataViewer.Controls
{
    public partial class ucAnalogLabels : UserControl
    {
        public ucAnalogLabels(C3DFile file)
        {
            InitializeComponent();

            UInt16 analogChannelCount = (file.Parameters.ContainsParameter("ANALOG", "USED") ? file.Parameters["ANALOG", "USED"].GetData<UInt16>() :
                (UInt16)(file.Header.AnalogSamplesPerFrame != 0 ? file.Header.AnalogMeasurementCount / file.Header.AnalogSamplesPerFrame : 0));

            String[] labels = this.LoadFromArray<String>(file.Parameters["ANALOG", "LABELS"], analogChannelCount);
            String[] descriptions = this.LoadFromArray<String>(file.Parameters["ANALOG", "DESCRIPTIONS"], analogChannelCount);

            Int16[] offset = this.LoadFromArray<Int16>(file.Parameters["ANALOG", "OFFSET"], analogChannelCount);
            Single[] scale = this.LoadFromArray<Single>(file.Parameters["ANALOG", "SCALE"], analogChannelCount);
            String[] units = this.LoadFromArray<String>(file.Parameters["ANALOG", "UNITS"], analogChannelCount);

            for (Int32 i = 0; i < analogChannelCount; i++)
            {
                this.lvItems.Items.Add(new ListViewItem(new String[] {
                    (i + 1).ToString(),
                    (labels != null && labels.Length > i ? labels[i].TrimEnd() : ""),
                    (descriptions != null && descriptions.Length > i ? descriptions[i].TrimEnd() : ""),
                    (offset != null && offset.Length > i ? offset[i].ToString() : ""),
{'fraction_non_alphanumeric': 0.14213197969543148, 'fraction_numerical': 0.011421319796954314, 'mean_word_length': 3.1486842105263158, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4656656', 'n_tokens_mistral': 896, 'n_tokens_neox': 833, 'n_words': 162}