Exemplo n.º 1
0
        public ViewAViewModel(Game game, AppLog logger)
        {
            _game   = game;
            _logger = logger;

            _logger.Log(@"ViewAViewModel HERE ☺!");
        }
 public void OnApplicationPause(bool pauseStatus)
 {
     if (this._wrapper != null)
     {
         if (!pauseStatus)
         {
             try
             {
                 AppLog.Log("Trying to resume SW", true);
                 this._wrapper.Resume();
                 this.RearmUnit();
             }
             catch (Exception exception)
             {
                 AppLog.Log("Exception during resume SW", true);
             }
         }
         else
         {
             try
             {
                 AppLog.Log("Trying to pause SW", true);
                 this._wrapper.Pause();
             }
             catch (Exception exception1)
             {
                 AppLog.Log("Exception during pause SW", true);
             }
         }
     }
 }
Exemplo n.º 3
0
    private static void CheckExcelPath()
    {
        //判断指定的Excel文件是否存在
        if (!Directory.Exists(ExcelPath))
        {
            AppLog.LogErrorAndExit(string.Format("错误!!! 输入的Excel表格所在目录不存在,路径为:{0}", ExcelPath));
        }

        ExcelPath = Path.GetFullPath(ExcelPath);
        AppLog.Log(string.Format("提示: 您选择的Excel所在路径:{0}", ExcelPath));


        Dictionary <string, List <string> > temp = new Dictionary <string, List <string> >();
        SearchOption searchOption;

        if (IsIncludeSubfolder == true)
        {
            searchOption = SearchOption.AllDirectories;
        }
        else
        {
            searchOption = SearchOption.TopDirectoryOnly;
        }
        //获取指定文件夹夹所有Excel文件
        AllExcelPaths = FileModule.GetFileInfo(ExcelPath, "xlsx", searchOption);
    }
 private void UpdateCheckingLicenseStatus()
 {
     if (this._isLicenseChecked || this._mmsDataCopy == null)
     {
         return;
     }
     if (this._wrapper.IsConnected && !this._isLicenseChecking)
     {
         this._isLicenseChecking = true;
     }
     if (this._wrapper.IsConnected && this._isLicenseChecking)
     {
         this._licenseCheck += Time.deltaTime;
         if (this._licenseCheck >= this._licenseCheckTime)
         {
             this._isLicenseChecking = false;
             SkyTrakSW.MMSLicense license = this._mmsDataCopy.License;
             AppLog.Log(string.Format("License: Validation result = {0}, Header = {1}, Body = {2}, DaysLeft = {3}", new object[] { license.ValidationResult, license.Header, license.Body, license.DaysLeftInCurrentPeriod }), true);
             if (license.ValidationResult != STSWMMSValidationResultType.STSW_VALIDATION_MMS_VALID)
             {
                 this.ShowEvaluationPeriodMessage(license);
             }
             if (license.ValidationResult == STSWMMSValidationResultType.STSW_VALIDATION_DEVICE_NOT_REGISTERED_BLOCK)
             {
                 ((ISkyTrakSW)this).DisarmBox();
             }
             else
             {
                 ((ISkyTrakSW)this).ArmBox();
             }
             this._isLicenseChecked = true;
             this.OnMMSUpdatedAction();
         }
     }
 }
Exemplo n.º 5
0
        private static string ConvertClubNameToServerSafe(string clubName)
        {
            string str = string.Copy(clubName);

            if (str.Contains("°"))
            {
                string[] strArrays = str.Split(new string[] { "°" }, StringSplitOptions.RemoveEmptyEntries);
                str = string.Concat(strArrays[0], "%B0");
                if ((int)strArrays.Length > 1)
                {
                    for (int i = 1; i < (int)strArrays.Length; i++)
                    {
                        str = string.Concat(str, strArrays[i]);
                    }
                }
            }
            if (str.Contains("#"))
            {
                string[] strArrays1 = str.Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries);
                str = string.Concat(strArrays1[0], "%23");
                if ((int)strArrays1.Length > 1)
                {
                    for (int j = 1; j < (int)strArrays1.Length; j++)
                    {
                        str = string.Concat(str, strArrays1[j]);
                    }
                }
            }
            if (str.Length > 16)
            {
                AppLog.Log("ClubNameServerSafe::ClubName is too large, sending truncated string", true);
                str = str.Substring(0, 16);
            }
            return(str);
        }
