diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..0f9996583 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,24 @@ +CDKey: + - "src/Servers/CDKey/**" + +Chat: + - "src/Servers/Chat/**" + +Game Status: + - "src/Servers/GameStatus/**" + +Nat Negotation: + - "src/Servers/NATNegotiation/**" + +Presence System: + - "src/Servers/PresenceConnectionManager/**" + - "src/Servers/PresenceSearchPlayer/**" + +Query Report: + - "src/Servers/QueryReport/**" + +Server Browser: + - "src/Servers/ServerBrowser/**" + +Web Services: + - "src/Servers/WebServices/**" \ No newline at end of file diff --git a/.github/workflows/cd-cdkey.yml b/.github/workflows/cd-cdkey.yml new file mode 100644 index 000000000..86259dd89 --- /dev/null +++ b/.github/workflows/cd-cdkey.yml @@ -0,0 +1,35 @@ +name: CD - CDKey + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/CDKey/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/cdkey + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/CDKey/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/cdkey + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/CDKey/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-chat.yml b/.github/workflows/cd-chat.yml new file mode 100644 index 000000000..63acc6828 --- /dev/null +++ b/.github/workflows/cd-chat.yml @@ -0,0 +1,35 @@ +name: CD - Chat + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/Chat/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/chat + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/Chat/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/chat + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/Chat/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-gs.yml b/.github/workflows/cd-gs.yml new file mode 100644 index 000000000..d2f1b365d --- /dev/null +++ b/.github/workflows/cd-gs.yml @@ -0,0 +1,35 @@ +name: CD - GS + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/GameStatus/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/gs + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/GameStatus/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/gs + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/GameStatus/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-nn.yml b/.github/workflows/cd-nn.yml new file mode 100644 index 000000000..597282eb4 --- /dev/null +++ b/.github/workflows/cd-nn.yml @@ -0,0 +1,35 @@ +name: CD - NN + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/NATNegotiation/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/nn + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/NATNegotiation/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/nn + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/NATNegotiation/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-pcm.yml b/.github/workflows/cd-pcm.yml new file mode 100644 index 000000000..369d70c9d --- /dev/null +++ b/.github/workflows/cd-pcm.yml @@ -0,0 +1,35 @@ +name: CD - PCM + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/PresenceConnectionManager/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/pcm + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/PresenceConnectionManager/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/pcm + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/PresenceConnectionManager/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-psp.yml b/.github/workflows/cd-psp.yml new file mode 100644 index 000000000..4f6e505a8 --- /dev/null +++ b/.github/workflows/cd-psp.yml @@ -0,0 +1,35 @@ +name: CD - PSP + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/PresenceSearchPlayer/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/psp + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/PresenceSearchPlayer/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/psp + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/PresenceSearchPlayer/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-qr.yml b/.github/workflows/cd-qr.yml new file mode 100644 index 000000000..d3ebfa4d9 --- /dev/null +++ b/.github/workflows/cd-qr.yml @@ -0,0 +1,35 @@ +name: CD - QR + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/QueryReport/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/qr + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/QueryReport/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/qr + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/QueryReport/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-sb.yml b/.github/workflows/cd-sb.yml new file mode 100644 index 000000000..2f2e0b80c --- /dev/null +++ b/.github/workflows/cd-sb.yml @@ -0,0 +1,35 @@ +name: CD - SB + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/ServerBrowser/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/sb + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/ServerBrowser/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/sb + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/ServerBrowser/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cd-ws.yml b/.github/workflows/cd-ws.yml new file mode 100644 index 000000000..8d5104044 --- /dev/null +++ b/.github/workflows/cd-ws.yml @@ -0,0 +1,35 @@ +name: CD - WS + +on: + push: + branches: + - master + - candidate + paths: + - "src/Servers/WebServices/**" + - "src/Libraries/UniSpyLib/**" + +jobs: + push: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Deploy to staging + if: github.event_name == 'push' && github.ref == 'refs/heads/candidate' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/ws + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/WebServices/Dockerfile + - name: Deploy to production + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + uses: elgohr/Publish-Docker-Github-Action@3.01 + with: + name: gameprogressive/ws + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_KEY }} + tagging: true + dockerfile: ./src/Servers/WebServices/Dockerfile \ No newline at end of file diff --git a/.github/workflows/cdkey-cd.yml b/.github/workflows/cdkey-cd.yml deleted file mode 100644 index c20e84b5a..000000000 --- a/.github/workflows/cdkey-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - CDKey - -on: - push: - paths: - - 'src/Servers/CDKey/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy CDKey to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/cdkey - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/CDKey/Dockerfile - - name: Deploy CDKey to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/cdkey - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/CDKey/Dockerfile \ No newline at end of file diff --git a/.github/workflows/chat-cd.yml b/.github/workflows/chat-cd.yml deleted file mode 100644 index 754a4978d..000000000 --- a/.github/workflows/chat-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - Chat - -on: - push: - paths: - - 'src/Servers/Chat/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy Chat to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/chat - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/Chat/Dockerfile - - name: Deploy Chat to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/chat - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/Chat/Dockerfile \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb3a43a00..8b27604f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,27 +2,26 @@ name: CI on: push: - branches-ignore: + branches: - master - candidate + - develop pull_request: - branches: - - '**' jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) + unispy: runs-on: ${{ matrix.os }} strategy: matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] + os: [ ubuntu-latest, windows-latest, macos-latest ] steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build \ No newline at end of file + - uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v1.7.2 + with: + dotnet-version: 5.0.100 + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore \ No newline at end of file diff --git a/.github/workflows/gs-cd.yml b/.github/workflows/gs-cd.yml deleted file mode 100644 index bd8556b28..000000000 --- a/.github/workflows/gs-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - GS - -on: - push: - paths: - - 'src/Servers/GameStatus/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy GS to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/gstats - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/GameStatus/Dockerfile - - name: Deploy GS to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/gstats - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/GameStatus/Dockerfile \ No newline at end of file diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 000000000..0d40ed334 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,12 @@ +name: "Pull Request Labeler" +on: +- pull_request_target + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v3 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true \ No newline at end of file diff --git a/.github/workflows/nn-cd.yml b/.github/workflows/nn-cd.yml deleted file mode 100644 index ee9603e4e..000000000 --- a/.github/workflows/nn-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - NN - -on: - push: - paths: - - 'src/Servers/NATNegotiation/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy NN to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/nn - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/NATNegotiation/Dockerfile - - name: Deploy NN to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/nn - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/NATNegotiation/Dockerfile \ No newline at end of file diff --git a/.github/workflows/pcm-cd.yml b/.github/workflows/pcm-cd.yml deleted file mode 100644 index 1c802c9bd..000000000 --- a/.github/workflows/pcm-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - PCM - -on: - push: - paths: - - 'src/Servers/PresenceConnectionManager/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy PCM to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/pcm - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/PresenceConnectionManager/Dockerfile - - name: Deploy PCM to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/pcm - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/PresenceConnectionManager/Dockerfile \ No newline at end of file diff --git a/.github/workflows/psp-cd.yml b/.github/workflows/psp-cd.yml deleted file mode 100644 index d172cb80c..000000000 --- a/.github/workflows/psp-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - PSP - -on: - push: - paths: - - 'src/Servers/PresenceSearchPlayer/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy PSP to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/psp - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/PresenceSearchPlayer/Dockerfile - - name: Deploy PSP to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/psp - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/PresenceSearchPlayer/Dockerfile \ No newline at end of file diff --git a/.github/workflows/qr-cd.yml b/.github/workflows/qr-cd.yml deleted file mode 100644 index 6de4bb9d2..000000000 --- a/.github/workflows/qr-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - QR - -on: - push: - paths: - - 'src/Servers/QueryReport/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy QR to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/qr - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/QueryReport/Dockerfile - - name: Deploy QR to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/qr - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/QueryReport/Dockerfile \ No newline at end of file diff --git a/.github/workflows/sb-cd.yml b/.github/workflows/sb-cd.yml deleted file mode 100644 index 31d694ad6..000000000 --- a/.github/workflows/sb-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - SB - -on: - push: - paths: - - 'src/Servers/ServerBrowser/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy SB to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/sb - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/ServerBrowser/Dockerfile - - name: Deploy SB to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/sb - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/ServerBrowser/Dockerfile \ No newline at end of file diff --git a/.github/workflows/ws-cd.yml b/.github/workflows/ws-cd.yml deleted file mode 100644 index e077820af..000000000 --- a/.github/workflows/ws-cd.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: CD - WS - -on: - push: - paths: - - 'src/Servers/WebServices/**' - branches: - - master - - candidate - -jobs: - build: - name: Test on .NET v${{ matrix.dotnet_version }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - dotnet_version: ['5.0.100'] - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v2 - - name: Setup .NET ${{ matrix.dotnet_version }} - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: ${{ matrix.dotnet_version }} - - name: Building project - run: dotnet build - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - env: - DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} - DOCKER_HUB_KEY: ${{ secrets.DOCKER_HUB_KEY }} - steps: - - uses: actions/checkout@v2 - - name: Deploy WS to staging - if: github.ref == 'refs/heads/candidate' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/ws - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/WebServices/Dockerfile - - name: Deploy WS to production - if: github.ref == 'refs/heads/master' - uses: elgohr/Publish-Docker-Github-Action@2.12 - with: - name: gameprogressive/ws - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_KEY }} - tagging: true - dockerfile: ./src/Servers/WebServices/Dockerfile \ No newline at end of file diff --git a/common/DatabaseCreationScript/RetroSpy.sql b/common/DatabaseCreationScript/RetroSpy.sql index 4673ca3ca..96100a924 100644 --- a/common/DatabaseCreationScript/RetroSpy.sql +++ b/common/DatabaseCreationScript/RetroSpy.sql @@ -920,7 +920,7 @@ INSERT INTO `games` (`gameid`, `gamename`, `secretkey`, `description`, `disabled (951, 'ganglandd', NULL, 'Gangland Demo', 0), (952, 'sniperelpc', NULL, 'Sniper Elite (PC)', 0), (954, 'altitude', NULL, 'Altitude', 0), - (955, 'fsx', NULL, 'Flight Simulator 2006', 0), + (955, 'fsx', 'y3Fd8H', 'Flight Simulator X', 0), (956, 'hotwheels2pc', NULL, 'Hot Wheels 2 (PC)', 0), (957, 'hotwheels2ps2', NULL, 'Hot Wheels 2 (PS2)', 0), (958, 'hotwheels2pcd', NULL, 'Hot Wheels 2 Demo (PC)', 0), @@ -1746,8 +1746,8 @@ INSERT INTO `games` (`gameid`, `gamename`, `secretkey`, `description`, `disabled (1842, 'birhhps3', NULL, 'Brothers In Arms: Hell\'s Highway (PS3)', 0), (1843, 'birhhps3am', NULL, 'Brothers In Arms: Hell\'s Highway Clone Automatch (PS3)', 0), (1844, 'sakuraTDDds', NULL, 'Sakura Taisen Dramatic Dungeon - Kimiarugatame (DS)', 0), - (1845, 'fsxa', NULL, 'Flight Simulator X: Acceleration', 0), - (1846, 'fsxaam', NULL, 'Flight Simulator X: Acceleration Automatch', 0), + (1845, 'fsxa', 'edkTBp', 'Flight Simulator X: Acceleration', 0), + (1846, 'fsxaam', 'edkTBp', 'Flight Simulator X: Acceleration Automatch', 0), (1847, 'ee3', NULL, 'Empire Earth 3', 0), (1848, 'nwn2mac', NULL, 'NeverWinter Nights 2 (MAC)', 0), (1849, 'nwn2macam', NULL, 'NeverWinter Nights 2 Automatch (MAC)', 0), diff --git a/common/docker-compose.build.yml b/common/docker-compose.build.yml index ccfb562f6..b82987ff3 100644 --- a/common/docker-compose.build.yml +++ b/common/docker-compose.build.yml @@ -23,11 +23,11 @@ services: stdin_open: true tty: true - natneg: + nn: build: context: ../ - dockerfile: ./src/Servers/NatNegotiation/Dockerfile - image: gameprogressive/natneg + dockerfile: ./src/Servers/NATNegotiation/Dockerfile + image: gameprogressive/nn ports: - "27901:27901" - "27901:27901/udp" @@ -75,11 +75,11 @@ services: stdin_open: true tty: true - gstats: + gs: build: context: ../ - dockerfile: ./src/Servers/StatsAndTracking/Dockerfile - image: gameprogressive/gstats + dockerfile: ./src/Servers/GameStatus/Dockerfile + image: gameprogressive/gs ports: - "29920:29920" stdin_open: true diff --git a/src/Libraries/SOAPMiddleware/SOAPMiddleware.csproj b/src/Libraries/SOAPMiddleware/SOAPMiddleware.csproj index 15f9c114a..6b81ce6cb 100644 --- a/src/Libraries/SOAPMiddleware/SOAPMiddleware.csproj +++ b/src/Libraries/SOAPMiddleware/SOAPMiddleware.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 AnyCPU @@ -12,8 +12,8 @@ - - + + diff --git a/src/Libraries/UniSpyLib/Abstraction/BaseClass/ExpireManagerBase.cs b/src/Libraries/UniSpyLib/Abstraction/BaseClass/ExpireManagerBase.cs index a588943f3..a8e6b26a9 100644 --- a/src/Libraries/UniSpyLib/Abstraction/BaseClass/ExpireManagerBase.cs +++ b/src/Libraries/UniSpyLib/Abstraction/BaseClass/ExpireManagerBase.cs @@ -3,14 +3,14 @@ namespace UniSpyLib.Abstraction.BaseClass { - public abstract class ExpireManagerBase + public abstract class TImerBase { protected static Timer _timer; /// /// Because every resource we manage is global /// so we do not parse any object to this class /// - public ExpireManagerBase() + public TImerBase() { //default settings _timer = new Timer diff --git a/src/Libraries/UniSpyLib/Abstraction/BaseClass/RequestBase.cs b/src/Libraries/UniSpyLib/Abstraction/BaseClass/RequestBase.cs index d39de4a9b..4b75a94f7 100644 --- a/src/Libraries/UniSpyLib/Abstraction/BaseClass/RequestBase.cs +++ b/src/Libraries/UniSpyLib/Abstraction/BaseClass/RequestBase.cs @@ -5,7 +5,7 @@ namespace UniSpyLib.Abstraction.BaseClass { - public class RequestBase + public abstract class RequestBase { public RequestBase() { diff --git a/src/Libraries/UniSpyLib/Abstraction/BaseClass/RequestSerializerBase.cs b/src/Libraries/UniSpyLib/Abstraction/BaseClass/RequestSerializerBase.cs new file mode 100644 index 000000000..62306f3c9 --- /dev/null +++ b/src/Libraries/UniSpyLib/Abstraction/BaseClass/RequestSerializerBase.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using UniSpyLib.Abstraction.Interface; +using UniSpyLib.Logging; + +namespace UniSpyLib.Abstraction.BaseClass +{ + public abstract class RequestSerializerBase + { + protected ISession _session; + protected object _rawRequest; + public List Requests; + public RequestSerializerBase(ISession session, object rawRequest) + { + _session = session; + _rawRequest = rawRequest; + Requests = new List(); + LogWriter.LogCurrentClass(this); + } + + public abstract void Serialize(); + + protected abstract IRequest GenerateRequest(object singleRequest); + } +} diff --git a/src/Libraries/UniSpyLib/Abstraction/Interface/IResponse.cs b/src/Libraries/UniSpyLib/Abstraction/Interface/IResponse.cs new file mode 100644 index 000000000..a6128fcb9 --- /dev/null +++ b/src/Libraries/UniSpyLib/Abstraction/Interface/IResponse.cs @@ -0,0 +1,8 @@ +using System; +namespace UniSpyLib.Abstraction.Interface +{ + public interface IResponse + { + object Build(); + } +} diff --git a/src/Libraries/UniSpyLib/Abstraction/Interface/ISession.cs b/src/Libraries/UniSpyLib/Abstraction/Interface/ISession.cs index 51048fff4..643db70c2 100644 --- a/src/Libraries/UniSpyLib/Abstraction/Interface/ISession.cs +++ b/src/Libraries/UniSpyLib/Abstraction/Interface/ISession.cs @@ -1,8 +1,10 @@ -namespace UniSpyLib.Abstraction.Interface +using System.Net; + +namespace UniSpyLib.Abstraction.Interface { public interface ISession { - public object GetInstance(); + public EndPoint RemoteEndPoint { get; } public long Send(byte[] buffer, long offset, long size); public long Send(string text); diff --git a/src/Libraries/UniSpyLib/MiscMethod/GamespyUtils.cs b/src/Libraries/UniSpyLib/MiscMethod/GamespyUtils.cs index c261003ee..164a4e5c6 100644 --- a/src/Libraries/UniSpyLib/MiscMethod/GamespyUtils.cs +++ b/src/Libraries/UniSpyLib/MiscMethod/GamespyUtils.cs @@ -10,10 +10,15 @@ namespace UniSpyLib.MiscMethod { public static class GameSpyUtils { - public static Dictionary ConvertRequestToKeyValue(string request) + /// + /// Split command to key value array then convert it to dictionary + /// + /// a string like request + /// + public static Dictionary ConvertToKeyValue(string request) { string[] commandParts = request.TrimStart('\\').Split('\\'); - return ConvertRequestToKeyValue(commandParts); + return ConvertToKeyValue(commandParts); } /// @@ -21,7 +26,7 @@ public static Dictionary ConvertRequestToKeyValue(string request /// /// The array of data from the client /// A converted dictionary - public static Dictionary ConvertRequestToKeyValue(string[] parts) + public static Dictionary ConvertToKeyValue(string[] parts) { Dictionary dict = new Dictionary(); try diff --git a/src/Libraries/UniSpyLib/Network/Tcp/Server/TCPSessionBase.cs b/src/Libraries/UniSpyLib/Network/Tcp/Server/TCPSessionBase.cs index f03950ff0..a63dfc526 100644 --- a/src/Libraries/UniSpyLib/Network/Tcp/Server/TCPSessionBase.cs +++ b/src/Libraries/UniSpyLib/Network/Tcp/Server/TCPSessionBase.cs @@ -16,7 +16,7 @@ namespace UniSpyLib.Network /// public abstract class TCPSessionBase : TcpSession, ISession { - public EndPoint RemoteEndPoint { get; protected set; } + public EndPoint RemoteEndPoint { get; private set; } public TCPSessionBase(TCPServerBase server) : base(server) { @@ -100,11 +100,6 @@ protected override void OnDisconnected() base.OnDisconnected(); } - public object GetInstance() - { - return this; - } - bool ISession.BaseSendAsync(byte[] buffer) { return BaseSendAsync(buffer); diff --git a/src/Libraries/UniSpyLib/Network/Udp/Server/UDPSessionBase.cs b/src/Libraries/UniSpyLib/Network/Udp/Server/UDPSessionBase.cs index bdc86084f..cfd1c0697 100644 --- a/src/Libraries/UniSpyLib/Network/Udp/Server/UDPSessionBase.cs +++ b/src/Libraries/UniSpyLib/Network/Udp/Server/UDPSessionBase.cs @@ -20,11 +20,6 @@ public UDPSessionBase(UDPServerBase server, EndPoint endPoint) RemoteEndPoint = endPoint; } - public object GetInstance() - { - return this; - } - public long Send(byte[] buffer, long offset, long size) { return Server.Send(RemoteEndPoint, buffer, offset, size); diff --git a/src/Libraries/UniSpyLib/UniSpyLib.csproj b/src/Libraries/UniSpyLib/UniSpyLib.csproj index 67524b1c8..c9c89a5a9 100644 --- a/src/Libraries/UniSpyLib/UniSpyLib.csproj +++ b/src/Libraries/UniSpyLib/UniSpyLib.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 @@ -12,10 +12,10 @@ ..\..\..\build\$(Configuration) - - - + + + diff --git a/src/Servers/CDKey/Abstraction/BaseClass/CDKeyCommandHandlerBase.cs b/src/Servers/CDKey/Abstraction/BaseClass/CDKeyCommandHandlerBase.cs index 8aee58825..864931bbf 100644 --- a/src/Servers/CDKey/Abstraction/BaseClass/CDKeyCommandHandlerBase.cs +++ b/src/Servers/CDKey/Abstraction/BaseClass/CDKeyCommandHandlerBase.cs @@ -8,7 +8,7 @@ public class CDKeyCommandHandlerBase : CommandHandlerBase { protected string _sendingBuffer; - public CDKeyCommandHandlerBase(ISession client, Dictionary recv) : base(client) + public CDKeyCommandHandlerBase(ISession session, Dictionary recv) : base(session) { } diff --git a/src/Servers/CDKey/CDKey.csproj b/src/Servers/CDKey/CDKey.csproj index 18b9e508d..ac206df66 100644 --- a/src/Servers/CDKey/CDKey.csproj +++ b/src/Servers/CDKey/CDKey.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 false ..\..\..\common\Icon\UniSpy_Logo.ico diff --git a/src/Servers/CDKey/Dockerfile b/src/Servers/CDKey/Dockerfile index 1c5c22b5f..85abb0d37 100644 --- a/src/Servers/CDKey/Dockerfile +++ b/src/Servers/CDKey/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 29910 EXPOSE 29910/udp -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/CDKey/CDKey.csproj", "src/Servers/CDKey/"] COPY ["src/Libraries/UniSpyLib/UniSpyLib.csproj", "src/Libraries/UniSpyLib/"] @@ -18,5 +18,5 @@ RUN dotnet publish "CDKey.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "CDKey.dll"] \ No newline at end of file diff --git a/src/Servers/CDKey/Entity/Structure/ClientInfo.cs b/src/Servers/CDKey/Entity/Structure/ClientInfo.cs deleted file mode 100644 index 7ba542642..000000000 --- a/src/Servers/CDKey/Entity/Structure/ClientInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Net; - -namespace CDKey.Entity.Structure -{ - /// - /// This class is used for storing the cdkey and user which is using this cdkey - /// - public class ClientInfo - { - //Stores the cdkey which are using - public string cdkey; - //Stores the IP address which is using this cdkey - public IPEndPoint remote; - } -} diff --git a/src/Servers/CDKey/Entity/Structure/RequestName.cs b/src/Servers/CDKey/Entity/Structure/RequestName.cs new file mode 100644 index 000000000..980625cd8 --- /dev/null +++ b/src/Servers/CDKey/Entity/Structure/RequestName.cs @@ -0,0 +1,29 @@ +using System; +namespace CDKey.Entity.Structure +{ + public class RequestName + { + /// + /// Reauthenticate with server to determine whether a client is still online + /// + public const string SKey = "skey"; + /// + /// Keep alive + /// + public const string KA = " ka"; + /// + /// Authentication CDKey + /// + public const string Auth = "auth"; + + /// + /// Disconnect from server + /// + public const string Disc = "disc"; + + public const string Resp = "resp"; + + public const string UON = "uon"; + public const string UOFF = "uoff"; + } +} diff --git a/src/Servers/CDKey/Handler/CommandHandler/Auth/AuthHandler.cs b/src/Servers/CDKey/Handler/CommandHandler/AuthHandler.cs similarity index 50% rename from src/Servers/CDKey/Handler/CommandHandler/Auth/AuthHandler.cs rename to src/Servers/CDKey/Handler/CommandHandler/AuthHandler.cs index f470045b1..9dc976581 100644 --- a/src/Servers/CDKey/Handler/CommandHandler/Auth/AuthHandler.cs +++ b/src/Servers/CDKey/Handler/CommandHandler/AuthHandler.cs @@ -1,4 +1,4 @@ -namespace CDKey.Handler.CommandHandler.Auth +namespace CDKey.Handler.CommandHandler { internal class AuthHandler { diff --git a/src/Servers/CDKey/Handler/CommandHandler/Disc/DiscHandler.cs b/src/Servers/CDKey/Handler/CommandHandler/DiscHandler.cs similarity index 84% rename from src/Servers/CDKey/Handler/CommandHandler/Disc/DiscHandler.cs rename to src/Servers/CDKey/Handler/CommandHandler/DiscHandler.cs index 79da67dbd..653e06c78 100644 --- a/src/Servers/CDKey/Handler/CommandHandler/Disc/DiscHandler.cs +++ b/src/Servers/CDKey/Handler/CommandHandler/DiscHandler.cs @@ -1,4 +1,4 @@ -namespace CDKey.Handler.CommandHandler.Disc +namespace CDKey.Handler.CommandHandler { /// /// disconnect from cdkey server diff --git a/src/Servers/CDKey/Handler/CommandHandler/SKey/SKeyHandler.cs b/src/Servers/CDKey/Handler/CommandHandler/SKeyHandler.cs similarity index 89% rename from src/Servers/CDKey/Handler/CommandHandler/SKey/SKeyHandler.cs rename to src/Servers/CDKey/Handler/CommandHandler/SKeyHandler.cs index 582c8eadd..ffeb562af 100644 --- a/src/Servers/CDKey/Handler/CommandHandler/SKey/SKeyHandler.cs +++ b/src/Servers/CDKey/Handler/CommandHandler/SKeyHandler.cs @@ -1,7 +1,7 @@ using UniSpyLib.Abstraction.Interface; using System.Collections.Generic; -namespace CDKey.Handler.CommandHandler.SKey +namespace CDKey.Handler.CommandHandler { /// /// This class contians gamespy cdkey check functions which help cdkeyserver to finish the cdkey check. @@ -14,7 +14,7 @@ public class SKeyHandler /// /// MD5cdkey string /// - public static void IsCDKeyValid(ISession client, Dictionary recv) + public static void IsCDKeyValid(ISession session, Dictionary recv) { //if (DBQuery.IsCDKeyValidate(recv["skey"])) //{ diff --git a/src/Servers/CDKey/Handler/CommandHandler/UON/UONHandler.cs b/src/Servers/CDKey/Handler/CommandHandler/UON/UONHandler.cs deleted file mode 100644 index d0ea03126..000000000 --- a/src/Servers/CDKey/Handler/CommandHandler/UON/UONHandler.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace CDKey.Handler.CommandHandler.UON -{ - internal class UONHandler - { - } -} diff --git a/src/Servers/CDKey/Handler/CommandHandler/UONHandler.cs b/src/Servers/CDKey/Handler/CommandHandler/UONHandler.cs new file mode 100644 index 000000000..dd0778e55 --- /dev/null +++ b/src/Servers/CDKey/Handler/CommandHandler/UONHandler.cs @@ -0,0 +1,6 @@ +namespace CDKey.Handler.CommandHandler +{ + public class UONHandler + { + } +} diff --git a/src/Servers/CDKey/Handler/CommandSwticher/CDKeyCommandSwitcher.cs b/src/Servers/CDKey/Handler/CommandSwticher/CDKeyCommandSwitcher.cs index 6a376ae1d..49c24536a 100644 --- a/src/Servers/CDKey/Handler/CommandSwticher/CDKeyCommandSwitcher.cs +++ b/src/Servers/CDKey/Handler/CommandSwticher/CDKeyCommandSwitcher.cs @@ -1,50 +1,37 @@ -using CDKey.Handler.CommandHandler.SKey; -using UniSpyLib.Abstraction.Interface; +using UniSpyLib.Abstraction.Interface; using UniSpyLib.Logging; -using UniSpyLib.MiscMethod; -using System; -using System.Collections.Generic; -using System.Linq; + namespace CDKey.Handler.CommandSwitcher { public class CDKeyCommandSwitcher { - public static void Switch(ISession client, string message) + public static void Switch(ISession session, string rawRequest) { - message.Replace(@"\r\n", "").Replace("\0", ""); - string[] keyValueArray = message.TrimStart('\\').Split('\\'); - Dictionary recv = GameSpyUtils.ConvertRequestToKeyValue(keyValueArray); + var requests = CDKeyRequestSerializer.Serialize(session, rawRequest); - try + foreach (var request in requests) { - switch (recv.Keys.First()) + switch (request.CommandName) { //keep client alive request, we skip this case "ka": - Console.WriteLine("Received keep alive command"); break; case "auth": break; case "resp": break; case "skey": - SKeyHandler.IsCDKeyValid(client, recv); break; case "disc"://disconnect from server break; case "uon": break; - default: - LogWriter.UnknownDataRecieved(message); + LogWriter.UnknownDataRecieved(rawRequest); break; } } - catch (Exception e) - { - LogWriter.ToLog(e); - } } } } diff --git a/src/Servers/CDKey/Handler/CommandSwticher/CDKeyRequestSerializer.cs b/src/Servers/CDKey/Handler/CommandSwticher/CDKeyRequestSerializer.cs new file mode 100644 index 000000000..408efa68e --- /dev/null +++ b/src/Servers/CDKey/Handler/CommandSwticher/CDKeyRequestSerializer.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CDKey.Entity.Structure; +using UniSpyLib.Abstraction.Interface; +using UniSpyLib.Logging; +using UniSpyLib.MiscMethod; + +namespace CDKey.Handler.CommandSwitcher +{ + public class CDKeyRequestSerializer + { + public static List Serialize(ISession session, string rawRequest) + { + List requests = new List(); + var request = rawRequest; + //request.Replace(@"\r\n", "").Replace("\0", ""); + string[] commands = rawRequest.Split(@"\r\n", StringSplitOptions.RemoveEmptyEntries); + foreach (var command in commands) + { + requests.Add(GenerateRequest(command)); + } + return requests; + } + + private static IRequest GenerateRequest(string command) + { + var kv = GameSpyUtils.ConvertToKeyValue(command); + + switch (kv.Keys.First()) + { + //keep client alive request, we skip this + case RequestName.KA: + return null; + case RequestName.Auth: + return null; + case RequestName.Resp: + return null; + case RequestName.SKey: + return null; + case RequestName.Disc://disconnect from server + return null; + case RequestName.UON: + return null; + default: + LogWriter.UnknownDataRecieved(command); + return null; + } + } + + } +} diff --git a/src/Servers/Chat/Abstraction/BaseClass/ChatCommandHandlerBase.cs b/src/Servers/Chat/Abstraction/BaseClass/ChatCommandHandlerBase.cs index 7f1f4f3a0..8146a5ec0 100644 --- a/src/Servers/Chat/Abstraction/BaseClass/ChatCommandHandlerBase.cs +++ b/src/Servers/Chat/Abstraction/BaseClass/ChatCommandHandlerBase.cs @@ -34,7 +34,7 @@ public ChatCommandHandlerBase(ISession session, ChatRequestBase request) : base( { _errorCode = ChatError.NoError; _request = request; - _session = (ChatSession)session.GetInstance(); + _session = (ChatSession)session; } //if we use this structure the error response should also write to _sendingBuffer diff --git a/src/Servers/Chat/Chat.csproj b/src/Servers/Chat/Chat.csproj index 6131cc996..6266b080b 100644 --- a/src/Servers/Chat/Chat.csproj +++ b/src/Servers/Chat/Chat.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 ..\..\..\common\Icon\UniSpy_Logo.ico Linux ..\.. diff --git a/src/Servers/Chat/Dockerfile b/src/Servers/Chat/Dockerfile index cb723762e..7949f1cde 100644 --- a/src/Servers/Chat/Dockerfile +++ b/src/Servers/Chat/Dockerfile @@ -1,8 +1,8 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 6667 -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/Chat/Chat.csproj", "src/Servers/Chat/"] COPY ["src/Servers/QueryReport/QueryReport.csproj", "src/Servers/QueryReport/"] @@ -18,5 +18,5 @@ RUN dotnet publish "Chat.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "Chat.dll"] \ No newline at end of file diff --git a/src/Servers/Chat/Handler/CommandHandler/General/CRYPTHandler.cs b/src/Servers/Chat/Handler/CommandHandler/General/CRYPTHandler.cs index b4041cad8..6ae0eb030 100644 --- a/src/Servers/Chat/Handler/CommandHandler/General/CRYPTHandler.cs +++ b/src/Servers/Chat/Handler/CommandHandler/General/CRYPTHandler.cs @@ -30,6 +30,7 @@ protected override void DataOperation() { LogWriter.ToLog(LogEventLevel.Error, "secret key not found!"); _errorCode = ChatError.UnSupportedGame; + _session.Disconnect(); return; } _session.UserInfo.SetGameSecretKey(secretKey); diff --git a/src/Servers/GameStatus/Abstraction/BaseClass/GSCommandHandlerBase.cs b/src/Servers/GameStatus/Abstraction/BaseClass/GSCommandHandlerBase.cs index fe1f72751..533e4bcaa 100644 --- a/src/Servers/GameStatus/Abstraction/BaseClass/GSCommandHandlerBase.cs +++ b/src/Servers/GameStatus/Abstraction/BaseClass/GSCommandHandlerBase.cs @@ -22,7 +22,7 @@ public abstract class GSCommandHandlerBase : CommandHandlerBase protected GSCommandHandlerBase(ISession session, Dictionary request) : base(session) { _errorCode = GSError.NoError; - _session = (GSSession)session.GetInstance(); + _session = (GSSession)session; } public override void Handle() diff --git a/src/Servers/GameStatus/Dockerfile b/src/Servers/GameStatus/Dockerfile index 274b69b87..a875c8e6c 100644 --- a/src/Servers/GameStatus/Dockerfile +++ b/src/Servers/GameStatus/Dockerfile @@ -1,8 +1,8 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 29920 -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/GameStatus/GameStatus.csproj", "src/Servers/GameStatus/"] COPY ["src/Libraries/UniSpyLib/UniSpyLib.csproj", "src/Libraries/UniSpyLib/"] @@ -17,5 +17,5 @@ RUN dotnet publish "GameStatus.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "GameStatus.dll"] \ No newline at end of file diff --git a/src/Servers/GameStatus/GameStatus.csproj b/src/Servers/GameStatus/GameStatus.csproj index cf99ee864..9d85a0f34 100644 --- a/src/Servers/GameStatus/GameStatus.csproj +++ b/src/Servers/GameStatus/GameStatus.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 ..\..\..\common\Icon\UniSpy_Logo.ico Linux ..\.. diff --git a/src/Servers/GameStatus/Handler/CommandSwitcher/GSCommandSwitcher.cs b/src/Servers/GameStatus/Handler/CommandSwitcher/GSCommandSwitcher.cs index 396acbf3b..12322b1da 100644 --- a/src/Servers/GameStatus/Handler/CommandSwitcher/GSCommandSwitcher.cs +++ b/src/Servers/GameStatus/Handler/CommandSwitcher/GSCommandSwitcher.cs @@ -26,7 +26,7 @@ public static void Switch(ISession session, string rawRequest) return; } string[] requestFraction = rawRequest.TrimStart('\\').Split('\\'); - var request = GameSpyUtils.ConvertRequestToKeyValue(requestFraction); + var request = GameSpyUtils.ConvertToKeyValue(requestFraction); switch (request.Keys.First()) { diff --git a/src/Servers/NATNegotiation/Abstraction/BaseClass/NNCommandHandlerBase.cs b/src/Servers/NATNegotiation/Abstraction/BaseClass/NNCommandHandlerBase.cs index 80b856e36..74eec8945 100644 --- a/src/Servers/NATNegotiation/Abstraction/BaseClass/NNCommandHandlerBase.cs +++ b/src/Servers/NATNegotiation/Abstraction/BaseClass/NNCommandHandlerBase.cs @@ -20,7 +20,7 @@ public class NNCommandHandlerBase : CommandHandlerBase public NNCommandHandlerBase(ISession session, IRequest request) : base(session) { _request = (NNRequestBase)request; - _session = (NNSession)session.GetInstance(); + _session = (NNSession)session; _errorCode = NNErrorCode.NoError; } diff --git a/src/Servers/NATNegotiation/Dockerfile b/src/Servers/NATNegotiation/Dockerfile index d517058a3..bb1ac2205 100644 --- a/src/Servers/NATNegotiation/Dockerfile +++ b/src/Servers/NATNegotiation/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 27901 EXPOSE 27901/udp -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/NATNegotiation/NATNegotiation.csproj", "src/Servers/NATNegotiation/"] COPY ["src/Libraries/UniSpyLib/UniSpyLib.csproj", "src/Libraries/UniSpyLib/"] @@ -18,5 +18,5 @@ RUN dotnet publish "NATNegotiation.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "NATNegotiation.dll"] \ No newline at end of file diff --git a/src/Servers/NATNegotiation/NATNegotiation.csproj b/src/Servers/NATNegotiation/NATNegotiation.csproj index 7f827a790..f59c2b166 100644 --- a/src/Servers/NATNegotiation/NATNegotiation.csproj +++ b/src/Servers/NATNegotiation/NATNegotiation.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 ..\..\..\common\Icon\UniSpy_Logo.ico Linux diff --git a/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMCommandHandlerBase.cs b/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMCommandHandlerBase.cs index 548edbdb4..d11baf088 100644 --- a/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMCommandHandlerBase.cs +++ b/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMCommandHandlerBase.cs @@ -16,11 +16,13 @@ public abstract class PCMCommandHandlerBase : CommandHandlerBase { protected GPError _errorCode; protected string _sendingBuffer; - new protected PCMSession _session; - public PCMCommandHandlerBase(ISession session, Dictionary recv) : base(session) + protected new PCMSession _session; + protected PCMRequestBase _request; + public PCMCommandHandlerBase(ISession session, IRequest request) : base(session) { _errorCode = GPError.NoError; - _session = (PCMSession)session.GetInstance(); + _request = (PCMRequestBase)request; + _session = (PCMSession)session; } public override void Handle() diff --git a/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMRequestBase.cs b/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMRequestBase.cs index 76c3d2106..5644bc0ae 100644 --- a/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMRequestBase.cs +++ b/src/Servers/PresenceConnectionManager/Abstraction/BaseClass/PCMRequestBase.cs @@ -8,18 +8,18 @@ namespace PresenceConnectionManager.Abstraction.BaseClass { public abstract class PCMRequestBase : IRequest { - public string CmdName { get; protected set; } + public string CommandName { get; protected set; } //public uint NamespaceID { get; protected set; } public uint OperationID { get; protected set; } - object IRequest.CommandName => CmdName; + object IRequest.CommandName => CommandName; protected Dictionary _recv; public PCMRequestBase(Dictionary recv) { _recv = recv; - CmdName = _recv.Keys.First(); + CommandName = _recv.Keys.First(); } public virtual GPError Parse() diff --git a/src/Servers/PresenceConnectionManager/Dockerfile b/src/Servers/PresenceConnectionManager/Dockerfile index e5d03473e..6fdcdd298 100644 --- a/src/Servers/PresenceConnectionManager/Dockerfile +++ b/src/Servers/PresenceConnectionManager/Dockerfile @@ -1,8 +1,8 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 29900 -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/PresenceConnectionManager/PresenceConnectionManager.csproj", "src/Servers/PresenceConnectionManager/"] COPY ["src/Libraries/UniSpyLib/UniSpyLib.csproj", "src/Libraries/UniSpyLib/"] @@ -18,5 +18,5 @@ RUN dotnet publish "PresenceConnectionManager.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/UniSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "PresenceConnectionManager.dll"] \ No newline at end of file diff --git a/src/Servers/PresenceConnectionManager/Entity/Structure/SDKRevision.cs b/src/Servers/PresenceConnectionManager/Entity/Structure/SDKRevision.cs index 1880e2a91..8388a4534 100644 --- a/src/Servers/PresenceConnectionManager/Entity/Structure/SDKRevision.cs +++ b/src/Servers/PresenceConnectionManager/Entity/Structure/SDKRevision.cs @@ -12,9 +12,9 @@ public static class SDKRevision /// /// Tell server send back extra information according to the number of sdkrevision /// - public static void ExtendedFunction(ISession client) + public static void ExtendedFunction(ISession session) { - PCMSession _session = (PCMSession)client.GetInstance(); + PCMSession _session = (PCMSession)session; if (_session.UserData.SDKRevision == 0) { LogWriter.ToLog(LogEventLevel.Error, "[SDKRev] No sdkrevision!"); diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/AddBuddyHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/AddBuddyHandler.cs index c96f8057e..7cebb1ac6 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/AddBuddyHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/AddBuddyHandler.cs @@ -1,16 +1,17 @@ using UniSpyLib.Abstraction.Interface; using PresenceConnectionManager.Entity.Structure.Request.Buddy; using System.Collections.Generic; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Buddy +namespace PresenceConnectionManager.Handler.CommandHandler { //\addbuddy\\sesskey\<>\newprofileid\<>\reason\<>\final\ public class AddBuddyHandler : PCMCommandHandlerBase { - protected AddBuddyRequest _request; - public AddBuddyHandler(ISession session, Dictionary recv) : base(session, recv) + protected new AddBuddyRequest _request; + public AddBuddyHandler(ISession session, IRequest request) : base(session, request) { - _request = new AddBuddyRequest(recv); + _request = (AddBuddyRequest)request; } protected override void CheckRequest() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/BuddyStatusInfo.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/BuddyStatusInfo.cs index 3988af64f..cada1d2f6 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/BuddyStatusInfo.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/BuddyStatusInfo.cs @@ -1,12 +1,13 @@ using UniSpyLib.Abstraction.Interface; using System.Collections.Generic; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Buddy +namespace PresenceConnectionManager.Handler.CommandHandler { - public class BuddyStatusInfo : PCMCommandHandlerBase + public class BuddyStatusInfoHandler : PCMCommandHandlerBase { - public BuddyStatusInfo(ISession session, Dictionary recv) : base(session, recv) + public BuddyStatusInfoHandler(ISession session, IRequest request) : base(session, request) { } //public static void SendBuddyStatusInfo(GPCMSession _session, uint[] profileids) diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/DelBuddyHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/DelBuddyHandler.cs index 35bb2ed0e..178c7cc83 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/DelBuddyHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/DelBuddyHandler.cs @@ -4,7 +4,9 @@ using PresenceSearchPlayer.Entity.Enumerate; using System.Collections.Generic; using System.Linq; -namespace PresenceConnectionManager.Abstraction.BaseClass.Buddy +using PresenceConnectionManager.Abstraction.BaseClass; + +namespace PresenceConnectionManager.Handler.CommandHandler { /// /// handles dell buddy request,remove friends from friends list @@ -13,16 +15,11 @@ public class DelBuddyHandler : PCMCommandHandlerBase { //PCMSession _session; //Dictionary _recv; - protected DelBuddyRequest _request; + protected new DelBuddyRequest _request; //delete friend in database then send bm_revoke message to friend - public DelBuddyHandler(ISession client, Dictionary recv) : base(client, recv) - { - _request = new DelBuddyRequest(recv); - } - - protected override void CheckRequest() + public DelBuddyHandler(ISession session, IRequest request) : base(session, request) { - _errorCode = _request.Parse(); + _request = (DelBuddyRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/InviteToHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/InviteToHandler.cs index b1558766f..e24752f71 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/InviteToHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/InviteToHandler.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.Linq; using PresenceConnectionManager.Network; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Buddy +namespace PresenceConnectionManager.Handler.CommandHandler { /// /// This function sets which games the local profile can be invited to. @@ -12,15 +13,10 @@ namespace PresenceConnectionManager.Abstraction.BaseClass.Buddy public class InviteToHandler : PCMCommandHandlerBase { //_session.SendAsync(@"\pinvite\\sesskey\223\profileid\13\productid\1038\final\"); - protected InviteToRequest _request; - public InviteToHandler(ISession client, Dictionary recv) : base(client, recv) + protected new InviteToRequest _request; + public InviteToHandler(ISession session, IRequest request) : base(session, request) { - _request = new InviteToRequest(recv); - } - - protected override void CheckRequest() - { - _errorCode = _request.Parse(); + _request = (InviteToRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusHandler.cs index e82824637..57bf383eb 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusHandler.cs @@ -2,20 +2,16 @@ using PresenceConnectionManager.Entity.Enumerate; using PresenceConnectionManager.Entity.Structure.Request.Buddy; using System.Collections.Generic; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Buddy +namespace PresenceConnectionManager.Handler.CommandHandler { public class StatusHandler : PCMCommandHandlerBase { - protected StatusRequest _request; - public StatusHandler(ISession client, Dictionary recv) : base(client, recv) + protected new StatusRequest _request; + public StatusHandler(ISession session, IRequest request) : base(session, request) { - _request = new StatusRequest(recv); - } - - protected override void CheckRequest() - { - _errorCode = _request.Parse(); + _request = (StatusRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusInfoHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusInfoHandler.cs index 2e32c0691..e825db024 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusInfoHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Buddy/StatusInfoHandler.cs @@ -2,22 +2,17 @@ using UniSpyLib.Database.DatabaseModel.MySql; using PresenceConnectionManager.Entity.Structure.Request.Buddy; using PresenceSearchPlayer.Entity.Enumerate; -using System.Collections.Generic; using System.Linq; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Buddy +namespace PresenceConnectionManager.Handler.CommandHandler { public class StatusInfoHandler : PCMCommandHandlerBase { - protected StatusInfoRequest _request; - public StatusInfoHandler(ISession session, Dictionary recv) : base(session, recv) + protected new StatusInfoRequest _request; + public StatusInfoHandler(ISession session, IRequest request) : base(session, request) { - _request = new StatusInfoRequest(recv); - } - - protected override void CheckRequest() - { - _errorCode = _request.Parse(); + _request = (StatusInfoRequest)request; } protected override void DataOperation() @@ -30,8 +25,6 @@ protected override void DataOperation() && s.Namespaceid == _session.UserData.NamespaceID) .Select(s => s); - - if (result.Count() == 0) { Statusinfo statusinfo = new Statusinfo diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/KeepAliveHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/KeepAliveHandler.cs index 290f71768..e3acba4d1 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/KeepAliveHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/KeepAliveHandler.cs @@ -1,11 +1,12 @@ using UniSpyLib.Abstraction.Interface; using System.Collections.Generic; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.General +namespace PresenceConnectionManager.Handler.CommandHandler { public class KeepAliveHandler : PCMCommandHandlerBase { - public KeepAliveHandler(ISession session, Dictionary recv) : base(session, recv) + public KeepAliveHandler(ISession session, IRequest request) : base(session, request) { } diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LoginHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LoginHandler.cs index 4a65e63ad..41d2f1c9e 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LoginHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LoginHandler.cs @@ -12,8 +12,9 @@ using System.Collections.Generic; using System.Linq; using PresenceConnectionManager.Network; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.General +namespace PresenceConnectionManager.Handler.CommandHandler { internal class LoginDBResult { @@ -31,19 +32,15 @@ internal class LoginDBResult public class LoginHandler : PCMCommandHandlerBase { - private Crc16 _crc; - protected LoginRequest _request; + protected new LoginRequest _request; private LoginDBResult _result; - public LoginHandler(ISession session, Dictionary recv) : base(session, recv) + public LoginHandler(ISession session, IRequest request) : base(session, request) { - _crc = new Crc16(Crc16Mode.Standard); - _request = new LoginRequest(recv); + _request = (LoginRequest)request; } protected override void CheckRequest() { - _errorCode = _request.Parse(); - switch (_request.LoginType) { case LoginType.NickEmail: diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LogoutHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LogoutHandler.cs index 14d561ab5..5559a5fa8 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LogoutHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/LogoutHandler.cs @@ -1,12 +1,13 @@ using UniSpyLib.Abstraction.Interface; using System.Collections.Generic; using PresenceConnectionManager.Network; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.General +namespace PresenceConnectionManager.Handler.CommandHandler { public class LogoutHandler : PCMCommandHandlerBase { - public LogoutHandler(ISession session, Dictionary recv) : base(session, recv) + public LogoutHandler(ISession session,IRequest request) : base(session, request) { } diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/NewUserHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/NewUserHandler.cs new file mode 100644 index 000000000..71f5177c4 --- /dev/null +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/General/NewUserHandler.cs @@ -0,0 +1,19 @@ +using System; +using UniSpyLib.Abstraction.Interface; + +namespace PresenceConnectionManager.Handler.CommandHandler +{ + public class NewUserHandler : PresenceSearchPlayer.Handler.CommandHandler.NewUserHandler + { + public NewUserHandler(ISession session, IRequest request) : base(session, request) + { + } + + protected override void BuildNormalResponse() + { + //PCM NewUser + _sendingBuffer = + $@"\nur\\userid\{_user.Userid}\profileid\{_subProfile.Profileid}\id\{_request.OperationID}\final\"; + } + } +} diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/AddBlockHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/AddBlockHandler.cs index 1941e1f4c..f126e8792 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/AddBlockHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/AddBlockHandler.cs @@ -1,23 +1,18 @@ using UniSpyLib.Abstraction.Interface; using UniSpyLib.Database.DatabaseModel.MySql; using PresenceConnectionManager.Entity.Structure.Request.Buddy; -using System.Collections.Generic; using System.Linq; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { public class AddBlockHandler : PCMCommandHandlerBase { - protected AddBlockRequest _request; - public AddBlockHandler(ISession session, Dictionary recv) : base(session, recv) + protected new AddBlockRequest _request; + public AddBlockHandler(ISession session, IRequest request) : base(session, request) { - _request = new AddBlockRequest(recv); - } - - protected override void CheckRequest() - { - _errorCode = _request.Parse(); + _request = (AddBlockRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/GetProfileHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/GetProfileHandler.cs index 808dd791a..c36b33bc3 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/GetProfileHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/GetProfileHandler.cs @@ -5,8 +5,9 @@ using PresenceSearchPlayer.Entity.Enumerate; using System.Collections.Generic; using System.Linq; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { public class GetProfileDBResult { @@ -43,11 +44,11 @@ public class GetProfileDBResult public class GetProfileHandler : PCMCommandHandlerBase { // \getprofile\\sesskey\19150\profileid\2\id\2\final\ - protected GetProfileRequest _request; + protected new GetProfileRequest _request; protected GetProfileDBResult _result; - public GetProfileHandler(ISession client, Dictionary recv) : base(client, recv) + public GetProfileHandler(ISession session, IRequest request) : base(session, request) { - _request = new GetProfileRequest(recv); + _request = (GetProfileRequest)request; } protected override void CheckRequest() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/NewProfileHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/NewProfileHandler.cs index 578258496..a1a2b8f1f 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/NewProfileHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/NewProfileHandler.cs @@ -4,20 +4,16 @@ using PresenceSearchPlayer.Entity.Enumerate; using System.Collections.Generic; using System.Linq; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { public class NewProfileHandler : PCMCommandHandlerBase { - protected NewProfileRequest _request; - public NewProfileHandler(ISession client, Dictionary recv) : base(client, recv) + protected new NewProfileRequest _request; + public NewProfileHandler(ISession session, IRequest request) : base(session, request) { - _request = new NewProfileRequest(recv); - } - - protected override void CheckRequest() - { - _errorCode = _request.Parse(); + _request = (NewProfileRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterCDKeyHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterCDKeyHandler.cs index 1bdaf3c97..a1f24de8e 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterCDKeyHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterCDKeyHandler.cs @@ -4,20 +4,16 @@ using PresenceSearchPlayer.Entity.Enumerate; using System.Collections.Generic; using System.Linq; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { public class RegisterCDKeyHandler : PCMCommandHandlerBase { - protected RegisterCDKeyRequest _request; - public RegisterCDKeyHandler(ISession client, Dictionary recv) : base(client, recv) + protected new RegisterCDKeyRequest _request; + public RegisterCDKeyHandler(ISession session, IRequest request) : base(session, request) { - _request = new RegisterCDKeyRequest(recv); - } - - protected override void CheckRequest() - { - _errorCode = _request.Parse(); + _request = (RegisterCDKeyRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterNickHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterNickHandler.cs index be0e30887..540eb6173 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterNickHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RegisterNickHandler.cs @@ -4,15 +4,16 @@ using PresenceSearchPlayer.Entity.Enumerate; using System.Collections.Generic; using System.Linq; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { public class RegisterNickHandler : PCMCommandHandlerBase { - protected RegisterNickRequest _request; - public RegisterNickHandler(ISession client, Dictionary recv) : base(client, recv) + protected new RegisterNickRequest _request; + public RegisterNickHandler(ISession session, IRequest request) : base(session, request) { - _request = new RegisterNickRequest(recv); + _request = (RegisterNickRequest)request; } protected override void CheckRequest() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RemoveBlockHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RemoveBlockHandler.cs index 7462ee1a7..43ad2c7b7 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RemoveBlockHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/RemoveBlockHandler.cs @@ -1,12 +1,13 @@ using UniSpyLib.Abstraction.Interface; using System; using System.Collections.Generic; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { public class RemoveBlockHandler : PCMCommandHandlerBase { - public RemoveBlockHandler(ISession session, Dictionary recv) : base(session, recv) + public RemoveBlockHandler(ISession session,IRequest request) : base(session, request) { throw new NotImplementedException(); } diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateProHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateProHandler.cs index 539d27a4c..fb1a40cba 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateProHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateProHandler.cs @@ -3,15 +3,16 @@ using PresenceConnectionManager.Entity.Structure.Request.Profile; using System.Collections.Generic; using System.Linq; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { public class UpdateProHandler : PCMCommandHandlerBase { - protected UpdateProRequest _request; - public UpdateProHandler(ISession client, Dictionary recv) : base(client, recv) + protected new UpdateProRequest _request; + public UpdateProHandler(ISession session, IRequest request) : base(session, request) { - _request = new UpdateProRequest(recv); + _request = (UpdateProRequest)request; } protected override void CheckRequest() diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateUIHandler.cs b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateUIHandler.cs index 9fb8a16db..6f154d5b5 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateUIHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandHandler/Profile/UpdateUIHandler.cs @@ -1,14 +1,15 @@ using UniSpyLib.Abstraction.Interface; using System.Collections.Generic; +using PresenceConnectionManager.Abstraction.BaseClass; -namespace PresenceConnectionManager.Abstraction.BaseClass.Profile +namespace PresenceConnectionManager.Handler.CommandHandler { /// /// Update user information (email) /// public class UpdateUIHandler : PCMCommandHandlerBase { - public UpdateUIHandler(ISession session, Dictionary recv) : base(session, recv) + public UpdateUIHandler(ISession session,IRequest request) : base(session, request) { //todo find what data is belong to user info throw new System.NotImplementedException(); diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMCommandSwitcher.cs b/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMCommandSwitcher.cs index aa3ad61c5..fdbbdea3b 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMCommandSwitcher.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMCommandSwitcher.cs @@ -1,108 +1,78 @@ using UniSpyLib.Abstraction.Interface; using UniSpyLib.Logging; -using UniSpyLib.MiscMethod; -using PresenceConnectionManager.Abstraction.BaseClass; -using PresenceConnectionManager.Abstraction.BaseClass.Buddy; -using PresenceConnectionManager.Abstraction.BaseClass.General; -using PresenceConnectionManager.Abstraction.BaseClass.Profile; + using PresenceConnectionManager.Entity.Structure; -using PresenceSearchPlayer.Handler.CommandHandler.NewUser; -using Serilog.Events; using System; -using System.Collections.Generic; -using System.Linq; +using PresenceConnectionManager.Handler.CommandHandler; -namespace PresenceConnectionManager.Abstraction +namespace PresenceConnectionManager.Handler.CommandSwitcher { public class PCMCommandSwitcher { public static void Switch(ISession session, string rawRequest) { - try - { - //message = @"\login\\challenge\VPUKQ5CiXSqtt0EdOKMwwRvf3CHqxrah\user\borger@mike@vale.ski\partnerid\0\response\4ec2535ddba4773168337c7b5f9588e7\firewall\1\port\0\productid\10936\gamename\greconawf2\namespaceid\0\sdkrevision\3\id\1\final\"; - rawRequest = PCMRequestBase.NormalizeRequest(rawRequest); - if (rawRequest[0] != '\\') - { - LogWriter.ToLog(LogEventLevel.Error, "Invalid request recieved!"); - return; - } - string[] commands = rawRequest.Split("\\final\\", StringSplitOptions.RemoveEmptyEntries); - - foreach (string command in commands) - { - if (command.Length < 1) - { - continue; - } - // Read client message, and parse it into key value pairs - string[] recieved = command.TrimStart('\\').Split('\\'); + var requests = PCMRequestSerializer.Serialize(session, rawRequest); - Dictionary recv = GameSpyUtils.ConvertRequestToKeyValue(recieved); - - switch (recv.Keys.First()) - { - case PCMRequestName.Login://login to retrospy - new LoginHandler(session, recv).Handle(); - break; - case PCMRequestName.Logout://logout from retrospy - new LogoutHandler(session, recv).Handle(); - break; - case PCMRequestName.KeepAlive: - new KeepAliveHandler(session, recv).Handle(); - break; + foreach (var requst in requests) + { + switch (requst.CommandName) + { + case PCMRequestName.Login://login to retrospy + new LoginHandler(session, requst).Handle(); + break; + case PCMRequestName.Logout://logout from retrospy + new LogoutHandler(session, requst).Handle(); + break; + case PCMRequestName.KeepAlive: + new KeepAliveHandler(session, requst).Handle(); + break; - case PCMRequestName.GetProfile://get profile of a player - new GetProfileHandler(session, recv).Handle(); - break; - case PCMRequestName.RegisterNick://update user's uniquenick - new RegisterNickHandler(session, recv).Handle(); - break; - case PCMRequestName.NewUser://create an new user - new NewUserHandler(session, recv).Handle(); - break; - case PCMRequestName.UpdateUI://update a user's email - new UpdateUIHandler(session, recv).Handle(); - break; - case PCMRequestName.UpdatePro://update a user's profile - new UpdateProHandler(session, recv).Handle(); - break; - case PCMRequestName.NewProfile://create an new profile - new NewProfileHandler(session, recv).Handle(); - break; - case PCMRequestName.DelProfile://delete profile - break; - case PCMRequestName.AddBlock://add an user to our block list - new AddBlockHandler(session, recv).Handle(); - break; - case PCMRequestName.RemoveBlock: - new RemoveBlockHandler(session, recv).Handle(); - break; + case PCMRequestName.GetProfile://get profile of a player + new GetProfileHandler(session, requst).Handle(); + break; + case PCMRequestName.RegisterNick://update user's uniquenick + new RegisterNickHandler(session, requst).Handle(); + break; + case PCMRequestName.NewUser://create an new user + new NewUserHandler(session, requst).Handle(); + break; + case PCMRequestName.UpdateUI://update a user's email + new UpdateUIHandler(session, requst).Handle(); + break; + case PCMRequestName.UpdatePro://update a user's profile + new UpdateProHandler(session, requst).Handle(); + break; + case PCMRequestName.NewProfile://create an new profile + new NewProfileHandler(session, requst).Handle(); + break; + case PCMRequestName.DelProfile://delete profile + break; + case PCMRequestName.AddBlock://add an user to our block list + new AddBlockHandler(session, requst).Handle(); + break; + case PCMRequestName.RemoveBlock: + new RemoveBlockHandler(session, requst).Handle(); + break; - case PCMRequestName.AddBuddy://Send a request which adds an user to our friend list - new AddBuddyHandler(session, recv).Handle(); - break; - case PCMRequestName.DelBuddy://delete a user from our friend list - new DelBuddyHandler(session, recv).Handle(); - break; - case PCMRequestName.Status://update current logged in user's status info - new StatusHandler(session, recv).Handle(); - break; - case PCMRequestName.StatusInfo: - throw new NotImplementedException(); - case PCMRequestName.InviteTo: - throw new NotImplementedException(); - default: - LogWriter.UnknownDataRecieved(rawRequest); - break; - } + case PCMRequestName.AddBuddy://Send a request which adds an user to our friend list + new AddBuddyHandler(session, requst).Handle(); + break; + case PCMRequestName.DelBuddy://delete a user from our friend list + new DelBuddyHandler(session, requst).Handle(); + break; + case PCMRequestName.Status://update current logged in user's status info + new StatusHandler(session, requst).Handle(); + break; + case PCMRequestName.StatusInfo: + throw new NotImplementedException(); + case PCMRequestName.InviteTo: + throw new NotImplementedException(); + default: + LogWriter.UnknownDataRecieved(rawRequest); + break; } } - catch (Exception e) - { - LogWriter.ToLog(LogEventLevel.Error, e.ToString()); - } } } } \ No newline at end of file diff --git a/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMRequestSerializer.cs b/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMRequestSerializer.cs index eccffc66d..d71778d48 100644 --- a/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMRequestSerializer.cs +++ b/src/Servers/PresenceConnectionManager/Handler/CommandSwticher/PCMRequestSerializer.cs @@ -14,7 +14,7 @@ using System.Collections.Generic; using System.Linq; -namespace PresenceConnectionManager.Abstraction.CommandSwticher +namespace PresenceConnectionManager.Handler.CommandSwitcher { public class PCMRequestSerializer { @@ -59,8 +59,7 @@ private static IRequest GenerateRequest(string command) return null; } // Read client message, and parse it into key value pairs - string[] recieved = command.TrimStart('\\').Split('\\'); - Dictionary keyValue = GameSpyUtils.ConvertRequestToKeyValue(recieved); + var keyValue = GameSpyUtils.ConvertToKeyValue(command); switch (keyValue.Keys.First()) { diff --git a/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BlockListHandler.cs b/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BlockListHandler.cs index 92ef27286..eca1e5055 100644 --- a/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BlockListHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BlockListHandler.cs @@ -9,7 +9,7 @@ namespace PresenceConnectionManager.Abstraction.SystemHandler public class BlockListHandler : PCMCommandHandlerBase { protected List _profileIDList; - public BlockListHandler(ISession session, Dictionary recv) : base(session, recv) + public BlockListHandler(ISession session, IRequest request) : base(session, request) { } diff --git a/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyListHandler.cs b/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyListHandler.cs index 215014765..f7c56c0c1 100644 --- a/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyListHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyListHandler.cs @@ -9,7 +9,7 @@ namespace PresenceConnectionManager.Abstraction.SystemHandler public class BuddyListHandler : PCMCommandHandlerBase { protected List _profileIDList; - public BuddyListHandler(ISession session, Dictionary recv) : base(session, recv) + public BuddyListHandler(ISession session, IRequest request) : base(session, request) { } diff --git a/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyStatusInfoHandler.cs b/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyStatusInfoHandler.cs index 1e1672828..d65f27ce2 100644 --- a/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyStatusInfoHandler.cs +++ b/src/Servers/PresenceConnectionManager/Handler/SystemHandler/Buddy/BuddyStatusInfoHandler.cs @@ -11,7 +11,7 @@ public class BuddyStatusInfoHandler : PCMCommandHandlerBase // "\bsi\\state\\profile\\bip\\bport\\hostip\\hprivip\" // "\qport\\hport\\sessflags\\rstatus\\gameType\" // "\gameVnt\\gameMn\\product\\qmodeflags\" - public BuddyStatusInfoHandler(ISession session, Dictionary recv) : base(session, recv) + public BuddyStatusInfoHandler(ISession session, IRequest request) : base(session, request) { } diff --git a/src/Servers/PresenceConnectionManager/Network/PCMSession.cs b/src/Servers/PresenceConnectionManager/Network/PCMSession.cs index 4ee024243..865cc6046 100644 --- a/src/Servers/PresenceConnectionManager/Network/PCMSession.cs +++ b/src/Servers/PresenceConnectionManager/Network/PCMSession.cs @@ -7,6 +7,7 @@ using Serilog.Events; using System; using System.Net; +using PresenceConnectionManager.Handler.CommandSwitcher; namespace PresenceConnectionManager.Network { @@ -46,7 +47,6 @@ protected override void OnConnected() protected override void OnReceived(string message) { PCMCommandSwitcher.Switch(this, message); - } public void SendServerChallenge() diff --git a/src/Servers/PresenceConnectionManager/PresenceConnectionManager.csproj b/src/Servers/PresenceConnectionManager/PresenceConnectionManager.csproj index a422a3742..083ccdc5e 100644 --- a/src/Servers/PresenceConnectionManager/PresenceConnectionManager.csproj +++ b/src/Servers/PresenceConnectionManager/PresenceConnectionManager.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 ..\..\..\common\Icon\UniSpy_Logo.ico diff --git a/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPCommandHandlerBase.cs b/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPCommandHandlerBase.cs index 5f8b527a5..31fec251b 100644 --- a/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPCommandHandlerBase.cs +++ b/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPCommandHandlerBase.cs @@ -16,16 +16,18 @@ public abstract class PSPCommandHandlerBase : CommandHandlerBase /// the decision formula should use _result.Count==0 /// protected string _sendingBuffer; - public PSPCommandHandlerBase(ISession session, Dictionary recv) : base(session) + protected PSPRequestBase _request; + public PSPCommandHandlerBase(ISession session, IRequest request) : base(session) { _errorCode = GPError.NoError; + _request = (PSPRequestBase)request; } public override void Handle() { base.Handle(); - RequestCheck(); + CheckRequest(); if (_errorCode < GPError.NoError) { @@ -47,7 +49,7 @@ public override void Handle() Response(); } - protected virtual void RequestCheck() { } + protected virtual void CheckRequest() { } protected virtual void DataOperation() { } /// diff --git a/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPRequestBase.cs b/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPRequestBase.cs index 44fde0f3e..9563acd3f 100644 --- a/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPRequestBase.cs +++ b/src/Servers/PresenceSearchPlayer/Abstraction/BaseClass/PSPRequestBase.cs @@ -8,15 +8,15 @@ namespace PresenceSearchPlayer.Abstraction.BaseClass public class PSPRequestBase : IRequest { protected Dictionary _rawRequest; - public string CmdName; + public string CommandName; public ushort OperationID { get; protected set; } - object IRequest.CommandName => CmdName; + object IRequest.CommandName => CommandName; public PSPRequestBase(Dictionary recv) { _rawRequest = recv; - CmdName = recv.Keys.First(); + CommandName = recv.Keys.First(); } public virtual GPError Parse() @@ -38,10 +38,5 @@ object IRequest.Parse() { return Parse(); } - - public object GetInstance() - { - return this; - } } } diff --git a/src/Servers/PresenceSearchPlayer/Dockerfile b/src/Servers/PresenceSearchPlayer/Dockerfile index 0299efae0..db335d9e5 100644 --- a/src/Servers/PresenceSearchPlayer/Dockerfile +++ b/src/Servers/PresenceSearchPlayer/Dockerfile @@ -1,8 +1,8 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 29901 -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/PresenceSearchPlayer/PresenceSearchPlayer.csproj", "src/Servers/PresenceSearchPlayer/"] COPY ["src/Libraries/UniSpyLib/UniSpyLib.csproj", "src/Libraries/UniSpyLib/"] @@ -17,5 +17,5 @@ RUN dotnet publish "PresenceSearchPlayer.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "PresenceSearchPlayer.dll"] \ No newline at end of file diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/CheckHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/CheckHandler.cs index 3f0d29be4..c5fae772f 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/CheckHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/CheckHandler.cs @@ -6,23 +6,18 @@ using System.Collections.Generic; using System.Linq; -namespace PresenceSearchPlayer.Handler.CommandHandler.Check +namespace PresenceSearchPlayer.Handler.CommandHandler { public class CheckHandler : PSPCommandHandlerBase { // \check\\nick\\email\\partnerid\0\passenc\\gamename\gmtest\final\ //\cur\pid\\final //check is request recieved correct and convert password into our MD5 type - protected CheckRequest _request; + protected new CheckRequest _request; uint _profileid; - public CheckHandler(ISession client, Dictionary recv) : base(client, recv) + public CheckHandler(ISession session, IRequest request) : base(session, request) { - _request = new CheckRequest(recv); - } - - protected override void RequestCheck() - { - _errorCode = _request.Parse(); + _request = (CheckRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NewUserHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NewUserHandler.cs index a167062c1..16e02f8ed 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NewUserHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NewUserHandler.cs @@ -1,27 +1,24 @@ -using UniSpyLib.Abstraction.BaseClass; -using UniSpyLib.Abstraction.Interface; +using UniSpyLib.Abstraction.Interface; using UniSpyLib.Database.DatabaseModel.MySql; -using UniSpyLib.Entity.Structure; using UniSpyLib.Logging; using PresenceSearchPlayer.Abstraction.BaseClass; using PresenceSearchPlayer.Entity.Enumerate; using PresenceSearchPlayer.Entity.Structure.Request; using Serilog.Events; using System; -using System.Collections.Generic; using System.Linq; -namespace PresenceSearchPlayer.Handler.CommandHandler.NewUser +namespace PresenceSearchPlayer.Handler.CommandHandler { public class NewUserHandler : PSPCommandHandlerBase { - private Users _user; - private Profiles _profile; - private Subprofiles _subProfile; - protected NewUserRequest _request; - public NewUserHandler(ISession client, Dictionary recv) : base(client, recv) + protected Users _user; + protected Profiles _profile; + protected Subprofiles _subProfile; + protected new NewUserRequest _request; + public NewUserHandler(ISession session, IRequest request) : base(session, request) { - _request = new NewUserRequest(recv); + _request = (NewUserRequest)request; } protected enum _newUserStatus @@ -37,11 +34,6 @@ protected enum _newUserStatus SubProfileExist } - protected override void RequestCheck() - { - _errorCode = _request.Parse(); - } - protected override void DataOperation() { using (var db = new retrospyContext()) @@ -79,19 +71,8 @@ protected override void BuildErrorResponse() protected override void BuildNormalResponse() { base.BuildNormalResponse(); - if (ServerManagerBase.ServerName - == UniSpyServerName.PSP) - { //PSP NewUser _sendingBuffer = $@"\nur\\pid\{_subProfile.Profileid}\final\"; - } - else if (ServerManagerBase.ServerName - == UniSpyServerName.PCM) - { - //PCM NewUser - _sendingBuffer = - $@"\nur\\userid\{_user.Userid}\profileid\{_subProfile.Profileid}\id\{_request.OperationID}\final\"; - } } private void UpdateOtherInfo() diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NicksHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NicksHandler.cs index 96aa04319..ce4645076 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NicksHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/NicksHandler.cs @@ -7,7 +7,7 @@ using System.Linq; /////////////////////////Finished?///////////////////////////////// -namespace PresenceSearchPlayer.Handler.CommandHandler.Nick +namespace PresenceSearchPlayer.Handler.CommandHandler { internal class NickHandlerDataModel { @@ -20,15 +20,10 @@ internal class NickHandlerDataModel public class NicksHandler : PSPCommandHandlerBase { List _result; - protected NicksRequest _request; - public NicksHandler(ISession client, Dictionary recv) : base(client, recv) + protected new NicksRequest _request; + public NicksHandler(ISession session, IRequest request) : base(session, request) { - _request = new NicksRequest(recv); - } - - protected override void RequestCheck() - { - _errorCode = _request.Parse(); + _request = (NicksRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersHandler.cs index 9323788c6..b28de206b 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersHandler.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; -namespace PresenceSearchPlayer.Handler.CommandHandler.Others +namespace PresenceSearchPlayer.Handler.CommandHandler { internal class OthersHandlerDataModel { @@ -22,17 +22,12 @@ internal class OthersHandlerDataModel /// public class OthersHandler : PSPCommandHandlerBase { - protected OthersRequest _request; + protected new OthersRequest _request; private List _result; - public OthersHandler(ISession client, Dictionary recv) : base(client, recv) + public OthersHandler(ISession session, IRequest request) : base(session, request) { - _request = new OthersRequest(recv); _result = new List(); - } - - protected override void RequestCheck() - { - _errorCode = _request.Parse(); + _request = (OthersRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersListHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersListHandler.cs index 26a5fd405..e71c6480c 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersListHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/OthersListHandler.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; -namespace PresenceSearchPlayer.Handler.CommandHandler.OthersList +namespace PresenceSearchPlayer.Handler.CommandHandler { internal class OthersListDBResult { @@ -14,23 +14,18 @@ internal class OthersListDBResult } public class OthersListHandler : PSPCommandHandlerBase { - protected OthersListRequest _request; + protected new OthersListRequest _request; private List _result; - public OthersListHandler(ISession client, Dictionary recv) : base(client, recv) + public OthersListHandler(ISession session, IRequest request) : base(session, request) { - _request = new OthersListRequest(recv); + _request = (OthersListRequest)request; _result = new List(); } //request: \otherslist\sesskey\\profileid\\numopids\ //\opids\|||******\namespaceid\<>\gamename\<>\final\ - protected override void RequestCheck() - { - _errorCode = _request.Parse(); - } - protected override void DataOperation() { using (var db = new retrospyContext()) diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchHandler.cs index a3f21b388..fc5a24894 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchHandler.cs @@ -14,7 +14,7 @@ //\more\\final\ //\search\sesskey\0\profileid\0\namespaceid\0\nick\gbr359_jordips\gamename\gbrome\final\ -namespace PresenceSearchPlayer.Handler.CommandHandler.Search +namespace PresenceSearchPlayer.Handler.CommandHandler { internal class SearchDBResult { @@ -29,20 +29,14 @@ internal class SearchDBResult public class SearchHandler : PSPCommandHandlerBase { - protected SearchRequest _request; + protected new SearchRequest _request; private List _result; - public SearchHandler(ISession client, Dictionary recv) : base(client, recv) + public SearchHandler(ISession session, IRequest request) : base(session, request) { - _request = new SearchRequest(recv); + _request = (SearchRequest)request; _result = new List(); } - protected override void RequestCheck() - { - _errorCode = _request.Parse(); - } - - protected override void DataOperation() { //TODO verify the search condition whether needed namespaceid!!!!! diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchUniqueHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchUniqueHandler.cs index e3fb41f3f..2b6b86c79 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchUniqueHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/SearchUniqueHandler.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; -namespace PresenceSearchPlayer.Handler.CommandHandler.SearchUnique +namespace PresenceSearchPlayer.Handler.CommandHandler { internal class SearchUniqueDBResult { @@ -23,16 +23,11 @@ internal class SearchUniqueDBResult /// public class SearchUniqueHandler : PSPCommandHandlerBase { - protected SearchUniqueRequest _request; + protected new SearchUniqueRequest _request; private List _result; - public SearchUniqueHandler(ISession client, Dictionary recv) : base(client, recv) + public SearchUniqueHandler(ISession session, IRequest request) : base(session, request) { - _request = new SearchUniqueRequest(recv); - } - - protected override void RequestCheck() - { - _errorCode = _request.Parse(); + _request = (SearchUniqueRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/UniqueSearchHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/UniqueSearchHandler.cs index 19aefc7e4..3885edc58 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/UniqueSearchHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/UniqueSearchHandler.cs @@ -5,21 +5,16 @@ using System.Collections.Generic; using System.Linq; -namespace PresenceSearchPlayer.Handler.CommandHandler.UniqueSearch +namespace PresenceSearchPlayer.Handler.CommandHandler { public class UniqueSearchHandler : PSPCommandHandlerBase { - protected UniqueSearchRequest _request; + protected new UniqueSearchRequest _request; private bool _isUniquenickExist; - public UniqueSearchHandler(ISession client, Dictionary recv) : base(client, recv) + public UniqueSearchHandler(ISession session, IRequest request) : base(session, request) { - _request = new UniqueSearchRequest(recv); - } - - protected override void RequestCheck() - { - _errorCode = _request.Parse(); + _request = (UniqueSearchRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/ValidHandler.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/ValidHandler.cs index c45d8837f..705dc467f 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/ValidHandler.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandHandler/ValidHandler.cs @@ -5,20 +5,15 @@ using System.Collections.Generic; using System.Linq; -namespace PresenceSearchPlayer.Handler.CommandHandler.Valid +namespace PresenceSearchPlayer.Handler.CommandHandler { public class ValidHandler : PSPCommandHandlerBase { - protected ValidRequest _request; + protected new ValidRequest _request; private bool _isAccountValid; - public ValidHandler(ISession client, Dictionary recv) : base(client, recv) + public ValidHandler(ISession session, IRequest request) : base(session, request) { - _request = new ValidRequest(recv); - } - - protected override void RequestCheck() - { - _errorCode = _request.Parse(); + _request = (ValidRequest)request; } protected override void DataOperation() diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandSwitcher/PSPCommandSwitcher.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandSwitcher/PSPCommandSwitcher.cs index 6084e9f04..d7b6cabe3 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/CommandSwitcher/PSPCommandSwitcher.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandSwitcher/PSPCommandSwitcher.cs @@ -1,90 +1,60 @@ using UniSpyLib.Logging; using UniSpyLib.MiscMethod; using PresenceSearchPlayer.Entity.Structure; -using PresenceSearchPlayer.Handler.CommandHandler.Check; -using PresenceSearchPlayer.Handler.CommandHandler.NewUser; -using PresenceSearchPlayer.Handler.CommandHandler.Nick; -using PresenceSearchPlayer.Handler.CommandHandler.Others; -using PresenceSearchPlayer.Handler.CommandHandler.OthersList; -//using PresenceSearchPlayer.Handler.CommandHandler.Pmatch; -using PresenceSearchPlayer.Handler.CommandHandler.Search; -using PresenceSearchPlayer.Handler.CommandHandler.SearchUnique; -using PresenceSearchPlayer.Handler.CommandHandler.UniqueSearch; -using PresenceSearchPlayer.Handler.CommandHandler.Valid; using Serilog.Events; using System; using System.Collections.Generic; using System.Linq; using PresenceSearchPlayer.Network; +using PresenceSearchPlayer.Handler.CommandHandler; namespace PresenceSearchPlayer.Handler.CommandSwitcher { public class PSPCommandSwitcher { - public static void Switch(PSPSession session, string message) + public static void Switch(PSPSession session, string rawRequest) { + var requests = PSPRequestSerializer.Serialize(session, rawRequest); - try + foreach (var request in requests) { - if (message[0] != '\\') + switch (request.CommandName) { - LogWriter.ToLog(LogEventLevel.Error, "Invalid request recieved!"); - return; + case PSPRequestName.Search: + new SearchHandler(session, request).Handle(); + break; + case PSPRequestName.Valid: + new ValidHandler(session, request).Handle(); + break; + case PSPRequestName.Nicks: + new NicksHandler(session, request).Handle(); + break; + case PSPRequestName.PMatch: + // PmatchHandler pmatch = new PmatchHandler(request); + // pmatch.Handle(session); + break; + case PSPRequestName.Check: + new CheckHandler(session, request).Handle(); + break; + case PSPRequestName.NewUser: + new NewUserHandler(session, request).Handle(); + break; + case PSPRequestName.SearchUnique: + new SearchUniqueHandler(session, request).Handle(); + break; + case PSPRequestName.Others: + new OthersHandler(session, request).Handle(); + break; + case PSPRequestName.OtherList: + new OthersListHandler(session, request).Handle(); + break; + case PSPRequestName.UniqueSearch: + new UniqueSearchHandler(session, request).Handle(); + break; + default: + LogWriter.UnknownDataRecieved(rawRequest); + break; } - string[] requests = message.Split("\\final\\", StringSplitOptions.RemoveEmptyEntries); - - foreach (string request in requests) - { - if (request.Length < 1) - { - continue; - } - - // Read client message, and parse it into key value pairs - Dictionary recv = GameSpyUtils.ConvertRequestToKeyValue(request); - - switch (recv.Keys.First()) - { - case PSPRequestName.Search: - new SearchHandler(session, recv).Handle(); - break; - case PSPRequestName.Valid: - new ValidHandler(session, recv).Handle(); - break; - case PSPRequestName.Nicks: - new NicksHandler(session, recv).Handle(); - break; - case PSPRequestName.PMatch: - // PmatchHandler pmatch = new PmatchHandler(recv); - // pmatch.Handle(session); - break; - case PSPRequestName.Check: - new CheckHandler(session, recv).Handle(); - break; - case PSPRequestName.NewUser: - new NewUserHandler(session, recv).Handle(); - break; - case PSPRequestName.SearchUnique: - new SearchUniqueHandler(session, recv).Handle(); - break; - case PSPRequestName.Others: - new OthersHandler(session, recv).Handle(); - break; - case PSPRequestName.OtherList: - new OthersListHandler(session, recv).Handle(); - break; - case PSPRequestName.UniqueSearch: - new UniqueSearchHandler(session, recv).Handle(); - break; - default: - LogWriter.UnknownDataRecieved(message); - break; - } - } - } - catch (Exception e) - { - LogWriter.ToLog(e); } } } diff --git a/src/Servers/PresenceSearchPlayer/Handler/CommandSwitcher/PSPRequestSerializer.cs b/src/Servers/PresenceSearchPlayer/Handler/CommandSwitcher/PSPRequestSerializer.cs new file mode 100644 index 000000000..aea5fef9a --- /dev/null +++ b/src/Servers/PresenceSearchPlayer/Handler/CommandSwitcher/PSPRequestSerializer.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using PresenceSearchPlayer.Entity.Enumerate; +using PresenceSearchPlayer.Entity.Structure; +using PresenceSearchPlayer.Entity.Structure.Request; +using PresenceSearchPlayer.Handler.CommandHandler.Error; +using Serilog.Events; +using UniSpyLib.Abstraction.Interface; +using UniSpyLib.Logging; +using UniSpyLib.MiscMethod; + +namespace PresenceSearchPlayer.Handler.CommandSwitcher +{ + public class PSPRequestSerializer + { + public static List Serialize(ISession session, string rawRequest) + { + List requestList = new List(); + if (rawRequest[0] != '\\') + { + LogWriter.ToLog(LogEventLevel.Error, "Invalid request recieved!"); + return null; + } + string[] commands = rawRequest.Split("\\final\\", StringSplitOptions.RemoveEmptyEntries); + foreach (var command in commands) + { + IRequest request = GenerateRequest(command); + if (request == null) + { + continue; + } + var flag = (GPError)request.Parse(); + if (flag != GPError.NoError) + { + session.SendAsync(ErrorMsg.BuildGPErrorMsg(flag)); + continue; + } + requestList.Add(request); + } + + return requestList; + } + + private static IRequest GenerateRequest(string rawCommand) + { + if (rawCommand.Length < 1) + { + return null; + } + // Read client message, and parse it into key value pairs + string[] recieved = rawCommand.TrimStart('\\').Split('\\'); + Dictionary keyValue = GameSpyUtils.ConvertToKeyValue(recieved); + + switch (keyValue.Keys.First()) + { + case PSPRequestName.Search: + return new SearchRequest(keyValue); + case PSPRequestName.Valid: + return new SearchRequest(keyValue); + case PSPRequestName.Nicks: + return new SearchRequest(keyValue); + case PSPRequestName.PMatch: + case PSPRequestName.Check: + return new SearchRequest(keyValue); + case PSPRequestName.NewUser: + return new SearchRequest(keyValue); + case PSPRequestName.SearchUnique: + return new SearchRequest(keyValue); + case PSPRequestName.Others: + return new SearchRequest(keyValue); + case PSPRequestName.OtherList: + return new SearchRequest(keyValue); + case PSPRequestName.UniqueSearch: + return new SearchRequest(keyValue); + default: + LogWriter.UnknownDataRecieved(rawCommand); + return null; + } + } + } +} diff --git a/src/Servers/PresenceSearchPlayer/Handler/SystemHandler/Error/ErrorMsg.cs b/src/Servers/PresenceSearchPlayer/Handler/SystemHandler/Error/ErrorMsg.cs index 73e3d4a0c..b55a9e4d4 100644 --- a/src/Servers/PresenceSearchPlayer/Handler/SystemHandler/Error/ErrorMsg.cs +++ b/src/Servers/PresenceSearchPlayer/Handler/SystemHandler/Error/ErrorMsg.cs @@ -180,11 +180,11 @@ public static string GetErrorMsg(GPError errorCode) /// The stream that will receive the error /// The error code /// The operation id - public static void SendGPSPError(ISession client, GPError errorCode, uint operationID) + public static void SendGPSPError(ISession session, GPError errorCode, uint operationID) { string errorMsg = GetErrorMsg(errorCode); string sendingBuffer = $@"\error\\err\{errorCode}\fatal\\errmsg\{errorMsg}\id\{operationID}\final\"; - client.SendAsync(sendingBuffer); + session.SendAsync(sendingBuffer); } public static string BuildGPErrorMsg(GPError errorCode) diff --git a/src/Servers/PresenceSearchPlayer/PresenceSearchPlayer.csproj b/src/Servers/PresenceSearchPlayer/PresenceSearchPlayer.csproj index a151e72d8..b883b08c1 100644 --- a/src/Servers/PresenceSearchPlayer/PresenceSearchPlayer.csproj +++ b/src/Servers/PresenceSearchPlayer/PresenceSearchPlayer.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 true ..\..\..\common\Icon\UniSpy_Logo.ico Linux @@ -29,5 +29,6 @@ + \ No newline at end of file diff --git a/src/Servers/QueryReport/Abstraction/BaseClass/QRRequestBase.cs b/src/Servers/QueryReport/Abstraction/BaseClass/QRRequestBase.cs index 66ad22121..62fa126e4 100644 --- a/src/Servers/QueryReport/Abstraction/BaseClass/QRRequestBase.cs +++ b/src/Servers/QueryReport/Abstraction/BaseClass/QRRequestBase.cs @@ -34,10 +34,5 @@ object IRequest.Parse() { return Parse(); } - - public object GetInstance() - { - return this; - } } } diff --git a/src/Servers/QueryReport/Dockerfile b/src/Servers/QueryReport/Dockerfile index e48575286..3e428be60 100644 --- a/src/Servers/QueryReport/Dockerfile +++ b/src/Servers/QueryReport/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 27900 EXPOSE 27900/udp -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/QueryReport/QueryReport.csproj", "src/Servers/QueryReport/"] COPY ["src/Libraries/UniSpyLib/UniSpyLib.csproj", "src/Libraries/UniSpyLib/"] @@ -18,5 +18,5 @@ RUN dotnet publish "QueryReport.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "QueryReport.dll"] \ No newline at end of file diff --git a/src/Servers/QueryReport/Handler/CommandHandler/KeepAliveHandler.cs b/src/Servers/QueryReport/Handler/CommandHandler/KeepAliveHandler.cs index b69e9c7fe..1e8d7fdb7 100644 --- a/src/Servers/QueryReport/Handler/CommandHandler/KeepAliveHandler.cs +++ b/src/Servers/QueryReport/Handler/CommandHandler/KeepAliveHandler.cs @@ -26,8 +26,7 @@ protected override void ConstructeResponse() _sendingBuffer = new QRResponseBase(_request).BuildResponse(); - QRSession client = (QRSession)_session.GetInstance(); - var result = GameServer.GetServers(client.RemoteEndPoint); + var result = GameServer.GetServers(_session.RemoteEndPoint); if (result.Count != 1) { _errorCode = QRErrorCode.Database; @@ -40,7 +39,7 @@ protected override void ConstructeResponse() GameServer.UpdateServer ( - client.RemoteEndPoint, + _session.RemoteEndPoint, gameServer.ServerData.KeyValue["gamename"], gameServer); } diff --git a/src/Servers/QueryReport/Handler/CommandSwitcher/QRCommandSwitcher.cs b/src/Servers/QueryReport/Handler/CommandSwitcher/QRCommandSwitcher.cs index 5e7e32f89..947e27c2b 100644 --- a/src/Servers/QueryReport/Handler/CommandSwitcher/QRCommandSwitcher.cs +++ b/src/Servers/QueryReport/Handler/CommandSwitcher/QRCommandSwitcher.cs @@ -7,8 +7,7 @@ using QueryReport.Handler.CommandHandler.Echo; using QueryReport.Handler.CommandHandler.HeartBeat; using QueryReport.Handler.CommandHandler.KeepAlive; -using Serilog.Events; -using System; +using QueryReport.Abstraction.BaseClass; namespace QueryReport.Handler.CommandSwitcher { @@ -16,12 +15,12 @@ public class QRCommandSwitcher { public static void Switch(ISession session, byte[] rawRequest) { - - try - { - IRequest request = QRRequestSerializer.Serilize(rawRequest); + var serializer = new QRRequestSerializer(session, rawRequest); + serializer.Serialize(); - switch ((QRPacketType)rawRequest[0]) + foreach (QRRequestBase request in serializer.Requests) + { + switch (request.PacketType) { case QRPacketType.AvaliableCheck: new AvailableHandler(session, request).Handle(); @@ -48,10 +47,6 @@ public static void Switch(ISession session, byte[] rawRequest) break; } } - catch (Exception e) - { - LogWriter.ToLog(LogEventLevel.Error, e.ToString()); - } } } } diff --git a/src/Servers/QueryReport/Handler/CommandSwitcher/QRRequestSerializer.cs b/src/Servers/QueryReport/Handler/CommandSwitcher/QRRequestSerializer.cs index 3cda58018..2a820a212 100644 --- a/src/Servers/QueryReport/Handler/CommandSwitcher/QRRequestSerializer.cs +++ b/src/Servers/QueryReport/Handler/CommandSwitcher/QRRequestSerializer.cs @@ -5,59 +5,67 @@ using QueryReport.Entity.Structure.Request; using QueryReport.Handler.SystemHandler.ErrorMessage; using Serilog.Events; +using UniSpyLib.Abstraction.BaseClass; namespace QueryReport.Handler.CommandSwitcher { - public class QRRequestSerializer + public class QRRequestSerializer:RequestSerializerBase { - public static IRequest Serilize(byte[] rawRequest) + protected new byte[] _rawRequest; + public QRRequestSerializer(ISession session, byte[] rawRequest) : base(session, rawRequest) { - IRequest request; - if (rawRequest.Length < 1) + _rawRequest = rawRequest; + } + + public override void Serialize() + { + if (_rawRequest.Length < 1) + { + return; + } + + var request = GenerateRequest(_rawRequest); + + if (request == null) { - return null; + return; } - switch ((QRPacketType)rawRequest[0]) + if (!(bool)request.Parse()) + { + LogWriter.ToLog(LogEventLevel.Error, ErrorMessage.GetErrorMessage(QRErrorCode.Parse)); + return; + } + + Requests.Add(request); + } + + protected override IRequest GenerateRequest(object singleRequest) + { + switch ((QRPacketType)_rawRequest[0]) { case QRPacketType.AvaliableCheck: - request = new AvaliableRequest(rawRequest); - break; + return new AvaliableRequest(_rawRequest); //verify challenge to check game server is real or fake; //after verify we can add game server to server list case QRPacketType.Challenge: - request = new ChallengeRequest(rawRequest); - break; + return new ChallengeRequest(_rawRequest); case QRPacketType.HeartBeat: - request = new HeartBeatRequest(rawRequest); - break; + return new HeartBeatRequest(_rawRequest); + case QRPacketType.KeepAlive: - request = new KeepAliveRequest(rawRequest); - break; + return new KeepAliveRequest(_rawRequest); + case QRPacketType.EchoResponse: - request = new QRRequestBase(rawRequest); - break; - case QRPacketType.ClientMessageACK: - request = new QRRequestBase(rawRequest); - break; - default: - LogWriter.UnknownDataRecieved(rawRequest); - request = null; - break; - } + return new QRRequestBase(_rawRequest); - if (request == null) - { - return null; - } + case QRPacketType.ClientMessageACK: + return new QRRequestBase(_rawRequest); - if (!(bool)request.Parse()) - { - LogWriter.ToLog(LogEventLevel.Error, ErrorMessage.GetErrorMessage(QRErrorCode.Parse)); - return null; + default: + LogWriter.UnknownDataRecieved(_rawRequest); + return null; } - - return request; } } } diff --git a/src/Servers/QueryReport/Handler/SystemHandler/QRSessionManage/QRSessionManager.cs b/src/Servers/QueryReport/Handler/SystemHandler/QRSessionManage/QRSessionManager.cs index 1c69a8c3d..bf5788439 100644 --- a/src/Servers/QueryReport/Handler/SystemHandler/QRSessionManage/QRSessionManager.cs +++ b/src/Servers/QueryReport/Handler/SystemHandler/QRSessionManage/QRSessionManager.cs @@ -5,7 +5,7 @@ namespace QueryReport.Handler.SystemHandler.QRSessionManage { - public class QRSessionManager : ExpireManagerBase + public class QRSessionManager : TImerBase { public static ConcurrentDictionary Sessions; diff --git a/src/Servers/QueryReport/Handler/SystemHandler/ServerList/ServerListManager.cs b/src/Servers/QueryReport/Handler/SystemHandler/ServerList/ServerListManager.cs index 4c0da3ce9..9ad5a33d2 100644 --- a/src/Servers/QueryReport/Handler/SystemHandler/ServerList/ServerListManager.cs +++ b/src/Servers/QueryReport/Handler/SystemHandler/ServerList/ServerListManager.cs @@ -5,7 +5,7 @@ namespace QueryReport.Handler.SystemHandler.ServerList { - public class ServerListManager : ExpireManagerBase + public class ServerListManager : TImerBase { protected override void CheckExpire() diff --git a/src/Servers/QueryReport/Network/QRServer.cs b/src/Servers/QueryReport/Network/QRServer.cs index 4d209514e..e35fe5cc6 100644 --- a/src/Servers/QueryReport/Network/QRServer.cs +++ b/src/Servers/QueryReport/Network/QRServer.cs @@ -43,6 +43,7 @@ protected override object CreateSession(EndPoint endPoint) protected override void OnReceived(EndPoint endPoint, byte[] message) { + base.OnReceived(endPoint, message); QRSession session; if (!QRSessionManager.Sessions.TryGetValue(endPoint, out session)) { @@ -51,5 +52,10 @@ protected override void OnReceived(EndPoint endPoint, byte[] message) } QRCommandSwitcher.Switch(session, message); } + + protected override void OnReceived(EndPoint endPoint, string message) + { + base.OnReceived(endPoint, message); + } } } diff --git a/src/Servers/QueryReport/QueryReport.csproj b/src/Servers/QueryReport/QueryReport.csproj index 5bb50ee28..c53e39460 100644 --- a/src/Servers/QueryReport/QueryReport.csproj +++ b/src/Servers/QueryReport/QueryReport.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 ..\..\..\common\Icon\UniSpy_Logo.ico Linux ..\.. diff --git a/src/Servers/ServerBrowser/Abstraction/BaseClass/SBCommandHandlerBase.cs b/src/Servers/ServerBrowser/Abstraction/BaseClass/SBCommandHandlerBase.cs index 3aab489d6..2ab2a4588 100644 --- a/src/Servers/ServerBrowser/Abstraction/BaseClass/SBCommandHandlerBase.cs +++ b/src/Servers/ServerBrowser/Abstraction/BaseClass/SBCommandHandlerBase.cs @@ -4,6 +4,8 @@ using Serilog.Events; using ServerBrowser.Entity.Enumerate; using ServerBrowser.Handler.SystemHandler.Error; +using ServerBrowser.Network; + namespace ServerBrowser.Abstraction.BaseClass { public abstract class SBCommandHandlerBase : CommandHandlerBase @@ -11,11 +13,12 @@ public abstract class SBCommandHandlerBase : CommandHandlerBase protected SBErrorCode _errorCode; protected byte[] _sendingBuffer; protected byte[] _recv; - - public SBCommandHandlerBase(ISession client, byte[] recv) : base(client) + protected new SBSession _session; + public SBCommandHandlerBase(ISession session, byte[] recv) : base(session) { _errorCode = SBErrorCode.NoError; _recv = recv; + _session = (SBSession)session; } public override void Handle() diff --git a/src/Servers/ServerBrowser/Abstraction/BaseClass/UpdateOptionHandlerBase.cs b/src/Servers/ServerBrowser/Abstraction/BaseClass/UpdateOptionHandlerBase.cs index 0220c13ec..d43d73424 100644 --- a/src/Servers/ServerBrowser/Abstraction/BaseClass/UpdateOptionHandlerBase.cs +++ b/src/Servers/ServerBrowser/Abstraction/BaseClass/UpdateOptionHandlerBase.cs @@ -30,6 +30,11 @@ public UpdateOptionHandlerBase(ServerListRequest request, ISession session, byte _dataList = new List(); } + public UpdateOptionHandlerBase(ISession session, byte[] recv) : base(session, recv) + { + _dataList = new List(); + } + protected override void CheckRequest() { base.CheckRequest(); @@ -47,8 +52,8 @@ protected override void CheckRequest() return; } //this is client public ip and default query port - SBSession session = (SBSession)_session.GetInstance(); - _clientRemoteIP = ((IPEndPoint)session.Socket.RemoteEndPoint).Address.GetAddressBytes(); + + _clientRemoteIP = ((IPEndPoint)_session.Socket.RemoteEndPoint).Address.GetAddressBytes(); //TODO //default port should be hton format byte[] defaultPortBytes = BitConverter.GetBytes( @@ -78,8 +83,7 @@ protected override void Response() SBServer.ServerChallenge ); //refresh encryption state - SBSession session = (SBSession)_session.GetInstance(); - session.EncState = enc.State; + _session.EncState = enc.State; if (_sendingBuffer == null || _sendingBuffer.Length < 4) { @@ -88,7 +92,7 @@ protected override void Response() LogWriter.ToLog(LogEventLevel.Debug, $"[Send] { StringExtensions.ReplaceUnreadableCharToHex(_dataList.ToArray(), 0, _dataList.Count)}"); - session.BaseSendAsync(_sendingBuffer); + _session.BaseSendAsync(_sendingBuffer); } protected virtual void GenerateServerKeys() diff --git a/src/Servers/ServerBrowser/Dockerfile b/src/Servers/ServerBrowser/Dockerfile index d6e9501ba..494293e82 100644 --- a/src/Servers/ServerBrowser/Dockerfile +++ b/src/Servers/ServerBrowser/Dockerfile @@ -1,8 +1,8 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 28910 -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/ServerBrowser/ServerBrowser.csproj", "src/Servers/ServerBrowser/"] COPY ["src/Servers/QueryReport/QueryReport.csproj", "src/Servers/QueryReport/"] @@ -19,5 +19,5 @@ RUN dotnet publish "ServerBrowser.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "ServerBrowser.dll"] \ No newline at end of file diff --git a/src/Servers/ServerBrowser/Entity/Enumerate/SBServerListEnum.cs b/src/Servers/ServerBrowser/Entity/Enumerate/SBServerListEnum.cs index 85e8f2e5c..16b58b321 100644 --- a/src/Servers/ServerBrowser/Entity/Enumerate/SBServerListEnum.cs +++ b/src/Servers/ServerBrowser/Entity/Enumerate/SBServerListEnum.cs @@ -37,6 +37,9 @@ public enum SBServerListUpdateOption /// this is used to check the connection to server browser /// NoServerList = 2, + /// + /// Push new local game status to QueryReport server + /// PushUpdates = 4, AlternateSourceIP = 8, SendGroups = 32, diff --git a/src/Servers/ServerBrowser/Entity/Structure/Packet/Request/AdHocRequest.cs b/src/Servers/ServerBrowser/Entity/Structure/Packet/Request/AdHocRequest.cs index 205756ec3..055f20613 100644 --- a/src/Servers/ServerBrowser/Entity/Structure/Packet/Request/AdHocRequest.cs +++ b/src/Servers/ServerBrowser/Entity/Structure/Packet/Request/AdHocRequest.cs @@ -1,41 +1,48 @@ using UniSpyLib.Extensions; using System; using System.Net; +using UniSpyLib.Abstraction.Interface; namespace ServerBrowser.Entity.Structure.Packet.Request { - public class AdHocRequest + public class AdHocRequest : IRequest { /// /// The game server client search for /// - public string TargetServerIP { get; protected set; } - public string TargetServerHostPort { get; protected set; } + public string TargetServerIP { get { return TargetEndPoint.Address.ToString(); } } + public string TargetServerHostPort { get { return TargetEndPoint.Port.ToString(); } } + public IPEndPoint TargetEndPoint { get; protected set; } + public byte[] RawRequest { get; protected set; } - public AdHocRequest() + object IRequest.CommandName => throw new NotImplementedException(); + + public AdHocRequest(byte[] rawRequest) { + RawRequest = rawRequest; } - public bool Parse(byte[] recv) + public bool Parse() { - ushort length = ByteTools.ToUInt16(ByteTools.SubBytes(recv, 0, 2), true); + ushort length = ByteTools.ToUInt16(ByteTools.SubBytes(RawRequest, 0, 2), true); //if(recv.Length SearchOption; - protected set { } + public PlayerSearchRequest(byte[] rawRequest) + { + RawRequest = rawRequest; } - private byte[] _message; - - public PlayerSearchRequest(byte[] recv) + public bool Parse() { - ByteTools.SubBytes(recv, 3, 3 + 4).CopyTo(SearchOption, 0); - ByteTools.SubBytes(recv, 7, 7 + 4).CopyTo(MaxResults, 0); + SearchOption = Convert.ToInt16(ByteTools.SubBytes(RawRequest, 3, 3 + 4)); + MaxResults = Convert.ToUInt16(ByteTools.SubBytes(RawRequest, 7, 7 + 4)); - int nameLength = BitConverter.ToInt32(ByteTools.SubBytes(recv, 11, 11 + 4)); + int nameLength = BitConverter.ToInt32( + ByteTools.SubBytes(RawRequest, 11, 11 + 4)); + SearchName = Encoding.ASCII.GetString( + ByteTools.SubBytes(RawRequest, 15, nameLength)); - _searchName = new byte[nameLength]; - ByteTools.SubBytes(recv, 15, nameLength).CopyTo(_searchName, 0); + int messageLength = BitConverter.ToInt32( + ByteTools.SubBytes(RawRequest, 15 + nameLength, 4)); + Message = Encoding.ASCII.GetString( + ByteTools.SubBytes(RawRequest, 15 + nameLength + 4, messageLength)); - int messageLength = BitConverter.ToInt32(ByteTools.SubBytes(recv, 15 + nameLength, 4)); + return true; + } - _message = new byte[messageLength]; - ByteTools.SubBytes(recv, 15 + nameLength + 4, messageLength).CopyTo(_message, 0); + object IRequest.Parse() + { + return Parse(); } } } diff --git a/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/SendMessageHandler.cs b/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/SendMessageHandler.cs index 854032a71..3dbbe77c8 100644 --- a/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/SendMessageHandler.cs +++ b/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/SendMessageHandler.cs @@ -4,14 +4,14 @@ using ServerBrowser.Entity.Structure.Packet.Request; using ServerBrowser.Network; -namespace ServerBrowser.Handler.CommandHandler.AdHoc.SendMessage +namespace ServerBrowser.Handler.CommandHandler { public class SendMessageHandler : SBCommandHandlerBase { private AdHocRequest _request; - public SendMessageHandler(ISession client, byte[] recv) : base(client, recv) + public SendMessageHandler(ISession session, byte[] recv) : base(session, recv) { - _request = new AdHocRequest(); + _request = new AdHocRequest(recv); } protected override void CheckRequest() @@ -19,7 +19,7 @@ protected override void CheckRequest() //we do not call base method because we have our own check method //base.CheckRequest(); - if (!_request.Parse(_recv)) + if (!_request.Parse()) { _errorCode = SBErrorCode.Parse; return; @@ -29,8 +29,7 @@ protected override void CheckRequest() protected override void DataOperation() { base.DataOperation(); - var session = (SBSession)_session.GetInstance(); - session.ServerMessageList.Add(_request); + _session.ServerMessageList.Add(_request); } } } diff --git a/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/ServerInfoHandler.cs b/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/ServerInfoHandler.cs index 33b23a4ea..3e06e8492 100644 --- a/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/ServerInfoHandler.cs +++ b/src/Servers/ServerBrowser/Handler/CommandHandler/AdHoc/ServerInfoHandler.cs @@ -11,9 +11,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using ServerBrowser.Network; -namespace ServerBrowser.Handler.CommandHandler.AdHoc.ServerInfo +namespace ServerBrowser.Handler.CommandHandler { /// /// Get full rules for a server (for example, to get @@ -24,16 +23,16 @@ public class ServerInfoHandler : UpdateOptionHandlerBase private new AdHocRequest _request; private GameServer _gameServer; - public ServerInfoHandler(ISession client, byte[] recv) : base(null, client, recv) + public ServerInfoHandler(ISession session, byte[] recv) : base(session, recv) { - _request = new AdHocRequest(); + _request = new AdHocRequest(recv); } protected override void CheckRequest() { //we do not call base.CheckRequest() method because we have our own check method - if (!_request.Parse(_recv)) + if (!_request.Parse()) { _errorCode = SBErrorCode.Parse; return; @@ -71,11 +70,9 @@ protected override void ConstructResponse() _dataList.InsertRange(0, msgLength); - SBSession session = (SBSession)_session.GetInstance(); - - GOAEncryption enc = new GOAEncryption(session.EncState); + GOAEncryption enc = new GOAEncryption(_session.EncState); _sendingBuffer = enc.Encrypt(_dataList.ToArray()); - session.EncState = enc.State; + _session.EncState = enc.State; } protected virtual List GenerateServerInfo() @@ -90,6 +87,7 @@ protected virtual List GenerateServerInfo() data.AddRange(Encoding.ASCII.GetBytes(kv.Value)); data.Add(SBStringFlag.StringSpliter); } + foreach (var player in _gameServer.PlayerData.KeyValueList) { foreach (var kv in player) @@ -100,6 +98,7 @@ protected virtual List GenerateServerInfo() data.Add(SBStringFlag.StringSpliter); } } + foreach (var team in _gameServer.TeamData.KeyValueList) { foreach (var kv in team) diff --git a/src/Servers/ServerBrowser/Handler/CommandHandler/NatNeg/NatNegCookieHandler.cs b/src/Servers/ServerBrowser/Handler/CommandHandler/NatNeg/NatNegCookieHandler.cs index f0dd69df7..8d178761c 100644 --- a/src/Servers/ServerBrowser/Handler/CommandHandler/NatNeg/NatNegCookieHandler.cs +++ b/src/Servers/ServerBrowser/Handler/CommandHandler/NatNeg/NatNegCookieHandler.cs @@ -10,7 +10,7 @@ using System.Linq; using ServerBrowser.Network; -namespace ServerBrowser.Handler.CommandHandler.NatNeg +namespace ServerBrowser.Handler.CommandHandler { /// /// we need forward this to game server diff --git a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/GeneralRequestHandler.cs b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/GeneralRequestHandler.cs index 67d634a33..77583b7be 100644 --- a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/GeneralRequestHandler.cs +++ b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/GeneralRequestHandler.cs @@ -4,11 +4,11 @@ using ServerBrowser.Entity.Structure; using ServerBrowser.Entity.Structure.Packet.Request; -namespace ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.GeneralRequest +namespace ServerBrowser.Handler.CommandHandler { public class GeneralRequestHandler : UpdateOptionHandlerBase { - public GeneralRequestHandler(ServerListRequest request, ISession client, byte[] recv) : base(request, client, recv) + public GeneralRequestHandler(ServerListRequest request, ISession session, byte[] recv) : base(request, session, recv) { } diff --git a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/NoServerListHandler.cs b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/NoServerListHandler.cs index 77ef3307b..0173efb49 100644 --- a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/NoServerListHandler.cs +++ b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/NoServerListHandler.cs @@ -2,7 +2,7 @@ using ServerBrowser.Abstraction.BaseClass; using ServerBrowser.Entity.Structure.Packet.Request; -namespace ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.NoServerList +namespace ServerBrowser.Handler.CommandHandler { /// /// No server list update option only get ip and host port for client @@ -10,7 +10,7 @@ namespace ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.No /// public class NoServerListHandler : UpdateOptionHandlerBase { - public NoServerListHandler(ServerListRequest request, ISession client, byte[] recv) : base(request, client, recv) + public NoServerListHandler(ServerListRequest request, ISession session, byte[] recv) : base(request, session, recv) { } } diff --git a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/PushUpdatesHandler.cs b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/PushUpdatesHandler.cs index 5a0baaa84..7849e5469 100644 --- a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/PushUpdatesHandler.cs +++ b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/PushUpdatesHandler.cs @@ -6,14 +6,14 @@ using ServerBrowser.Entity.Structure.Packet.Request; using System.Linq; -namespace ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.PushUpdates +namespace ServerBrowser.Handler.CommandHandler { /// /// Search peer to peer game servers to client /// public class PushUpdatesHandler : UpdateOptionHandlerBase { - public PushUpdatesHandler(ServerListRequest request, ISession client, byte[] recv) : base(request, client, recv) + public PushUpdatesHandler(ServerListRequest request, ISession session, byte[] recv) : base(request, session, recv) { } diff --git a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/SendGroupsHandler.cs b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/SendGroupsHandler.cs index 59150dfb5..c57b5b485 100644 --- a/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/SendGroupsHandler.cs +++ b/src/Servers/ServerBrowser/Handler/CommandHandler/ServerList/SendGroupsHandler.cs @@ -7,13 +7,13 @@ using ServerBrowser.Entity.Structure.Packet.Request; using System.Text; -namespace ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.SendGroups +namespace ServerBrowser.Handler.CommandHandler { public class SendGroupsHandler : UpdateOptionHandlerBase { private PeerGroup _peerGroup; - public SendGroupsHandler(ServerListRequest request, ISession client, byte[] recv) : base(request, client, recv) + public SendGroupsHandler(ServerListRequest request, ISession session, byte[] recv) : base(request, session, recv) { } diff --git a/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBCommandSwitcher.cs b/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBCommandSwitcher.cs index 60c9ec489..85ccda5b1 100644 --- a/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBCommandSwitcher.cs +++ b/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBCommandSwitcher.cs @@ -2,11 +2,9 @@ using UniSpyLib.Logging; using NATNegotiation.Abstraction.BaseClass; using ServerBrowser.Entity.Enumerate; -using ServerBrowser.Handler.CommandHandler.AdHoc.SendMessage; -using ServerBrowser.Handler.CommandHandler.AdHoc.ServerInfo; -using ServerBrowser.Handler.CommandHandler.NatNeg; using ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionSwitcher; using System.Linq; +using ServerBrowser.Handler.CommandHandler; namespace ServerBrowser.Handler.CommandSwitcher { diff --git a/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBRequestSerializer.cs b/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBRequestSerializer.cs new file mode 100644 index 000000000..513c1535a --- /dev/null +++ b/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBRequestSerializer.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using UniSpyLib.Abstraction.Interface; + +namespace ServerBrowser.Handler.CommandSwitcher +{ + public class SBRequestSerializer + { + public static List Serialize(ISession session, byte[] rawRequest) + { + List requests = new List(); + + return requests; + } + + public static IRequest GenerateRequest(byte[] rawRequest) + { + + + return null; + } + } +} diff --git a/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBUpdateOptionSwitcher.cs b/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBUpdateOptionSwitcher.cs index f770faabd..b0039de2e 100644 --- a/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBUpdateOptionSwitcher.cs +++ b/src/Servers/ServerBrowser/Handler/CommandSwitcher/SBUpdateOptionSwitcher.cs @@ -3,10 +3,6 @@ using Serilog.Events; using ServerBrowser.Entity.Enumerate; using ServerBrowser.Entity.Structure.Packet.Request; -using ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.GeneralRequest; -using ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.NoServerList; -using ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.PushUpdates; -using ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionHandler.SendGroups; using ServerBrowser.Handler.SystemHandler.Error; namespace ServerBrowser.Handler.CommandHandler.ServerList.UpdateOptionSwitcher diff --git a/src/Servers/ServerBrowser/ServerBrowser.csproj b/src/Servers/ServerBrowser/ServerBrowser.csproj index f3b38f3ea..aceaff452 100644 --- a/src/Servers/ServerBrowser/ServerBrowser.csproj +++ b/src/Servers/ServerBrowser/ServerBrowser.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 ..\..\..\common\Icon\UniSpy_Logo.ico Linux ..\.. diff --git a/src/Servers/WebServices/Dockerfile b/src/Servers/WebServices/Dockerfile index 6a7ab0f10..2ac60f03c 100644 --- a/src/Servers/WebServices/Dockerfile +++ b/src/Servers/WebServices/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.7-alpine3.12 AS base +FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine3.12 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/core/sdk:3.1.401-alpine3.12 AS build +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine3.12 AS build WORKDIR /src COPY ["src/Servers/WebServices/WebServices.csproj", "src/Servers/WebServices/"] COPY ["src/Libraries/UniSpyLib/UniSpyLib.csproj", "src/Libraries/UniSpyLib/"] @@ -19,5 +19,5 @@ RUN dotnet publish "WebServices.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -COPY ./common/RetroSpyServer.json . +COPY ./common/UniSpyServer.cfg . ENTRYPOINT ["dotnet", "WebServices.dll"] \ No newline at end of file diff --git a/src/Servers/WebServices/RetroSpyServices/Authentication/Entity/Interface/IAuthService.cs b/src/Servers/WebServices/Services/Authentication/Entity/Interface/IAuthService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Authentication/Entity/Interface/IAuthService.cs rename to src/Servers/WebServices/Services/Authentication/Entity/Interface/IAuthService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Authentication/Entity/Structure/Model/AuthServiceModel.cs b/src/Servers/WebServices/Services/Authentication/Entity/Structure/Model/AuthServiceModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Authentication/Entity/Structure/Model/AuthServiceModel.cs rename to src/Servers/WebServices/Services/Authentication/Entity/Structure/Model/AuthServiceModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Authentication/Service/AuthService.cs b/src/Servers/WebServices/Services/Authentication/Service/AuthService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Authentication/Service/AuthService.cs rename to src/Servers/WebServices/Services/Authentication/Service/AuthService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Competitive/Entity/Interface/ICompetitiveService.cs b/src/Servers/WebServices/Services/Competitive/Entity/Interface/ICompetitiveService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Competitive/Entity/Interface/ICompetitiveService.cs rename to src/Servers/WebServices/Services/Competitive/Entity/Interface/ICompetitiveService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Competitive/Entity/Structure/Model/CompetitiveModel.cs b/src/Servers/WebServices/Services/Competitive/Entity/Structure/Model/CompetitiveModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Competitive/Entity/Structure/Model/CompetitiveModel.cs rename to src/Servers/WebServices/Services/Competitive/Entity/Structure/Model/CompetitiveModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Competitive/Service/CompetitiveService.cs b/src/Servers/WebServices/Services/Competitive/Service/CompetitiveService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Competitive/Service/CompetitiveService.cs rename to src/Servers/WebServices/Services/Competitive/Service/CompetitiveService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Direct2Game/Entity/Interface/IDirect2GameService.cs b/src/Servers/WebServices/Services/Direct2Game/Entity/Interface/IDirect2GameService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Direct2Game/Entity/Interface/IDirect2GameService.cs rename to src/Servers/WebServices/Services/Direct2Game/Entity/Interface/IDirect2GameService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Direct2Game/Entity/Structure/Model/Direct2GameServiceModel.cs b/src/Servers/WebServices/Services/Direct2Game/Entity/Structure/Model/Direct2GameServiceModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Direct2Game/Entity/Structure/Model/Direct2GameServiceModel.cs rename to src/Servers/WebServices/Services/Direct2Game/Entity/Structure/Model/Direct2GameServiceModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Direct2Game/Service/Direct2GameService.cs b/src/Servers/WebServices/Services/Direct2Game/Service/Direct2GameService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Direct2Game/Service/Direct2GameService.cs rename to src/Servers/WebServices/Services/Direct2Game/Service/Direct2GameService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Motd/Entity/Interface/IMotdService.cs b/src/Servers/WebServices/Services/Motd/Entity/Interface/IMotdService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Motd/Entity/Interface/IMotdService.cs rename to src/Servers/WebServices/Services/Motd/Entity/Interface/IMotdService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Motd/Entity/Structure/Model/MotdServiceModel.cs b/src/Servers/WebServices/Services/Motd/Entity/Structure/Model/MotdServiceModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Motd/Entity/Structure/Model/MotdServiceModel.cs rename to src/Servers/WebServices/Services/Motd/Entity/Structure/Model/MotdServiceModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Motd/Service/MotdService.cs b/src/Servers/WebServices/Services/Motd/Service/MotdService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Motd/Service/MotdService.cs rename to src/Servers/WebServices/Services/Motd/Service/MotdService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/PatchingAndTracking/Entity/Interface/IPatchingAndTrackingService.cs b/src/Servers/WebServices/Services/PatchingAndTracking/Entity/Interface/IPatchingAndTrackingService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/PatchingAndTracking/Entity/Interface/IPatchingAndTrackingService.cs rename to src/Servers/WebServices/Services/PatchingAndTracking/Entity/Interface/IPatchingAndTrackingService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/PatchingAndTracking/Entity/Structure/Model/PatchingAndTrackingServiceModel.cs b/src/Servers/WebServices/Services/PatchingAndTracking/Entity/Structure/Model/PatchingAndTrackingServiceModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/PatchingAndTracking/Entity/Structure/Model/PatchingAndTrackingServiceModel.cs rename to src/Servers/WebServices/Services/PatchingAndTracking/Entity/Structure/Model/PatchingAndTrackingServiceModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/PatchingAndTracking/Handler/Service/PatchingAndTrackingService.cs b/src/Servers/WebServices/Services/PatchingAndTracking/Handler/Service/PatchingAndTrackingService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/PatchingAndTracking/Handler/Service/PatchingAndTrackingService.cs rename to src/Servers/WebServices/Services/PatchingAndTracking/Handler/Service/PatchingAndTrackingService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Interface/ISakeStorageService.cs b/src/Servers/WebServices/Services/Sake/Entity/Interface/ISakeStorageService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Interface/ISakeStorageService.cs rename to src/Servers/WebServices/Services/Sake/Entity/Interface/ISakeStorageService.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeCreateRecordModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeCreateRecordModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeCreateRecordModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeCreateRecordModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeDeleteRecordModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeDeleteRecordModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeDeleteRecordModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeDeleteRecordModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetMyRecords.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetMyRecords.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetMyRecords.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetMyRecords.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetRamdomRecordModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetRamdomRecordModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetRamdomRecordModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetRamdomRecordModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetRecordLimitModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetRecordLimitModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetRecordLimitModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetRecordLimitModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetSpecificRecordsModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetSpecificRecordsModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeGetSpecificRecordsModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeGetSpecificRecordsModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeRateRecordModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeRateRecordModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeRateRecordModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeRateRecordModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeRequestBase.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeRequestBase.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeRequestBase.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeRequestBase.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeSearchForRecordModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeSearchForRecordModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeSearchForRecordModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeSearchForRecordModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeUpdateRecordModel.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeUpdateRecordModel.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Request/SakeUpdateRecordModel.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Request/SakeUpdateRecordModel.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeCreateRecordResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeCreateRecordResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeCreateRecordResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeCreateRecordResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeDeleteRecordResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeDeleteRecordResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeDeleteRecordResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeDeleteRecordResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetMyRecordsResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetMyRecordsResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetMyRecordsResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetMyRecordsResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetRandomRecordResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetRandomRecordResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetRandomRecordResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetRandomRecordResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetRecordLimitReponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetRecordLimitReponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetRecordLimitReponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetRecordLimitReponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetSpecificRecordsResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetSpecificRecordsResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeGetSpecificRecordsResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeGetSpecificRecordsResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeRateRecordResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeRateRecordResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeRateRecordResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeRateRecordResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeSearchForRecordResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeSearchForRecordResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeSearchForRecordResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeSearchForRecordResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeUpdateRecordResponse.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeUpdateRecordResponse.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/Response/SakeUpdateRecordResponse.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/Response/SakeUpdateRecordResponse.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/SakeXmlLable.cs b/src/Servers/WebServices/Services/Sake/Entity/Structure/SakeXmlLable.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Entity/Structure/SakeXmlLable.cs rename to src/Servers/WebServices/Services/Sake/Entity/Structure/SakeXmlLable.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Handler/CommandHandler/CommandHandlerBase.cs b/src/Servers/WebServices/Services/Sake/Handler/CommandHandler/CommandHandlerBase.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Handler/CommandHandler/CommandHandlerBase.cs rename to src/Servers/WebServices/Services/Sake/Handler/CommandHandler/CommandHandlerBase.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Handler/CommandHandler/CreateRecord/CreateRecordHandler.cs b/src/Servers/WebServices/Services/Sake/Handler/CommandHandler/CreateRecord/CreateRecordHandler.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Handler/CommandHandler/CreateRecord/CreateRecordHandler.cs rename to src/Servers/WebServices/Services/Sake/Handler/CommandHandler/CreateRecord/CreateRecordHandler.cs diff --git a/src/Servers/WebServices/RetroSpyServices/Sake/Handler/Service/SakeStorageService.cs b/src/Servers/WebServices/Services/Sake/Handler/Service/SakeStorageService.cs similarity index 100% rename from src/Servers/WebServices/RetroSpyServices/Sake/Handler/Service/SakeStorageService.cs rename to src/Servers/WebServices/Services/Sake/Handler/Service/SakeStorageService.cs diff --git a/src/Servers/WebServices/WebServices.csproj b/src/Servers/WebServices/WebServices.csproj index fc6f2d3fd..b799c5bbd 100644 --- a/src/Servers/WebServices/WebServices.csproj +++ b/src/Servers/WebServices/WebServices.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 WebServices.Program 4e4ca5ab-cb18-409c-a769-880498fda2b2 Linux @@ -23,48 +23,48 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +