private void Unpack()
 {
     try
     {
         StatusText.Text = "Starting unpacker...";
         StatusText.Text = "Unpacking...";
         DFUnpack      dfu = StaticMemory.DFU;
         DirectoryInfo dir = Directory.CreateDirectory(TempController.GeneratedDir.FullName + "/update");
         ZipFile.ExtractToDirectory(TempController.GeneratedDir.FullName + "/" + dfu.Filename, dir.FullName);
         StatusText.Text = "Deleting old version...";
         if (Directory.Exists(dfu.InstallPath))
         {
             TempController.DestroyDirectory(dfu.InstallPath);
             Directory.Delete(dfu.InstallPath);
         }
         StatusText.Text = "Moving files...";
         Directory.Move(dir.FullName, dfu.InstallPath);
         StatusText.Text = "Finalizing update...";
         Application.Current.Shutdown(ExitCode.Success);
     } catch (Exception e)
     {
         Debug.WriteLine("Exception: " + e.Message);
         Application.Current.Shutdown(ExitCode.InternalError);
         return;
     }
 }
Пример #2
0
 protected override void OnStartup(StartupEventArgs e)
 {
     try
     {
         MainWindow mw = new MainWindow();
         base.OnStartup(e);
         if (e.Args.Length == 2)
         {
             if (e.Args[0] == "test")
             {
                 Debug.Listeners.Add(new TextWriterTraceListener(TempController.GenTempDir().FullName + "/debug.log"));
                 StaticMemory.Operation = Operation.Test;
                 StaticMemory.Args      = e.Args;
                 Debug.WriteLine("Using DFTestXml: " + e.Args[1]);
                 new MainTest();
             }
             else if (e.Args[0] == "install")
             {
                 Debug.Listeners.Add(new TextWriterTraceListener(TempController.GenTempDir().FullName + "/debug.log"));
                 StaticMemory.Operation = Operation.Test;
                 StaticMemory.Operation = Operation.Install;
                 StaticMemory.Args      = e.Args;
                 Debug.WriteLine("Using DFInstallXml: " + e.Args[1]);
                 mw.Show();
             }
             else if (e.Args[0] == "finalize")
             {
                 TempController.GenTempDir(int.Parse(e.Args[1]));
                 TempController.ClearDirectory();
             }
             else if (e.Args[0] == "unpack")
             {
                 StaticMemory.Operation = Operation.Unpack;
                 StaticMemory.Args      = e.Args;
                 StaticMemory.DFU       = DFUnpack.ParseXml(e.Args[1]);
                 Debug.Listeners.Add(new TextWriterTraceListener(TempController.GenTempDir(StaticMemory.DFU.InstallId).FullName + "/debug-installer.log"));
                 Debug.WriteLine("Using DFUnpackXml: " + e.Args[1]);
                 Debug.WriteLine("Temp path: " + TempController.GeneratedDir.FullName);
                 mw.Show();
             }
             else
             {
                 Current.Shutdown(ExitCode.UnknownArgs);
             }
         }
         else
         {
             Current.Shutdown(ExitCode.UnknownArgs);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Exception: " + ex.Message);
         Current.Shutdown(ExitCode.InternalError);
         return;
     }
 }
Пример #3
0
    void Start()
    {
        TempController c = default;

        if (controller != null)
        {
            c = controller.GetComponent <TempController>();
        }
        Facade.RegisterController(typeof(TempController), c);
    }
Пример #4
0
 // Start is called before the first frame update
 void Awake()
 {
     Time.timeScale = 1;
     timer          = GameObject.Find("Main Camera").GetComponent <TempController>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <Animator>();
     spawnPoint     = GameObject.Find("SpawnPoint");
     StartCoroutine(TitleDisplay());
     audioSource = GetComponent <AudioSource>();
 }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var controller = new TempController();
         var data       = controller.ListMenuCategories();
         // Hook the data up to the GridView
         MenuCategoryGrid.DataSource = data;
         MenuCategoryGrid.DataBind();
     }
 }
