Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

c# how could i parse this file to key value pair

$
0
0

ok what im trying to do is load this file in this stucture 

"anim template" "anim fileds""angleError" "0.05""boneStabilizers" """customnote0action" "None""customnote0actionparam1" """customnote0actionparam2" """customnote0frame" "1""customnote0useexistingnote" """filename" "elfenliedtopfan5_anims\\elf_bo3_pdw\\elf_cp_bo2_pdw_ads_down.xanim_bin""fx_customnote0action" "None""fx_customnote0actionparam1" """fx_customnote0actionparam2" """fx_customnote0frame" "1""fx_customnote0useexistingnote" """fx_shutdownnote0action" "None""fx_shutdownnote0actionparam1" """fx_shutdownnote0actionparam2" """fx_startupnote0action" "None""fx_startupnote0actionparam1" """fx_startupnote0actionparam2" """ignoreSpineBones" "0""leftHandGripIK" "0""looping" "0""loopsync" "0""model" "corpse_party_weapons_bo3\\t6_wpn_smg_pdw57_view\\elf_pdw_animated.xmodel_bin""node" """previewAlignChildTag" """previewAlignParentTag" """previewAttachModel" """previewModel" """shutdownnote0action" "None""shutdownnote0actionparam1" """shutdownnote0actionparam2" """sound_customnote0action" "None""sound_customnote0actionparam1" """sound_customnote0actionparam2" """sound_customnote0frame" "1""sound_customnote0useexistingnote" """sound_shutdownnote0action" "None""sound_shutdownnote0actionparam1" """sound_shutdownnote0actionparam2" """sound_startupnote0action" "None""sound_startupnote0actionparam1" """sound_startupnote0actionparam2" """startupnote0action" "None""startupnote0actionparam1" """startupnote0actionparam2" """translationError" "0.025""type" "relative""useBones" "0""useNtExportFile" "0"

and split it into key value pairs like say 

"angleError" "0.05"

key value key being "angleError"

value being "0.05"

but not sure how to accumplish this i have tryied 

        string elf = @"‪C:\Users\elfenliedtopfan5\Desktop\elf_peogram_template\weapon_template.gdt";
        public void testfunc()
        {

            Dictionary<String, String> dict = new Dictionary<String, String>();
            using (StreamReader rdr = new StreamReader(File.OpenRead(elf)))
            {

                String line;
                while ((line = rdr.ReadLine()) != null)
                {


                    Int32 spaceIdx = line.IndexOf(' ');
                    if (spaceIdx == 0 || spaceIdx == -1) continue;

                    String key = line.Substring(0, spaceIdx - 1);
                    String value = line.Substring(spaceIdx);

                    dict.Add(key, value);
                }
            }
        }

but for some reason it tells me sorry this text format is not supported 


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>