Skip to content

Commit

Permalink
update for 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
evogelsa committed Apr 14, 2021
1 parent ce3e344 commit a740a3f
Show file tree
Hide file tree
Showing 12 changed files with 507 additions and 381 deletions.
20 changes: 10 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# ignore debugging file
__debug_bin

# binaries
bin/

# testing files
config.json
mission.miz
realweather.miz
# ignore debugging file
__debug_bin

# binaries
bin/

# testing files
config.json
mission.miz
realweather.miz
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2020 evogelsa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2020 evogelsa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
windows:
mkdir -p bin/windows
env GOOS=windows GOARCH=amd64 go build -o bin/windows/realweather.exe
cp examples/config-template.json bin/windows/config.json
zip -j windows.zip bin/windows/realweather.exe bin/windows/config.json
mv windows.zip bin/windows/.
windows:
mkdir -p bin/windows
env GOOS=windows GOARCH=amd64 go build -o bin/windows/realweather.exe
cp examples/config-template.json bin/windows/config.json
zip -j windows.zip bin/windows/realweather.exe bin/windows/config.json
mv windows.zip bin/windows/.
69 changes: 37 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
# DCS Real Weather Updater

## About

Replaces static weather data in a DCS mission file with data from a METAR report
of an airport of choice.

Not extensively tested.

## Usage

