public Folder(eFolder a_eFolder, int a_nData = 0, int a_nDateOffset = 0) { m_eFolder = a_eFolder; m_nData = a_nData; m_nDateOffset = a_nDateOffset; m_sName = Global.Path.FolderName(m_eFolder, m_nData); m_sName_withFullPath = System.IO.Path.Combine(Config.sFolderPath, m_sName); if (string.IsNullOrEmpty(m_sName_withFullPath) == true) { Define.LogError("logic error"); return; } if (System.IO.Directory.Exists(m_sName_withFullPath) == true) // 폴더가 있다면 안의 파일, 폴더를 취합 { var arName = System.IO.Directory.GetFiles(m_sName_withFullPath); for (int i = 0; i < arName.Length; ++i) { arName[i] = System.IO.Path.GetFileName(arName[i]); m_liChild.AddLast(new File(arName[i], this)); } } else // 폴더가 없었다면 ~일 폴더들을 만듬 { System.IO.Directory.CreateDirectory(sFolderName); } }
public static string FolderName(eFolder a_eFolder, int a_nData = 0) { string sName = string.Empty; switch (a_eFolder) { case eFolder.Normal: { string sStringFormat = string.Empty; if (a_nData < (int)Global.eDate.AfterDateGap) { sStringFormat = System.IO.Path.Combine(Properties.Resources.sFolderName_Study, Properties.Resources.sFixedDateForderAdd); a_nData -= (int)Global.eDate.FixedDateGap; } else { sStringFormat = System.IO.Path.Combine(Properties.Resources.sFolderName_Study, Properties.Resources.sAfterDateFolderAdd); a_nData -= (int)Global.eDate.AfterDateGap; } sName = string.Format(sStringFormat, a_nData); // _{0}일, {0}일 후 } break; case eFolder.Start: { sName = Properties.Resources.sFolderName_Start; } break; case eFolder.Study: { sName = Properties.Resources.sFolderName_Study; } break; case eFolder.Finish: { sName = Properties.Resources.sFolderName_Finish; } break; } if (string.IsNullOrEmpty(sName) == true) { Define.LogError("arg error"); return(string.Empty); } return(sName); }
public bool IsTypedFolder(eFolder a_eType) { return(m_eFolder == a_eType); }
public void ResearchFoldersAndFiles() { if (Config.bIsSetting == false) { return; } var sRoot = Config.sFolderPath; var liDate = Config.liDate; m_liDateFolder.Clear(); m_mapSpecialFolder.Clear(); // 특수폴더부터 생성해야함 for (int i = (int)eFolder.Start; i <= (int)eFolder.Finish; ++i) { eFolder eFolder = (eFolder)i; m_mapSpecialFolder.Add(eFolder, new Folder((eFolder)eFolder)); } int nDateOffset = 0; foreach (var val in liDate) { if (val < (int)eDate.AfterDateGap) { int nTemp = val - (int)eDate.FixedDateGap; nDateOffset = nTemp; } else { int nTemp = val - (int)eDate.AfterDateGap; nDateOffset += nTemp; } m_liDateFolder.Add(new Folder(eFolder.Normal, val, nDateOffset)); } // 오늘 복습할 파일들 취합 _CollectTodayReviewFile(); return; #region LOCAL_FUNCTION void _CollectTodayReviewFile() { m_liStudyList.Clear(); foreach (var file in m_mapSpecialFolder[eFolder.Start].m_liChild) { m_liStudyList.AddLast(file); } foreach (var folder in m_liDateFolder) { foreach (var file in folder.m_liChild) { if (file.bIsTodayReviewFile == true) { m_liStudyList.AddLast(file); } } } } #endregion LOCAL_FUNCTION }