예제 #1
0
        public ActionResult GenerateClock(string location)
        {
            try
            {
                location = location.Trim();
                ClockGenerator generatorObj = new ClockGenerator(_context);
                ClockURL       clockDTO     = generatorObj.GenerateClock(location);
                //setting Redirection Clock
                string redirectionType = dbService.GetConfigurationProperties("WebClockType");
                if (redirectionType.ToUpper() == "WEB")
                {
                    clockDTO.RedirectURL = clockDTO.SilverLighClockURL;
                }
                else if (redirectionType.ToUpper() == "HTML")
                {
                    clockDTO.RedirectURL = clockDTO.HTMLClockURL;
                }

                var result = Json(clockDTO);
                return(result);
            }
            catch (Exception ex)
            {
                CustomLogging.ErrorLog(ex);
                return(Json(false));
            }
        }
예제 #2
0
        public VirtualMachine(CPU cpu, ClockGenerator clock, Northbridge northbridge, Southbridge southbridge)
        {
            this.cpu        = cpu;
            this.cpu.Parent = this;

            this.northbridge       = northbridge;
            this.southbridge       = southbridge;
            this.northbridge.Clock = clock;
        }
예제 #3
0
        public ActionResult GetClockURL(int number)
        {
            try
            {
                UserInfo userInfo = new UserInfo(_context, HttpContext, User);
                bool     isAdmin  = userInfo.isAdmin();
                if (isAdmin) //If user is admin, show admin panel to user by setting is admin property to true
                {
                    ClockURL dto = new ClockURL();
                    dto.IsAdmin = isAdmin;
                    return(Json(dto));
                }
                else
                {
                    //If user is not admin, try to find location of user from user info.
                    string locationID  = "";
                    var    userDetails = userInfo.GetUserInfo();
                    CustomLogging.InfoLog("UserInfo details: empID=" + userDetails.empID + "; locationID=" + userDetails.locationID +
                                          "; jobCode=" + userDetails.jobCode + "; dept=" + userDetails.dept);
                    locationID = userDetails.locationID;
                    //IF location is not recieived from user info, try to find it from user agent string
                    if (locationID == "0" || locationID == null)
                    {
                        var userAgent = Request.Headers["User-Agent"].ToString();
                        locationID = Util.GetStoreFromUserAgent(userAgent);
                    }
                    //If location is not present in user agent string, show dropdown to user by sending empty object
                    if (locationID == "0" || String.IsNullOrEmpty(locationID))
                    {
                        ClockURL dtObject = new ClockURL();
                        return(Json(dtObject));
                    }
                    // Now if location is present, generate URL's
                    ClockGenerator generatorObj = new ClockGenerator(_context);
                    ClockURL       clockDTO     = generatorObj.GetClockURLObject(locationID);

                    //setting Redirection Clock
                    string redirectionType = dbService.GetConfigurationProperties("WebClockType");
                    if (redirectionType.ToUpper() == "WEB")
                    {
                        clockDTO.RedirectURL = clockDTO.SilverLighClockURL;
                    }
                    else if (redirectionType.ToUpper() == "HTML")
                    {
                        clockDTO.RedirectURL = clockDTO.HTMLClockURL;
                    }
                    var result = Json(clockDTO);
                    return(result);
                }
            }
            catch (Exception ex)
            {
                CustomLogging.ErrorLog(ex);
                return(Json(false));
            }
        }
예제 #4
0
 // Update is called once per frame
 void Update()
 {
     LimitTime -= Time.deltaTime;
     text_Timer.text = ""+Mathf.Round(LimitTime);
     
     if(Mathf.Round(LimitTime)<=0) //타임이 0이 되면
     {
         text_Timer.text = "Clear !";
         TextGenerator.ListenTimeOver(); // 타이머 다 됐다고 텍스트 그만 만들라고 전달하는 코드에요!
         ClockGenerator.ListenTimeOver(); // 얘도 똑같이 만들어줬어요!
     }
 }