Exemplo n.º 6
0
    private void UpdateValues()
    {
        if (SecurityWrapperService.Instance == null)
        {
            return;
        }
        this.softwareVersionLabel.text  = string.Format("{0} ({1})", SoftwareVersion.ShortVersion, SoftwareVersion.BuildNumber);
        this.unitSerialNumberLabel.text = (!SecurityWrapperService.Instance.IsConnected ? "NOT CONNECTED" : SecurityWrapperService.Instance.ESN);
        this.firmwareVersionLabel.text  = (!SecurityWrapperService.Instance.IsConnected ? "NOT CONNECTED" : SecurityWrapperService.Instance.FWVersion);
        string str = "NOT CONNECTED";

        if (!SecurityWrapperService.Instance.IsConnected)
        {
            this.ShowRegisterButton(false);
        }
        else
        {
            if (!SecurityWrapperService.Instance.MMSData.Registered)
            {
                str = "NOT REGISTERED";
            }
            else
            {
                AppLog.Log(string.Format("First name {0}", SecurityWrapperService.Instance.MMSData.MemberFirstName), true);
                AppLog.Log(string.Format("Last name {0}", SecurityWrapperService.Instance.MMSData.MemberLastName), true);
                string str1 = string.Format("{0} {1}", SecurityWrapperService.Instance.MMSData.MemberFirstName, SecurityWrapperService.Instance.MMSData.MemberLastName);
                if (!SecurityWrapperService.Instance.MMSData.MemberFirstName.ToUpper().Equals("FFFFFFFFFFFF") && !SecurityWrapperService.Instance.MMSData.MemberLastName.ToUpper().Equals("FFFFFFFFFFFF"))
                {
                    str = str1;
                }
            }
            //this.ShowRegisterButton(LoginManager.IsUserLoggedIn);
        }
        this.registeredToLabel.text = str;
    }
Exemplo n.º 7
0
        private void LoadLanguageContext(SupportedLanguages lang, string token)
        {
            try
            {
                Issue = DB_DBBrokerIssue.GetByToken(token);
            }
            catch (Exception ex)
            {
                AppLog.Log(ex);
            }

            if (Issue == null)
            {
                Issue = new DBBrokerIssue();
            }

            if (lang == SupportedLanguages.Português)
            {
                Title         = "Ativação do relato";
                TxSubtitle    = Issue.Id == 0 ? ":( Nenhuma interação encontrada" : "O seu feedback ou relato de um bug foi ativado. Entraremos em contato o mais breve possível.";
                TxTitle       = "Título";
                TxDescription = "Descrição";
            }
            else
            {
                Title         = "Issue activation";
                TxSubtitle    = Issue.Id == 0 ? ":( Nothing found" :  "Your feedback or issue has been activated. We will respond as soon as possible.";
                TxTitle       = "Title";
                TxDescription = "Description";
            }
        }
