Ejemplo n.º 1
0
 private static void TimerThread()
 {
     while (true)
     {
         TimeStamp = WocketsTimer.GetUnixTime();
         Thread.Sleep(20);
     }
 }
Ejemplo n.º 2
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 = WocketsTimer.GetUnixTime(dt);
                dfn.endUnixTime   = dfn.startUnixTime + WocketsTimer.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);
            }
        }
Ejemplo n.º 3
0
 public static void Log(String msg)
 {
     try
     {
         DateTime now        = DateTime.Now;
         string   hourlyPath = now.ToString("yyyy-MM-dd") + "\\" + now.Hour;
         if (!Directory.Exists(_FilePath + "\\" + hourlyPath))
         {
             Directory.CreateDirectory(_FilePath + "\\" + hourlyPath);
         }
         TextWriter tw = new StreamWriter(_FilePath + "\\" + hourlyPath + "\\log.csv", true);
         tw.WriteLine(WocketsTimer.GetUnixTime() + "," + DateTime.Now + "," + msg);
         tw.Flush();
         tw.Close();
     }
     catch
     {
     }
 }