示例#1
0
        public ScannerViewModel(
            CashQRCodeViewModel cashQRCodeVM,
            ScannerSettingsViewModel scannerSettingsVM,
            ScannerHelper scannerHelper,
            IPlayer player)
            : base()
        {
            CashQRCodeVM       = cashQRCodeVM;
            ScannerSettingsVM  = scannerSettingsVM;
            this.scannerHelper = scannerHelper;
            this.player        = player;
            cancellationTS     = new CancellationTokenSource();
            SetSubscribe();

            RunAnimationCommand        = new AsyncCommand(RunAnimation);
            BackCommand                = new AsyncCommand(GoToBack);
            SwitchTorchCommand         = new Command(SwitchTorch);
            TurnTorchCommand           = new Command <bool>(TurnTorch);
            SetOutlineCodeCommand      = new Command(SetOutlineCode);
            InfoCommand                = new AsyncCommand(ShowInfo);
            ScanCommand                = new AsyncCommand <string>(Scan);
            ProcessScanResultCommand   = new AsyncCommand <Result>(ProcessScanResult);
            ScannerSwitchCommand       = new Command <bool>(ScannerSwitch);
            CancelScanningPhotoCommand = new Command(CancelScanningPhoto);
        }
示例#2
0
        // Update methods
        private async void UpdateScannerInfo()
        {
            while (SelectedScanner == null)
            {
                try
                {
                    SelectedScanner = await ImageScanner.FromIdAsync(_selectedDevice.Id);

                    ScannerSources      = ScannerHelper.GetSupportedScanSources(SelectedScanner);
                    UIIsScannerSelected = true;
                }
                catch (Exception ex)
                {
                    // https://stackoverflow.com/questions/15772373/error-code-when-trying-to-connect-to-a-scanner-using-wpf

                    Debug.WriteLine("MainViewModel - Scanner is busy");
                    Debug.WriteLine(ex);
                }
            }

            // Set the default properties
            var defaultScannerSource = SelectedScanner.DefaultScanSource;

            if (ScannerSources.Contains(defaultScannerSource))
            {
                SelectedScannerSource = defaultScannerSource;
            }
        }
 void Save()
 {
     try
     {
         if (MessageBox.Show("Do you want to submit this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             return;
         }
         UnitOfWork unitOfWork = new UnitOfWork(new DTSDb());
         var        item       = unitOfWork.DocumentsRepo.Find(x => x.Id == documents.Id);
         item.CommunicationType = cboCommType.EditValue?.ToString();
         item.DocumentType      = cboType.EditValue?.ToString();
         item.SourceOfficeId    = cboSourceOffice.EditValue?.ToInt();
         item.Signatory         = cboSignatories.EditValue?.ToInt();
         item.Subject           = txtSubjects.EditValue?.ToString();
         var image = ((byte[])pctScannedDocs.Image);
         if (image.Length == 0)
         {
             ScannerHelper.DeleteFile("Documents", item.Id);
         }
         else
         {
             ScannerHelper.SaveImage("DTS", new StaticSettings().Offices.OffcAcr, item.Id, "Documents", Image.FromStream(new MemoryStream((byte[])pctScannedDocs.Image)));
         }
         unitOfWork.Save();
         this.isClosed = true;
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#4
0
        public override bool OnCalloutAccepted()
        {
            start = true;
            try
            {
                Game.LogTrivial("DocumentLack: Creating Entity");
                suspectCar = new Vehicle(spawn);
                suspectCar.IsPersistent = true;
                suspect = suspectCar.CreateRandomDriver();
                suspect.IsPersistent = true;
                Game.LogTrivial("DocumentLack: Creating Blip");
                blip                = suspect.AttachBlip();
                blip.RouteColor     = Color.Red;
                blip.IsRouteEnabled = true;
                Game.LogTrivial("DocumentLack: Entity Success, dentermine Situations");
                string message;
                switch (situation)
                {
                case EDocumentLackSituation.Insurance:
                    Game.LogTrivial("INSURANCE determined");
                    if (Integreate.StopThePed)
                    {
                        suspectCar.SetInsurance((HCVehicleStatus)MathHelper.GetRandomInteger(0, 1));
                    }
                    Game.LogTrivial("INSURANCE set");
                    message = "The target vehicle has been reported as Uninsured or it's insurance has expired.";
                    break;

                default:
                case EDocumentLackSituation.Registration:
                    Game.LogTrivial("REGISTRATION determined");
                    if (Integreate.StopThePed)
                    {
                        suspectCar.SetRegistration((HCVehicleStatus)MathHelper.GetRandomInteger(0, 1));
                    }
                    Game.LogTrivial("REGISTRATION set");
                    message = "The target vehicle has been reported as No registiration or it's expired.";
                    break;
                }
                Game.LogTrivial("DocumentLack: Situations determined");
                ScannerHelper.DisplayDispatchNote(message);
                Game.LogTrivial("Checking for Stop The Ped");
                if (!Integreate.StopThePed)
                {
                    Game.DisplayHelp("This callout works best if you install ~y~StopThePed~s~ by BejoIlo.");
                }
                Game.LogTrivial("Prepar done");
                Game.DisplaySubtitle("Approach the ~r~suspect~s~.");
                return(base.OnCalloutAccepted());
            }
            catch (Exception ex)
            {
                Game.LogExtremelyVerbose("HotCallout Debug: Failed on DocumentLack");
                Game.LogExtremelyVerbose("HotCallout Debug: " + ex.GetType().Name);
                Game.LogExtremelyVerbose("HotCallout Debug: " + ex.Message);
                Game.LogExtremelyVerbose(ex.StackTrace);
                Game.DisplayHelp($"The \"{CalloutMessage}\" callout encounterd fatal error and must exit.");
                return(false);
            }
        }
示例#5
0
        private async void cmbxScanner_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            selectedDevice  = (DeviceInformation)cmbxScanner.SelectedItem;
            selectedScanner = await ImageScanner.FromIdAsync(selectedDevice.Id);

            scannerSources = ScannerHelper.GetSupportedScanSources(selectedScanner);
            cmbxScannerSource.ItemsSource = scannerSources;
        }
示例#6
0
        private void btnDeletePQRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (this.FilesGridView.GetFocusedRow() is Files item)
            {
                ScannerHelper.DeleteFile(item.Id);

                this.Init();
            }
        }
示例#7
0
 private void btnDownload_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (this.FilesGridView.GetFocusedRow() is Files item)
     {
         ScannerHelper.DownloadFile("Document-Files", item.Id, web =>
         {
             web.DownloadProgressChanged += Web_DownloadProgressChanged;
         });
     }
 }