Exemplo n.º 8
0
    private bool TryLoadSessionSettingsFromPlayerPrefs()
    {
        string str;
        bool   flag;

        try
        {
            bool isUserLoggedIn = LoginManager.IsUserLoggedIn;
            str = (!isUserLoggedIn ? "NoLoggedInUser|JsonSessionSettings" : string.Concat(LoginManager.UserData.Email, "|JsonSessionSettings"));
            if (!PlayerPrefs.HasKey(str))
            {
                flag = false;
            }
            else
            {
                string str1 = PlayerPrefs.GetString(str);
                this.JsonSettings = new JSONObject(str1, -2, false, false);
                if (isUserLoggedIn)
                {
                    this.SaveSettingToJson(GameSettings.GameSetting.HandToggleValue, this.bProfileLeftHandFlag.ToString());
                }
                flag = true;
            }
        }
        catch (Exception exception1)
        {
            Exception exception = exception1;
            AppLog.Log(string.Concat("Exception: in LoadSettingsFromPlayerPrefs - ", exception.Message), true);
            flag = false;
        }
        return(flag);
    }
Exemplo n.º 9
0
    public Activity CreateActivity()
    {
        if (this.CurrentSessionData == null)
        {
            return(null);
        }
        if (string.IsNullOrEmpty(ApplicationDataManager.instance.ESN) || ApplicationDataManager.instance.ESN == "NOESN" || string.IsNullOrEmpty(ApplicationDataManager.instance.FWVersion) || CGameManager.instance == null || !LoginManager.IsUserLoggedIn)
        {
            return(null);
        }
        this.CurrentSessionData.Esn = ApplicationDataManager.instance.ESN;
        //DatabaseManager.Update<Session>(this.CurrentSessionData);
        Activity instance = DataEntry.GetInstance <Activity>(ApplicationDataManager.instance.GenerateLocalEsnID());

        instance.Esn                = ApplicationDataManager.instance.ESN;
        instance.User               = LoginManager.UserData;
        instance.TypeId             = Activity.GetTypeIdForGameRulesType(CGameManager.instance.currentGameType);
        instance.SubTypeId          = Activity.GetSubTypeIdForGameRulesType(CGameManager.instance.currentGameType);
        instance.StartTime          = DateTime.Now.ToLocalTime();
        instance.EndTime            = DateTime.Now.ToLocalTime();
        instance.CourseId           = null;
        instance.CourseConditionsId = null;
        instance.TeePositionId      = null;
        instance.Session            = this.CurrentSessionData;
        AppLog.Log(string.Concat("Create new activity Id =", instance.Id), true);
        this._activitiesStack.Push(instance);
        return(instance);
    }
 private void OnDiscoverUpdated(List <RIPECommBoxDataParamsType> ripeCommBoxDataParamsTypes)
 {
     if (ripeCommBoxDataParamsTypes.Count == 0)
     {
         try
         {
             this._wrapper.Discover();
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Discover Exception: ", exception.Message), true);
         }
         return;
     }
     foreach (RIPECommBoxDataParamsType ripeCommBoxDataParamsType in ripeCommBoxDataParamsTypes)
     {
         AppLog.Log(string.Concat("Discovered Box: ", ripeCommBoxDataParamsType.boxName), true);
         this._boxList.Clear();
         this._boxList.AddRange(ripeCommBoxDataParamsTypes);
     }
     try
     {
         this._wrapper.BoxConnect(ripeCommBoxDataParamsTypes[0].boxName);
     }
     catch (Exception exception3)
     {
         Exception exception2 = exception3;
         AppLog.Log(string.Concat("Box Connect Exception: ", exception2.Message), true);
     }
 }
 private void PrintMMS()
 {
     if (this._mmsDataCopy == null)
     {
         return;
     }
     AppLog.Log(string.Concat("MMS: ", this._mmsDataCopy.ToString()), true);
 }
 public void CallbackMethod(string eventString)
 {
     AppLog.Log(string.Concat("!!!!!!!!!!!!! CallbackMethod:", eventString), true);
     if (this.CallbackAction != null)
     {
         this.CallbackAction(eventString);
     }
 }
