Esempio n. 1
0
        private static DayFolderNode[] GetDayFolderInformation(FileSystemInfo[] fia)
        {
            if (fia == null || fia.Length < 1)
            {
                return(null);
            }

            System.Collections.ArrayList ret = new System.Collections.ArrayList();

            DayFolderNode dfn;

            HourFolderNode[] hours = null;

            DateTime dt;

            foreach (FileSystemInfo fsi in fia)
            {
                //fill the info
                dfn = new DayFolderNode();

                dfn.folderName  = fsi.FullName;
                dfn.dayAsString = fsi.Name;


                if (!DirectoryStructure.TimeFromDayFolderName(fsi.Name, out dt))
                {
                    return(null);
                }

                dfn.startUnixTime = UnixTime.GetUnixTime(dt);
                dfn.endUnixTime   = dfn.startUnixTime + UnixTime.MilliInDay - 1;

                //Get the hour information
                hours = DirectoryStructure.GetHourFolderInformation(fsi.FullName, dfn.startUnixTime);
                if (hours == null || hours.Length < 1)
                {
                    continue;
                }

                dfn.hours = hours;

                //add to the list
                ret.Add(dfn);

                hours = null;
                dfn   = null;
            }

            if (ret.Count > 0)
            {
                //Create the array to return
                return((DayFolderNode[])ret.ToArray(typeof(DayFolderNode)));
            }
            else
            {
                return(null);
            }
        }
		private static DayFolderNode[] GetDayFolderInformation(FileSystemInfo[] fia,string fileRegex)
		{
			if(fia == null || fia.Length<1)
				return null;

			System.Collections.ArrayList ret = new System.Collections.ArrayList();
			
			DayFolderNode dfn;
			HourFolderNode[] hours =null;
			
			DateTime dt;

			foreach(FileSystemInfo fsi in fia)
			{

				//fill the info
				dfn=new DayFolderNode();
			
				dfn.folderName = fsi.FullName;
				
				if(!DirectoryStructure.TimeFromDayFolderName(fsi.Name,out dt))
				{
					return null;
				}

				dfn.startUnixTime = UnixTime.GetUnixTime(dt);
				dfn.endUnixTime = dfn.startUnixTime+UnixTime.MilliInDay-1;

				//Get the hour information
				hours =  DirectoryStructure.GetHourFolderInformation(fsi.FullName,dfn.startUnixTime,fileRegex);
				if(hours==null || hours.Length<1)
					continue;
				
					dfn.hours = hours;

				//add to the list
				ret.Add(dfn);

				hours = null;
				dfn = null;
			}

			if(ret.Count>0)
			{
				//Create the array to return
				return (DayFolderNode[])ret.ToArray(typeof(DayFolderNode));
			}
			else
			{
				return null;
			}
		}