예제 #1
0
        public MainState LoadState()
        {
            MainState state = null;

            if (File.Exists(_configPath))
            {
                try
                {
                    var json = File.ReadAllText(_configPath);
                    state = JsonConvert.DeserializeObject <MainState>(json);
                }
                catch
                {
                    state = null;
                }
            }

            if (state == null)
            {
                state = new MainState
                {
                    SelectedBaseCommandType = BaseCommandTypes.FirstOrDefault(),
                    SelectedLastObjectType  = LastObjectTypes.FirstOrDefault(),
                    SelectedResponseType    = LastResponseTypes.FirstOrDefault(),

                    CommandParameters = new Dictionary <string, string> {
                        { "album", "The Fall of Math" },
                        { "artist", "65daysofstatic" }
                    },
                    CommandMethodName = "album.getInfo",
                    CommandPageNumber = "0",
                    CommandItemCount  = "20",
                };
            }

            return(state);
        }
예제 #2
0
        public MainState LoadState()
        {
            MainState state = null;
            if (File.Exists(_configPath))
            {
                try
                {
                    var json = File.ReadAllText(_configPath);
                    state = JsonConvert.DeserializeObject<MainState>(json);
                }
                catch
                {
                    state = null;
                }
            }

            if (state == null)
            {
                state = new MainState
                {
                    SelectedBaseCommandType = BaseCommandTypes.FirstOrDefault(),
                    SelectedLastObjectType = LastObjectTypes.FirstOrDefault(),
                    SelectedResponseType = LastResponseTypes.FirstOrDefault(),

                    CommandParameters = new Dictionary<string, string>{
                        {"album", "The Fall of Math"},
                        {"artist", "65daysofstatic"}
                    },
                    CommandMethodName = "album.getInfo",
                    CommandPageNumber = "0",
                    CommandItemCount = "20",
                };
            }

            return state;
        }