First step is to create an API key at [checkwx](https://www.checkwxapi.com/).
This will be needed to fetch the weather data. You'll then want to edit the
`config.json` file provided in the zip download. Each field is required and a
summary of their purpose is provided below. Some reasonable defaults are
provided for most options.

### Config file parameters

| Key | Type | Description |
|-------------|--------|----------------------------------------------------|
| api-key | string | API key from [checkwx](https://www.checkwxapi.com) |
| icao | string | airport ICAO where you want to get METAR from |
| hour-offset | int | mission time offset from system time |
| input-file | string | mission file which will be used to modify |
| output-file | string | name of mission file which will be output |

After you have edited the config to your liking it is recommended you place the
binary into its own directory along with the config file. You can either
manually move the `input-file` into this directory and run the binary, or you
can accomplish this task through a script. An example batch script is provided
in [examples](./examples/replace_mission.bat)
# DCS Real Weather Updater

## About

Replaces static weather data in a DCS mission file with data from a METAR report
of an airport of choice.

Not extensively tested.

## Usage

First step is to create an API key at [checkwx](https://www.checkwxapi.com/).
This will be needed to fetch the weather data. You'll then want to edit the
`config.json` file provided in the zip download. Each field is required and a
summary of their purpose is provided below. Some reasonable defaults are
provided for most options.

Second step is to create the mission file you want to be updated with the METAR
weather. The input mission file you supply must have one of the preset cloud
types selected in order for it to update properly, but the other weather options
should not matter.

### Config file parameters

| Key | Type | Description |
|-------------|--------|----------------------------------------------------|
| api-key | string | API key from [checkwx](https://www.checkwxapi.com) |
| icao | string | airport ICAO where you want to get METAR from |
| hour-offset | int | mission time offset from system time |
| input-file | string | mission file which will be used to modify |
| output-file | string | name of mission file which will be output |

After you have edited the config to your liking it is recommended you place the
binary into its own directory along with the config file. You can either
manually move the `input-file` into this directory and run the binary, or you
can accomplish this task through a script. An example batch script is provided
in [examples](./examples)
14 changes: 7 additions & 7 deletions examples/config-template.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"api-key": "",
"icao": "UGKO",
"hour-offset": 0,
"input-mission-file": "mission.miz",
"output-mission-file": "realweather.miz"
}
{
"api-key": "",
"icao": "UGKO",
"hour-offset": 0,
"input-mission-file": "mission.miz",
"output-mission-file": "realweather.miz"
}
8 changes: 4 additions & 4 deletions examples/starting_scripts/start_all_rw.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ rem DEFINE PATHS BELOW

rem Required: DCS paths
set dcs=C:\Program Files\Eagle Dynamics\DCS World OpenBeta Server\bin\DCS_updater.exe
set inputFile=C:\Users\admin\Saved Games\DCS.openbeta_server\Missions\SVR2_PG_010_AD.miz
set outputFile=C:\Users\admin\Saved Games\DCS.openbeta_server\Missions\SVR2_PG_010_RW.miz
set inputFile=C:\Users\admin\Saved Games\DCS.openbeta_server\Missions\Mission.miz
set outputFile=C:\Users\admin\Saved Games\DCS.openbeta_server\Missions\RealWeather.miz

rem Other programs to start

Expand Down Expand Up @@ -41,9 +41,9 @@ rem Start Perun and SRS - these do not need to be included in the restart loop
if not %startAll%==0 (
if not "%perun%"=="" (start "" "%perun%" 48621 1 "%srsClients%" "%lotatcStats%" 1)
if not "%srsParentDir%"=="" (
cd "%srsParentDir%"
cd /d "%srsParentDir%"
start "" "SR-Server.exe"
cd %origDir%
cd /d %origDir%
)
)

Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/evogelsa/DCS-real-weather

go 1.14

require github.com/go-delve/delve v1.5.0 // indirect
module github.com/evogelsa/DCS-real-weather

go 1.14

require github.com/go-delve/delve v1.5.0 // indirect
66 changes: 33 additions & 33 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
github.com/cosiner/argv v0.1.0/go.mod h1:EusR6TucWKX+zFgtdUsKT2Cvg45K5rtpCcWz4hK06d8=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-delve/delve v1.5.0 h1:gQsRvFdR0BGk19NROQZsAv6iG4w5QIZoJlxJeEUBb0c=
github.com/go-delve/delve v1.5.0/go.mod h1:c6b3a1Gry6x8a4LGCe/CWzrocrfaHvkUxCj3k4bvSUQ=
github.com/google/go-dap v0.2.0/go.mod h1:5q8aYQFnHOAZEMP+6vmq25HKYAEwE+LF5yh7JKrrhSQ=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
go.starlark.net v0.0.0-20190702223751-32f345186213/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg=
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191127201027-ecd32218bd7f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
github.com/cosiner/argv v0.1.0/go.mod h1:EusR6TucWKX+zFgtdUsKT2Cvg45K5rtpCcWz4hK06d8=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-delve/delve v1.5.0 h1:gQsRvFdR0BGk19NROQZsAv6iG4w5QIZoJlxJeEUBb0c=
github.com/go-delve/delve v1.5.0/go.mod h1:c6b3a1Gry6x8a4LGCe/CWzrocrfaHvkUxCj3k4bvSUQ=
github.com/google/go-dap v0.2.0/go.mod h1:5q8aYQFnHOAZEMP+6vmq25HKYAEwE+LF5yh7JKrrhSQ=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
go.starlark.net v0.0.0-20190702223751-32f345186213/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg=
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191127201027-ecd32218bd7f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
50 changes: 25 additions & 25 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package main

import (
"github.com/evogelsa/DCS-real-weather/miz"
"github.com/evogelsa/DCS-real-weather/util"
"github.com/evogelsa/DCS-real-weather/weather"
)

func main() {
// get METAR report
data := weather.GetWeather()

// unzip mission file
_, err := miz.Unzip()
util.Must(err)

// update mission file with weather data
miz.Update(data)

// repack mission file contents and form realweather.miz output
miz.Zip()

// remove unpacked contents from directory
miz.Clean()
}
package main

import (
"github.com/evogelsa/DCS-real-weather/miz"
"github.com/evogelsa/DCS-real-weather/util"
"github.com/evogelsa/DCS-real-weather/weather"
)

func main() {
// get METAR report
data := weather.GetWeather()

// unzip mission file
_, err := miz.Unzip()
util.Must(err)

// update mission file with weather data
miz.Update(data)

// repack mission file contents and form realweather.miz output
miz.Zip()

// remove unpacked contents from directory
miz.Clean()
}
Loading

0 comments on commit a740a3f

Please sign in to comment.