示例#8
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     ScannerHelper.SaveFiles("DTS", new StaticSettings().Offices.OffcAcr, refId, "Document-Files", User.UserId,
                             web =>
     {
         web.UploadProgressChanged += (wE, sE) =>
         {
             tsDownloading.Text = $"Uploading: {sE.ProgressPercentage} %";
             tsProgress.Value   = (sE.ProgressPercentage);
         };
     }); this.Init();
 }
示例#9
0
        /// <summary>
        /// Initialzes the scanner
        /// </summary>
        /// <param name="startupArg">Starting arguments</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _scannerCommon = new ScannerCommon(this);
            _scannerHelper = new ScannerHelper(this, startupArg);

            if (!_scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return(false);
            }

            return(true);
        }
 public override void Process()
 {
     if (!dead && officer.IsDead)
     {
         dead = true;
         ScannerHelper.DisplayDispatchDialogue("Dispatch", "Officer down. ~r~Respond with code 99~s~.");
         Functions.PlayScannerAudioUsingPosition("ATTENTION_ALL_UNITS WE_HAVE CRIME_OFFICER_DOWN IN_OR_ON_POSITION", officer.Position);
     }
     if (!suspect.Exists() || suspect.IsDeadOrDetained())
     {
         End();
     }
 }
示例#11
0
        public override void Process()
        {
            /* Archival
             * 2020/6/29 20:48 - Fix "InvalidHandleableException" causing whole LSPDFR to crash.
             *                   Add crash prevention system.
             */

            base.Process();
            try
            {
                if (!suspect.Exists() && !suspectCar.Exists())
                {
                    Game.LogTrivial("[Dangerous Driver/HotCallouts] Forced ending Dangerous Driver because suspect or suspect's car does not exist.");
                    ScannerHelper.ReportNormalCode4("Dangerous Driving");
                    End();
                    return;
                }

                if (!pursuited && Functions.IsPedInPursuit(suspect))
                {
                    pursuited = true;
                    Game.LogTrivial("[Dangerous Driver/HotCallouts] Fleeing > suspect");
                    ScannerHelper.DisplayDispatchDialogue("Dispatch", "suspect fleeing.");
                    currentPursuit = Functions.GetActivePursuit();
                }

                if (!(!pursuited || currentPursuit == null || !Functions.IsPursuitStillRunning(currentPursuit)))
                {
                    pursuited = false;
                    ScannerHelper.DisplayDispatchDialogue("Dispatch", "The pursuit has ~g~concluded~s~.");
                }

                if (Game.IsKeyDown(Keys.End))
                {
                    Game.LogTrivial("[Dangerous Driver/HotCallouts] End > Dangerous Driving");
                    ScannerHelper.ReportNormalCode4("Dangerous Driving");
                    End();
                }
            }
            catch (Exception ex)
            {
                End();
                Game.DisplayNotification("The callout <b>Dangerous Driver</b> was encountered error and must exit.");
                Game.DisplayNotification("Check log file for more details.");
                Game.LogTrivial("HotCallouts: exception: " + ex.GetType().Name);
                Game.LogTrivial("HotCallouts: message: " + ex.Message);
                Game.LogTrivial("HotCallouts: trace: \r\n" + ex.StackTrace);
            }
        }
