Example #1
0
 public SearchException(int id, ERROR_TYPE type, string msg, string desc) : base(msg)
 {
     ID          = id;
     TYPE        = type;
     ErrMessage  = msg;
     Description = desc;
 }
        private void ProcessConnectionError(ERROR_TYPE Error_Type)
        {
            DisplayMessage(Bluetooth.GetStatusMessage());

            // Todo: add error handling
            switch (Error_Type)
            {
            case ERROR_TYPE.ADAPTER_ERROR:     // Fatal Bluetooth not present or device error
                break;

            case ERROR_TYPE.ADAPTER_DISABLED:     // Bluetooth turned off

                break;

            case ERROR_TYPE.PAIR_ERROR:
                break;

            case ERROR_TYPE.PAIR_NONE:
                break;

            case ERROR_TYPE.PAIR_FAILED:
                break;

            case ERROR_TYPE.NONE:
                break;
            }

            Bluetooth.SetBluetoothState(Bluetooth.BLUETOOTH_STATE.CONNECTED);
        }
Example #3
0
 public DocumentSearchException(int id, ERROR_TYPE type, string msg, string desc, Exception ex) : base(msg, ex)
 {
     ID          = id;
     TYPE        = type;
     ErrMessage  = msg;
     Description = desc;
 }
Example #4
0
 public TaxonomyException(int id, ERROR_TYPE type, string msg, string desc, Exception ex) : base(msg, ex)
 {
     ID          = id;
     TYPE        = type;
     ErrMessage  = msg;
     Description = desc;
 }
Example #5
0
        public override void DealWithParserError(string p_Error)
        {
            ERROR_TYPE parserError = (ERROR_TYPE)Enum.Parse(typeof(ERROR_TYPE), p_Error);

            switch (parserError)
            {
            case ERROR_TYPE.Checksum_error:
                break;
            }
        }
Example #6
0
        //拼图流程的主入口,从此处区分各个功能要执行的不同操作
        public static ERROR_TYPE ImageCompose(string path)
        {
            ERROR_TYPE result = ERROR_TYPE.Unknown; // todo : 错误类型功能实现得很不好。是错误的尝试,反面教材。有待改进。

            switch (funcType)
            {
            case FUNC_TYPE.SSRWide:
                result = WideCompose(path);
                break;

            case FUNC_TYPE.SSRUpright:
                switch (uprightType)
                {
                case UPRIGHT_TYPE.NoFrame:
                    result = UprightCompose(path);
                    break;

                case UPRIGHT_TYPE.WithFrame:
                    result = UprightComposeWithFrame(path);
                    break;

                case UPRIGHT_TYPE.Both:
                    result = UprightCompose(path);
                    if (result == ERROR_TYPE.Succeed)
                    {
                        result = UprightComposeWithFrame(path);
                    }
                    else
                    {
                        UprightComposeWithFrame(path);
                    }
                    break;
                }
                break;

            case FUNC_TYPE.Gasha:
                result = GashaCardCompose(path);
                break;

            case FUNC_TYPE.GashaInfo:
                result = GashaInfoCompose(path);
                break;

            case FUNC_TYPE.WhiteBoard:
                result = WhiteBoardCompose(path);
                break;

            //新增EVENT
            case FUNC_TYPE.Event:
                result = EventCompose(path);
                break;
            }

            return(result);
        }
