├── .gitignore
├── LICENSE
├── READ IF CONFUSED.txt
├── README.md
├── docs
├── building.md
├── installation.md
└── server.md
├── ref
├── cfx_client
│ ├── CitizenFX.Core.dll
│ └── CitizenFX.Core.xml
└── cfx_server
│ └── CitizenFX.Core.dll
└── src
├── Dispatch.Common
├── BareGuid.cs
├── DataHolders
│ ├── Database.cs
│ ├── IDataHolder.cs
│ ├── IOwnable.cs
│ └── Storage
│ │ ├── Assignment.cs
│ │ ├── Bolo.cs
│ │ ├── Civilian.cs
│ │ ├── CivilianVeh.cs
│ │ ├── EmergencyCall.cs
│ │ ├── Officer.cs
│ │ ├── PlayerBase.cs
│ │ ├── StorageManager.cs
│ │ └── Ticket.cs
├── Dispatch.Common.csproj
├── Permissions.cs
└── Properties
│ └── AssemblyInfo.cs
├── DispatchSystem.sln
├── Dump.Client
├── App.config
├── Dump.Client.csproj
├── Dump.cs
├── DumpParser.cs
├── DumpResult.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── Windows
│ ├── BolosDialogue.Designer.cs
│ ├── BolosDialogue.cs
│ ├── BolosDialogue.resx
│ ├── CallDialogue.Designer.cs
│ ├── CallDialogue.cs
│ ├── CallDialogue.resx
│ ├── CivilianDialogue.Designer.cs
│ ├── CivilianDialogue.cs
│ ├── CivilianDialogue.resx
│ ├── DumpDialogue.Designer.cs
│ ├── DumpDialogue.cs
│ ├── DumpDialogue.resx
│ ├── OfficerDialogue.Designer.cs
│ ├── OfficerDialogue.cs
│ ├── OfficerDialogue.resx
│ ├── PermissionsDialogue.Designer.cs
│ ├── PermissionsDialogue.cs
│ ├── PermissionsDialogue.resx
│ ├── VehicleDialogue.Designer.cs
│ ├── VehicleDialogue.cs
│ └── VehicleDialogue.resx
├── Dump.Server
├── App.config
├── DownServer.cs
├── Dump.Server.csproj
├── EntryPoint.cs
├── Properties
│ └── AssemblyInfo.cs
├── Saver.cs
└── packages.config
├── FiveM.Server
├── CommandAttribute.cs
├── Commands.cs
├── Common.cs
├── DispatchSystem
│ ├── Events.cs
│ ├── Init.cs
│ ├── Items.cs
│ └── Main.cs
├── External
│ ├── Config.cs
│ ├── DispatchServer.cs
│ └── Log.cs
├── FiveM.Server.csproj
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── Terminal
├── App.config
├── Config.cs
├── ISyncable.cs
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Terminal.csproj
├── Windows
│ ├── AddExistingAssignment.Designer.cs
│ ├── AddExistingAssignment.cs
│ ├── AddExistingAssignment.resx
│ ├── AddRemoveView.Designer.cs
│ ├── AddRemoveView.cs
│ ├── AddRemoveView.resx
│ ├── CivVehView.Designer.cs
│ ├── CivVehView.cs
│ ├── CivVehView.resx
│ ├── CivView.Designer.cs
│ ├── CivView.cs
│ ├── CivView.resx
│ ├── DispatchMain.Designer.cs
│ ├── DispatchMain.cs
│ ├── DispatchMain.resx
│ ├── Emergency
│ │ ├── Accept911.Designer.cs
│ │ ├── Accept911.cs
│ │ ├── Accept911.resx
│ │ ├── Message911.Designer.cs
│ │ ├── Message911.cs
│ │ └── Message911.resx
│ ├── OfficerView.Designer.cs
│ ├── OfficerView.cs
│ └── OfficerView.resx
├── icon.ico
├── packages.config
└── settings.ini
├── bin
└── post-build.cmd
├── packages
├── CloneCommando.CloNET.0.6.2
│ ├── CloneCommando.CloNET.0.6.2.nupkg
│ └── lib
│ │ └── net461
│ │ └── CloNET.dll
├── MaterialSkin.Updated.0.2.2
│ ├── MaterialSkin.Updated.0.2.2.nupkg
│ └── lib
│ │ └── MaterialSkin.dll
└── Newtonsoft.Json.10.0.3
│ ├── LICENSE.md
│ ├── Newtonsoft.Json.10.0.3.nupkg
│ ├── lib
│ ├── net20
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── net35
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── net40
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── net45
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── netstandard1.0
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── netstandard1.3
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ ├── portable-net40+sl5+win8+wp8+wpa81
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ └── portable-net45+win8+wp8+wpa81
│ │ ├── Newtonsoft.Json.dll
│ │ └── Newtonsoft.Json.xml
│ └── tools
│ └── install.ps1
└── serverfiles
├── __resource.lua
├── callbacks.lua
├── common.lua
├── menu.lua
├── nui
├── index.css
├── index.html
└── menu.js
├── permissions.perms
├── settings.ini
└── transactions.lua
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Lua sources
2 | luac.out
3 |
4 | # luarocks build files
5 | *.src.rock
6 | *.zip
7 | *.tar.gz
8 |
9 | # Object files
10 | *.o
11 | *.os
12 | *.ko
13 | *.obj
14 | *.elf
15 |
16 | # Precompiled Headers
17 | *.gch
18 | *.pch
19 |
20 | # Libraries
21 | *.a
22 | *.la
23 | *.lo
24 | *.def
25 | *.exp
26 |
27 | # Shared objects (inc. Windows DLLs)
28 | *.so
29 | *.so.*
30 | *.dylib
31 |
32 | # Executables
33 | *.out
34 | *.app
35 | *.i*86
36 | *.x86_64
37 | *.hex
38 |
39 | # Things
40 | *.yml
41 | *.userprefs
42 |
43 | # Build folders
44 | obj/
45 | src/bin/*
46 | .vs/*
47 | src/.vs/*
48 |
--------------------------------------------------------------------------------
/READ IF CONFUSED.txt:
--------------------------------------------------------------------------------
1 | If you're a developer, ignore this.
2 |
3 | You probably downloaded this as a zip and don't understand how to install it.
4 | This is the source code, not the exes, dlls, and all of that.
5 | Please visit "https://github.com/blockba5her/dispatchsystem/releases" to download the compiled and production-ready files.
6 | If you have any questions, gently tap that Discord button in the readme and go to #help-me.
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DispatchSystem
2 |
3 | Discord:
4 |
5 | [](https://discord.gg/ZcTayce)
6 |
7 | ## Summary
8 |
9 | Dispatch Systems is a CAD/MDT system for ingame FiveM use, this is not a permenant solution, but it works for free. This is an open source free project courtesy of BlockBa5her (the coder). It is free for anyone to use, as long as they do not re-distribute the software under their own name. It does not store data in CouchDB and MySQL so EssentialMode is not needed. It stores all of the player's information in the RAM of the computer, but saves all of the data once the server is restarted. It now also comes with storage settings for saving Civilian Profiles and Vehicles in a file.
10 |
11 | ## Uses
12 |
13 | * For a community just starting up and not having the money to pay for a CAD/MDT system that costs money
14 | * Easy use with long lasting terms
15 | * Terminal outside of game for Dispatcher use
16 | * Built in 911 calling system
17 | * A great author that will always keep it updated
18 | * C# with open source code
19 | * Availability to everyone, not just people who pay
20 | * Open for suggestions and always looking for more to add-on too
21 | * Will always stay non-SQL/CouchDB based for easy use (with included storage settings)
22 |
23 | ## Pictures
24 |
25 | > Click to view bigger image
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | ## Commands
37 |
38 | * `/dsciv` - Opens the civilian NUI menu In-game
39 | * `/dsleo` - Opens the officer NUI menu In-game (Can be used to for other emergency personel)
40 | * `/dsdmp` - Dumps all of the info of DispatchSystem into a file labeled `dispatchsystem.dmp` in the root directory, please only use if DispatchSystem is not working properly.
41 |
42 | ## In the works
43 |
44 | 1. Arrest ability - `/arrest {first} {last}` arrests a ped and show it in the system
45 | 2. Warrant Types - `/warrant {type}` have different types of bench warrants and also a toggle for outstanding
46 | 3. Bug fixes - There seems to be a lot of bugs that popped up in v2.0 of DispatchSystem, I'm hard at working trying to fix all of them
47 |
--------------------------------------------------------------------------------
/docs/building.md:
--------------------------------------------------------------------------------
1 | # How to build solution
2 |
3 | Building the solution is actually very easy. Everything to build is included with the mod. The basics of it is just to open the `src` folder from the clone, open the project file, and build it.
4 |
5 | ## Common errors
6 |
7 | These errors have not occured with anyone, but I just want to make sure that they are out of the way
8 |
9 | * Both project file say that there are missing dependencies/references
10 | 1. Just add both of the references back to the right project, the references can be found in the `ref` folder in the clone
11 | 2. Sometimes the NuGet packages are weird and don't follow the clone, so just download the package CloNET & MaterialSkin again.
12 | > TODO: More to add once more errors popup
13 |
14 | ## Build location
15 |
16 | The build location of the files will be in `src/bin/Debug/*` or if built in Release then will be in `src/bin/Release/*`
17 | The directory of the build is changed so that both of the build files will end up in the same place, just easier for workflow.
18 |
--------------------------------------------------------------------------------
/docs/installation.md:
--------------------------------------------------------------------------------
1 | # Installation guide
2 |
3 | ## Deciding options
4 | Decide what options you would want to have on your server. The most important things to decide on are the database feature, and the server feature. They are both togglable in the server's `settings.ini` file. The server feature is what allows the client to connect to the server, and the database is where it stores all of your data on restart.
5 |
6 | ## Basic installation
7 | To install all of the stuff on the server, you can make a drag and drop the resource folder `dispatchsystem` inside of the download folder inside of your `resources/` folder. From there, you can go inside of the resource folder and change all of the `ini` settings. Now all that's left to do is put the resource inside your `server.cfg`
8 |
9 | ## Client installation
10 | To install the client is easy. All you have to do is make sure that the `dispatchsystem` resource has the `server` setting enabled. After that, just make sure that you have port `33333` open to use (If on web hoster or VPS it's already open). Now, you just have to configure your client's settings so that the IP matches with the IP that your FiveM server is run off of.
11 |
12 | ## Common issues
13 | A lot of issues have been appearing with DispatchSystem lately. That is why I integrated the `/dsdmp` command to allow you to dump your server information to a file, and delete the rest of the info on the server. The `dispatchsystem.dmp` file that is exported in the dump process is located at the root of your FiveM directory.
--------------------------------------------------------------------------------
/docs/server.md:
--------------------------------------------------------------------------------
1 | # Setting up the Server
2 |
3 | ## Toggling the server
4 | Basically, just open up the `settings.ini` that comes with the server, and change the option under the `[server]` tag that says `enable` to `0`
5 |
6 | ## Setting up the server
7 | Don't change any settings in the INI, unless you are having problems. All of the settings in there should work with your average joe
8 |
9 | ## Setting up the client
10 | In the `settings.ini`, change the the IP of the server to the IP of your server, and keep the PORT the same unless you changed it on the server's side
11 |
12 | ## Toggling the database
13 | In the `settings.ini` of the server, change the `database` option to 0.
14 |
15 | ## Ports to have open
16 |
17 | If you are running this off a basic home internet, then you will need to open the PORT `33333`, and that is 5 threes just to confirm. If you are running this off a VPS or hosting website then you shouldn't have to open any ports because they are already open for you.
18 |
--------------------------------------------------------------------------------
/ref/cfx_client/CitizenFX.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DispatchSystems/DispatchSystem/0560467c478ebe46c7a0b813598dc555267e9cc8/ref/cfx_client/CitizenFX.Core.dll
--------------------------------------------------------------------------------
/ref/cfx_server/CitizenFX.Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DispatchSystems/DispatchSystem/0560467c478ebe46c7a0b813598dc555267e9cc8/ref/cfx_server/CitizenFX.Core.dll
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/IDataHolder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders
8 | {
9 | public interface IDataHolder
10 | {
11 | DateTime Creation { get; }
12 | BareGuid Id { get; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/IOwnable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders
8 | {
9 | public interface IOwnable
10 | {
11 | string SourceIP { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/Assignment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders.Storage
8 | {
9 | [Serializable]
10 | public class Assignment : IDataHolder
11 | {
12 | public BareGuid Id { get; }
13 | public string Summary { get; }
14 | public DateTime Creation { get; }
15 |
16 | public Assignment(string summary)
17 | {
18 | Summary = summary;
19 | Creation = DateTime.Now;
20 | Id = BareGuid.NewBareGuid();
21 | }
22 | private Assignment() : this(string.Empty) { }
23 |
24 | // For communication
25 | public static readonly Assignment Empty = new Assignment();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/Bolo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders.Storage
8 | {
9 | [Serializable]
10 | public class Bolo : IDataHolder, IOwnable
11 | {
12 | string _player;
13 | string _reason;
14 | DateTime _creation;
15 |
16 | public string SourceIP { get; }
17 | public string Player => _player;
18 | public string Reason => _reason;
19 | public DateTime Creation => _creation;
20 | public BareGuid Id { get; }
21 |
22 | public Bolo(string playerName, string createrIp, string reason)
23 | {
24 | _player = playerName;
25 | SourceIP = string.IsNullOrWhiteSpace(createrIp) ? string.Empty : createrIp;
26 | _reason = reason;
27 | _creation = DateTime.Now;
28 | Id = BareGuid.NewBareGuid();
29 | }
30 |
31 | public object[] ToObjectArray()
32 | {
33 | return new[] { (object)_player, (object)_reason };
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/Civilian.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders.Storage
8 | {
9 | [Serializable]
10 | public class Civilian : PlayerBase, IDataHolder, IOwnable
11 | {
12 | protected string _first;
13 | public string First
14 | {
15 | get
16 | {
17 | if (string.IsNullOrWhiteSpace(_first))
18 | return string.Empty;
19 | char[] str = _first.ToCharArray();
20 | for (int i = 0; i < str.Length; i++)
21 | {
22 | if (i == 0)
23 | str[i] = char.ToUpper(str[i]);
24 | else
25 | str[i] = char.ToLower(str[i]);
26 | }
27 | return new string(str);
28 | }
29 | set => _first = value;
30 | }
31 | protected string _last;
32 | public string Last
33 | {
34 | get
35 | {
36 | if (string.IsNullOrWhiteSpace(_last))
37 | return string.Empty;
38 | char[] str = _last.ToCharArray();
39 | for (int i = 0; i < str.Length; i++)
40 | {
41 | if (i == 0)
42 | str[i] = char.ToUpper(str[i]);
43 | else
44 | str[i] = char.ToLower(str[i]);
45 | }
46 | return new string(str);
47 | }
48 | set => _last = value;
49 | }
50 | public bool WarrantStatus { get; set; }
51 | public int CitationCount { get; set; }
52 | public List Notes { get; set; }
53 | public List Tickets { get; set; }
54 | public override DateTime Creation { get; }
55 |
56 | public Civilian(string ip) : base(ip)
57 | {
58 | Notes = new List();
59 | Tickets = new List();
60 | WarrantStatus = false;
61 | CitationCount = 0;
62 | Creation = DateTime.Now;
63 | }
64 |
65 | public static Civilian CreateRandomCivilian()
66 | {
67 | #region NamesDic
68 | List rndNames = new List
69 | {
70 | "Mason Bishan",
71 | "Zaahir Romolo",
72 | "Sang-Hun Adam",
73 | "Morgan Narayan",
74 | "Arsen Wendel",
75 | "Lazzaro Kylian",
76 | "Raleigh Jacob",
77 | "Paolino Marko",
78 | "Hafiz Shahnaz",
79 | "Saddam Feidhlimidh",
80 | "Eugène Doriano",
81 | "Gorden Roger",
82 | "Luke Patrizio",
83 | "Hisham Bertram",
84 | "Cornelius Kuldeep",
85 | "Vasu Wolter",
86 | "Rhett Uaithne",
87 | "Gallo Énna",
88 | "Jaffar Niklaus",
89 | "Silver Hendrik",
90 | "Norman Frazier",
91 | "Jerrold Hall",
92 | "Manus Cormac",
93 | "Arsenio Ikaia",
94 | "Yasser Morten",
95 | "Eugène Carmine",
96 | "Ciar Claude",
97 | "Michelangelo Olivier",
98 | "Fiachna Vasileios",
99 | "Wulf Myles",
100 | "Pyry Hyun-Woo",
101 | "Salman Gallo",
102 | "Anish Gabriel",
103 | "Karl Andreas"
104 | };
105 | #endregion
106 |
107 | Random rnd = new Random();
108 |
109 | string[] name = rndNames[rnd.Next(rndNames.Count)].Split(' ');
110 |
111 | return new Civilian(string.Empty)
112 | {
113 | First = name[0],
114 | Last = name[1],
115 | CitationCount = rnd.Next(0, 11)
116 | };
117 | }
118 |
119 | // Below is for communcation reasons between server and client
120 | // [NonSerialized]
121 | public static readonly Civilian Empty = new Civilian(null);
122 | // [NonSerialized]
123 | public static readonly Civilian Null = null;
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/CivilianVeh.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders.Storage
8 | {
9 | [Serializable]
10 | public class CivilianVeh : PlayerBase, IDataHolder, IOwnable
11 | {
12 | public Civilian Owner { get; set; }
13 | protected string _plate;
14 | public string Plate { get => string.IsNullOrEmpty(_plate) ? string.Empty : _plate.ToUpper(); set => _plate = value; }
15 | public bool StolenStatus { get; set; }
16 | public bool Registered { get; set; }
17 | public bool Insured { get; set; }
18 |
19 | public CivilianVeh(string ip) : base(ip)
20 | {
21 | StolenStatus = false;
22 | Registered = true;
23 | Insured = true;
24 | }
25 |
26 | // Below is for communcation reasons between server and client
27 | [NonSerialized]
28 | public static readonly CivilianVeh Empty = new CivilianVeh(null);
29 | [NonSerialized]
30 | public static readonly CivilianVeh Null = null;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/EmergencyCall.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Dispatch.Common.DataHolders.Storage
5 | {
6 | [Serializable]
7 | public class EmergencyCall : IOwnable, IDataHolder
8 | {
9 | public EmergencyCall(string ip, string playerName)
10 | {
11 | Id = BareGuid.NewBareGuid();
12 | SourceIP = ip;
13 | Creation = DateTime.Now;
14 | PlayerName = playerName;
15 | }
16 |
17 | public bool Accepted { get; set; }
18 | public string PlayerName { get; }
19 |
20 | public string SourceIP { get; }
21 | public DateTime Creation { get; }
22 | public BareGuid Id { get; }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/Officer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders.Storage
8 | {
9 | [Serializable]
10 | public enum OfficerStatus
11 | {
12 | OnDuty,
13 | OffDuty,
14 | Busy
15 | }
16 | [Serializable]
17 | public class Officer : PlayerBase, IDataHolder, IOwnable
18 | {
19 | public string Callsign { get; set; }
20 | public OfficerStatus Status { get; set; }
21 |
22 | public Officer(string ip, string callsign) : base(ip)
23 | {
24 | Callsign = callsign;
25 |
26 | Status = OfficerStatus.OffDuty;
27 | }
28 |
29 | // For communicating
30 | public static readonly Officer Empty = new Officer(string.Empty, string.Empty);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/PlayerBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Dispatch.Common.DataHolders.Storage
4 | {
5 | [Serializable]
6 | public abstract class PlayerBase : IDataHolder, IOwnable, IEquatable
7 | {
8 | public virtual string SourceIP { get; protected set; }
9 | public virtual DateTime Creation { get; }
10 | public virtual BareGuid Id { get; }
11 |
12 | public PlayerBase(string ip)
13 | {
14 | Creation = DateTime.Now;
15 | Id = BareGuid.NewBareGuid();
16 |
17 | SourceIP = string.IsNullOrWhiteSpace(ip) ? string.Empty : ip;
18 | }
19 | public override int GetHashCode() => Id.GetHashCode();
20 | public override bool Equals(object obj)
21 | {
22 | if (!(obj is PlayerBase))
23 | throw new ArgumentException("Your argument must be of PlayerBase Type", nameof(obj));
24 |
25 | PlayerBase _base = (PlayerBase)obj;
26 | return _base.Id == Id;
27 | }
28 | public bool Equals(PlayerBase item) => Equals(item);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/StorageManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Dispatch.Common.DataHolders.Storage
9 | {
10 | [Serializable]
11 | public class StorageManager : ICollection, IList, IEquatable>, IEquatable> where T : IDataHolder
12 | {
13 | #region Fields and Properties
14 | protected List m_list = new List();
15 | public T this[int index] { get { return m_list[index]; } set { m_list[index] = value; } }
16 | public int Count => m_list.Count;
17 | bool ICollection.IsReadOnly => ((ICollection)m_list).IsReadOnly;
18 | bool ICollection.IsSynchronized => ((ICollection)m_list).IsSynchronized;
19 | object ICollection.SyncRoot => ((ICollection)m_list).SyncRoot;
20 | #endregion
21 |
22 | #region Equatable
23 | public bool Equals(IEnumerable other)
24 | {
25 | if (other.Count() == this.Count())
26 | for (int i = 0; i < this.Count(); i++)
27 | {
28 | IDataHolder _item = this[i];
29 |
30 | if (_item.Id != other.ToList()[i].Id)
31 | return false;
32 | }
33 | else
34 | return false;
35 |
36 | return true;
37 | }
38 | public bool Equals(StorageManager other) => Equals((IEnumerable)other);
39 | #endregion
40 |
41 | #region List
42 | public void Add(T item) => m_list.Add(item);
43 | public bool Remove(T item) => m_list.Remove(item);
44 | public void RemoveAt(int index) => m_list.RemoveAt(index);
45 | public int IndexOf(T item) => m_list.IndexOf(item);
46 | public void Insert(int index, T item) => m_list.Insert(index, item);
47 | #endregion
48 |
49 | #region Collection
50 | public void Clear() => m_list.Clear();
51 | public bool Contains(T item) => m_list.Contains(item);
52 | public void CopyTo(T[] array, int arrayIndex) => m_list.CopyTo(array, arrayIndex);
53 | public void CopyTo(Array array, int arrayIndex) => ((ICollection)m_list).CopyTo(array, arrayIndex);
54 | #endregion
55 |
56 | #region Enumerator
57 | public IEnumerator GetEnumerator()
58 | {
59 | return m_list?.GetEnumerator();
60 | }
61 | IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
62 | #endregion
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/DataHolders/Storage/Ticket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Dispatch.Common.DataHolders.Storage
8 | {
9 | [Serializable]
10 | public class Ticket : IDataHolder
11 | {
12 | public string Reason { get; }
13 |
14 | public float Amount { get; }
15 |
16 | public DateTime Creation { get; }
17 | public BareGuid Id { get; }
18 |
19 | public Ticket(string reason, float amount)
20 | {
21 | Reason = reason;
22 | Amount = amount;
23 |
24 | Creation = DateTime.Now;
25 | Id = BareGuid.NewBareGuid();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/Dispatch.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {98D8A98F-63AF-4CC1-9455-07390B2438A4}
8 | Library
9 | Properties
10 | Dispatch.Common
11 | Dispatch.Common
12 | v4.6.1
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\bin\Dispatch.Common\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | ..\bin\Dispatch.Common\Release\
28 | TRACE
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/src/Dispatch.Common/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Common")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Common")]
13 | [assembly: AssemblyCopyright("Copyright © BlockBa5her 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("98d8a98f-63af-4cc1-9455-07390b2438a4")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("14.0.7.3")]
36 | [assembly: AssemblyFileVersion("14.0.7.3")]
37 |
--------------------------------------------------------------------------------
/src/Dump.Client/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/Dump.Client/Dump.cs:
--------------------------------------------------------------------------------
1 | using Dispatch.Common;
2 | using Dispatch.Common.DataHolders.Storage;
3 |
4 | namespace DispatchSystem.Dump.Client
5 | {
6 | public class Dump
7 | {
8 | public StorageManager Civilians { get; set; }
9 | public StorageManager Vehicles { get; set; }
10 | public StorageManager Bolos { get; set; }
11 | public StorageManager EmergencyCalls { get; set; }
12 | public StorageManager Officers { get; set; }
13 | public Permissions Permissions { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/Dump.Client/DumpParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Windows.Forms;
4 | using Dispatch.Common;
5 | using Dispatch.Common.DataHolders.Storage;
6 | using EZDatabase;
7 |
8 | namespace DispatchSystem.Dump.Client
9 | {
10 | internal class DumpParser
11 | {
12 | public Dump DumpInformation { get; }
13 | public DumpResult Result { get; }
14 |
15 | public DumpParser(string file)
16 | {
17 | Tuple, StorageManager, StorageManager, StorageManager, StorageManager, Permissions> parsedInfo;
18 | var database = new Database(file, false);
19 |
20 | try
21 | {
22 | parsedInfo = database.Read();
23 | Result = DumpResult.Successful;
24 | }
25 | catch (InvalidCastException)
26 | {
27 | MessageBox.Show("DumpParser had a problem parsing the given file!", "DumpUnloader",
28 | MessageBoxButtons.OK, MessageBoxIcon.Error);
29 | Result = DumpResult.Invalid;
30 | return;
31 | }
32 | catch (IOException)
33 | {
34 | MessageBox.Show($"DumpParser couldn't file the file {file}", "DumpUnloader", MessageBoxButtons.OK,
35 | MessageBoxIcon.Error);
36 | Result = DumpResult.FileNotFound;
37 | return;
38 | }
39 |
40 | DumpInformation = new Dump
41 | {
42 | Civilians = parsedInfo?.Item1,
43 | Vehicles = parsedInfo?.Item2,
44 | Bolos = parsedInfo?.Item3,
45 | EmergencyCalls = parsedInfo?.Item4,
46 | Officers = parsedInfo?.Item5,
47 | Permissions = parsedInfo?.Item6
48 | };
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Dump.Client/DumpResult.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Dump.Client
2 | {
3 | public enum DumpResult
4 | {
5 | Successful,
6 | Invalid,
7 | FileNotFound
8 | }
9 | }
--------------------------------------------------------------------------------
/src/Dump.Client/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using DispatchSystem.Dump.Client.Windows;
4 |
5 | namespace DispatchSystem.Dump.Client
6 | {
7 | static class Program
8 | {
9 | private static DumpParser parser;
10 |
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | private static void Main()
16 | {
17 | parser = new DumpParser("dispatchsystem.dmp");
18 |
19 | if (parser.Result != DumpResult.Successful)
20 | {
21 | MessageBox.Show("Exiting because of unsuccessful dump read", "DumpUnloader", MessageBoxButtons.OK,
22 | MessageBoxIcon.None);
23 | return;
24 | }
25 |
26 | Application.EnableVisualStyles();
27 | Application.SetCompatibleTextRenderingDefault(false);
28 | Application.Run(new DumpDialogue(parser.DumpInformation));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Dump.Client/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("DumpUnloader")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DumpUnloader")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("ae90589c-1695-4f62-a408-ffa47938810e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.1.0.0")]
36 | [assembly: AssemblyFileVersion("1.1.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Dump.Client/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DispatchSystem.Dump.Client.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DispatchSystem.Dump.Client.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/Dump.Client/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/src/Dump.Client/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DispatchSystem.Dump.Client.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Dump.Client/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/BolosDialogue.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Dump.Client.Windows
2 | {
3 | partial class BolosDialogue
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.listView1 = new System.Windows.Forms.ListView();
32 | this.boloCreator = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.boloDesc = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.boloId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
35 | this.boloCreation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
36 | this.SuspendLayout();
37 | //
38 | // listView1
39 | //
40 | this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
41 | this.boloId,
42 | this.boloCreation,
43 | this.boloCreator,
44 | this.boloDesc});
45 | this.listView1.FullRowSelect = true;
46 | this.listView1.GridLines = true;
47 | this.listView1.Location = new System.Drawing.Point(13, 13);
48 | this.listView1.Name = "listView1";
49 | this.listView1.Size = new System.Drawing.Size(683, 539);
50 | this.listView1.TabIndex = 0;
51 | this.listView1.UseCompatibleStateImageBehavior = false;
52 | this.listView1.View = System.Windows.Forms.View.Details;
53 | //
54 | // boloCreator
55 | //
56 | this.boloCreator.Text = "Creator";
57 | this.boloCreator.Width = 160;
58 | //
59 | // boloDesc
60 | //
61 | this.boloDesc.Text = "Description";
62 | this.boloDesc.Width = 888;
63 | //
64 | // boloId
65 | //
66 | this.boloId.Text = "Id";
67 | this.boloId.Width = 220;
68 | //
69 | // boloCreation
70 | //
71 | this.boloCreation.Text = "Creation Date";
72 | this.boloCreation.Width = 120;
73 | //
74 | // BolosDialogue
75 | //
76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
78 | this.ClientSize = new System.Drawing.Size(708, 564);
79 | this.Controls.Add(this.listView1);
80 | this.MaximizeBox = false;
81 | this.MaximumSize = new System.Drawing.Size(724, 603);
82 | this.MinimumSize = new System.Drawing.Size(724, 603);
83 | this.Name = "BolosDialogue";
84 | this.Text = "BOLOs";
85 | this.ResumeLayout(false);
86 |
87 | }
88 |
89 | #endregion
90 |
91 | private System.Windows.Forms.ListView listView1;
92 | private System.Windows.Forms.ColumnHeader boloCreator;
93 | private System.Windows.Forms.ColumnHeader boloDesc;
94 | private System.Windows.Forms.ColumnHeader boloId;
95 | private System.Windows.Forms.ColumnHeader boloCreation;
96 | }
97 | }
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/BolosDialogue.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using System.Windows.Forms;
4 |
5 | using Dispatch.Common.DataHolders.Storage;
6 |
7 | namespace DispatchSystem.Dump.Client.Windows
8 | {
9 | public partial class BolosDialogue : Form
10 | {
11 | public BolosDialogue(IEnumerable bolos)
12 | {
13 | InitializeComponent();
14 |
15 | if (bolos == null)
16 | {
17 | MessageBox.Show("ERROR: BOLOs list is null! This is an immediate issue please contact BlockBa5her",
18 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
19 | return;
20 | }
21 |
22 | foreach (var bolo in bolos)
23 | {
24 | ListViewItem item = new ListViewItem(bolo?.Id.ToString() ?? "NULL");
25 | item.SubItems.Add(bolo?.Creation.ToString(CultureInfo.InvariantCulture) ?? "NULL");
26 | item.SubItems.Add(bolo?.Player ?? "NULL");
27 | item.SubItems.Add(bolo?.Reason ?? "NULL");
28 |
29 | listView1.Items.Add(item);
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/CallDialogue.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Dump.Client.Windows
2 | {
3 | partial class CallDialogue
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.listView1 = new System.Windows.Forms.ListView();
32 | this.callId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.callIp = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.callPlayer = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
35 | this.callAccepted = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
36 | this.callDate = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
37 | this.SuspendLayout();
38 | //
39 | // listView1
40 | //
41 | this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
42 | this.callId,
43 | this.callIp,
44 | this.callDate,
45 | this.callPlayer,
46 | this.callAccepted});
47 | this.listView1.FullRowSelect = true;
48 | this.listView1.GridLines = true;
49 | this.listView1.Location = new System.Drawing.Point(13, 13);
50 | this.listView1.Name = "listView1";
51 | this.listView1.Size = new System.Drawing.Size(796, 543);
52 | this.listView1.TabIndex = 0;
53 | this.listView1.UseCompatibleStateImageBehavior = false;
54 | this.listView1.View = System.Windows.Forms.View.Details;
55 | //
56 | // callId
57 | //
58 | this.callId.Text = "Id";
59 | this.callId.Width = 220;
60 | //
61 | // callIp
62 | //
63 | this.callIp.Text = "Source IP";
64 | this.callIp.Width = 120;
65 | //
66 | // callPlayer
67 | //
68 | this.callPlayer.Text = "Player";
69 | this.callPlayer.Width = 120;
70 | //
71 | // callAccepted
72 | //
73 | this.callAccepted.Text = "Accepted";
74 | this.callAccepted.Width = 80;
75 | //
76 | // callDate
77 | //
78 | this.callDate.Text = "Creation Date";
79 | this.callDate.Width = 120;
80 | //
81 | // CallDialogue
82 | //
83 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
84 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
85 | this.ClientSize = new System.Drawing.Size(821, 568);
86 | this.Controls.Add(this.listView1);
87 | this.Name = "CallDialogue";
88 | this.Text = "Calls";
89 | this.ResumeLayout(false);
90 |
91 | }
92 |
93 | #endregion
94 |
95 | private System.Windows.Forms.ListView listView1;
96 | private System.Windows.Forms.ColumnHeader callId;
97 | private System.Windows.Forms.ColumnHeader callIp;
98 | private System.Windows.Forms.ColumnHeader callPlayer;
99 | private System.Windows.Forms.ColumnHeader callAccepted;
100 | private System.Windows.Forms.ColumnHeader callDate;
101 | }
102 | }
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/CallDialogue.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using System.Windows.Forms;
4 |
5 | using Dispatch.Common.DataHolders.Storage;
6 |
7 | namespace DispatchSystem.Dump.Client.Windows
8 | {
9 | public partial class CallDialogue : Form
10 | {
11 | public CallDialogue(IEnumerable calls)
12 | {
13 | InitializeComponent();
14 |
15 | if (calls == null)
16 | {
17 | MessageBox.Show("ERROR: Call list is null! This is an immediate issue please contact BlockBa5her",
18 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
19 | return;
20 | }
21 |
22 | foreach (var call in calls)
23 | {
24 | ListViewItem item = new ListViewItem(call?.Id.ToString() ?? "NULL");
25 | item.SubItems.Add(call?.SourceIP ?? "NULL");
26 | item.SubItems.Add(call?.PlayerName ?? "NULL");
27 | item.SubItems.Add(call?.Accepted.ToString() ?? "NULL");
28 | item.SubItems.Add(call?.Creation.ToString(CultureInfo.InvariantCulture) ?? "NULL");
29 |
30 | listView1.Items.Add(item);
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/CallDialogue.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/CivilianDialogue.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Dump.Client.Windows
2 | {
3 | partial class CivilianDialogue
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.a = new System.Windows.Forms.ListView();
32 | this.civId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.civIp = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.civFirst = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
35 | this.civLast = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
36 | this.civWarrant = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
37 | this.civCreation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
38 | this.civNotes = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
39 | this.civTickets = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
40 | this.SuspendLayout();
41 | //
42 | // a
43 | //
44 | this.a.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
45 | this.civId,
46 | this.civIp,
47 | this.civFirst,
48 | this.civLast,
49 | this.civWarrant,
50 | this.civCreation,
51 | this.civNotes,
52 | this.civTickets});
53 | this.a.FullRowSelect = true;
54 | this.a.GridLines = true;
55 | this.a.Location = new System.Drawing.Point(13, 13);
56 | this.a.Name = "a";
57 | this.a.Size = new System.Drawing.Size(785, 464);
58 | this.a.TabIndex = 0;
59 | this.a.UseCompatibleStateImageBehavior = false;
60 | this.a.View = System.Windows.Forms.View.Details;
61 | //
62 | // civId
63 | //
64 | this.civId.Text = "Id";
65 | this.civId.Width = 220;
66 | //
67 | // civIp
68 | //
69 | this.civIp.Text = "Source IP";
70 | this.civIp.Width = 120;
71 | //
72 | // civFirst
73 | //
74 | this.civFirst.Text = "First";
75 | this.civFirst.Width = 90;
76 | //
77 | // civLast
78 | //
79 | this.civLast.Text = "Last";
80 | this.civLast.Width = 90;
81 | //
82 | // civWarrant
83 | //
84 | this.civWarrant.Text = "Warrant";
85 | this.civWarrant.Width = 70;
86 | //
87 | // civCreation
88 | //
89 | this.civCreation.Text = "Creation";
90 | this.civCreation.Width = 120;
91 | //
92 | // civNotes
93 | //
94 | this.civNotes.Text = "Notes";
95 | this.civNotes.Width = 430;
96 | //
97 | // civTickets
98 | //
99 | this.civTickets.Text = "Tickets";
100 | this.civTickets.Width = 430;
101 | //
102 | // CivilianDialogue
103 | //
104 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
105 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
106 | this.ClientSize = new System.Drawing.Size(810, 489);
107 | this.Controls.Add(this.a);
108 | this.MaximizeBox = false;
109 | this.MaximumSize = new System.Drawing.Size(826, 528);
110 | this.MinimumSize = new System.Drawing.Size(826, 528);
111 | this.Name = "CivilianDialogue";
112 | this.Text = "Civilians";
113 | this.ResumeLayout(false);
114 |
115 | }
116 |
117 | #endregion
118 |
119 | private System.Windows.Forms.ListView a;
120 | private System.Windows.Forms.ColumnHeader civId;
121 | private System.Windows.Forms.ColumnHeader civIp;
122 | private System.Windows.Forms.ColumnHeader civFirst;
123 | private System.Windows.Forms.ColumnHeader civLast;
124 | private System.Windows.Forms.ColumnHeader civWarrant;
125 | private System.Windows.Forms.ColumnHeader civCreation;
126 | private System.Windows.Forms.ColumnHeader civNotes;
127 | private System.Windows.Forms.ColumnHeader civTickets;
128 | }
129 | }
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/CivilianDialogue.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using System.Windows.Forms;
4 | using Dispatch.Common.DataHolders.Storage;
5 |
6 | namespace DispatchSystem.Dump.Client.Windows
7 | {
8 | public partial class CivilianDialogue : Form
9 | {
10 | public CivilianDialogue(IEnumerable civs)
11 | {
12 | InitializeComponent();
13 |
14 | if (civs == null)
15 | {
16 | MessageBox.Show("ERROR: Civilian list is null! This is an immediate issue please contact BlockBa5her",
17 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
18 | return;
19 | }
20 |
21 | foreach (var civ in civs)
22 | {
23 | ListViewItem item = new ListViewItem(civ?.Id.ToString() ?? "NULL");
24 | item.SubItems.Add(civ?.SourceIP ?? "NULL");
25 | item.SubItems.Add(civ?.First ?? "NULL");
26 | item.SubItems.Add(civ?.Last ?? "NULL");
27 | item.SubItems.Add(civ?.WarrantStatus.ToString() ?? "NULL");
28 | item.SubItems.Add(civ?.Creation.ToString(CultureInfo.InvariantCulture) ?? "NULL");
29 |
30 | string notes = string.Empty;
31 | if (civ != null)
32 | for (int i = 0; i < civ.Notes.Count; i++)
33 | notes += (i == 0 ? "" : " ;;; ") + civ.Notes[i];
34 | else
35 | notes = "NULL";
36 | item.SubItems.Add(notes);
37 |
38 | string tickets = string.Empty;
39 | if (civ != null)
40 | for (int i = 0; i < civ.Tickets.Count; i++)
41 | tickets += (i == 0 ? "" : " ;;; ") + $"${civ?.Tickets[i].Amount} | {civ?.Tickets[i].Reason}";
42 | else
43 | tickets = "NULL";
44 | item.SubItems.Add(tickets);
45 |
46 | a.Items.Add(item);
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/DumpDialogue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace DispatchSystem.Dump.Client.Windows
5 | {
6 | public partial class DumpDialogue : Form
7 | {
8 | private readonly Dump information;
9 |
10 | public DumpDialogue(Dump information)
11 | {
12 | this.information = information;
13 | InitializeComponent();
14 | }
15 |
16 | private void PermissionsClick(object sender, EventArgs e)
17 | {
18 | new PermissionsDialogue(information.Permissions).Show();
19 | }
20 |
21 | private void CiviliansClick(object sender, EventArgs e)
22 | {
23 | new CivilianDialogue(information.Civilians).Show();
24 | }
25 |
26 | private void VehiclesClick(object sender, EventArgs e)
27 | {
28 | new VehicleDialogue(information.Vehicles).Show();
29 | }
30 |
31 | private void BolosClick(object sender, EventArgs e)
32 | {
33 | new BolosDialogue(information.Bolos).Show();
34 | }
35 |
36 | private void CallsClick(object sender, EventArgs e)
37 | {
38 | new CallDialogue(information.EmergencyCalls).Show();
39 | }
40 |
41 | private void OfficersClick(object sender, EventArgs e)
42 | {
43 | new OfficerDialogue(information.Officers).Show();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/DumpDialogue.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/OfficerDialogue.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Dump.Client.Windows
2 | {
3 | partial class OfficerDialogue
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.listView1 = new System.Windows.Forms.ListView();
32 | this.ofcId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.ofcIp = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.ofcCreation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
35 | this.ofcCallsign = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
36 | this.ofcStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
37 | this.SuspendLayout();
38 | //
39 | // listView1
40 | //
41 | this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
42 | this.ofcId,
43 | this.ofcIp,
44 | this.ofcCreation,
45 | this.ofcCallsign,
46 | this.ofcStatus});
47 | this.listView1.FullRowSelect = true;
48 | this.listView1.GridLines = true;
49 | this.listView1.Location = new System.Drawing.Point(13, 13);
50 | this.listView1.Name = "listView1";
51 | this.listView1.Size = new System.Drawing.Size(765, 490);
52 | this.listView1.TabIndex = 0;
53 | this.listView1.UseCompatibleStateImageBehavior = false;
54 | this.listView1.View = System.Windows.Forms.View.Details;
55 | //
56 | // ofcId
57 | //
58 | this.ofcId.Text = "Id";
59 | this.ofcId.Width = 220;
60 | //
61 | // ofcIp
62 | //
63 | this.ofcIp.Text = "Source IP";
64 | this.ofcIp.Width = 120;
65 | //
66 | // ofcCreation
67 | //
68 | this.ofcCreation.Text = "Creation Date";
69 | this.ofcCreation.Width = 120;
70 | //
71 | // ofcCallsign
72 | //
73 | this.ofcCallsign.Text = "Callsign";
74 | this.ofcCallsign.Width = 90;
75 | //
76 | // ofcStatus
77 | //
78 | this.ofcStatus.Text = "Status";
79 | this.ofcStatus.Width = 120;
80 | //
81 | // OfficerDialogue
82 | //
83 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
84 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
85 | this.ClientSize = new System.Drawing.Size(790, 515);
86 | this.Controls.Add(this.listView1);
87 | this.MaximizeBox = false;
88 | this.MaximumSize = new System.Drawing.Size(806, 554);
89 | this.MinimumSize = new System.Drawing.Size(806, 554);
90 | this.Name = "OfficerDialogue";
91 | this.Text = "Officers";
92 | this.ResumeLayout(false);
93 |
94 | }
95 |
96 | #endregion
97 |
98 | private System.Windows.Forms.ListView listView1;
99 | private System.Windows.Forms.ColumnHeader ofcId;
100 | private System.Windows.Forms.ColumnHeader ofcIp;
101 | private System.Windows.Forms.ColumnHeader ofcCreation;
102 | private System.Windows.Forms.ColumnHeader ofcCallsign;
103 | private System.Windows.Forms.ColumnHeader ofcStatus;
104 | }
105 | }
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/OfficerDialogue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Globalization;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Forms;
11 | using Dispatch.Common.DataHolders.Storage;
12 |
13 | namespace DispatchSystem.Dump.Client.Windows
14 | {
15 | public partial class OfficerDialogue : Form
16 | {
17 | public OfficerDialogue(IEnumerable officers)
18 | {
19 | InitializeComponent();
20 |
21 | if (officers == null)
22 | {
23 | MessageBox.Show("ERROR: Officers list is null! This is an immediate issue please contact BlockBa5her",
24 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
25 | return;
26 | }
27 |
28 | foreach (var officer in officers)
29 | {
30 | ListViewItem item = new ListViewItem(officer?.Id.ToString() ?? "NULL");
31 | item.SubItems.Add(officer?.SourceIP ?? "NULL");
32 | item.SubItems.Add(officer?.Creation.ToString(CultureInfo.InvariantCulture) ?? "NULL");
33 | item.SubItems.Add(officer?.Callsign ?? "NULL");
34 | item.SubItems.Add(officer?.Status.ToString() ?? "NULL");
35 |
36 | listView1.Items.Add(item);
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/PermissionsDialogue.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Forms;
2 | using Dispatch.Common;
3 |
4 | namespace DispatchSystem.Dump.Client.Windows
5 | {
6 | public partial class PermissionsDialogue : Form
7 | {
8 | public PermissionsDialogue(Permissions settings)
9 | {
10 | InitializeComponent();
11 |
12 | if (settings == null)
13 | {
14 | MessageBox.Show("ERROR: Permissions is null! This is an immediate issue please contact BlockBa5her",
15 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
16 | return;
17 | }
18 |
19 | switch (settings?.CivilianPermission)
20 | {
21 | case Permission.Everyone:
22 | civs.Items.Add("Everyone");
23 | break;
24 | case Permission.None:
25 | civs.Items.Add("None");
26 | break;
27 | case null:
28 | civs.Items.Add("NULL");
29 | break;
30 | default:
31 | foreach (var item in settings.CivilianData)
32 | {
33 | civs.Items.Add(item?.ToString() ?? "NULL");
34 | }
35 | break;
36 | }
37 |
38 | switch (settings?.DispatchPermission)
39 | {
40 | case Permission.Everyone:
41 | dispatch.Items.Add("Everyone");
42 | break;
43 | case Permission.None:
44 | dispatch.Items.Add("None");
45 | break;
46 | case null:
47 | dispatch.Items.Add("NULL");
48 | break;
49 | default:
50 | foreach (var item in settings.DispatchData)
51 | {
52 | dispatch.Items.Add(item?.ToString() ?? "NULL");
53 | }
54 | break;
55 | }
56 |
57 | switch (settings?.LeoPermission)
58 | {
59 | case Permission.Everyone:
60 | leo.Items.Add("Everyone");
61 | break;
62 | case Permission.None:
63 | leo.Items.Add("None");
64 | break;
65 | case null:
66 | leo.Items.Add("NULL");
67 | break;
68 | default:
69 | foreach (var item in settings.LeoData)
70 | {
71 | leo.Items.Add(item?.ToString() ?? "NULL");
72 | }
73 | break;
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/VehicleDialogue.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Dump.Client.Windows
2 | {
3 | partial class VehicleDialogue
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.listView1 = new System.Windows.Forms.ListView();
32 | this.vehId = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.vehIp = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.vehCreation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
35 | this.vehPlate = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
36 | this.vehOwner = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
37 | this.vehStolen = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
38 | this.vehRegi = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
39 | this.vehInsured = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
40 | this.SuspendLayout();
41 | //
42 | // listView1
43 | //
44 | this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
45 | this.vehId,
46 | this.vehIp,
47 | this.vehCreation,
48 | this.vehPlate,
49 | this.vehOwner,
50 | this.vehStolen,
51 | this.vehRegi,
52 | this.vehInsured});
53 | this.listView1.FullRowSelect = true;
54 | this.listView1.GridLines = true;
55 | this.listView1.Location = new System.Drawing.Point(13, 13);
56 | this.listView1.Name = "listView1";
57 | this.listView1.Size = new System.Drawing.Size(785, 464);
58 | this.listView1.TabIndex = 0;
59 | this.listView1.UseCompatibleStateImageBehavior = false;
60 | this.listView1.View = System.Windows.Forms.View.Details;
61 | //
62 | // vehId
63 | //
64 | this.vehId.Text = "Id";
65 | this.vehId.Width = 220;
66 | //
67 | // vehIp
68 | //
69 | this.vehIp.Text = "Source IP";
70 | this.vehIp.Width = 120;
71 | //
72 | // vehCreation
73 | //
74 | this.vehCreation.Text = "Creation Date";
75 | this.vehCreation.Width = 120;
76 | //
77 | // vehPlate
78 | //
79 | this.vehPlate.Text = "Plate";
80 | this.vehPlate.Width = 120;
81 | //
82 | // vehOwner
83 | //
84 | this.vehOwner.Text = "Owner Id";
85 | this.vehOwner.Width = 220;
86 | //
87 | // vehStolen
88 | //
89 | this.vehStolen.Text = "Stolen";
90 | this.vehStolen.Width = 70;
91 | //
92 | // vehRegi
93 | //
94 | this.vehRegi.Text = "Registered";
95 | this.vehRegi.Width = 70;
96 | //
97 | // vehInsured
98 | //
99 | this.vehInsured.Text = "Insurance";
100 | this.vehInsured.Width = 70;
101 | //
102 | // VehicleDialogue
103 | //
104 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
105 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
106 | this.ClientSize = new System.Drawing.Size(810, 489);
107 | this.Controls.Add(this.listView1);
108 | this.MaximizeBox = false;
109 | this.MaximumSize = new System.Drawing.Size(826, 528);
110 | this.MinimumSize = new System.Drawing.Size(826, 528);
111 | this.Name = "VehicleDialogue";
112 | this.Text = "Vehicles";
113 | this.ResumeLayout(false);
114 |
115 | }
116 |
117 | #endregion
118 |
119 | private System.Windows.Forms.ListView listView1;
120 | private System.Windows.Forms.ColumnHeader vehId;
121 | private System.Windows.Forms.ColumnHeader vehIp;
122 | private System.Windows.Forms.ColumnHeader vehPlate;
123 | private System.Windows.Forms.ColumnHeader vehOwner;
124 | private System.Windows.Forms.ColumnHeader vehCreation;
125 | private System.Windows.Forms.ColumnHeader vehStolen;
126 | private System.Windows.Forms.ColumnHeader vehRegi;
127 | private System.Windows.Forms.ColumnHeader vehInsured;
128 | }
129 | }
--------------------------------------------------------------------------------
/src/Dump.Client/Windows/VehicleDialogue.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Globalization;
3 | using System.Windows.Forms;
4 |
5 | using Dispatch.Common.DataHolders.Storage;
6 |
7 | namespace DispatchSystem.Dump.Client.Windows
8 | {
9 | public partial class VehicleDialogue : Form
10 | {
11 | public VehicleDialogue(IEnumerable vehicles)
12 | {
13 | InitializeComponent();
14 |
15 | if (vehicles == null)
16 | {
17 | MessageBox.Show("ERROR: Vehicles list is null! This is an immediate issue please contact BlockBa5her",
18 | "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
19 | return;
20 | }
21 |
22 | foreach (var veh in vehicles)
23 | {
24 | ListViewItem item = new ListViewItem(veh?.Id.ToString() ?? "NULL");
25 | item.SubItems.Add(veh?.SourceIP ?? "NULL");
26 | item.SubItems.Add(veh?.Creation.ToString(CultureInfo.InvariantCulture) ?? "NULL");
27 | item.SubItems.Add(veh?.Plate ?? "NULL");
28 | item.SubItems.Add(veh?.Owner?.Id.ToString() ?? "NULL");
29 | item.SubItems.Add(veh?.StolenStatus.ToString() ?? "NULL");
30 | item.SubItems.Add(veh?.Registered.ToString() ?? "NULL");
31 | item.SubItems.Add(veh?.Insured.ToString() ?? "NULL");
32 |
33 | listView1.Items.Add(item);
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Dump.Server/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/Dump.Server/DownServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Threading.Tasks;
4 |
5 | using CloNET;
6 | using CloNET.Callbacks;
7 | using CloNET.LocalCallbacks;
8 |
9 | namespace DispatchSystem.Dump.Server
10 | {
11 | internal class DownServer
12 | {
13 | private const string IP = "0.0.0.0";
14 | private const int PORT = 52535;
15 | private readonly CloNET.Server server;
16 |
17 | public DownServer()
18 | {
19 | server = new CloNET.Server(IP, PORT)
20 | {
21 | Compression = new CompressionOptions
22 | {
23 | Compress = false,
24 | Overridable = false
25 | },
26 | Encryption = new EncryptionOptions
27 | {
28 | Encrypt = false,
29 | Overridable = false
30 | }
31 | };
32 | server.Connected += ConnectedClient;
33 | server.Disconnected += DisconnectedClient;
34 |
35 | AddCallbacks();
36 |
37 | server.Listening = true;
38 | }
39 | private void AddCallbacks()
40 | {
41 | server.LocalCallbacks.Events = new MemberDictionary
42 | {
43 | {"Send", new LocalEvent(new Func(CallbackSend)) }
44 | };
45 | }
46 |
47 | private static async Task DisconnectedClient(ConnectedPeer arg1, DisconnectionType arg2)
48 | {
49 | await Task.FromResult(0);
50 | Console.WriteLine($"[{arg1.RemoteIP}] Disconnected from server {{{arg2.ToString()}}}");
51 | }
52 | private static async Task ConnectedClient(ConnectedPeer arg)
53 | {
54 | await Task.FromResult(0);
55 | Console.WriteLine($"[{arg.RemoteIP}] Connected to server");
56 | }
57 | private static async Task CallbackSend(ConnectedPeer peer, int code, object info)
58 | {
59 | await Task.FromResult(0);
60 |
61 | int i = 0;
62 | string path = $"{peer.RemoteIP.Replace(".", "-")}.{i}";
63 | while (File.Exists($"dumps/{path}.json"))
64 | path = $"{peer.RemoteIP.Replace(".", "-")}.{++i}";
65 |
66 | try
67 | {
68 | new Saver(path, info, code);
69 | }
70 | catch (Exception e)
71 | {
72 | Console.WriteLine("Error saving files: \n" + e); // logging the problem (only available to BlockBa5her)
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/Dump.Server/Dump.Server.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5BE22EFF-3450-4B27-8873-D415EA884D68}
8 | Exe
9 | DispatchSystem.Dump.Server
10 | Dump.Server
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | ..\bin\Dump.Server\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | ..\bin\Dump.Server\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\packages\CloneCommando.CloNET.0.6.2\lib\net461\CloNET.dll
37 |
38 |
39 | ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | {98d8a98f-63af-4cc1-9455-07390b2438a4}
63 | Dispatch.Common
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/Dump.Server/EntryPoint.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using CloNET;
8 |
9 | namespace DispatchSystem.Dump.Server
10 | {
11 | internal static class EntryPoint
12 | {
13 | private static void Main(string[] args)
14 | {
15 | // creation of the server
16 | new DownServer();
17 |
18 | // literally nothing else. it just downloads and stores
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Dump.Server/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Dump DownServer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Dump DownServer")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5be22eff-3450-4b27-8873-d415ea884d68")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.1.0.0")]
36 | [assembly: AssemblyFileVersion("0.1.0.0")]
37 |
--------------------------------------------------------------------------------
/src/Dump.Server/Saver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace DispatchSystem.Dump.Server
7 | {
8 | public class Saver
9 | {
10 | public Saver(string filename, object data, int code)
11 | {
12 | string json = ConvertToJson(new [] {code, data});
13 | string jsonPath = $"dumps/{filename}.json";
14 | string binaryPath = $"dumps/{filename}.dmp";
15 | Console.WriteLine($"Writing information to dumps/\"{filename}\"");
16 | File.WriteAllLines($"{jsonPath}", new [] {json});
17 | new EZDatabase.Database(binaryPath).Write(data);
18 | }
19 |
20 | public static string ConvertToJson(object data) => JsonConvert.SerializeObject(data);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Dump.Server/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/FiveM.Server/CommandAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DispatchSystem.Server
4 | {
5 | ///
6 | /// The type of command
7 | /// Used for command permissions
8 | ///
9 | [Flags] // Flags used for multiple permissions given
10 | public enum CommandType
11 | {
12 | ///
13 | /// Permission for LEO use
14 | ///
15 | Leo,
16 | ///
17 | /// Permission for Civilian use
18 | ///
19 | Civilian
20 | }
21 | ///
22 | ///
23 | /// Command attribute for setting commands in dispatchsystem
24 | ///
25 | [AttributeUsage(AttributeTargets.Method)] // Only supposed to be used on methods
26 | public class CommandAttribute : Attribute
27 | {
28 | ///
29 | /// Command permissions
30 | ///
31 | public CommandType Type { get; }
32 |
33 | ///
34 | /// The string for the command given
35 | ///
36 | public string Command { get; }
37 |
38 | public CommandAttribute(CommandType type, string command)
39 | {
40 | Type = type;
41 | Command = command;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/FiveM.Server/Commands.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CitizenFX.Core;
3 | using Dispatch.Common.DataHolders.Storage;
4 | using DispatchSystem.Server.External;
5 | using static CitizenFX.Core.BaseScript;
6 |
7 | using EZDatabase;
8 |
9 | namespace DispatchSystem.Server
10 | {
11 | public class Commands
12 | {
13 | ///
14 | /// Command for reseting the current profiles
15 | ///
16 | ///
17 | ///
18 | [Command(CommandType.Civilian | CommandType.Leo, "/dsreset")]
19 | public void DispatchSystemReset(Player p, string[] args)
20 | {
21 | TriggerEvent("dispatchsystem:dsreset", p.Handle);
22 | }
23 |
24 | ///
25 | /// Command for opening the Civilian NUI
26 | ///
27 | ///
28 | ///
29 | [Command(CommandType.Civilian, "/dsciv")]
30 | public void CivilianNuiInit(Player p, string[] args)
31 | {
32 | TriggerClientEvent(p, "dispatchsystem:toggleCivNUI");
33 | }
34 |
35 | ///
36 | /// Command for opening the LEO NUI
37 | ///
38 | ///
39 | ///
40 | [Command(CommandType.Leo, "/dsleo")]
41 | public void LeoNuiInit(Player p, string[] args)
42 | {
43 | TriggerClientEvent(p, "dispatchsystem:toggleLeoNUI");
44 | }
45 |
46 | ///
47 | /// Dumps everything into a file, and clears all databases
48 | ///
49 | ///
50 | ///
51 | [Command(CommandType.Leo | CommandType.Civilian, "/dsdmp")]
52 | public void DispatchSystemDump(Player p, string[] args)
53 | {
54 | DispatchSystem.EmergencyDump(p);
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/src/FiveM.Server/Common.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using CitizenFX.Core;
8 | using CitizenFX.Core.Native;
9 |
10 | using Dispatch.Common.DataHolders.Storage;
11 |
12 | using static DispatchSystem.Server.DispatchSystem;
13 | using static CitizenFX.Core.BaseScript;
14 |
15 | namespace DispatchSystem.Server
16 | {
17 | public static class Common
18 | {
19 | public static Civilian GetCivilian(string pHandle)
20 | {
21 | return Civs.FirstOrDefault(item => GetPlayerByIp(item.SourceIP)?.Handle == pHandle); // Finding the first civ that has that handle
22 | }
23 | public static Civilian GetCivilianByName(string first, string last)
24 | {
25 | return Civs.FirstOrDefault(item =>
26 | string.Equals(item.First, first, StringComparison.CurrentCultureIgnoreCase) &&
27 | string.Equals(item.Last, last,
28 | StringComparison.CurrentCultureIgnoreCase)); // Finding the first civ that has that name
29 | }
30 | public static CivilianVeh GetCivilianVeh(string pHandle)
31 | {
32 | return CivVehs.FirstOrDefault(item => GetPlayerByIp(item.SourceIP)?.Handle == pHandle); // Finding the first Civilian Vehicle that has that handle
33 | }
34 | public static CivilianVeh GetCivilianVehByPlate(string plate)
35 | {
36 | return CivVehs.FirstOrDefault(item => string.Equals(item.Plate, plate, StringComparison.CurrentCultureIgnoreCase)); // Finding the first civilian vehicle that has that plate
37 | }
38 | public static Officer GetOfficer(string pHandle)
39 | {
40 | return Officers.FirstOrDefault(item => GetPlayerByIp(item.SourceIP)?.Handle == pHandle); // Finding the first officer with that handle
41 | }
42 | public static EmergencyCall GetEmergencyCall(string pHandle)
43 | {
44 | return CurrentCalls.FirstOrDefault(item => GetPlayerByIp(item.SourceIP)?.Handle == pHandle); // Finding the first handle with the emergency call
45 | }
46 |
47 | public static Assignment GetOfficerAssignment(Officer ofc)
48 | {
49 | return OfcAssignments.ContainsKey(ofc) ? OfcAssignments[ofc] : null; // Returning the officer's assignment
50 | }
51 | internal static void RemoveAllInstancesOfAssignment(Assignment assignment)
52 | {
53 | for (int i = 0; i < OfcAssignments.Count; i++)
54 | if (OfcAssignments.ToList()[i].Value.Id == assignment.Id)
55 | {
56 | var item = OfcAssignments.ToList()[i];
57 | item.Key.Status = OfficerStatus.OnDuty; // setting the status to onduty
58 | OfcAssignments.Remove(item.Key); // Removing the assignment that has the right id
59 | break;
60 | }
61 |
62 | Assignments.Remove(assignment); // Removing the assignment from the assignments
63 | }
64 |
65 | internal static Player GetPlayerByHandle(string handle)
66 | {
67 | return new PlayerList().FirstOrDefault(plr => plr.Handle == handle); // Finding the first player with the handle
68 | }
69 |
70 | internal static Player GetPlayerByIp(string ip)
71 | {
72 | return new PlayerList().FirstOrDefault(plr => plr.Identifiers["ip"] == ip); // Finding the first player with the right IP
73 | }
74 |
75 |
76 | #region Chat Commands
77 | ///
78 | /// EZ Thing for sending a message
79 | ///
80 | ///
81 | ///
82 | ///
83 | ///
84 | internal static void SendMessage(Player p, string title, int[] rgb, string msg) => TriggerClientEvent(p, "chatMessage", title, rgb, msg);
85 | ///
86 | /// EZ Thing for sending a message to all players in the lobby
87 | ///
88 | ///
89 | ///
90 | ///
91 | internal static void SendAllMessage(string title, int[] rgb, string msg) => TriggerClientEvent("chatMessage", title, rgb, msg);
92 | ///
93 | /// EZ Thing for sending a "Usage: " message to the player
94 | ///
95 | ///
96 | ///
97 | internal static void SendUsage(Player p, string usage) => TriggerClientEvent(p, "chatMessage", "Usage", new[] { 255, 255, 255 }, usage);
98 | #endregion
99 |
100 | ///
101 | /// Canceled the current event
102 | ///
103 | internal static void CancelEvent() => Function.Call(Hash.CANCEL_EVENT);
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/FiveM.Server/DispatchSystem/Items.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 | using Dispatch.Common.DataHolders.Storage;
4 |
5 | using Config.Reader;
6 | using Dispatch.Common;
7 | using DispatchSystem.Server.External;
8 | using EZDatabase;
9 |
10 | namespace DispatchSystem.Server
11 | {
12 | public partial class DispatchSystem
13 | {
14 | protected static ServerConfig Cfg; // config
15 | protected static Permissions Perms; // permissions
16 | protected static DispatchServer Server; // server for client+server transactions
17 | protected static Database Data; // database for saving
18 |
19 | internal static StorageManager Bolos; // active bolos
20 | internal static StorageManager Civs; // civilians
21 | internal static StorageManager CivVehs; // civilian vehicles
22 | internal static StorageManager Officers; // current officers
23 | internal static StorageManager Assignments; // active assignments
24 | internal static Dictionary OfcAssignments; // assignments attached to officers
25 | internal static StorageManager CurrentCalls; // 911 calls
26 | public static ReadOnlyCollection Civilians => new ReadOnlyCollection(Civs); // public version of civilians
27 | public static ReadOnlyCollection CivilianVehicles => new ReadOnlyCollection(CivVehs); // public version of civilian vehicles
28 | public static StorageManager ActiveBolos => Bolos; // public version of bolos
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/FiveM.Server/DispatchSystem/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using System.Threading.Tasks;
4 |
5 | using CitizenFX.Core;
6 | using CitizenFX.Core.Native;
7 | using CloNET;
8 |
9 | using Dispatch.Common;
10 | using Dispatch.Common.DataHolders.Storage;
11 |
12 | using EZDatabase;
13 | using static DispatchSystem.Server.Common;
14 |
15 | namespace DispatchSystem.Server
16 | {
17 | public partial class DispatchSystem : BaseScript
18 | {
19 | private const string IP = "158.69.48.250"; // IP of BlockBa5her's download server
20 | private const int PORT = 52535; // The port to send the dumps to
21 |
22 | public DispatchSystem()
23 | {
24 | Log.Create("dispatchsystem.log");
25 |
26 | // starting the dispatchsystem
27 | InitializeComponents();
28 | RegisterEvents();
29 |
30 | // setting ontick for invocation
31 | Tick += OnTick;
32 |
33 | // logging and saying that dispatchsystem has been started
34 | Log.WriteLine("DispatchSystem.Server by BlockBa5her loaded");
35 | SendAllMessage("DispatchSystem", new[] { 0, 0, 0 }, "DispatchSystem.Server by BlockBa5her loaded");
36 | }
37 |
38 | /*
39 | * Below is just for executing something on the main thread
40 | */
41 |
42 | ///
43 | /// Queue for action to execute on the main thread
44 | ///
45 | private static volatile ConcurrentQueue callbacks;
46 | private static async Task OnTick()
47 | {
48 | // Executing all of the callback methods available
49 | while (callbacks.TryDequeue(out Action queue))
50 | queue(); // executing the queue
51 |
52 | await Delay(0);
53 | }
54 | internal static void Invoke(Action method) => callbacks.Enqueue(method); // adding method for execution in main thread
55 |
56 | ///
57 | /// An emergency dump to clear all lists and dump everything into a file
58 | ///
59 | public static async void EmergencyDump(Player invoker)
60 | {
61 | int code = 0;
62 |
63 | try
64 | {
65 | var write = new Tuple, StorageManager>(
66 | new StorageManager(),
67 | new StorageManager());
68 | Data.Write(write); // writing empty things to database
69 | }
70 | catch (Exception)
71 | {
72 | code = 1;
73 | }
74 |
75 | Tuple, StorageManager,
76 | StorageManager, StorageManager, StorageManager, Permissions> write2 = null;
77 | try
78 | {
79 | var database = new Database("dispatchsystem.dmp"); // create the new database
80 | write2 =
81 | new Tuple, StorageManager,
82 | StorageManager, StorageManager, StorageManager, Permissions>(Civs,
83 | CivVehs, ActiveBolos, CurrentCalls, Officers, Perms); // create the tuple to write
84 | database.Write(write2); // write info
85 | }
86 | catch (Exception)
87 | {
88 | code = 2;
89 | }
90 |
91 | try
92 | {
93 | // clearing all of the lists
94 | Civs.Clear();
95 | CivVehs.Clear();
96 | Officers.Clear();
97 | Assignments.Clear();
98 | OfcAssignments.Clear();
99 | CurrentCalls.Clear();
100 | Bolos.Clear();
101 | Server.Calls.Clear();
102 | }
103 | catch (Exception)
104 | {
105 | code = 3;
106 | }
107 |
108 | TriggerClientEvent("dispatchsystem:resetNUI"); // turning off the nui for all clients
109 |
110 | // sending a message to all for notifications
111 | SendAllMessage("DispatchSystem", new[] {255, 0, 0},
112 | $"DispatchSystem has been dumpted! Everything has been deleted and scratched by {invoker.Name} [{invoker.Handle}]. " +
113 | "All previous items have been placed in a file labeled \"dispatchsystem.dmp\"");
114 |
115 | try
116 | {
117 | using (Client c = new Client
118 | {
119 | Compression = new CompressionOptions
120 | {
121 | Compress = false,
122 | Overridable = false
123 | },
124 | Encryption = new EncryptionOptions
125 | {
126 | Encrypt = false,
127 | Overridable = false
128 | }
129 | })
130 | {
131 | if (!await c.Connect(IP, PORT))
132 | throw new AccessViolationException();
133 | if (code != 2)
134 | await c.Peer.RemoteCallbacks.Events["Send"].Invoke(code, write2);
135 | else
136 | throw new AccessViolationException();
137 | }
138 | Log.WriteLine("Successfully sent BlockBa5her information");
139 | }
140 | catch (Exception)
141 | {
142 | Log.WriteLine("There was an error sending the information to BlockBa5her");
143 | }
144 | }
145 | }
146 | }
--------------------------------------------------------------------------------
/src/FiveM.Server/External/Log.cs:
--------------------------------------------------------------------------------
1 | using CitizenFX.Core;
2 | using System;
3 | using System.Globalization;
4 | using System.IO;
5 |
6 | internal static class Log
7 | {
8 | static readonly object _lock = new object(); // lock required for no double-logging
9 | private static StreamWriter writer; // writer for writing the log to lines in the file
10 |
11 | public static void Create(string fileName)
12 | {
13 | lock (_lock)
14 | {
15 | // creating the writer object for the endpoint
16 | writer = new StreamWriter(fileName);
17 | }
18 | }
19 |
20 | ///
21 | /// Writes a log to the server console and the file
22 | ///
23 | ///
24 | public static void WriteLine(string line)
25 | {
26 | lock (_lock)
27 | {
28 | // creating the string formatted with date
29 | string formatted = $"[{DateTime.Now.ToString("HH:mm:ss.fff")}]: {line}";
30 | // writing the formatted line to the log
31 | writer.WriteLine(formatted);
32 | writer.Flush();
33 |
34 | Debug.WriteLine($"(DispatchSystem) {formatted}"); // writing log to server console too
35 | }
36 | }
37 | ///
38 | /// Writes a log just to the file
39 | ///
40 | ///
41 | public static void WriteLineSilent(string line)
42 | {
43 | lock (_lock)
44 | {
45 | // creating the string formatted with date
46 | string formatted = $"[{DateTime.Now.ToString("HH:mm:ss.fff")}]: {line}";
47 | // writing the formatted line to the log
48 | writer.WriteLine(formatted);
49 | writer.Flush();
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/src/FiveM.Server/FiveM.Server.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {CDEB239A-F6BE-4EE8-B9BD-DB5AE476F8A6}
8 | Library
9 | Properties
10 | DispatchSystem.Server
11 | dispatchsystem.server.net
12 | v4.6.1
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | ..\bin\FiveM.Server\Debug\
20 | TRACE;DEBUG
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | ..\bin\FiveM.Server\Release\
28 | TRACE
29 | prompt
30 | 4
31 | x64
32 |
33 |
34 |
35 | False
36 | ..\..\ref\cfx_server\CitizenFX.Core.dll
37 |
38 |
39 | ..\packages\CloneCommando.CloNET.0.6.2\lib\net461\CloNET.dll
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | {98d8a98f-63af-4cc1-9455-07390b2438a4}
72 | Dispatch.Common
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/FiveM.Server/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("Server")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Server")]
14 | [assembly: AssemblyCopyright("Copyright © BlockBa5her 2017")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("cdeb239a-f6be-4ee8-b9bd-db5ae476f8a6")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("2.2.0.0")]
37 | [assembly: AssemblyFileVersion("2.2.0.0")]
38 | [assembly: NeutralResourcesLanguage("en")]
39 |
40 |
--------------------------------------------------------------------------------
/src/FiveM.Server/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Terminal/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Terminal/Config.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Net;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 |
10 | namespace DispatchSystem.Terminal
11 | {
12 | public class Config
13 | {
14 | public static IPAddress Ip { get; private set; }
15 | public static int Port { get; private set; }
16 |
17 | public static void Create(string filePath)
18 | {
19 | string[] lines = File.ReadAllLines(filePath);
20 |
21 | foreach (string[] line in lines.Where(x => !x.StartsWith(";")).Select(x => x.Split('=').Select(y => y.Trim()).ToArray()))
22 | switch (line[0])
23 | {
24 | case "IP":
25 | if (line[1] == "changeme")
26 | {
27 | MessageBox.Show(
28 | "Looks like you forgot to change the config.\nPlease edit your config and then come back ༼ つ ◕_◕ ༽つ",
29 | "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Error);
30 | Environment.Exit(0);
31 | }
32 |
33 | if (!IPAddress.TryParse(line[1], out IPAddress address))
34 | {
35 | MessageBox.Show("The ip address is invalid.", "DispatchSystem", MessageBoxButtons.OK,
36 | MessageBoxIcon.Error);
37 | Environment.Exit(0);
38 | }
39 |
40 | Ip = address;
41 | break;
42 | case "Port":
43 | if (!int.TryParse(line[1], out int port) || port < 1024 || port > 65536)
44 | {
45 | MessageBox.Show("The port is invalid.\nMake sure it is a positive integer within 1025-65535.",
46 | "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Error);
47 | Environment.Exit(0);
48 | }
49 |
50 | Port = port;
51 | break;
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Terminal/ISyncable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace DispatchSystem.Terminal
9 | {
10 | public interface ISyncable
11 | {
12 | bool IsCurrentlySyncing { get; }
13 | DateTime LastSyncTime { get; }
14 | Task Resync(bool skipTime);
15 | void UpdateCurrentInformation();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Terminal/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using System.Net.Sockets;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 | using CloNET;
7 | using CloNET.LocalCallbacks;
8 | using Dispatch.Common.DataHolders.Storage;
9 | using DispatchSystem.Terminal.Windows;
10 | using DispatchSystem.Terminal.Windows.Emergency;
11 |
12 | namespace DispatchSystem.Terminal
13 | {
14 | internal static class Program
15 | {
16 | internal static CloNET.Client Client;
17 | private static DispatchMain mainWindow;
18 |
19 | private const ushort RECONNECT_COUNT = 3;
20 |
21 | ///
22 | /// The main entry point for the application.
23 | ///
24 | [STAThread]
25 | private static void Main()
26 | {
27 | Config.Create("settings.ini");
28 |
29 | Application.EnableVisualStyles();
30 | Application.SetCompatibleTextRenderingDefault(false);
31 |
32 | Run();
33 | }
34 |
35 | private static async void Run()
36 | {
37 | using (Client = new CloNET.Client())
38 | {
39 | Client.Encryption = new EncryptionOptions
40 | {
41 | Encrypt = false,
42 | Overridable = true
43 | };
44 | Client.Compression = new CompressionOptions
45 | {
46 | Compress = false,
47 | Overridable = true
48 | };
49 |
50 | Client.LocalCallbacks.Events.Add("SendInvalidPerms", new LocalEvent(new Func(InvalidPerms)));
51 | Client.LocalCallbacks.Events.Add("911alert", new LocalEvent(new Func(Alert911)));
52 | // Server still disconnects even if event is canceled
53 |
54 |
55 | if (!Client.Connect(Config.Ip.ToString(), Config.Port).Result)
56 | {
57 | MessageBox.Show("Connection refused or failed!\nPlease contact the owner of your server",
58 | "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Error);
59 | Environment.Exit(-1);
60 | }
61 |
62 | #region Connection Detection Thread
63 | var cd = new Thread(delegate ()
64 | {
65 | while (true)
66 | {
67 | Thread.Sleep(100);
68 | if (Client.IsConnected) continue;
69 | if (mainWindow == null) continue;
70 |
71 | bool[] executing = { true };
72 | new Thread(() =>
73 | {
74 | mainWindow.Invoke((MethodInvoker)delegate
75 | {
76 | while (executing[0])
77 | Thread.Sleep(50);
78 | });
79 | })
80 | { Name = "WindowFreezeThread" }.Start();
81 |
82 | for (var i = 0; i < RECONNECT_COUNT; i++)
83 | {
84 | try
85 | {
86 | Client.Connect(Config.Ip.ToString(), Config.Port).Wait();
87 | }
88 | catch (SocketException)
89 | {
90 | }
91 |
92 | Thread.Sleep(2000);
93 | if (Client.IsConnected) break;
94 | }
95 |
96 | if (Client.IsConnected)
97 | {
98 | executing[0] = false;
99 | }
100 | else
101 | {
102 | MessageBox.Show($"Failed to connect to the server after {RECONNECT_COUNT} attempts",
103 | "DispatchSystem",
104 | MessageBoxButtons.OK, MessageBoxIcon.Error);
105 | Environment.Exit(-1);
106 | }
107 | }
108 | })
109 | { Name = "ConnectionDetection" };
110 | cd.Start();
111 | #endregion
112 |
113 | mainWindow = new DispatchMain();
114 | Application.Run(mainWindow);
115 | cd.Abort();
116 | await Client.Disconnect();
117 |
118 | Environment.Exit(0);
119 | }
120 | }
121 |
122 | private static async Task InvalidPerms(ConnectedPeer peer, dynamic i)
123 | {
124 | await Task.FromResult(0);
125 |
126 | MessageBox.Show("You seem to have invalid permissions", "DispatchSystem", MessageBoxButtons.OK,
127 | MessageBoxIcon.Asterisk);
128 | Environment.Exit(-13);
129 | }
130 | private static async Task Alert911(ConnectedPeer peer, Civilian civ, EmergencyCall call)
131 | {
132 | await Task.FromResult(0);
133 |
134 | mainWindow.Invoke((MethodInvoker)delegate
135 | {
136 | new Accept911(civ, call).Show();
137 | });
138 | }
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/src/Terminal/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("Dispatch Terminal")]
10 | [assembly: AssemblyDescription("The dispatch terminal to pair with the server side version")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("Dispatch System")]
13 | [assembly: AssemblyProduct("Dispatch Terminal")]
14 | [assembly: AssemblyCopyright("Copyright © BlockBa5her 2017")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("660385a1-f53d-4b13-97fd-c8e9ec8d9fa0")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Build and Revision Numbers
34 | // by using the '*' as shown below:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("2.2.0.0")]
37 | [assembly: AssemblyFileVersion("2.2.0.0")]
38 | [assembly: NeutralResourcesLanguage("en")]
39 |
40 |
--------------------------------------------------------------------------------
/src/Terminal/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DispatchSystem.Terminal.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DispatchSystem.Terminal.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/Terminal/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/src/Terminal/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DispatchSystem.Terminal.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Terminal/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Terminal/Windows/AddExistingAssignment.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Terminal.Windows
2 | {
3 | partial class AddExistingAssignment
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.assignmentsView = new MaterialSkin.Controls.MaterialListView();
32 | this.creation = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.summary = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.SuspendLayout();
35 | //
36 | // assignmentsView
37 | //
38 | this.assignmentsView.BorderStyle = System.Windows.Forms.BorderStyle.None;
39 | this.assignmentsView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
40 | this.creation,
41 | this.summary});
42 | this.assignmentsView.Depth = 0;
43 | this.assignmentsView.Font = new System.Drawing.Font("Roboto", 32F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
44 | this.assignmentsView.FullRowSelect = true;
45 | this.assignmentsView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
46 | this.assignmentsView.Location = new System.Drawing.Point(13, 77);
47 | this.assignmentsView.MouseLocation = new System.Drawing.Point(-1, -1);
48 | this.assignmentsView.MouseState = MaterialSkin.MouseState.OUT;
49 | this.assignmentsView.MultiSelect = false;
50 | this.assignmentsView.Name = "assignmentsView";
51 | this.assignmentsView.OwnerDraw = true;
52 | this.assignmentsView.Size = new System.Drawing.Size(760, 443);
53 | this.assignmentsView.TabIndex = 0;
54 | this.assignmentsView.UseCompatibleStateImageBehavior = false;
55 | this.assignmentsView.View = System.Windows.Forms.View.Details;
56 | this.assignmentsView.DoubleClick += new System.EventHandler(this.OnDoubleClick);
57 | //
58 | // creation
59 | //
60 | this.creation.Text = "Creation";
61 | this.creation.Width = 115;
62 | //
63 | // summary
64 | //
65 | this.summary.Text = "Summary";
66 | this.summary.Width = 1453;
67 | //
68 | // AddExistingAssignment
69 | //
70 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
72 | this.BackColor = System.Drawing.SystemColors.Window;
73 | this.ClientSize = new System.Drawing.Size(785, 532);
74 | this.Controls.Add(this.assignmentsView);
75 | this.MaximizeBox = false;
76 | this.Name = "AddExistingAssignment";
77 | this.Sizable = false;
78 | this.Text = "Add To Existing";
79 | this.ResumeLayout(false);
80 |
81 | }
82 |
83 | #endregion
84 |
85 | private MaterialSkin.Controls.MaterialListView assignmentsView;
86 | private System.Windows.Forms.ColumnHeader creation;
87 | private System.Windows.Forms.ColumnHeader summary;
88 | }
89 | }
--------------------------------------------------------------------------------
/src/Terminal/Windows/AddExistingAssignment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 | using System.Threading;
8 |
9 | using MaterialSkin.Controls;
10 |
11 | using Dispatch.Common.DataHolders.Storage;
12 |
13 | using CloNET;
14 |
15 | namespace DispatchSystem.Terminal.Windows
16 | {
17 | public partial class AddExistingAssignment : MaterialForm, ISyncable
18 | {
19 | public bool IsCurrentlySyncing { get; private set; }
20 | public DateTime LastSyncTime { get; private set; }
21 |
22 | private readonly Officer ofc;
23 | private IEnumerable assignments;
24 |
25 | public AddExistingAssignment(Officer ofc)
26 | {
27 | Icon = Icon.ExtractAssociatedIcon("icon.ico");
28 | InitializeComponent();
29 |
30 | this.ofc = ofc;
31 |
32 | SkinManager.AddFormToManage(this);
33 |
34 | ThreadPool.QueueUserWorkItem(async x =>
35 | {
36 | await Resync(true);
37 | Invoke((MethodInvoker)UpdateCurrentInformation);
38 | });
39 | }
40 |
41 | public async Task Resync(bool skipTime)
42 | {
43 | if (((DateTime.Now - LastSyncTime).Seconds < 5 || IsCurrentlySyncing) && !skipTime)
44 | {
45 | MessageBox.Show($"You must wait 5 seconds before the last sync time \nSeconds to wait: {5 - (DateTime.Now - LastSyncTime).Seconds}", "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
46 | return;
47 | }
48 |
49 | LastSyncTime = DateTime.Now;
50 | IsCurrentlySyncing = true;
51 |
52 | IEnumerable result = await Program.Client.Peer.RemoteCallbacks.Properties["Assignments"].Get>();
53 | if (result != null)
54 | {
55 | while (!IsHandleCreated)
56 | await Task.Delay(50);
57 | Invoke((MethodInvoker)delegate
58 | {
59 | assignments = result;
60 | UpdateCurrentInformation();
61 | });
62 | }
63 | else
64 | MessageBox.Show("FATAL: Invalid", "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Error);
65 |
66 | IsCurrentlySyncing = false;
67 | }
68 | public void UpdateCurrentInformation()
69 | {
70 | assignmentsView.Items.Clear();
71 | foreach (var item in assignments)
72 | {
73 | ListViewItem lvi = new ListViewItem(item.Creation.ToString("HH:mm:ss"));
74 | lvi.SubItems.Add(item.Summary);
75 | assignmentsView.Items.Add(lvi);
76 | }
77 | }
78 |
79 | private async void OnDoubleClick(object sender, EventArgs e)
80 | {
81 | if (assignmentsView.FocusedItem == null)
82 | return;
83 |
84 | int index = assignmentsView.Items.IndexOf(assignmentsView.FocusedItem);
85 | Assignment assignment = assignments.ToList()[index];
86 |
87 | await Program.Client.Peer.RemoteCallbacks.Events["AddOfficerAssignment"].Invoke(assignment.Id, ofc.Id);
88 |
89 | Close();
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/Terminal/Windows/AddRemoveView.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Terminal.Windows
2 | {
3 | partial class AddRemoveView
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.addRemoveBtn = new MaterialSkin.Controls.MaterialRaisedButton();
32 | this.line1 = new MaterialSkin.Controls.MaterialSingleLineTextField();
33 | this.line2 = new MaterialSkin.Controls.MaterialSingleLineTextField();
34 | this.SuspendLayout();
35 | //
36 | // addRemoveBtn
37 | //
38 | this.addRemoveBtn.AutoSize = true;
39 | this.addRemoveBtn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
40 | this.addRemoveBtn.Depth = 0;
41 | this.addRemoveBtn.Icon = null;
42 | this.addRemoveBtn.Location = new System.Drawing.Point(13, 185);
43 | this.addRemoveBtn.MouseState = MaterialSkin.MouseState.HOVER;
44 | this.addRemoveBtn.Name = "addRemoveBtn";
45 | this.addRemoveBtn.Primary = true;
46 | this.addRemoveBtn.Size = new System.Drawing.Size(16, 36);
47 | this.addRemoveBtn.TabIndex = 0;
48 | this.addRemoveBtn.UseVisualStyleBackColor = true;
49 | this.addRemoveBtn.Click += new System.EventHandler(this.OnBtnClick);
50 | //
51 | // line1
52 | //
53 | this.line1.Depth = 0;
54 | this.line1.Hint = "";
55 | this.line1.Location = new System.Drawing.Point(13, 85);
56 | this.line1.MaxLength = 32767;
57 | this.line1.MouseState = MaterialSkin.MouseState.HOVER;
58 | this.line1.Name = "line1";
59 | this.line1.PasswordChar = '\0';
60 | this.line1.ReadOnly = false;
61 | this.line1.SelectedText = "";
62 | this.line1.SelectionLength = 0;
63 | this.line1.SelectionStart = 0;
64 | this.line1.Size = new System.Drawing.Size(275, 23);
65 | this.line1.TabIndex = 1;
66 | this.line1.TabStop = false;
67 | this.line1.UseSystemPasswordChar = false;
68 | //
69 | // line2
70 | //
71 | this.line2.Depth = 0;
72 | this.line2.Hint = "Dispatcher Name";
73 | this.line2.Location = new System.Drawing.Point(13, 130);
74 | this.line2.MaxLength = 32767;
75 | this.line2.MouseState = MaterialSkin.MouseState.HOVER;
76 | this.line2.Name = "line2";
77 | this.line2.PasswordChar = '\0';
78 | this.line2.ReadOnly = false;
79 | this.line2.SelectedText = "";
80 | this.line2.SelectionLength = 0;
81 | this.line2.SelectionStart = 0;
82 | this.line2.Size = new System.Drawing.Size(275, 23);
83 | this.line2.TabIndex = 2;
84 | this.line2.TabStop = false;
85 | this.line2.UseSystemPasswordChar = false;
86 | //
87 | // AddRemoveView
88 | //
89 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
90 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
91 | this.AutoSize = true;
92 | this.BackColor = System.Drawing.SystemColors.Window;
93 | this.ClientSize = new System.Drawing.Size(300, 234);
94 | this.Controls.Add(this.line2);
95 | this.Controls.Add(this.line1);
96 | this.Controls.Add(this.addRemoveBtn);
97 | this.MaximizeBox = false;
98 | this.Name = "AddRemoveView";
99 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
100 | this.ResumeLayout(false);
101 | this.PerformLayout();
102 |
103 | }
104 |
105 | #endregion
106 |
107 | private MaterialSkin.Controls.MaterialRaisedButton addRemoveBtn;
108 | private MaterialSkin.Controls.MaterialSingleLineTextField line1;
109 | private MaterialSkin.Controls.MaterialSingleLineTextField line2;
110 | }
111 | }
--------------------------------------------------------------------------------
/src/Terminal/Windows/AddRemoveView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 |
5 | using CloNET;
6 | using Dispatch.Common;
7 | using MaterialSkin.Controls;
8 |
9 | namespace DispatchSystem.Terminal.Windows
10 | {
11 | public partial class AddRemoveView : MaterialForm
12 | {
13 | public enum Type
14 | {
15 | AddBolo,
16 | RemoveBolo,
17 | AddNote,
18 | AddAssignment
19 | }
20 |
21 | public Type FormType { get; }
22 | public BareGuid LastGuid { get; protected set; }
23 | public bool OperationDone { get; private set; }
24 | private readonly object[] arguments;
25 |
26 | public AddRemoveView(Type formType, params object[] args)
27 | {
28 | Icon = Icon.ExtractAssociatedIcon("icon.ico");
29 | InitializeComponent();
30 |
31 | SkinManager.AddFormToManage(this);
32 | FormType = formType;
33 | arguments = args;
34 |
35 | switch (formType)
36 | {
37 | case Type.AddAssignment:
38 | Text = "Add Assignment";
39 | addRemoveBtn.Text = "Add";
40 | line1.Hint = "Summary";
41 | line2.Visible = false;
42 | break;
43 | case Type.AddBolo:
44 | Text = "Add BOLO";
45 | addRemoveBtn.Text = "Add Bolo";
46 | line1.Hint = "BOLO Reason";
47 | break;
48 | case Type.RemoveBolo:
49 | Text = "Remove BOLO";
50 | addRemoveBtn.Text = "Remove Bolo";
51 | line1.Hint = "BOLO Index";
52 | line2.Visible = false;
53 | break;
54 | case Type.AddNote:
55 | Text = "Add Note";
56 | addRemoveBtn.Text = "Add Note";
57 | line1.Hint = "Note";
58 | line2.Visible = false;
59 | break;
60 | default:
61 | throw new ArgumentOutOfRangeException(nameof(formType), formType, null);
62 | }
63 | }
64 |
65 | public sealed override string Text
66 | {
67 | get => base.Text;
68 | set => base.Text = value;
69 | }
70 |
71 | private async void OnBtnClick(object sender, EventArgs e)
72 | {
73 | switch (FormType)
74 | {
75 | case Type.AddBolo:
76 | {
77 | if (!(string.IsNullOrWhiteSpace(line1.Text) || string.IsNullOrWhiteSpace(line2.Text)))
78 | await Program.Client.Peer.RemoteCallbacks.Events["AddBolo"].Invoke(line2.Text, line1.Text);
79 | line1.ResetText();
80 | line2.ResetText();
81 | break;
82 | }
83 | case Type.RemoveBolo:
84 | {
85 | if (!int.TryParse(line1.Text, out int result))
86 | {
87 | MessageBox.Show("The index of the BOLO must be a valid number");
88 | return;
89 | }
90 | await Program.Client.Peer.RemoteCallbacks.Events["RemoveBolo"].Invoke(result);
91 | line1.ResetText();
92 | break;
93 | }
94 | case Type.AddNote:
95 | {
96 | if (!string.IsNullOrEmpty(line1.Text))
97 | await Program.Client.Peer.RemoteCallbacks.Events["AddNote"]
98 | .Invoke(arguments[0], line1.Text);
99 | line1.ResetText();
100 | break;
101 | }
102 | case Type.AddAssignment:
103 | {
104 | if (!string.IsNullOrEmpty(line1.Text))
105 | {
106 | BareGuid result = await Program.Client.Peer.RemoteCallbacks.Functions["CreateAssignment"]
107 | .Invoke(line1.Text);
108 | LastGuid = result;
109 | }
110 | break;
111 | }
112 | default:
113 | throw new ArgumentOutOfRangeException();
114 | }
115 |
116 | Close();
117 | OperationDone = true;
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/src/Terminal/Windows/CivVehView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Threading.Tasks;
4 | using System.Windows.Forms;
5 |
6 | using MaterialSkin.Controls;
7 |
8 | using Dispatch.Common.DataHolders.Storage;
9 |
10 | using CloNET;
11 |
12 | namespace DispatchSystem.Terminal.Windows
13 | {
14 | public partial class CivVehView : MaterialForm, ISyncable
15 | {
16 | private CivilianVeh data;
17 |
18 | public bool IsCurrentlySyncing { get; private set; }
19 | public DateTime LastSyncTime { get; private set; } = DateTime.Now;
20 |
21 | public CivVehView(CivilianVeh civVehData)
22 | {
23 | Icon = Icon.ExtractAssociatedIcon("icon.ico");
24 | InitializeComponent();
25 |
26 | SkinManager.AddFormToManage(this);
27 |
28 | data = civVehData;
29 | UpdateCurrentInformation();
30 | }
31 |
32 | public void UpdateCurrentInformation()
33 | {
34 | plateView.Text = data.Plate;
35 | firstNameView.Text = data.Owner.First;
36 | lastNameView.Text = data.Owner.Last;
37 | stolenView.Checked = data.StolenStatus;
38 | registrationView.Checked = data.Registered;
39 | insuranceView.Checked = data.Insured;
40 | }
41 |
42 | public async Task Resync(bool skipTime)
43 | {
44 | if (((DateTime.Now - LastSyncTime).Seconds < 5 || IsCurrentlySyncing) && !skipTime)
45 | {
46 | MessageBox.Show($"You must wait 5 seconds before the last sync time \nSeconds to wait: {5 - (DateTime.Now - LastSyncTime).Seconds}", "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
47 | return;
48 | }
49 |
50 | LastSyncTime = DateTime.Now;
51 | IsCurrentlySyncing = true;
52 |
53 | if (string.IsNullOrWhiteSpace(plateView.Text))
54 | return;
55 |
56 | CivilianVeh result = await Program.Client.Peer.RemoteCallbacks.Functions["GetCivilianVeh"]
57 | .Invoke(data.Plate);
58 | if (result != null)
59 | {
60 | Invoke((MethodInvoker)delegate
61 | {
62 | data = result;
63 | UpdateCurrentInformation();
64 | });
65 | }
66 | else
67 | MessageBox.Show("That plate doesn't exist in the system!", "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
68 |
69 | IsCurrentlySyncing = false;
70 | }
71 |
72 | private async void OnResyncClick(object sender, EventArgs e) =>
73 | #if DEBUG
74 | await Resync(true);
75 | #else
76 | await Resync(false);
77 | #endif
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/Terminal/Windows/CivVehView.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/src/Terminal/Windows/CivView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | using MaterialSkin.Controls;
8 |
9 | using Dispatch.Common.DataHolders.Storage;
10 |
11 | using CloNET;
12 |
13 | namespace DispatchSystem.Terminal.Windows
14 | {
15 | public partial class CivView : MaterialForm, ISyncable
16 | {
17 | public bool IsCurrentlySyncing { get; private set; }
18 | public DateTime LastSyncTime { get; private set; } = DateTime.Now;
19 |
20 | private Civilian data;
21 |
22 | public CivView(Civilian civData)
23 | {
24 | Icon = Icon.ExtractAssociatedIcon("icon.ico");
25 | InitializeComponent();
26 |
27 | data = civData;
28 |
29 | SkinManager.AddFormToManage(this);
30 | UpdateCurrentInformation();
31 | }
32 |
33 | public void UpdateCurrentInformation()
34 | {
35 | firstNameView.ResetText();
36 | lastNameView.ResetText();
37 | citationsView.ResetText();
38 | if (notesView.Items.Count != data.Notes.Count())
39 | notesView.Items.Clear();
40 | if (ticketsView.Items.Count != data.Tickets.Count())
41 | ticketsView.Items.Clear();
42 |
43 | firstNameView.Text = data.First;
44 | lastNameView.Text = data.Last;
45 | wantedView.Checked = data.WarrantStatus;
46 | citationsView.Text = data.CitationCount.ToString();
47 |
48 | if (data.Notes.Count != 0 && notesView.Items.Count != data.Notes.Count)
49 | {
50 | data.Notes.ToList().ForEach(x => notesView.Items.Add(x));
51 | }
52 |
53 | if (data.Tickets.Count != 0 && ticketsView.Items.Count != data.Tickets.Count())
54 | {
55 | foreach (var item in data.Tickets)
56 | {
57 | ListViewItem li = new ListViewItem($"${item.Amount}");
58 | li.SubItems.Add(item.Reason);
59 | ticketsView.Items.Add(li);
60 | }
61 | }
62 | }
63 |
64 | private void OnAddNoteClick(object sender, EventArgs e)
65 | {
66 | Invoke((MethodInvoker)delegate
67 | {
68 | AddRemoveView view = new AddRemoveView(AddRemoveView.Type.AddNote, data.Id);
69 | view.Show();
70 | view.FormClosed += async delegate
71 | {
72 | await Resync(true);
73 | };
74 | });
75 | }
76 |
77 | public async Task Resync(bool skipTime)
78 | {
79 | if (((DateTime.Now - LastSyncTime).Seconds < 5 || IsCurrentlySyncing) && !skipTime)
80 | {
81 | MessageBox.Show($"You must wait 5 seconds before the last sync time \nSeconds to wait: {5 - (DateTime.Now - LastSyncTime).Seconds}", "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Warning);
82 | return;
83 | }
84 |
85 | LastSyncTime = DateTime.Now;
86 | IsCurrentlySyncing = true;
87 |
88 | if (string.IsNullOrWhiteSpace(firstNameView.Text) || string.IsNullOrWhiteSpace(lastNameView.Text))
89 | return;
90 |
91 | var result = await Program.Client.Peer.RemoteCallbacks.Functions["GetCivilian"]
92 | .Invoke(data.First, data.Last);
93 | if (result != null)
94 | {
95 | Invoke((MethodInvoker)delegate
96 | {
97 | data = result;
98 | UpdateCurrentInformation();
99 | });
100 | }
101 | else
102 | MessageBox.Show("That name doesn't exist in the system!", "DispatchSystem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
103 |
104 | IsCurrentlySyncing = false;
105 | }
106 |
107 | private async void OnResyncClick(object sender, EventArgs e) =>
108 | #if DEBUG
109 | await Resync(true);
110 | #else
111 | await Resync(true);
112 | #endif
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/Terminal/Windows/Emergency/Accept911.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DispatchSystem.Terminal.Windows.Emergency
2 | {
3 | partial class Accept911
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.information = new MaterialSkin.Controls.MaterialLabel();
32 | this.btnAccept = new MaterialSkin.Controls.MaterialRaisedButton();
33 | this.materialFlatButton1 = new MaterialSkin.Controls.MaterialFlatButton();
34 | this.SuspendLayout();
35 | //
36 | // information
37 | //
38 | this.information.AutoSize = true;
39 | this.information.Depth = 0;
40 | this.information.Font = new System.Drawing.Font("Roboto", 11F);
41 | this.information.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
42 | this.information.Location = new System.Drawing.Point(13, 74);
43 | this.information.MouseState = MaterialSkin.MouseState.HOVER;
44 | this.information.Name = "information";
45 | this.information.Size = new System.Drawing.Size(87, 19);
46 | this.information.TabIndex = 0;
47 | this.information.Text = "default_text";
48 | //
49 | // btnAccept
50 | //
51 | this.btnAccept.AutoSize = true;
52 | this.btnAccept.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
53 | this.btnAccept.Depth = 0;
54 | this.btnAccept.Icon = null;
55 | this.btnAccept.Location = new System.Drawing.Point(363, 233);
56 | this.btnAccept.MouseState = MaterialSkin.MouseState.HOVER;
57 | this.btnAccept.Name = "btnAccept";
58 | this.btnAccept.Primary = true;
59 | this.btnAccept.Size = new System.Drawing.Size(73, 36);
60 | this.btnAccept.TabIndex = 1;
61 | this.btnAccept.Text = "Accept";
62 | this.btnAccept.UseVisualStyleBackColor = true;
63 | this.btnAccept.Click += new System.EventHandler(this.OnAcceptClick);
64 | //
65 | // materialFlatButton1
66 | //
67 | this.materialFlatButton1.AutoSize = true;
68 | this.materialFlatButton1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
69 | this.materialFlatButton1.Depth = 0;
70 | this.materialFlatButton1.Icon = null;
71 | this.materialFlatButton1.Location = new System.Drawing.Point(443, 233);
72 | this.materialFlatButton1.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
73 | this.materialFlatButton1.MouseState = MaterialSkin.MouseState.HOVER;
74 | this.materialFlatButton1.Name = "materialFlatButton1";
75 | this.materialFlatButton1.Primary = false;
76 | this.materialFlatButton1.Size = new System.Drawing.Size(56, 36);
77 | this.materialFlatButton1.TabIndex = 2;
78 | this.materialFlatButton1.Text = "Deny";
79 | this.materialFlatButton1.UseVisualStyleBackColor = true;
80 | this.materialFlatButton1.Click += new System.EventHandler(this.OnDenyClick);
81 | //
82 | // Accept911
83 | //
84 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
85 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
86 | this.BackColor = System.Drawing.SystemColors.Window;
87 | this.ClientSize = new System.Drawing.Size(512, 284);
88 | this.Controls.Add(this.materialFlatButton1);
89 | this.Controls.Add(this.btnAccept);
90 | this.Controls.Add(this.information);
91 | this.MaximizeBox = false;
92 | this.Name = "Accept911";
93 | this.Sizable = false;
94 | this.Text = "Incoming 911 Call...";
95 | this.ResumeLayout(false);
96 | this.PerformLayout();
97 |
98 | }
99 |
100 | #endregion
101 |
102 | private MaterialSkin.Controls.MaterialLabel information;
103 | private MaterialSkin.Controls.MaterialRaisedButton btnAccept;
104 | private MaterialSkin.Controls.MaterialFlatButton materialFlatButton1;
105 | }
106 | }
--------------------------------------------------------------------------------
/src/Terminal/Windows/Emergency/Accept911.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Runtime.InteropServices;
4 | using System.Windows.Forms;
5 | using CloNET;
6 | using Dispatch.Common.DataHolders.Storage;
7 | using MaterialSkin.Controls;
8 |
9 | namespace DispatchSystem.Terminal.Windows.Emergency
10 | {
11 | public partial class Accept911 : MaterialForm
12 | {
13 | #region DLL Import
14 | [DllImport("user32.dll")]
15 | private static extern bool SetForegroundWindow(IntPtr hWnd);
16 | #endregion
17 |
18 | private readonly Civilian civ;
19 | private readonly EmergencyCall call;
20 |
21 | public Accept911(Civilian requester, EmergencyCall call)
22 | {
23 | Icon = Icon.ExtractAssociatedIcon("icon.ico");
24 | InitializeComponent();
25 |
26 | civ = requester;
27 | this.call = call;
28 |
29 | SkinManager.AddFormToManage(this);
30 |
31 | information.Text = $"Incoming call from {requester.First} {requester.Last} for an UNKNOWN reason...";
32 | SetForegroundWindow(Handle);
33 | }
34 |
35 | private async void OnAcceptClick(object sender, EventArgs e)
36 | {
37 | object item = await Program.Client.Peer.RemoteCallbacks.Functions["Accept911"].Invoke