示例#12
0
        /// <summary>
        /// Initialzes the scanner
        /// </summary>
        /// <param name="startupArg">Starting arguments</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _scannerCommon = new ScannerCommon(this);
            _scannerHelper = new ScannerHelper(this, startupArg);

            if (!_scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return(false);
            }

            Context.AppPanelManager.PausePanelChangeRequests();

            return(true);
        }
示例#13
0
        private async void btnScan_Click(object sender, EventArgs e)
        {
            WIAHelper wIAHelper = new WIAHelper();

            wIAHelper.GetDefaultDeviceID();
            SplashScreenManager.ShowForm(this, typeof(frmLoading), true, true, SplashFormStartPosition.Default, new Point(0, 0), ParentFormState.Locked);
            var res = await wIAHelper.ScanPages();

            SplashScreenManager.CloseForm();
            foreach (var i in res)
            {
                ScannerHelper.SaveImage("OFMIS", new StaticSettings().Offices.OffcAcr, this.refId, "Document-Files",
                                        fileName, User.UserId, i);
            }
            this.Init();
        }
示例#14
0
 public override void Process()
 {
     if (!approach && Game.LocalPlayer.Character.Position.DistanceTo2D(suspect.Position) <= 10f)
     {
         approach = true;
         Game.LogTrivialDebug("HotCallout Debug: DistanceTo2D cycle has <= 10f");
         Game.DisplaySubtitle("Pull the ~r~suspect~s~ over.");
         ScannerHelper.DisplayDispatchDialogue("You", "I have the suspect in sight.");
         ScannerHelper.DisplayDispatchDialogue("Dispatch", "10-4. Perform traffic stop.");
     }
     if (approach && Game.IsKeyDown(Keys.End))
     {
         Game.LogTrivialDebug("HotCallout Debug: User End");
         End();
     }
     base.Process();
 }
