Exemple #1
0
    public void UpdateData(string id, List <EventDataOperater.ConvertedText> dataSet)
    {
        foreach (var data in dataSet)
        {
            switch (data._head)
            {
            case "text":
                _codeData._text = string.Join("\n", data._content);
                break;

            case "term":
                _codeData.coalTerm.ResetTerm();
                foreach (var con in data._content)
                {
                    var temp = con.Split(' ');
                    if (temp[0].Equals("ormode", StringComparison.OrdinalIgnoreCase))    //ormodeの設定
                    {
                        bool flag = temp[1].Equals("true", StringComparison.OrdinalIgnoreCase);
                        _codeData.coalTerm._orMode = flag;
                    }
                    else
                    {
                        int num    = int.Parse(temp[2]);
                        var hikaku = DataMemberInspector.CreateHikaku(temp[3]);
                        _codeData.coalTerm.AddTerm(temp[0], temp[1], num, hikaku);
                    }
                }
                break;

            case "next":
                UpdateData_next(id, data);
                break;
            }
        }
    }
    public void UpdateData(string id, List <EventDataOperater.ConvertedText> dataSet)
    {
        foreach (var data in dataSet)
        {
            switch (data._head)
            {
            case "text":
                _codeData._text = string.Join("\n", data._content);
                break;

            case "term":
                _codeData.coalTerm.ResetTerm();
                foreach (var con in data._content)
                {
                    var temp = con.Split(' ');
                    if (temp[0].Equals("ormode", StringComparison.OrdinalIgnoreCase))    //ormodeの設定
                    {
                        try
                        {
                            bool flag = temp[1].Equals("true", StringComparison.OrdinalIgnoreCase);
                            _codeData.coalTerm._orMode = flag;
                            if (!flag && !temp[1].Equals("false", StringComparison.OrdinalIgnoreCase))    //falseを明示したとき以外のfalse
                            {
                                ThrowErrorLog(null, "", "データ内容に誤りがあります", name, $"term,<{con}>");
                            }
                        }catch (IndexOutOfRangeException e)
                        {
                            ThrowErrorLog(e, "", "文法に誤りがあります", name, $"term,<{con}>");
                        }
                    }
                    else
                    {
                        try
                        {
                            int num      = int.Parse(temp[2]);
                            var datatype = DataMemberInspector.CreateDataType(temp[0]);
                            var hikaku   = DataMemberInspector.CreateHikaku(temp[3]);
                            _codeData.coalTerm.AddTerm(temp[1], num, datatype, hikaku);
                        }
                        catch (Exception e) when(e is IndexOutOfRangeException ||
                                                 e is InvalidOperationException ||
                                                 e is FormatException)
                        {
                            ThrowErrorLog(e, "", "文法に誤りがあります", name, $"term,<{con}>");
                        }
                        catch (Exception e) when(e is ArgumentException)
                        {
                            ThrowErrorLog(e, "", "データ内容に誤りがあります", name, $"term,<{con}>");
                        }
                    }
                }
                break;

            case "next":
                UpdateData_next(id, data);
                break;

            default:
                ThrowErrorLog(null, "", "括弧の前のやつが不正な値です", name, data._head);
                break;
            }
        }
    }