Exemplo n.º 13
0
 public void OneTimeSetup()
 {
     AppLog.Log("Test log 1");
     AppLog.Error("Test error 1");
     AppLog.Log("Test log 2");
     AppLog.Debug("Test debug 1");
     AppLog.Exception(new AmbiguousMatchException(), "Test exception 1");
     AppLog.Debug("Invalid Format {0}");
 }
 private void OnStatusUpdated(RIPEBoxParamsType ripeBoxParamsType)
 {
     if (this._saveBoxParamsToLog)
     {
         AppLog.Log(string.Format("Box Params: Handness State - {0}, Charging State - {1}, Battery Percent - {2}, IsBoxInAPMode = {3}", new object[] { ripeBoxParamsType.handednessState, ripeBoxParamsType.chargingState, ripeBoxParamsType.batteryPercent.ToString("F1"), ripeBoxParamsType.isBoxInAPMode }), true);
         this._saveBoxParamsToLog = false;
     }
     this._boxParams = ripeBoxParamsType;
 }
 private void OnConnectFail(RIPEErrType ripeErrType)
 {
     AppLog.Log("OnConnectedFail EVENT", true);
     if (this.OnDisconnectedAction != null)
     {
         this.OnDisconnectedAction();
     }
     this.ResetLicenseEndStartDiscovering();
 }
Exemplo n.º 16
0
        public MainWindow(AppLog logger)
        {
            InitializeComponent();

            _logger = logger;
            _vm     = DataContext as MainWindowViewModel;

            _logger.Log($@"StartViewModel HERE ☺!");

            this.Loaded += (sender, args) => _vm.MainWindow_Loaded();
        }
Exemplo n.º 17
0
    public static void ExportToTxt(TableInfo tableInfo)
    {
        string errorString = null;

        if (AppValues.MergeTableList.ContainsKey(tableInfo.TableName))
        {
            TableExportToTxtHelper.ExportTableToTxt2(tableInfo, out errorString);
            if (errorString != null)
            {
                AppLog.LogErrorAndExit(errorString);
            }
            else
            {
                AppLog.Log("合并表导出txt成功");
            }
            return;
        }

        // 对表格按默认方式导出
        if (TableAnalyzeHelper.GetOneConfigData(tableInfo, TxtStruct.Excel_Config_ExportTxt, ref TxtStruct.IsExportTxt))
        {
            // 对表格按默认方式导出
            if (TxtStruct.IsExportTxt == true)
            {
                TableExportToTxtHelper.ExportTableToTxt(tableInfo, out errorString);
                if (errorString != null)
                {
                    AppLog.LogErrorAndExit(errorString);
                }
                else
                {
                    AppLog.Log("按默认方式导出txt成功");
                }
            }
        }
        else
        {
            // 对表格按默认方式导出
            if (TxtStruct.IsExport == true)
            {
                TableExportToTxtHelper.ExportTableToTxt(tableInfo, out errorString);
                if (errorString != null)
                {
                    AppLog.LogErrorAndExit(errorString);
                }
                else
                {
                    AppLog.Log("按默认方式导出txt成功");
                }
            }
        }
    }
        public void ResultData_IncludesLogs()
        {
            AppLog.Log("Test Log 1");
            AppLog.Error("Test Error 1");
            var rd = new ResultData {
                EstimatedPrecipitation = 0.1
            };

            var json = rd.ToString();

            StringAssert.Contains("LOG: Test Log 1", json, "Doesn't contain test log 1");
            StringAssert.Contains("ERR: Test Error 1", json, "Doesn't contain test error 1");
        }
        private IEnumerator StartRearmUnit()
        {
            if (_wrapper == null)
            {
                yield return(new WaitForSeconds(6f));
            }

            AppLog.Log("Start Rearming", true);
            Instance.DisarmBox();

            yield return(new WaitForSeconds(1f));

            Instance.ArmBox();
        }
