Ejemplo n.º 1
0
 /// <summary>
 /// Gets the current day of the week in string form.
 /// </summary>
 /// <returns></returns>
 public static string GetDay()
 {
     if (SysClock.DayOfTheWeek() == 1)
     {
         return("Thursday");
     }
     else if (SysClock.DayOfTheWeek() == 2)
     {
         return("Friday");
     }
     else if (SysClock.DayOfTheWeek() == 3)
     {
         return("Saturday");
     }
     else if (SysClock.DayOfTheWeek() == 4)
     {
         return("Sunday");
     }
     else if (SysClock.DayOfTheWeek() == 5)
     {
         return("Monday");
     }
     else if (SysClock.DayOfTheWeek() == 6)
     {
         return("Tuesday");
     }
     else if (SysClock.DayOfTheWeek() == 7)
     {
         return("Wednesday");
     }
     else
     {
         return("Invalid DayOfTheWeek");
     }
 }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            m_trackerCfg = new Config();
            var clock = new SysClock();

            services.AddControllers();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title       = "pentoTrack",
                    Version     = "v1",
                    Description = "A simple time tracking API",
                });
                // Set the comments path for the Swagger JSON and UI.
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
            });
            services.AddSingleton <Config>(m_trackerCfg);
            services.AddSingleton <IClock>(clock);
            var trackerRepo = new JsonFileTrackerRepo(m_trackerCfg, clock);

            services.AddSingleton <ITrackerRepository>(trackerRepo);
            var userRepo = new SingleUserRepository();

            services.AddSingleton <IUserRepository>(userRepo);
        }
Ejemplo n.º 3
0
    public void BindReferences()
    {
        SysLog.Log("SysRef.BindReferences");
        UiRef = GameObject.FindObjectOfType <UiRef>();

        sysState = GameObject.FindObjectOfType <SysState>();
        sysClock = GameObject.FindObjectOfType <SysClock>();
    }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets the current month in string form.
 /// </summary>
 /// <returns></returns>
 public static string GetMonth()
 {
     if (SysClock.Month() == 1)
     {
         return("January");
     }
     else if (SysClock.Month() == 2)
     {
         return("February");
     }
     else if (SysClock.Month() == 3)
     {
         return("March");
     }
     else if (SysClock.Month() == 4)
     {
         return("April");
     }
     else if (SysClock.Month() == 5)
     {
         return("May");
     }
     else if (SysClock.Month() == 6)
     {
         return("June");
     }
     else if (SysClock.Month() == 7)
     {
         return("July");
     }
     else if (SysClock.Month() == 8)
     {
         return("August");
     }
     else if (SysClock.Month() == 9)
     {
         return("September");
     }
     else if (SysClock.Month() == 10)
     {
         return("October");
     }
     else if (SysClock.Month() == 11)
     {
         return("November");
     }
     else if (SysClock.Month() == 12)
     {
         return("December");
     }
     else
     {
         return("Invalid Month");
     }
 }
Ejemplo n.º 5
0
        public void Record(string logtext)
        {
            string datetime = SysClock.Month() + ":" + SysClock.DayOfTheMonth() + ":" + SysClock.Hour() + ":" + SysClock.Minute() + ":" + SysClock.Second();

            Log.Write(datetime + "\t" + logtext);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Prints today's date.
 /// </summary>
 public static void printDate()
 {
     Console.WriteLine("The current date is " + Date.GetDay() + " " + SysClock.DayOfTheMonth().ToString() + " of " + Date.GetMonth() + ", " + SysClock.Century().ToString() + SysClock.Year().ToString());
 }
Ejemplo n.º 7
0
 public static int DayOfTheMonth()
 {
     return(SysClock.DayOfTheMonth());
 }
Ejemplo n.º 8
0
 public static int Month()
 {
     return(SysClock.Month());
 }
Ejemplo n.º 9
0
 public static int Year()
 {
     return(SysClock.Year());
 }
Ejemplo n.º 10
0
 public static int DayOfTheWeek()
 {
     return(SysClock.DayOfTheWeek());
 }
Ejemplo n.º 11
0
 public static int Hour()
 {
     return(SysClock.Hour());
 }
Ejemplo n.º 12
0
 public static int Minute()
 {
     return(SysClock.Minute());
 }
Ejemplo n.º 13
0
 public static int Second()
 {
     return(SysClock.Second());
 }
Ejemplo n.º 14
0
 public static void printTime()
 {
     Console.WriteLine("The current time is " + SysClock.Hour().ToString() + " :" + SysClock.Minute().ToString() + " :" + SysClock.Second().ToString());
 }