<commit_before>﻿using Newtonsoft.Json;
using System;

namespace Inklewriter.Runtime
{
    public class ControlCommand : Runtime.Object
    {
        public enum CommandType
        {
            NotSet = -1,
            EvalStart,
            EvalOutput,
            EvalEnd,
            StackPush,
            StackPop,
            Duplicate,
            PopEvaluatedValue,
            NoOp,
            ChoiceCount,
            VisitIndex,
            SequenceShuffleIndex
        }
            
        public CommandType commandType { get; protected set; }

        // For serialisation
        [JsonProperty("cmd")]
        [UniqueJsonIdentifier]
        public string commandName {
            get {
                return this.commandType.ToString ();
            }
            set {
                string[] enumNames = typeof(CommandType).GetEnumNames ();
                int enumIndex = Array.IndexOf (enumNames, value);
                commandType = (CommandType) typeof(CommandType).GetEnumValues ().GetValue(enumIndex);
            }
        }

        public ControlCommand (CommandType commandType)
        {
            this.commandType = commandType;
        }

        // Require default constructor for serialisation
        public ControlCommand() : this(CommandType.NotSet) {}

        public static ControlCommand EvalStart() {
            return new ControlCommand(CommandType.EvalStart);
        }

        public static ControlCommand EvalOutput() {
            return new ControlCommand(CommandType.EvalOutput);
        }

        public static ControlCommand EvalEnd() {
            return new ControlCommand(CommandType.EvalEnd);
        }

        public static ControlCommand StackPush() {<commit_msg>Fix for incompatibility with C# 2.x (for unity)<commit_after>﻿using Newtonsoft.Json;
using System;

namespace Inklewriter.Runtime
{
    public class ControlCommand : Runtime.Object
    {
        public enum CommandType
        {
            NotSet = -1,
            EvalStart,
            EvalOutput,
            EvalEnd,
            StackPush,
            StackPop,
            Duplicate,
            PopEvaluatedValue,
            NoOp,
            ChoiceCount,
            VisitIndex,
            SequenceShuffleIndex
        }
            
        public CommandType commandType { get; protected set; }

        // For serialisation
        [JsonProperty("cmd")]
        [UniqueJsonIdentifier]
        public string commandName {
            get {
                return this.commandType.ToString ();
            }
            set {
                string[] enumNames = Enum.GetNames (typeof(CommandType));
                int enumIndex = Array.IndexOf (enumNames, value);
                commandType = (CommandType) Enum.GetValues(typeof(CommandType)).GetValue(enumIndex);
            }
        }

        public ControlCommand (CommandType commandType)
        {
            this.commandType = commandType;
        }

        // Require default constructor for serialisation
        public ControlCommand() : this(CommandType.NotSet) {}

        public static ControlCommand EvalStart() {
            return new ControlCommand(CommandType.EvalStart);
        }

        public static ControlCommand EvalOutput() {
            return new ControlCommand(CommandType.EvalOutput);
        }

        public static ControlCommand EvalEnd() {
            return new ControlCommand(CommandType.EvalEnd);
        }

        public static ControlCommand StackPush() {
{'fraction_non_alphanumeric': 0.0715307582260372, 'fraction_numerical': 0.0008583690987124463, 'mean_word_length': 1.6892307692307693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7649710', 'n_tokens_mistral': 819, 'n_tokens_neox': 792, 'n_words': 195}