Example #7
0
        //根据返回的错误类型显示结果
        private void ShowResult()
        {
            bool       allGreen = true;
            ERROR_TYPE error    = ERROR_TYPE.Succeed;

            foreach (var result in resultList)
            {
                if (result != ERROR_TYPE.Succeed)
                {
                    error = result;
                }
            }

            switch (error)
            {
            case ERROR_TYPE.Succeed:
                break;

            case ERROR_TYPE.SizeError:
                MessageBox.Show("文件大小不符合拼接需求。请核对原文件。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                allGreen = false;
                break;

            case ERROR_TYPE.FileError:
                MessageBox.Show("文件读写出现错误。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                allGreen = false;
                break;

            case ERROR_TYPE.Unknown:
                MessageBox.Show("未知错误。万策尽きた!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                allGreen = false;
                break;
            }

            if (allGreen)
            {
                MessageBox.Show("拼接操作完成。生成的文件在源文件同目录下。", "操作完成", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("拼接操作终止。", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #8
0
 public SearchException(int id, ERROR_TYPE type, string desc, Exception ex) : base("SEARCH EXCEPTION", ex)
 {
     ID          = id;
     TYPE        = type;
     Description = desc;
 }
Example #9
0
        private void doROEError(ERROR_TYPE _gravity, Game _game, PositionPlayer _batter, DefensiveAttributes.POSITION _posCommitingError)
        {
            _game.CommitError();

            bool doDeep = false;

            switch (_gravity)
            {
                case ERROR_TYPE.DEEP_FIELDING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, _batter.FirstName + " reaches on an outfield fielding error by " + _game.GetDefenderFirstName(_posCommitingError) + "!");
                    doDeep = true;
                    break;
                case ERROR_TYPE.DEEP_THROWING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, _batter.FirstName + " reaches on an outfield throwing error by " + _game.GetDefenderFirstName(_posCommitingError) + "!");
                    doDeep = true;
                    break;
                case ERROR_TYPE.SHORT_THROWING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, _batter.FirstName + " reaches on an infield throwing error by " + _game.GetDefenderFirstName(_posCommitingError) + "!");
                    doDeep = true;
                    break;
                case ERROR_TYPE.SHORT_FIELDING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, _batter.FirstName + " reaches on an infield fielding error by " + _game.GetDefenderFirstName(_posCommitingError) + "!");
                    doDeep = false;
                    break;
            }

            if (doDeep)
            {
                doDeepError(_game);
                _game.RunnerOnSecond = _batter;
            }
            else
            {
                doShortError(_game);
                _game.RunnerOnFirst = _batter;
            }
        }
Example #10
0
        private void doNonROEError(ERROR_TYPE _gravity, Game _game, DefensiveAttributes.POSITION _posCommitingError)
        {
            _game.CommitError();

            bool doDeep = false;

            switch (_gravity)
            {
                case ERROR_TYPE.DEEP_FIELDING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, "An outfield fielding error by " + _game.GetDefenderFirstName(_posCommitingError) + " allows the runners to advance!");
                    doDeep = true;
                    break;
                case ERROR_TYPE.DEEP_THROWING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, "An outfield throwing error by " + _game.GetDefenderFirstName(_posCommitingError) + " allows the runners to advance!");
                    doDeep = true;
                    break;
                case ERROR_TYPE.SHORT_THROWING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, "An infield throwing error by " + _game.GetDefenderFirstName(_posCommitingError) + " allows the runners to advance!");
                    doDeep = true;
                    break;
                case ERROR_TYPE.SHORT_FIELDING:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, "An infield fielding error by " + _game.GetDefenderFirstName(_posCommitingError) + " allows the runners to advance!");
                    doDeep = false;
                    break;
                case ERROR_TYPE.DEEP_BOBBLE:
                    _game.GetLog().addEvent(_game.CurrentHalfInning, _game.HomeTeamAtBat, "A bobble by " + _game.GetDefenderFirstName(_posCommitingError) + " allows the runners to advance!");
                    doDeep = false;
                    break;
            }

            if (doDeep)
            {
                doDeepError(_game);
            }
            else
            {
                doShortError(_game);
            }
        }
 public void HandleError()
 {
     ErrorType = ERROR_TYPE.FATAL_ERROR;
     OnError();
     KillSynchronizers();
     Thread.Sleep(5000);
     InitializeSynchronizers(true);
 }
 public void HandleError(LocalRepository repo)
 {
     ErrorType = ERROR_TYPE.FATAL_ERROR;
     OnError();
     KillSynchronizers(repo);
     Thread.Sleep(5000);
     InitializeSynchronizers(repo, true);
 }
 public void HandleDisconnection()
 {
     ErrorType = ERROR_TYPE.DISCONNECTION;
     OnError();
     SynchronizerUnit.DisconnectAll();
 }
 public void InitializeSynchronizers(LocalRepository repo, bool recovery)
 {
     SQLiteRepositoryDAO repoDAO = new SQLiteRepositoryDAO();
     Thread startSync;
     startSync = new Thread(delegate()
     {
         try
         {
             Logger.LogInfo("INFO INITIALIZE SYNC", "Initializing Synchronizers!");
             SynchronizerUnit unit = SynchronizerUnit.GetByRepo(repo);
             if (unit == null)
             {
                 unit = new SynchronizerUnit(repo);
                 SynchronizerUnit.Add(repo, unit);
             }
             unit.InitializeSynchronizers(recovery);
             Logger.LogInfo("INFO INITIALIZE SYNC", "Synchronizers Ready!");
             ErrorType = ERROR_TYPE.NULL;
             OnIdle();
         }
         catch (Exception e)
         {
             Logger.LogInfo("ERROR ON INITIALIZATION SYNC", e);
         }
     });
     startSync.Start();
 }
Example #15
0
 public TaxonomyException(ERROR_TYPE type, string desc) : base("TAXONOMY EXCEPTION")
 {
     TYPE        = type;
     Description = desc;
 }
Example #16
0
 public SearchException(ERROR_TYPE type, string desc) : base("SEARCH EXCEPTION")
 {
     TYPE        = type;
     Description = desc;
 }
Example #17
0
 public DocumentSearchException(int id, ERROR_TYPE type, string desc) : base("DOCUMENT SEARCH EXCEPTION")
 {
     ID          = id;
     TYPE        = type;
     Description = desc;
 }
 public AbstractApplicationController() {
     if (firstRun)
     {
         foreach (string f in Directory.GetFiles(RuntimeSettings.ConfigPath))
             File.Delete(f);
         UpdateConfigFile();
         FirstRunAction ();
     }
     ErrorType = ERROR_TYPE.NULL;
     checkConnection = new Thread(delegate()
         {
         while(true){
             try{
                 bool hasCon = CheckConnection();
                 if(hasCon){
                     if (disconected || ErrorType == ERROR_TYPE.DISCONNECTION)
                     {
                         disconected = false;
                         ErrorType = ERROR_TYPE.NULL;
                         HandleReconnection();
                     }
                 } else {
                     if (!disconected)
                     {
                         disconected = true;
                         HandleDisconnection();
                     }
                 }
                 Thread.Sleep (5000);
                 } catch (Exception e) { Logger.LogInfo("ERROR ON CHECK CONNECTION", e); };
         }
     });
 }
Example #19
0
 public DocumentSearchException(ERROR_TYPE type, string desc, Exception ex) : base("DOCUMENT SEARCH EXCEPTION", ex)
 {
     TYPE        = type;
     Description = desc;
 }
Example #20
0
 public void SetError(ERROR_TYPE error)
 {
     this.PutByte((byte)error, 4);
 }