Exemplo n.º 20
0
    public void CloseSubActivity()
    {
        Activity now = this._activitiesStack.Peek();

        if (now.Parent == null)
        {
            return;
        }
        now.EndTime = DateTime.Now;
        now.IsDirty = true;
        //DatabaseManager.Update<Activity>(now);
        this._activitiesStack.Pop();
        AppLog.Log(string.Concat("Active activity now is: ", this._activitiesStack.Peek().Id), true);
    }
Exemplo n.º 21
0
    public static void ExportToLuaFile(TableInfo tableInfo)
    {
        string errorString = null;

        TableExportToLuaFileHelper.ExportTableToLuaFile(tableInfo, out errorString);
        if (errorString != null)
        {
            AppLog.LogErrorAndExit(errorString);
        }
        else
        {
            AppLog.Log("按默认方式导出LuaFile成功");
        }
    }
 void Security.ISkyTrakSW.SetHandedness(bool isLefty)
 {
     if (this._wrapper != null)
     {
         try
         {
             this._wrapper.BoxSetHandedness((!isLefty ? RIPEBoxHandednessStateType.RIPE_HANDEDNESS_RIGHT : RIPEBoxHandednessStateType.RIPE_HANDEDNESS_LEFT));
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Set Handedness Exception: ", exception.Message), true);
         }
     }
 }
 void Security.ISkyTrakSW.ConnectToDevice(string boxName)
 {
     if (this._wrapper != null)
     {
         try
         {
             this._wrapper.BoxConnect(boxName);
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Box Connect Exception: ", exception.Message), true);
         }
     }
 }
 void Security.ISkyTrakSW.DisarmBox()
 {
     if (this._wrapper != null)
     {
         try
         {
             this._wrapper.BoxDisarm();
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Disarm Box Exception: ", exception.Message), true);
         }
     }
 }
 void Security.ISkyTrakSW.SetShotModePutting()
 {
     if (this._wrapper != null)
     {
         try
         {
             this._wrapper.BoxSetShotModePutting();
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Exception during set putting mode: ", exception.Message), true);
         }
     }
 }
Exemplo n.º 26
0
    private void LoadHandnessFromProfile()
    {
        string str;

        if (!LoginManager.IsUserLoggedIn)
        {
            str = "false";
        }
        else
        {
            AppLog.Log(string.Concat("PauseSettings: persistent profile hand setting: ", this.bProfileLeftHandFlag), true);
            str = this.bProfileLeftHandFlag.ToString();
        }
        this.SaveSettingToJson(GameSettings.GameSetting.HandToggleValue, str);
    }
 private void OnMmsUpdated()
 {
     AppLog.Log("MMS was updated", true);
     try
     {
         this._mmsDataCopy = this._wrapper.CopyConnectedBoxMMSData();
         this.PrintMMS();
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         AppLog.Log(string.Concat("Copy MMS Exception: ", exception.Message), true);
         AppLog.Log(string.Concat("Stacktrace: ", exception.StackTrace), true);
     }
     this.OnMMSUpdatedAction();
 }
 void Security.ISkyTrakSW.AddEsnToCache(string esn)
 {
     AppLog.Log(string.Concat("esn:", esn), true);
     if (this._wrapper != null)
     {
         try
         {
             this._wrapper.AddBoxEsnToCache(esn);
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Add Box Esn to Cache Exception: ", exception.Message), true);
         }
     }
 }
 void Security.ISkyTrakSW.BoxSetNetworkConfig(RIPENetworkConfigType config)
 {
     if (this._wrapper != null)
     {
         try
         {
             this._wrapper.BoxSetNetworkConfig(config);
             this._configWasChanged = true;
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Set Network Config Exception: ", exception.Message), true);
         }
     }
 }
 void Security.ISkyTrakSW.ForceNetworkConnect()
 {
     if (this._wrapper != null)
     {
         try
         {
             this._wrapper.BoxBootForceNetworkConnect();
             this._configWasChanged = true;
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             AppLog.Log(string.Concat("Force Network Connect Exception: ", exception.Message), true);
         }
     }
 }