private void Create_favorite_playlist(string filename)
        {
            try
            {
                
                String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                string filedirectory = path + @"\OrangePlayer\favoritePlaylist";
                if (!Directory.Exists(filedirectory))
                    Directory.CreateDirectory(filedirectory);


                string filepath = string.Format("{0}/{1}.orm", filedirectory, filename);
                //System.AppDomain.CurrentDomain.BaseDirectory 
                //System.IO.Directory.GetCurrentDirectory();
                File.WriteAllText(filepath, Security.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(myPlayListCollection)));

                if (File.Exists(filepath))
                {
                    PlaylistItem item = new PlaylistItem();
                    item.name = filename;
                    item.filePath = filepath;

                    myFavoriteMgr.MyfavoriteCollection.Add(item);

                }
                else { MessageBoxOrange.ShowDialog("Warning", "failed to create the file"); }
            }catch(Exception ex)
            {
                MessageBoxOrange.ShowDialog("Exception", ex.Message);
            }
            
        }
        private void LoadConfig()
        {
            Config.Language_for_Orange = Properties.Settings.Default.Language_for_Orange;
            LanguagePack.TYPE = Config.Language_for_Orange;
            Config.IsShffle = Properties.Settings.Default.IsShffle;
            if (!Config.IsShffle)
            {
                ShuffleBtn.Template = (ControlTemplate)FindResource("NonShuffleButtonControlTemplate");
                ShuffleBtn.ToolTip = LanguagePack.PlayStraight();               
            }
            else
            {
                ShuffleBtn.Template = (ControlTemplate)FindResource("ShuffleButtonControlTemplate");
                ShuffleBtn.ToolTip = LanguagePack.Shuffle();
            }

            switch (Properties.Settings.Default.REPEAT)
            {
                case 0:
                    Properties.Settings.Default.REPEAT = 1;
                    repeatBtn.Template = (ControlTemplate)FindResource("DefaultRepeatButtonControlTemplate");
                    repeatBtn.ToolTip = LanguagePack.RepeatAllSongs();
                    break;
                
                case 1:
                    repeatBtn.Template = (ControlTemplate)FindResource("DefaultRepeatButtonControlTemplate");
                    repeatBtn.ToolTip = LanguagePack.RepeatAllSongs();
                    break;
                case 2:
                    repeatBtn.Template = (ControlTemplate)FindResource("SingleRepeatButtonControlTemplate");
                    repeatBtn.ToolTip = LanguagePack.RepeatOneSong();
                    break;
            }
            Config.IsMute = Properties.Settings.Default.IsMute;
            

               try
                {
                    String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    string filedirectory = path + @"\OrangePlayer\favoritePlaylist";
                        
                    //string filepath = string.Format("{0}/{1}.orm", filedirectory, filename);

                        // 지정한 경로에 폴더가 존재 하는지 확인 합니다.
                    if (System.IO.Directory.Exists(filedirectory))
                    {
                              // DirectoryInfo Class 를 생성 합니다.
                              System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(filedirectory);
                             // foreach 구문을 이용하여 폴더 내부에 있는 파일정보를 가져옵니다.
                             foreach (var item in di.GetFiles())
                             {
                                 if(item.Extension.Equals(".orm"))
                                 {
                                     PlaylistItem plist = new PlaylistItem();

                                     plist.name = item.Name.Remove(item.Name.Length-4);
                                     plist.filePath = string.Format("{0}/{1}.orm", filedirectory, item.Name);
                                     myFavoriteMgr.MyfavoriteCollection.Add(plist);
                                 }
//                                 // 파일 이름 출력
//                                     Console.WriteLine("FILE NAME : " + item.Name);
//                                 // 파일 타입 (확장자) 출력
//                                 Console.WriteLine("FILE TYPE : " + item.Extension);
//                                 // 파일 생성날짜 출력
//                                 Console.WriteLine("CREATE DATE : " + item.CreationTime);                   
                             }
                    }
               }catch(Exception ex)
               {
                    MessageBoxOrange.ShowDialog("Exception",ex.Message);
               }
//                     
// 
// 
// 
//             if (File.Exists(filepath))
//             {
// 
//                     string json = Security.Decrypt(Properties.Settings.Default.Playlist);
//                     var playerList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PlaylistItem>>(json);
//                     myFavoriteMgr.MyfavoriteCollection.Clear();
//                     
//                     
//                     string filedirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\OrangePlayer\favoritePlaylist";
//                     
//                     foreach (var it in playerList)
//                     {
//                         string filepath = string.Format("{0}/{1}.orm", filedirectory, it.name);
//                         if(File.Exists(filepath))
//                             myFavoriteMgr.MyfavoriteCollection.Add(it);
//                     }
//                 }
//                 catch (Exception e)
//                 {
//                     MessageBoxOrange.ShowDialog("Exception",e.Message);
//                 }    
            
             
            
        }