Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何解析CIMPLICITY的ctx文件_.net_Wpf_User Interface_Fparsec - Fatal编程技术网

.net 如何解析CIMPLICITY的ctx文件

.net 如何解析CIMPLICITY的ctx文件,.net,wpf,user-interface,fparsec,.net,Wpf,User Interface,Fparsec,我必须解析CIMPLICITY的ctx文件。Ctx文件示例: (Version 42) (DocumentSummary) (GmmiToplevelDocument (GmmiDocumentObject (GmmiContainerObject (GmmiObject "" 0 (Help "" "" "") (GmmiPointMap (GmmiPoint "MODBUS.HOIST.HST1.HST" 8 0 1

我必须解析CIMPLICITY的ctx文件。Ctx文件示例:

(Version 42)
(DocumentSummary)
(GmmiToplevelDocument
  (GmmiDocumentObject
    (GmmiContainerObject
      (GmmiObject "" 0
        (Help "" "" "")
        (GmmiPointMap
          (GmmiPoint "MODBUS.HOIST.HST1.HST" 8 0 1)
          (GmmiPoint "MODBUS.HOIST.HST2.MAXVAL" 9 0 1))
        (GmmiOptionTable
          (GmmiVariables))
        (GmmiTabOrder -1)) (Color 3 8) (Color 3 5)
      (Font "Arial" 0 280 1 0)
      (GmmiObjectPtrList
        (GmmiOleObject
          (GmmiObject "" 0
            (Help "" "" "")
            (Empty)
            (GmmiTabOrder 0)) 0
          (Extents
            (Rect 180 6840 6255 3825)
            (Rect 180 6840 6255 3825))
          (Border (Color 1 &hff000000) 0 11 0)
          (Interior (Color 0) (Color 1 &hff000000) 1)
          (Interior (Color 1 &hff000000) (Color 1 &hff000000) 1) 0 0 1000 1000 1000 1000
          (Rect 180 6840 6255 3825) "TREND.TrendCtrl.1"
          (OleMagic 0)
          (GROleControl
            (OlePropBag {B4E7803D-9435-11CE-9CF4-0020AF743F4D}
               "BInLegend1" 1
               "BaseProject" "MOD_TEST"
               "Color1" 255
               "CompressionSampleUnits1" 0
               "Name1" "MODBUS.HOIST.HST1.HST"
               "Name2" "Chart X Axis"
               "Name3" "Chart Y Axis"
               "NumberLines" 1
               "Order1" 0
               "PointID1" "MODBUS.HOIST.HST1.HST"
               "Type1" 7
               "Type3" 1
               "_ExtentX" 10716
               "_ExtentY" 5318
               "_StockProps" 13
               "_Version" 393220)))
        (GmmiTextObject
          (GmmiObject "" 0
            (Help "" "" "")
            (Empty)
            (GmmiTabOrder -1)) 23
          (Extents
            (Rect 180 3600 3144 2752)
            (Rect 180 3600 1776 2752))
          (Font "" 0 720 1 0)
          (Interior (Color 1 &hff000000) (Color 1 &hffffffff) 1)
          (Border (Color 1 &hff000000) 0 11 0) 18
          (Point 180 3600) "HOIST 1")
        (GmmiTextObject
          (GmmiObject "" 0
            (Help "" "" "")
            (GmmiOptionTable
              (GmmiOptionTable
                (GmmiValueAnim
                  (GmmiExprAnim 3
                    (GmmiExpr "MODBUS.HOIST.HST1.HST")) 0
                  (ExecCond "" "") "%s" 4)))
            (GmmiTabOrder -1)) 23
          (Extents
            (Rect 3240 3600 4436 2964)
            (Rect 3240 3420 4436 2784))
          (Font "" 0 540 1 0)
          (Interior (Color 1 &hff000000) (Color 1 &hffffffff) 1)
          (Border (Color 1 &hff000000) 0 11 0) 18
          (Point 3240 3600) "Text")
        (GmmiTextObject
          (GmmiObject "" 0
            (Help "" "" "")
            (Empty)
            (GmmiTabOrder -1)) 23
          (Extents
            (Rect 360 1800 1662 1471)
            (Rect 360 1800 1662 1471))
          (Font "Arial" 0 -280 1 0)
          (Interior (Color 1 &hff000000) (Color 1 &hffffffff) 1)
          (Border (Color 1 &hff000000) 0 11 0) 18
          (Point 360 1800) "Test data:")
        (GmmiTextObject
          (GmmiObject "" 0
            (Help "" "" "")
            (GmmiOptionTable
              (GmmiOptionTable
                (GmmiValueAnim
                  (GmmiExprAnim 3
                    (GmmiExpr "MODBUS.HOIST.HST2.MAXVAL")) 0
                  (ExecCond "" "") "%s" 4)))
            (GmmiTabOrder -1)) 23
          (Extents
            (Rect 1980 1800 2599 1471)
            (Rect 1980 1800 2599 1471))
          (Font "Arial" 0 -280 1 0)
          (Interior (Color 1 &hff000000) (Color 1 &hffffffff) 1)
          (Border (Color 1 &hff000000) 0 11 0) 18
          (Point 1980 1800) "Text")) 0
      (GmmiBackdrop
        (Border (Color 1 &hff000000) 0 11 0)
        (Interior (Color 1 &hffc0c0c0) (Color 1 &hff000000) 1))))
  (Point 100 100)
  (Size 9600 7200) 100 "")
(OleItems)
上面的文件表示CIMPLICITY的屏幕。问题是基于该文件构建WPF屏幕。首先,我认为,我应该解析该文件,删除不需要的部分,然后构建接口

我在网上搜索过基于.Net的解析器-。问题是我从来没有用F编码过,很难理解如何使用这个库。所以我不想做额外的工作

主要问题:是否可以用FParsec将该文件解析为表示屏幕结构的自定义对象。例如,此对象可能具有以下定义:

public class Document
{
    public string Version { get; set; }
    public object Summary { get; set; }

    public GmmiTopLevelDocument GmmiTopLevelDocument { get; set: }
}

public class GmmiTopLevelDocument
{
    public GmmiDocumentObject GmmiDocumentObject { get; set; }

    public Point Point { get; set; }
    public Size Size { get; set; }
}

public class GmmiDocumentObject
{
    ...
}
可能是走错了路?什么是对的

更新:

我也有关于屏幕语言的。样本:

<GmmiTextButtonObject> ::= "(" GmmiTextButtonObject<GmmiButtonObject><GRTextButton>")"
<GmmiTextObject> ::= "(" GmmiTextObject<GmmiGraphicObject> <GRText> ")"

<ToplevelDocument> ::= "(" GmmiToplevelDocument<GmmiDocument><initialPosition.Point><Size>zoom.number> ")"
<ToplevelDocumentPO> ::= <GmmiPointMap><ambientForeground.GRColorAttr><ambientBackground.GRColorAttr>
<ambientFont.GRFontAttr>
<GmmiProcedureMap>

按照我想象的工作方式,我认为F和FParsec将是一个优雅的组合。@ChaosPandion:谢谢,但我已经用正则表达式实现了这一点:它花费的开发时间更少