2017-02-20 1 views
0

すでに想像しているように、私はいくつかの助けが必要です。私は現在、友人とWPFで作業していますが、問題があります。特定の種類のテキストを解析する必要がありますが、それを行う方法はわかりません。私たちはSpracheを見つけました。それは素晴らしいパーサーのようですが、私たちはそれをどのように使用するのか分かりません。また、英語は私たちの母国語ではないので、紹介記事はわかりにくいです。SpracheでC#の "xxx = {..}"というテキストを解析する

私たちはここでそれについてStackoverflowで尋ねる決定を下しました。

我々は、単純なの.txtファイルに位置して解析するとこのようになりますテキスト:

focus_tree = { 
id = german_focus 

country = { 
    factor = 0 

    modifier = { 
     add = 10 
     tag = GER 
    } 
} 

default = no 

focus = { 
    id = GER_autobahn 
    icon = GFX_goal_generic_construct_infrastructure 
    x = 0 
    y = 0 
    cost = 10 
    ai_will_do = { 
     factor = 12 
    } 

    completion_reward = { 
     custom_effect_tooltip = GER_autobahn_tt 
     hidden_effect = { 
      64 = { 
       if = { 
        limit = { is_controlled_by = ROOT } 
        add_building_construction = { 
         type = infrastructure 
         level = 10 
         instant_build = yes 
        } 
       } 
      } 
      59 = { 
       if = { 
        limit = { is_controlled_by = ROOT } 

        add_building_construction = { 
         type = infrastructure 
         level = 10 
         instant_build = yes 
        } 
       } 
      } 
      60 = { 
       if = { 
        limit = { is_controlled_by = ROOT } 
        add_building_construction = { 
         type = infrastructure 
         level = 10 
         instant_build = yes 
        } 
       } 
      } 
      54 = { 
       if = { 
        limit = { is_controlled_by = ROOT } 
        add_building_construction = { 
         type = infrastructure 
         level = 10 
         instant_build = yes 
        } 
       } 
      } 
     }  
    } 
} 

(これは、と「アイアンIVのハーツ」と呼ばれるゲームから全体のほんの一部です物)

あなたは私たちに少しの助けや小さなヒントを与えることができますか?事前に

おかげで、 Stuffi代わりにコロン(:)、およびプロパティの間にはカンマでJSONよく似ていますが、その代わりに、文字列の引用符で囲まれていないトークンと、記号(=)に等しい

答えて

0

。ライブラリSpracheJSONをチェックアウトしてファイルを解析するために少し修正することができますか?

関連する問題