示例#15
0
        /// <summary>
        /// Initializes the class
        /// </summary>
        /// <param name="startupArg">startup parameter</param>
        /// <returns></returns>
        public bool Initialize(StartupArg startupArg)
        {
            Log.Debug();
            PanelClass        = startupArg.PanelClass;
            startupCommandArg = startupArg.Arg;
            this.startupArg   = startupArg;

            _scannerHelper = new ScannerHelper(this, startupArg);

            if (!scannerCommon.Initialize(startupArg))
            {
                return(false);
            }

            rootWidget = PanelCommon.RootWidget;
            return(true);
        }
示例#16
0
        private void _scanWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            switch (_scanMode)
            {
            case ScanningMode.Manual:
                System.Drawing.Image image = ScannerHelper.Scan();
                _scannedImages.Add(image);
                DisplayedPage = _scannedImages.Count - 1;
                e.Result      = image;
                break;

            case ScanningMode.Automatic:
                BackgroundWorker back = (BackgroundWorker)sender;
                while (!back.CancellationPending)
                {
                    back.ReportProgress(0);
                    this.Dispatcher.Invoke(() =>
                    {
                        ScanningWindows.ScanningAutomatic scan = (ScanningWindows.ScanningAutomatic)ContentArea.Content;
                        loadingOverlay.Visibility       = Visibility.Visible;
                        scan.btnStopScanning.Visibility = Visibility.Collapsed;
                        ReadyButton.Visibility          = Visibility.Collapsed;
                    });
                    System.Drawing.Image image2 = ScannerHelper.Scan();
                    _scannedImages.Add(image2);
                    DisplayedPage = _scannedImages.Count - 1;
                    this.Dispatcher.Invoke(() =>
                    {
                        ScanningWindows.ScanningAutomatic scan = (ScanningWindows.ScanningAutomatic)ContentArea.Content;
                        loadingOverlay.Visibility       = Visibility.Collapsed;
                        scan.btnStopScanning.Visibility = Visibility.Visible;
                    });
                    for (int i = 1; i <= Convert.ToInt32(e.Argument) * 10; i++)
                    {
                        if (!back.CancellationPending)
                        {
                            System.Threading.Thread.Sleep(100);
                            back.ReportProgress(i);
                        }
                    }
                }
                break;
            }
        }
示例#17
0
        /// <summary>
        /// Initialzes the class
        /// </summary>
        /// <param name="startupArg">startup parameters</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            Log.Debug();
            PanelClass        = startupArg.PanelClass;
            startupCommandArg = startupArg.Arg;
            this.startupArg   = startupArg;

            _scannerHelper = new ScannerHelper(this, startupArg);
            scannerCommon  = new ScannerCommon(this);

            if (!scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return(false);
            }

            rootWidget = scannerCommon.GetRootWidget();
            return(true);
        }
 public override void End()
 {
     base.End();
     ScannerHelper.ReportNormalCode4("Firearm attack on officer");
     if (suspect.Exists())
     {
         if (suspectBlip.Exists())
         {
             suspectBlip.Delete();
         }
         if (!Functions.IsPedArrested(suspect))
         {
             suspect.Dismiss();
         }
     }
     if (officer.Exists())
     {
         officer.Dismiss();
     }
 }
 public override bool OnCalloutAccepted()
 {
     suspect = new Ped(spawnPoint);
     suspect.BlockPermanentEvents = true;
     suspect.IsPersistent         = true;
     officer = new Ped("s_m_y_cop_01", suspect.Position.Around(5f), suspect.Heading);
     officer.BlockPermanentEvents = true;
     officer.IsPersistent         = true;
     Functions.SetPedAsCop(officer);
     officer.Inventory.GiveNewWeapon(WeaponHash.Pistol, short.MaxValue, true);
     officer.Tasks.FightAgainst(suspect);
     suspect.Inventory.GiveNewWeapon(WeaponHash.Pistol, short.MaxValue, true);
     suspect.Tasks.FightAgainst(officer);
     suspectBlip                = suspect.AttachBlip();
     suspectBlip.Sprite         = BlipSprite.Enemy;
     suspectBlip.IsFriendly     = false;
     suspectBlip.IsRouteEnabled = true;
     suspectBlip.Color          = Color.Red;
     ScannerHelper.DisplayDispatchNote("There's a suspect shooting at an officer. Quick, before anything goes wrong.");
     return(base.OnCalloutAccepted());
 }
