private void GetAllRARFileName() { string folderName = "./downloadFile"; foreach (string fname in System.IO.Directory.GetFileSystemEntries(folderName)) { if (fname.IndexOf(".zip") > 0 || fname.IndexOf(".rar") > 0) { PRData mPRData = new PRData(); mPRData.FullName = fname.Substring(folderName.Length + 1, fname.Length - folderName.Length - 1); string[] arrString = (fname.Substring(folderName.Length + 1, fname.Length - folderName.Length - 5)).Split('_'); mPRData.Date = arrString[0]; mPRData.Time = arrString[1]; mPRData.Name = arrString[2]; arrPRData.Add(mPRData); } } }
/// <summary> /// 設定comboBoxItem /// </summary> /// <param name="cbx"></param> /// <param name="type"> /// 0=Year /// 1=Month /// 2=Day /// </param> /// <param name="selectString"> /// </param> private void cbxDateSet(PRData str, ComboBox cbx, int type, string selectString) { if (cbx.Items.Count == 0) { string[] s = str.Date.Split('-'); cbx.Items.Add(s[type]); } else { bool isPresence = false; foreach (string x in cbx.Items) { if (str.Date.IndexOf(x) != -1) { isPresence = true; } } if (!isPresence) { string[] s = str.Date.Split('-'); cbx.Items.Add(s[type]); } } }