예제 #5
0
        static void Main(string[] args)
        {
            TimerCallback           callback    = null;
            Timer                   timer       = null;
            CancellationTokenSource tokenSource = new CancellationTokenSource();
            CancellationToken       token       = tokenSource.Token;
            List <ProcessDomain>    processes   = new List <ProcessDomain>
            {
                new ProcessDomain {
                    ProcessName = "p0", ProcessID = 4, State = ProcessState.Running, Priority = ProcessPriority.Normal
                },
                new ProcessDomain {
                    ProcessName = "p1", ProcessID = 5, State = ProcessState.Completed, Priority = ProcessPriority.Normal
                },
                new ProcessDomain {
                    ProcessName = "p2", ProcessID = 6, State = ProcessState.Completed, Priority = ProcessPriority.Normal
                },
                new ProcessDomain {
                    ProcessName = "p3", ProcessID = 7, State = ProcessState.Completed, Priority = ProcessPriority.Normal
                }
            };

            foreach (var item in GetAllProcess(processes))
            {
                Console.WriteLine(item);
            }

            ClockGenerator clock = new ClockGenerator(callback, timer);
            SJFScheduler   sjf   = new SJFScheduler(processes);

            //var runTasks = sjf.StartConvertToRunningOperation(token);
            //var resTask = sjf.Start(token);


            //nonpreemptive imitation
            Thread.Sleep(500);
            sjf.AddProcess(new ProcessDomain {
                ProcessName = "p3", ProcessID = 8, State = ProcessState.New, Priority = ProcessPriority.Normal
            });

            //resTask.Wait();

            //if (resTask.IsCompleted)
            //{
            //    foreach (var res in resTask.Result)
            //    {
            //        Console.WriteLine(res);
            //    }
            //}
            //clock.Stop();
            //Console.Read();
        }
예제 #6
0
        public IActionResult Startup(string location)
        {
            string locationID = "";

            ViewData["RedirectURL"]  = "";
            ViewData["LocationID"]   = "";
            ViewData["LocationType"] = "";
            var userAgent = Request.Headers["User-Agent"].ToString();

            CustomLogging.InfoLog("User-Agent String = " + userAgent);
            locationID = String.IsNullOrEmpty(location)? Util.GetStoreFromUserAgent(userAgent):location;
            if (!String.IsNullOrEmpty(locationID))
            {
                // Now if location is present, generate URL's
                ClockGenerator generatorObj = new ClockGenerator(_context);
                ClockURL       clockDTO     = generatorObj.GetClockURLObject(locationID);
                //Check if clock is registered or not.
                if (clockDTO.StatusCode == "101")
                {
                    ViewData["RedirectURL"] = clockDTO.StatusCode;
                    ViewData["LocationID"]  = locationID;
                }
                else
                {
                    //setting Redirection Clock
                    string redirectionType = dbService.GetConfigurationProperties("WebClockType");
                    if (redirectionType.ToUpper() == "WEB")
                    {
                        clockDTO.RedirectURL = clockDTO.SilverLighClockURL;
                    }
                    else if (redirectionType.ToUpper() == "HTML")
                    {
                        clockDTO.RedirectURL = clockDTO.HTMLClockURL;
                    }
                    ViewData["RedirectURL"]  = clockDTO.RedirectURL;
                    ViewData["LocationType"] = clockDTO.LocationType;
                }
            }
            return(View());
        }
예제 #7
0
        }                                           // A register to hold flags after an operation



        //Constructor: takes frequency and an optional clock mode
        public SAP1_8Bit(int frequency = 1000, ClockGenerator.ClockModes clockMode = ClockGenerator.ClockModes.Auto)
        {
            Flags = new FlagsRegister(0x03); // Create a 2-bit flag register

            // Create the devices and configure how many bits they connect with other devices.
            A      = new Register();              //Create an 8-bit register (no mask provided defualts to 8-bit)
            B      = new Register();              //Create an 8-bit register
            Inst   = new Register(maskOut: 0x0F); //Instruction Register only connects to bus with 4 LSB, thus the maskOut=0x0F, defaults to 8-bit into the Bus
            MAR    = new Register(maskIn: 0x0F);  // MAR gets a 0x0F mask since it's only a 4 bit register, no need to set maskOut since it never puts on BUS
            Output = new Register();              //Create an 8-bit register
            Sum    = new ALU(A, B, Flags);        // Connect A Reg and B Reg as operands and the Flags Register to the ALU, 1st Op is also the accumilator
            RAM    = new SRAM(MAR);               // Connect MAR as the address pointer to the RAM
            PC     = new Counter(mask: 0x0F);     //PC is a 4 Bit counter so gets a 4bit mask

            //Initialize the Bus and connect the devices to it as shown in the figure above.
            Bus = new Bus(new List <Register> {
                A, B, Inst, MAR, Output, Sum, RAM, PC
            });

            CL    = new ControlSequencer(Inst, Flags);                                 // Control logic is directly connected to the instruction register and flags register.
            Clock = new ClockGenerator(frequency, RisingEdge, FallingEdge, clockMode); // Initialize the clock and tell it what to do on rising edge and faling edge.
            Reset();                                                                   // Reset everything at creation
        }