示例#20
0
 void Details(Documents item)
 {
     try
     {
         UnitOfWork unitOfWork     = new UnitOfWork(new DTSDb());
         var        staticSettings = new StaticSettings();
         item = unitOfWork.DocumentsRepo.Find(x => x.Id == item.Id);
         this.dtDate.EditValue      = item.Date;
         this.txtCommType.EditValue = item.CommunicationType;
         this.txtDocType.EditValue  = item.DocumentType;
         this.txtSignatory.Text     = item.Employees?.EmployeeName;
         this.txtSubject.EditValue  = item.Subject;
         this.lblSignatory.Text     = item.Employees?.EmployeeName;
         this.lblType.Text          = item.DocumentType;
         this.pctScannedImage.Image = ScannerHelper.LoadImage(item.Id, "Documents");
         tabActionTaken.Controls.Clear();
         tabActionTaken.Controls.Add(new UCDocumentActions(item.Id, item.ControlNo, "", "Documents")
         {
             Dock = DockStyle.Fill
         });
         tabLetter.Controls.Clear();
         tabLetter.Controls.Add(new UcLetters(item.Id, item.ControlNo, "Documents",
                                              $"[{staticSettings.Offices.OffcAcr}]Document Tracking System ({User.GetUserName()}) {item.ControlNo}")
         {
             Dock = DockStyle.Fill
         });
         tabFiles.Controls.Clear();
         tabFiles.Controls.Add(new UCFiles(item.Id)
         {
             Dock = DockStyle.Fill
         });
         var row = DocumentGridView.LocateByValue("Id", item.Id);
         this.DocumentGridView.FocusedRowHandle = row;
         this.DocumentGridView.MakeRowVisible(row);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#21
0
        public override void Process()
        {
            base.Process();

            if (!approach && Game.LocalPlayer.Character.Position.DistanceTo(suspect) < 30f)
            {
                approach = true;
                Game.DisplayHelp("Perform a traffic stop to target " + suspectVehicle.Model.Name + ".");
            }

            /*
             * if(!pursuited && Game.LocalPlayer.Character.Position.DistanceTo(suspect) < 30f)
             * {
             *  pursuit = Functions.CreatePursuit();
             *  Functions.AddPedToPursuit(pursuit, suspect);
             *  Functions.SetPursuitIsActiveForPlayer(pursuit, true);
             *  pursuited = true;
             *  ScannerHelper.DisplayDispatchDialogue("You", "To dispatch, suspect fleeing.");
             *  ScannerHelper.DisplayDispatchDialogue("Dispatch", "Affirmtive, suspect plate " + suspectVehicle.LicensePlate.ToUpper() + ", vehicle " + suspectVehicle.Model.Name);
             *  Functions.RequestBackup(suspect.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
             * }
             *
             * if(pursuited && !Functions.IsPursuitStillRunning(pursuit))
             * {
             *  PedHelper.DeclareSubjectStatus(suspect);
             *  End();
             * }
             */
            if (!inPursuit && Functions.IsPedInPursuit(suspect))
            {
                inPursuit = true;
                ScannerHelper.DisplayDispatchDialogue("You", "To dispatch, suspect fleeing.");
            }
            if (!suspect.Exists() || suspect.IsDead || Functions.IsPedArrested(suspect))
            {
                PedHelper.DeclareSubjectStatus(suspect);
                End();
            }
        }
示例#22
0
        public override void Process()
        {
            base.Process();
            if (!pursuited && Game.LocalPlayer.Character.Position.DistanceTo2D(suspect) <= 10f)
            {
                pursuited = true;
                blip.Delete();
                pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(pursuit, suspect);
                Functions.AddPedToPursuit(pursuit, prisoner);
                Functions.SetPursuitIsActiveForPlayer(pursuit, true);
                Functions.RequestBackup(suspect.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);
                Functions.RequestBackup(suspect.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                ScannerHelper.DisplayDispatchDialogue("Dispatch", "Suspect fleeing. Sending backup and air unit.");
            }

            if (pursuited && pursuit != null && !Functions.IsPursuitStillRunning(pursuit))
            {
                ScannerHelper.DisplayDispatchDialogue("Dispatch", "We are code 4 on Escaping Prisoner.");
                End();
            }
        }
示例#23
0
        public override void End()
        {
            if (!approach && start)
            {
                Game.LogTrivial("HotCallout Warning: The End does not seems like user has opreated because user dident even approach the suspect.");
                Game.LogTrivial("HotCallout Warning: This normally triggered by LSPDFR becuase error on methods or ended by external plugin.");
                CommonHelper.DeclareUnexceptedEnd(CalloutMessage);
            }
            else if (start)
            {
                ScannerHelper.DisplayDispatchDialogue("Dispatch", $"Officer reporting, we're code 4 on <b>{CalloutMessage}</b>.");
            }

            if (suspect.Exists())
            {
                suspect.Dismiss();
            }
            if (suspectCar.Exists())
            {
                suspectCar.Dismiss();
            }
            base.End();
        }
示例#24
0
        public override bool OnCalloutAccepted()
        {
            suspectCar = new Vehicle(spawn);
            suspectCar.IsPersistent = true;
            ScannerHelper.RandomiseLicencePlate(suspectCar);

            suspect = suspectCar.CreateRandomDriver();
            suspect.IsPersistent         = true;
            suspect.BlockPermanentEvents = true;

            prisoner = new Ped("S_M_Y_PRISONER_01", suspect.Position.Around(5f), suspect.Heading);
            prisoner.IsPersistent = true;
            prisoner.WarpIntoVehicle(suspectCar, 0);
            prisoner.AttachBlip();

            blip                = suspect.AttachBlip();
            blip.IsFriendly     = false;
            blip.IsRouteEnabled = true;
            blip.Name           = "Escaping Prisoner";

            suspect.Tasks.CruiseWithVehicle(30f, VehicleDrivingFlags.Emergency);

            return(base.OnCalloutAccepted());
        }
示例#25
0
 void Details(Documents item)
 {
     try
     {
         UnitOfWork     unitOfWork     = new UnitOfWork(new DTSDb());
         StaticSettings staticSettings = new StaticSettings();
         this.documentTypesBindingSource.DataSource = unitOfWork.DocumentTypesRepo.Get();
         this.officesBindingSource.DataSource       = new UnitOfWork().OfficesRepo.Get();
         this.employeesBindingSource.DataSource     = new UnitOfWork().EmployeesRepo.Get();
         item = unitOfWork.DocumentsRepo.Find(x => x.Id == item.Id);
         this.dtDate.EditValue          = item.Date;
         this.cboCommType.EditValue     = item.CommunicationType;
         this.cboType.EditValue         = item.DocumentType;
         this.cboSourceOffice.EditValue = item.SourceOfficeId;
         this.txtSubjects.EditValue     = item.Subject;
         this.lblControlNo.Text         = item.ControlNo;
         this.cboSignatories.EditValue  = item.Signatory;
         this.pctScannedDocs.Image      = ScannerHelper.ToImageByte(item.Id, "Documents");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        int Scan()
        {
            try {
                for (; ;)
                {
                    int next;
                    state = currentStart;
                    while ((next = NextState()) == goStart)
                    {
                        GetCode();
                    }
                    MarkToken();
                    state = next;
                    GetCode();

                    while ((next = NextState()) > eofNum)
                    {
                        state = next;
                        GetCode();
                    }
                    if (state <= maxAccept)
                    {
                        MarkEnd();

                        #region ActionSwitch

                        #pragma warning disable 162

                        switch (state)
                        {
                        case eofNum:
                            if (yywrap())
                            {
                                return((int)Tokens.EOF);
                            }
                            break;

                        case 1:
                            return((int)Tokens.NUMBER);

                        case 2:
                            int res = ScannerHelper.GetIDToken(yytext);
                            return(res);

                        case 3:
                            return((int)Tokens.SEMICOLON);

                        case 4:
                            return((int)Tokens.BRACKETL);

                        case 5:
                            return((int)Tokens.BRACKETR);

                        case 6:
                            return((int)Tokens.BRACEL);

                        case 7:
                            return((int)Tokens.BRACER);

                        case 8:
                            LexError();
                            return((int)Tokens.EOF);

                        default:
                            break;
                        }

                        #pragma warning restore 162

                        #endregion
                    }
                }
            }
            finally
            {
                yylloc = new LexLocation(tokLin, tokCol, tokELin, tokECol);
            }
        }
示例#27
0
        public override bool OnCalloutAccepted()
        {
            /* Archival
             * 2020/6/30 09:23 - Add logging to flags
             * 2020/6/30 09:28 - Add line number logging to locate error
             */
            Game.LogTrivial("[Dangerous Driver/HotCallouts] Accepted Instance > Dangerous Driver");
            Game.LogTrivialDebug("LINE NUMBER: 52 / Used with source repository if pushed.");
            suspectCar = new Vehicle(spawn);
            suspectCar.IsPersistent = true;

            Game.LogTrivial("[Dangerous Driver/HotCallouts] Spawned suspectCar (" + suspectCar.Model.Name + ") and set to Persistent");
            Game.LogTrivialDebug("LINE NUMBER: 56 / Used with source repository if pushed.");

            suspect = suspectCar.CreateRandomDriver();
            suspect.IsPersistent         = true;
            suspect.BlockPermanentEvents = true;
            Game.LogTrivial($"[Dangerous Driver/HotCallouts] Spawned suspect ({suspect.Model.Name}) and set to Persistent & Block Events");
            Game.LogTrivialDebug("LINE NUMBER: 63 / Used with source repository if pushed.");

            blip                = suspect.AttachBlip();
            blip.IsFriendly     = false;
            blip.IsRouteEnabled = true;
            blip.Name           = "Reckless Driver";
            Game.LogTrivial("[Dangerous Driver/HotCallouts] Spawned blip and renamed to Reckless Driver");
            Game.LogTrivialDebug("LINE NUMBER: 70 / Used with source repository if pushed.");

            situations = MathHelper.GetRandomInteger(0, 3);
            string message;
            string audioMessage;

            switch (situations)
            {
            default:
            case 0:
                Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 0: Emergency with 15f speed");
                suspect.Tasks.CruiseWithVehicle(15f, VehicleDrivingFlags.Emergency);
                message      = "driving all over the road, but with normal speed";
                audioMessage = "CRIME_RECKLESS_DRIVER";
                break;

            case 1:
                Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 1: Emergency with 30f speed");
                suspect.Tasks.CruiseWithVehicle(30f, VehicleDrivingFlags.Emergency);
                message      = "driving all over the road and overspeed";
                audioMessage = "CRIME_SPEEDING_FELONY";
                break;

            case 2:
                Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 2: Normal with 45f speed");
                suspect.Tasks.CruiseWithVehicle(45f, VehicleDrivingFlags.Normal);
                message      = "overspeeding";
                audioMessage = "CRIME_SPEEDING_FELONY";
                break;

            case 3:
                Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 3: Alcohol intoxication");
                if (Integreate.TrafficPolicer)
                {
                    Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 3 Created: Traffic Policer Exists");
                    suspect.Tasks.CruiseWithVehicle(50f, VehicleDrivingFlags.Emergency);
                    Traffic_Policer.API.Functions.SetPedAlcoholLevel(suspect, Traffic_Policer.Impairment_Tests.AlcoholLevels.OverLimit);
                    audioMessage = "CRIME_RECKLESS_DRIVER";
                    message      = "driving under the influence of alcohol";
                    break;
                }
                else
                {
                    Game.LogTrivial("[Dangerous Driver/HotCallouts] Flag 3 Aborted: Traffic Policer does not exists");
                    Game.LogTrivial("[Dangerous Driver/HotCallouts] Creating Flag 2");
                    goto case 2;
                }
            }
            ScannerHelper.ReportEvent(audioMessage);
            ScannerHelper.DisplayDispatchNote("We received a 911 report of a vehicle " + message + ". Respond with Code 3.");
            Game.LogTrivial("[Dangerous Driver/HotCallouts] Done > Dangerous Driver");
            return(base.OnCalloutAccepted());
        }
示例#28
0
        /// <summary>
        /// Updates all the Lists containing the properties for the selected Scanner Source
        /// </summary>
        private void GetSelectedScannerSourceProperties()
        {
            // Get all supported options for the selected scanning source
            ScannerFormats.Clear();
            ScannerFormats = ScannerHelper.GetSupportedImageFormats(SelectedScanner, SelectedScannerSource);
            ScannerColourModes.Clear();
            ScannerColourModes = ScannerHelper.GetSupportedColourModes(SelectedScanner, SelectedScannerSource);
            //ScannerAutoCropppingModes.Clear();
            //ScannerAutoCropppingModes = ScannerHelper.GetSupportedAutoCroppingModes(SelectedScanner, SelectedScannerSource);
            // #TODO Build this for DPI

            // Select Defaults
            switch (SelectedScannerSource)
            {
            case ImageScannerScanSource.Feeder:
            {
                // Format
                var defaultScannerFormat = SelectedScanner.FeederConfiguration.DefaultFormat;
                if (ScannerFormats.Contains(defaultScannerFormat))
                {
                    SelectedScannerFormat = defaultScannerFormat;
                }
                // Colour mode
                var defaultColourMode = SelectedScanner.FeederConfiguration.DefaultColorMode;
                if (ScannerColourModes.Contains(defaultColourMode))
                {
                    SelectedScannerColourMode = defaultColourMode;
                }
                // Auto Cropping Mode
                //SelectedScanner.FeederConfiguration.AutoCroppingMode = ImageScannerAutoCroppingMode.Disabled;

                break;
            }

            case ImageScannerScanSource.Flatbed:
            {
                // Format
                var defaultScannerFormat = SelectedScanner.FlatbedConfiguration.DefaultFormat;
                if (ScannerFormats.Contains(defaultScannerFormat))
                {
                    SelectedScannerFormat = defaultScannerFormat;
                }
                // Colour mode
                var defaultColourMode = SelectedScanner.FlatbedConfiguration.DefaultColorMode;
                if (ScannerColourModes.Contains(defaultColourMode))
                {
                    SelectedScannerColourMode = defaultColourMode;
                }
                // Auto Cropping Mode
                //SelectedScanner.FlatbedConfiguration.AutoCroppingMode = ImageScannerAutoCroppingMode.Disabled;

                break;
            }

            case ImageScannerScanSource.AutoConfigured:
            {
                // Only Format is available as a customisable option here
                var defaultScannerFormat = SelectedScanner.AutoConfiguration.DefaultFormat;
                if (ScannerFormats.Contains(defaultScannerFormat))
                {
                    SelectedScannerFormat = defaultScannerFormat;
                }
                break;
            }

            case ImageScannerScanSource.Default:
            {
                // No available settings for this
                break;
            }
            }


            // #TODO Update Visibility statusses
        }
示例#29
0
        // 1 - Get scanners
        // 2 - Get available sources
        // 3 - Once selected, get all available options


        private void GetAllAvailableSettingsForCurrentScannerSource()
        {
            sourceFormats = ScannerHelper.GetSupportedImageFormats(selectedScanner, selectedScannerSource);
            cmbxImageFormat.ItemsSource = sourceFormats;
        }