Пример #6
0
        public void temp_controller_get_paginated_list()
        {
            var tempController = new TempController(_dbConnectionString);

            var addEntity = new TempModel
            {
                Id       = 1,
                Value    = 1f,
                DateTime = new DateTime(2018, 12, 1, 12, 0, 0)
            };
            var addSuccess = tempController.AddTemp(addEntity);

            Assert.IsTrue(addSuccess);

            var addEntity2 = new TempModel
            {
                Id       = 2,
                Value    = 2f,
                DateTime = new DateTime(2019, 12, 1, 12, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity2);
            Assert.IsTrue(addSuccess);

            var addEntity3 = new TempModel
            {
                Id       = 3,
                Value    = 3f,
                DateTime = new DateTime(2019, 12, 1, 18, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity3);
            Assert.IsTrue(addSuccess);

            var getPaginatedList = tempController.GetTempsAsPaginatedList(1, 2);

            Assert.IsNotNull(getPaginatedList);
            Assert.AreEqual(getPaginatedList.PageSize, getPaginatedList.Items.ToArray().Length);
            Assert.AreEqual(3, getPaginatedList.Items.ToArray()[0].Id);
            Assert.AreEqual(2, getPaginatedList.Items.ToArray()[1].Id);

            getPaginatedList = tempController.GetTempsAsPaginatedList(2, 1);
            Assert.IsNotNull(getPaginatedList);
            Assert.AreEqual(getPaginatedList.PageSize, getPaginatedList.Items.ToArray().Length);
            Assert.AreEqual(2, getPaginatedList.Items.ToArray()[0].Id);

            getPaginatedList = tempController.GetTempsAsPaginatedList(5, 1);
            Assert.IsNotNull(getPaginatedList);
            Assert.AreEqual(0, getPaginatedList.Items.ToArray().Length);

            Assert.IsTrue(tempController.RemoveTemp((int)addEntity.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity2.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity3.Id));
        }
Пример #7
0
        public async Task TestLogic()
        {
            // Arrange
            var controller = new TempController(_dispatcherFactory.Object, _controllerService.Object);
            // Act
            var result = controller.Test(new TempModel {
                name = "123"
            });

            // Assert
            var viewResult = Assert.IsType <string>(result);

            Assert.Equal("ok", viewResult);
        }
Пример #8
0
        public void temp_controller_get_all_temps_of_date()
        {
            var tempController = new TempController(_dbConnectionString);

            var addEntity = new TempModel
            {
                Id       = 1,
                Value    = 1f,
                DateTime = new DateTime(2018, 12, 1, 12, 0, 0)
            };
            var addSuccess = tempController.AddTemp(addEntity);

            Assert.IsTrue(addSuccess);

            var addEntity2 = new TempModel
            {
                Id       = 2,
                Value    = 2f,
                DateTime = new DateTime(2019, 12, 1, 12, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity2);
            Assert.IsTrue(addSuccess);

            var addEntity3 = new TempModel
            {
                Id       = 3,
                Value    = 3f,
                DateTime = new DateTime(2019, 12, 1, 18, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity3);
            Assert.IsTrue(addSuccess);

            var temps = tempController.GetTempsByDate(new DateTime(2019, 12, 1)).ToArray();

            Assert.IsNotNull(temps);
            Assert.AreEqual(2, temps.Length);

            Assert.AreEqual(addEntity3.Id, temps[0].Id);
            Assert.AreEqual(addEntity3.DateTime, temps[0].DateTime);
            Assert.AreEqual(addEntity3.Value, temps[0].Value);
            Assert.AreEqual(addEntity2.Id, temps[1].Id);
            Assert.AreEqual(addEntity2.DateTime, temps[1].DateTime);
            Assert.AreEqual(addEntity2.Value, temps[1].Value);

            Assert.IsTrue(tempController.RemoveTemp((int)addEntity.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity2.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity3.Id));
        }
Пример #9
0
 protected override void OnExit(ExitEventArgs e)
 {
     base.OnExit(e);
     try
     {
         Debug.Close();
         if (e.ApplicationExitCode != ExitCode.Unpacking && e.ApplicationExitCode != ExitCode.InternalError && e.ApplicationExitCode != ExitCode.InvalidXml)
         {
             TempController.ClearDirectory();
         }
         Current.Shutdown(e.ApplicationExitCode);
     } catch (Exception ex)
     {
         Debug.WriteLine("Exception: " + ex.Message);
     }
 }
Пример #10
0
 // Use this for initialization
 void Start()
 {
     tempController = Temp.GetComponent <TempController>();
     anim           = GetComponentInChildren <Animator>();
     audioSource    = GetComponent <AudioSource>();
 }
Пример #11
0
    public void Switch()
    {
        PlayerPrefs.SetInt("LoadIndex", targetLevelIndex);
        PlayerPrefs.SetInt("NowLevelIndex", nowlevelIndex);

        SceneManager.LoadScene(PlayerPrefs.GetInt("LoadingSceneIndex"), LoadSceneMode.Additive);


        if (resetPlayer)
        {
            TempController controller = GameObject.FindGameObjectWithTag("TempController").GetComponent <TempController>();
            controller.resetPos = pos;
            controller.resetRot = rot;
            controller.reset    = true;
            Debug.Log("已调用" + controller);
        }
        string levelName = "Level_0" + (targetLevelIndex > 9 ? targetLevelIndex.ToString() : "0" + targetLevelIndex.ToString());

        Debug.Log("Loading " + levelName);
        if (isMapSwitcher)
        {
            if (PlayerPrefs.GetString(levelName)[1] == '0')
            {
                PlayerPrefs.SetInt("LoadMain", 0);

                for (int i = 0; i < SceneManager.sceneCount; i++)
                {
                    if (SceneManager.GetSceneAt(i).name == "U.N.'")
                    {
                        SceneManager.UnloadSceneAsync(SceneManager.GetSceneAt(i));
                    }
                }
            }
            else
            {
                nowlevelIndex = GetComponent <GalaxyMapButton>().nowLevel;
                levelName     = "Level_0" + (nowlevelIndex > 9 ? nowlevelIndex.ToString() : "0" + nowlevelIndex.ToString());
                PlayerPrefs.SetInt("LoadMain", (PlayerPrefs.GetString(levelName)[1] == '0') ? 1 : 0);
            }

            SceneManager.UnloadSceneAsync(PlayerPrefs.GetInt("GalaxyMapIndex"));
        }
        else
        {
            PlayerPrefs.SetInt("LoadMain", 0);

            if (GameObject.FindGameObjectWithTag("KeepPlayer"))
            {
                GameObject.FindGameObjectWithTag("KeepPlayer").GetComponent <Center>().stopPlane = true;
            }
            if (unloadSelf)
            {
                Debug.Log("unloadSelf");
                SceneManager.UnloadSceneAsync(thisLevelIndex);
            }
        }

        if (unloadSelfF)
        {
            SceneManager.UnloadSceneAsync(thisLevelIndex);
        }
    }
Пример #12
0
        public static async Task <ResponseMessage> Process(RequestRawMessageModel cfxRequest)
        {
            ResponseMessage rm = new ResponseMessage();

            try
            {
                TempController tempController = new TempController();
                string         ResponseJSON   = string.Empty;;

                CFXAccountResponse cfxAccountResponse;

                switch (cfxRequest.REQUEST_TYPE)
                {
                //One
                case StaticRequestType.TagLookupSimple:

                    cfxAccountResponse = await tempController.GetAccountInfoGivenTagNumber(cfxRequest.RequestMesssage.TagNumber, cfxRequest.RequestMesssage.IssuingAuthority);

                    ResponseTypeOneModel responseTypeOneModel = new ResponseTypeOneModel();

                    responseTypeOneModel.RequestType = cfxRequest.REQUEST_TYPE;
                    responseTypeOneModel.RequestId   = cfxRequest.CRM_REQUEST_ID;
                    responseTypeOneModel.Requestor   = cfxRequest.REQUESTOR;
                    responseTypeOneModel.RequestDate = Validate.ConvertToDateTime(cfxRequest.REQUEST_DATE);

                    if (cfxAccountResponse.Errors.Length == 0)
                    {
                        responseTypeOneModel.ResponseCode         = "0";
                        responseTypeOneModel.ResponseMessage      = "";
                        responseTypeOneModel.AccountNumber        = cfxAccountResponse.AccountNumber;
                        responseTypeOneModel.AccountStatusCurrent = cfxAccountResponse.AccountStatus;
                        responseTypeOneModel.AccountStatusAtTrans = cfxAccountResponse.AccountStatusAtTransaction;
                    }
                    else
                    {
                        responseTypeOneModel.ResponseCode    = "1";
                        responseTypeOneModel.ResponseMessage = "Account Not Found for TagNumber:" + cfxRequest.RequestMesssage.TagNumber;
                    }
                    ResponseJSON = JsonConvert.SerializeObject(responseTypeOneModel, Newtonsoft.Json.Formatting.None);

                    rm.JSONMessage = ResponseJSON;

                    break;

                case StaticRequestType.PlateLookupForVES:

                    cfxAccountResponse = await tempController.GetAccountInfoGivenPlateInfo(cfxRequest.RequestMesssage.LicensePlate, cfxRequest.RequestMesssage.LicenseState);

                    ResponseTypeTwoModel responseTypeTwoModel = new ResponseTypeTwoModel();

                    responseTypeTwoModel.RequestType = cfxRequest.REQUEST_TYPE;
                    responseTypeTwoModel.RequestId   = cfxRequest.CRM_REQUEST_ID;
                    responseTypeTwoModel.Requestor   = cfxRequest.REQUESTOR;
                    responseTypeTwoModel.RequestDate = cfxRequest.REQUEST_DATE;

                    if (cfxAccountResponse.Errors.Length == 0)
                    {
                        responseTypeTwoModel.ResponseCode         = "0";
                        responseTypeTwoModel.ResponseMessage      = "";
                        responseTypeTwoModel.AccountNumber        = cfxAccountResponse.AccountNumber;
                        responseTypeTwoModel.AccountStatusCurrent = cfxAccountResponse.AccountStatus;
                        responseTypeTwoModel.AccountStatusAtTrans = cfxAccountResponse.AccountStatusAtTransaction;

                        responseTypeTwoModel.cfxEPASS.TagNumber            = cfxAccountResponse.TagNumber;
                        responseTypeTwoModel.cfxEPASS.IssuingAuthority     = cfxAccountResponse.IssuingAuthorityCode;
                        responseTypeTwoModel.cfxEPASS.AccountNumber        = cfxAccountResponse.AccountNumber;
                        responseTypeTwoModel.cfxEPASS.AccountStatusAtTrans = cfxAccountResponse.AccountStatus;
                        responseTypeTwoModel.cfxEPASS.AccountStatusAtTrans = cfxAccountResponse.AccountStatusAtTransaction;
                        // responseTypeTwoModel.cfxEPASS. = cfxAccountResponse.RevNonRevType;

                        responseTypeTwoModel.cfxTRPP.TagNumber            = cfxAccountResponse.TagNumber;
                        responseTypeTwoModel.cfxTRPP.IssuingAuthority     = cfxAccountResponse.IssuingAuthorityCode;
                        responseTypeTwoModel.cfxTRPP.StateCode            = cfxAccountResponse.StateCode;
                        responseTypeTwoModel.cfxTRPP.AccountNumber        = cfxAccountResponse.AccountNumber;
                        responseTypeTwoModel.cfxTRPP.AccountStatusCurrent = cfxAccountResponse.AccountStatusAtTransaction;
                        responseTypeTwoModel.cfxTRPP.AccountStatusCurrent = cfxAccountResponse.AccountStatus;

                        responseTypeTwoModel.cfxPOCH.TagNumber        = cfxAccountResponse.TagNumber;
                        responseTypeTwoModel.cfxPOCH.IssuingAuthority = cfxAccountResponse.IssuingAuthority;
                        responseTypeTwoModel.cfxPOCH.StateCode        = cfxAccountResponse.StateCode;
                        responseTypeTwoModel.cfxPOCH.AccountNumber    = cfxAccountResponse.AccountNumber;

                        responseTypeTwoModel.cfxCHP.TagNumber            = cfxAccountResponse.TagNumber;
                        responseTypeTwoModel.cfxCHP.IssuingAuthority     = cfxAccountResponse.IssuingAuthority;
                        responseTypeTwoModel.cfxCHP.StateCode            = cfxAccountResponse.StateCode;
                        responseTypeTwoModel.cfxCHP.AccountNumber        = cfxAccountResponse.AccountNumber;
                        responseTypeTwoModel.cfxCHP.AccountStatusAtTrans = cfxAccountResponse.AccountStatusAtTransaction;
                    }
                    else
                    {
                        responseTypeTwoModel.ResponseCode    = "2";
                        responseTypeTwoModel.ResponseMessage = "Account Not Found for TagNumber:" + cfxRequest.RequestMesssage.TagNumber;
                    }
                    ResponseJSON = JsonConvert.SerializeObject(responseTypeTwoModel, Newtonsoft.Json.Formatting.None);

                    rm.JSONMessage = ResponseJSON;


                    break;

                case StaticRequestType.Loop2Tagas:

                    cfxAccountResponse = await tempController.GetAccountInfoGivenTagNumber(cfxRequest.RequestMesssage.TagNumber, cfxRequest.RequestMesssage.IssuingAuthority);

                    ResponseTypeThreeModel requestTypeThreeModel = new ResponseTypeThreeModel();
                    requestTypeThreeModel.RequestType = cfxRequest.REQUEST_TYPE;
                    requestTypeThreeModel.RequestId   = cfxRequest.CRM_REQUEST_ID;
                    requestTypeThreeModel.Requestor   = cfxRequest.REQUESTOR;
                    requestTypeThreeModel.RequestDate = Validate.ConvertToDateTime(cfxRequest.REQUEST_DATE);

                    if (requestTypeThreeModel.Errors.Length == 0)
                    {
                        requestTypeThreeModel.ResponseCode         = "0";
                        requestTypeThreeModel.ResponseMessage      = "";
                        requestTypeThreeModel.AccountNumber        = cfxAccountResponse.AccountNumber;
                        requestTypeThreeModel.AccountStatusCurrent = cfxAccountResponse.AccountStatus;
                        requestTypeThreeModel.AccountStatusAtTrans = cfxAccountResponse.AccountStatusAtTransaction;
                    }
                    else
                    {
                        requestTypeThreeModel.ResponseCode    = "1";
                        requestTypeThreeModel.ResponseMessage = "Account Not Found for TagNumber:" + cfxRequest.RequestMesssage.TagNumber;
                    }
                    ResponseJSON = JsonConvert.SerializeObject(requestTypeThreeModel, Newtonsoft.Json.Formatting.None);

                    rm.JSONMessage = ResponseJSON;



                    break;

                case StaticRequestType.Loop2Plates:

                    cfxAccountResponse = await tempController.GetAccountInfoGivenTagNumber(cfxRequest.RequestMesssage.TagNumber, cfxRequest.RequestMesssage.IssuingAuthority);

                    ResponseTypeFourModel requestTypeFourModel = new ResponseTypeFourModel();
                    requestTypeFourModel.RequestType = cfxRequest.REQUEST_TYPE;
                    requestTypeFourModel.RequestId   = cfxRequest.CRM_REQUEST_ID;
                    requestTypeFourModel.Requestor   = cfxRequest.REQUESTOR;
                    requestTypeFourModel.RequestDate = Validate.ConvertToDateTime(cfxRequest.REQUEST_DATE);

                    if (requestTypeFourModel.Errors.Length == 0)
                    {
                        requestTypeFourModel.ResponseCode         = "0";
                        requestTypeFourModel.ResponseMessage      = "";
                        requestTypeFourModel.AccountNumber        = cfxAccountResponse.AccountNumber;
                        requestTypeFourModel.AccountStatusCurrent = cfxAccountResponse.AccountStatus;
                        requestTypeFourModel.AccountStatusAtTrans = cfxAccountResponse.AccountStatusAtTransaction;
                    }
                    else
                    {
                        requestTypeFourModel.ResponseCode    = "1";
                        requestTypeFourModel.ResponseMessage = "Account Not Found for TagNumber:" + cfxRequest.RequestMesssage.TagNumber;
                    }
                    ResponseJSON = JsonConvert.SerializeObject(requestTypeFourModel, Newtonsoft.Json.Formatting.None);

                    rm.JSONMessage = ResponseJSON;


                    break;

                case StaticRequestType.Rebates:

                    cfxAccountResponse = await tempController.GetAccountInfoGivenTagNumber(cfxRequest.RequestMesssage.TagNumber, cfxRequest.RequestMesssage.IssuingAuthority);

                    ResponseTypeFiveModel requestTypeFiveModel = new ResponseTypeFiveModel();
                    requestTypeFiveModel.RequestType = cfxRequest.REQUEST_TYPE;
                    requestTypeFiveModel.RequestId   = cfxRequest.CRM_REQUEST_ID;
                    requestTypeFiveModel.Requestor   = cfxRequest.REQUESTOR;
                    requestTypeFiveModel.RequestDate = Validate.ConvertToDateTime(cfxRequest.REQUEST_DATE);

                    if (requestTypeFiveModel.Errors.Length == 0)
                    {
                        requestTypeFiveModel.ResponseCode         = "0";
                        requestTypeFiveModel.ResponseMessage      = "";
                        requestTypeFiveModel.AccountNumber        = cfxAccountResponse.AccountNumber;
                        requestTypeFiveModel.AccountStatusCurrent = cfxAccountResponse.AccountStatus;
                        requestTypeFiveModel.AccountStatusAtTrans = cfxAccountResponse.AccountStatusAtTransaction;
                    }
                    else
                    {
                        requestTypeFiveModel.ResponseCode    = "1";
                        requestTypeFiveModel.ResponseMessage = "Account Not Found for TagNumber:" + cfxRequest.RequestMesssage.TagNumber;
                    }
                    ResponseJSON = JsonConvert.SerializeObject(requestTypeFiveModel, Newtonsoft.Json.Formatting.None);

                    rm.JSONMessage = ResponseJSON;


                    break;

                case StaticRequestType.TagStatus:
                    break;

                case StaticRequestType.MTOLLS:
                    break;

                default:

                    break;
                }
            }
            catch (Exception ex)
            {
                rm.Error = ex.Message.ToString();
            }



            return(rm);
        }
Пример #13
0
 // Use this for initialization
 void Start()
 {
     tempController = Temp.GetComponent <TempController>();
     pre_temp       = tempController.GetTemp();
     Ice.SetActive(false);
 }