Init commit
This commit is contained in:
commit
9e4f67f86a
557
.gitignore
vendored
Normal file
557
.gitignore
vendored
Normal file
@ -0,0 +1,557 @@
|
|||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,jetbrains,windows,visualstudiocode,rider,dotnetcore
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,jetbrains,windows,visualstudiocode,rider,dotnetcore
|
||||||
|
|
||||||
|
### DotnetCore ###
|
||||||
|
# .NET Core build folders
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
|
||||||
|
# Common node modules locations
|
||||||
|
/node_modules
|
||||||
|
/wwwroot/node_modules
|
||||||
|
|
||||||
|
### JetBrains ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
### JetBrains Patch ###
|
||||||
|
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||||
|
|
||||||
|
# *.iml
|
||||||
|
# modules.xml
|
||||||
|
# .idea/misc.xml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# Sonarlint plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||||
|
.idea/**/sonarlint/
|
||||||
|
|
||||||
|
# SonarQube Plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||||
|
.idea/**/sonarIssues.xml
|
||||||
|
|
||||||
|
# Markdown Navigator plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||||
|
.idea/**/markdown-navigator.xml
|
||||||
|
.idea/**/markdown-navigator-enh.xml
|
||||||
|
.idea/**/markdown-navigator/
|
||||||
|
|
||||||
|
# Cache file creation
|
||||||
|
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||||
|
.idea/$CACHE_FILE$
|
||||||
|
|
||||||
|
# CodeStream plugin
|
||||||
|
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||||
|
.idea/codestream.xml
|
||||||
|
|
||||||
|
### Rider ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/artifacts
|
||||||
|
# .idea/compiler.xml
|
||||||
|
# .idea/jarRepositories.xml
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
# *.iml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
|
||||||
|
### VisualStudioCode ###
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
### VisualStudioCode Patch ###
|
||||||
|
# Ignore all local history of files
|
||||||
|
.history
|
||||||
|
.ionide
|
||||||
|
|
||||||
|
### Windows ###
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
Thumbs.db:encryptable
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
### VisualStudio ###
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*[.json, .xml, .info]
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/visualstudio,jetbrains,windows,visualstudiocode,rider,dotnetcore
|
||||||
|
|
||||||
|
ConsoleApp1/
|
||||||
|
/Utils/CsRinRuLogin.cs
|
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
|
</state>
|
||||||
|
</component>
|
4
.idea/.idea.auto-creamapi/.idea/encodings.xml
Normal file
4
.idea/.idea.auto-creamapi/.idea/encodings.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||||
|
</project>
|
8
.idea/.idea.auto-creamapi/.idea/indexLayout.xml
Normal file
8
.idea/.idea.auto-creamapi/.idea/indexLayout.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ContentModelUserStore">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/.idea.auto-creamapi/.idea/modules.xml
Normal file
8
.idea/.idea.auto-creamapi/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.auto-creamapi/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.auto-creamapi/riderModule.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RiderProjectSettingsUpdater">
|
||||||
|
<option name="vcsConfiguration" value="2" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/.idea.auto-creamapi/.idea/vcs.xml
Normal file
6
.idea/.idea.auto-creamapi/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
7
.idea/.idea.auto-creamapi/riderModule.iml
Normal file
7
.idea/.idea.auto-creamapi/riderModule.iml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="RIDER_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$/../.." />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
8
App.xaml
Normal file
8
App.xaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<Application x:Class="auto_creamapi.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
9
App.xaml.cs
Normal file
9
App.xaml.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace auto_creamapi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
10
AssemblyInfo.cs
Normal file
10
AssemblyInfo.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
21
DownloadWindow.xaml
Normal file
21
DownloadWindow.xaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<Window x:Class="auto_creamapi.DownloadWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:auto_creamapi"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="DownloadWindow" Width="400" Height="200">
|
||||||
|
<Grid Margin="10,10,10,20">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Content="Downloading..." HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top"/>
|
||||||
|
<Label Content="..." Name="FilenameLabel" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="1"/>
|
||||||
|
<Label Content="00,00%" Name="PercentLabel" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="1"/>
|
||||||
|
<ProgressBar Name="ProgressBar" HorizontalAlignment="Stretch" Margin="0,10,0,10" VerticalAlignment="Top" Grid.Row="2" MinHeight="20" Height="20"
|
||||||
|
Minimum="0" Maximum="0.99" ValueChanged="ProgressBar_OnValueChanged" Value="0"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
32
DownloadWindow.xaml.cs
Normal file
32
DownloadWindow.xaml.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using auto_creamapi.Utils;
|
||||||
|
|
||||||
|
namespace auto_creamapi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for DownloadWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class DownloadWindow
|
||||||
|
{
|
||||||
|
public DownloadWindow()
|
||||||
|
{
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProgressBar_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information(ProgressBar.Value.ToString("N"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
55
MainWindow.xaml
Normal file
55
MainWindow.xaml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<Window x:Class="auto_creamapi.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:wcl="clr-namespace:WatermarkControlsLib.Controls;assembly=WatermarkControlsLib"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Auto-CreamAPI" Width="420" Height="540" MinWidth="420" MinHeight="540">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<wcl:WatermarkTextBox x:Name="DllPath" Watermark="Path to game's steam_api(64).dll..." Margin="10,11,55,0" TextWrapping="NoWrap" VerticalAlignment="Top" Padding="0" Grid.Row="0" IsReadOnly="True" IsReadOnlyCaretVisible="True" MouseDoubleClick="DllPath_MouseDoubleClick"/>
|
||||||
|
<Button x:Name="OpenFile" Content="" HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top" FontFamily="Segoe UI Symbol" Width="40" Click="OpenFile_Click" ToolTip="Select DLL file." Grid.Row="0"/>
|
||||||
|
<wcl:WatermarkTextBox x:Name="Game" Margin="10,10,180,0" Watermark="Game Name" TextWrapping="Wrap" VerticalAlignment="Top" Padding="0" Grid.Row="1"/>
|
||||||
|
<Button x:Name="Search" Content="" HorizontalAlignment="Right" Margin="0,9,135,0" VerticalAlignment="Top" FontFamily="Segoe UI Symbol" Width="40" Click="Search_Click" ToolTip="Find AppID." Grid.Row="1"/>
|
||||||
|
<wcl:WatermarkTextBox x:Name="AppId" HorizontalAlignment="Right" Margin="0,10,10,0" Watermark="AppID" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Padding="0" Grid.Row="1" KeyUp="AppId_OnTextChanged" />
|
||||||
|
<ComboBox x:Name="Lang" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="120" Grid.Row="2"/>
|
||||||
|
<CheckBox x:Name="ForceOffline" Content="Force offline mode" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" ToolTip="offlinemode" Grid.Row="3"/>
|
||||||
|
<CheckBox x:Name="ExtraProtection" Content="Try to bypass game-specific protection" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" ToolTip="extraprotection" Grid.Row="4"/>
|
||||||
|
<Grid Margin="10,10,10,0" Grid.Row="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<GroupBox x:Name="DlcGroup" Header="DLC" Grid.Row="0" VerticalAlignment="Stretch">
|
||||||
|
<Grid>
|
||||||
|
<CheckBox x:Name="UnlockAll" Content="Unlock all DLCs (if possible)" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" ToolTip="unlockall"/>
|
||||||
|
<CheckBox x:Name="SteamDb" Content="Additionally use SteamDB for DLCs" HorizontalAlignment="Left" Margin="10,30,0,0" VerticalAlignment="Top"/>
|
||||||
|
<wcl:WatermarkTextBox x:Name="ListOfDlcs" Margin="10,55,10,40" Watermark="List of DLCs...
0000 = DLC Name" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Padding="0"/>
|
||||||
|
<Button x:Name="GetListOfDlcs" Content="Get DLCs for AppID" Margin="0,0,10,10" Height="19.96" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="108" Click="GetListOfDlc_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
<GroupBox x:Name="StatusGroup" Header="Status" Grid.Row="1" VerticalAlignment="Bottom">
|
||||||
|
<Grid IsEnabled="False">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<CheckBox x:Name="creamApiApplied" Content="CreamAPI DLL applied" Margin="10,10,0,10" Grid.Column="0" IsEnabled="False"/>
|
||||||
|
<CheckBox x:Name="configExists" Content="CreamAPI Config exists" Margin="10,10,0,10" Grid.Column="1"/>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
<Button x:Name="Save" Content="Save" Margin="0,10,55,10" HorizontalAlignment="Right" Width="40" Height="20" VerticalAlignment="Bottom" Click="Save_Click" Grid.Row="11"/>
|
||||||
|
<Button x:Name="Reset" Content="Reset" Margin="0,10,10,10" Height="20" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="40" Click="Reset_Click" Grid.Row="11"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
190
MainWindow.xaml.cs
Normal file
190
MainWindow.xaml.cs
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using auto_creamapi.Model;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace auto_creamapi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow
|
||||||
|
{
|
||||||
|
private const string DefaultLangSelection = "english";
|
||||||
|
private static CacheModel _cacheModel;
|
||||||
|
private static CreamConfigModel _configModel;
|
||||||
|
private static CreamDllModel _dllModel;
|
||||||
|
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
_cacheModel = CacheModel.Instance;
|
||||||
|
_configModel = CreamConfigModel.Instance;
|
||||||
|
_dllModel = CreamDllModel.Instance;
|
||||||
|
InitializeComponent();
|
||||||
|
_cacheModel.Languages.ForEach(x => Lang.Items.Add(x));
|
||||||
|
Lang.SelectedItem = DefaultLangSelection;
|
||||||
|
SteamDb.IsChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up the AppID of the specified game.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Search_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var app = _cacheModel.GetAppByName(Game.Text);
|
||||||
|
if (app != null)
|
||||||
|
{
|
||||||
|
AppId.Text = app.AppId.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var listOfAppsByName = _cacheModel.GetListOfAppsByName(Game.Text);
|
||||||
|
var searchWindow = new SearchResultWindow(listOfAppsByName);
|
||||||
|
searchWindow.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DllPath_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
MyOpenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Opens a file chooser to select the path to steam_api(64).dll.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void OpenFile_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MyOpenFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyOpenFile()
|
||||||
|
{
|
||||||
|
var dialog = new OpenFileDialog
|
||||||
|
{
|
||||||
|
Filter = "SteamAPI DLL|steam_api.dll;steam_api64.dll|" +
|
||||||
|
"All files (*.*)|*.*",
|
||||||
|
Multiselect = false,
|
||||||
|
Title = "Select SteamAPI DLL..."
|
||||||
|
};
|
||||||
|
if (dialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
//Console.WriteLine(dialog.FileName);
|
||||||
|
var filePath = dialog.FileName;
|
||||||
|
DllPath.Text = filePath;
|
||||||
|
var dirPath = Path.GetDirectoryName(filePath);
|
||||||
|
if (dirPath != null)
|
||||||
|
{
|
||||||
|
_configModel.ReadFile(Path.Combine(dirPath, "cream_api.ini"));
|
||||||
|
ResetFormData();
|
||||||
|
_dllModel.TargetPath = dirPath;
|
||||||
|
_dllModel.CheckExistence();
|
||||||
|
CheckExistance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a list of DLCs for the specified AppID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private async void GetListOfDlc_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (int.TryParse(AppId.Text, out var appId))
|
||||||
|
{
|
||||||
|
var app = new POCOs.App() {AppId = appId, Name = Game.Text};
|
||||||
|
var listOfDlc = await _cacheModel.GetListOfDlc(app,
|
||||||
|
SteamDb.IsChecked != null && (bool) SteamDb.IsChecked);
|
||||||
|
var result = "";
|
||||||
|
listOfDlc.Sort((app1, app2) => app1.AppId.CompareTo(app2.AppId));
|
||||||
|
listOfDlc.ForEach(x => result += $"{x.AppId}={x.Name}\n");
|
||||||
|
ListOfDlcs.Text = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Saves form data to cream_api.ini.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Save_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_configModel.SetConfigData(
|
||||||
|
Convert.ToInt32(AppId.Text),
|
||||||
|
Lang.SelectedItem.ToString(),
|
||||||
|
UnlockAll.IsChecked != null && (bool) UnlockAll.IsChecked,
|
||||||
|
ExtraProtection.IsChecked != null && (bool) ExtraProtection.IsChecked,
|
||||||
|
ForceOffline.IsChecked != null && (bool) ForceOffline.IsChecked,
|
||||||
|
ListOfDlcs.Text
|
||||||
|
);
|
||||||
|
_configModel.SaveFile();
|
||||||
|
_dllModel.Save();
|
||||||
|
CheckExistance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets form data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Reset_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ResetFormData();
|
||||||
|
CheckExistance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets app name on id change
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="keyEventArgs"></param>
|
||||||
|
private void AppId_OnTextChanged(object sender, KeyEventArgs keyEventArgs)
|
||||||
|
{
|
||||||
|
SetNameById();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetNameById()
|
||||||
|
{
|
||||||
|
if (int.TryParse(AppId.Text, out var appId))
|
||||||
|
{
|
||||||
|
var app = _cacheModel.GetAppById(appId);
|
||||||
|
if (app != null) Game.Text = app.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResetFormData()
|
||||||
|
{
|
||||||
|
AppId.Text = _configModel.Config.AppId.ToString();
|
||||||
|
Lang.SelectedItem = _configModel.Config.Language;
|
||||||
|
UnlockAll.IsChecked = _configModel.Config.UnlockAll; // public bool UnlockAll;
|
||||||
|
ExtraProtection.IsChecked = _configModel.Config.ExtraProtection; // public bool ExtraProtection;
|
||||||
|
ForceOffline.IsChecked = _configModel.Config.ForceOffline; // public bool ForceOffline;
|
||||||
|
// public Dictionary<int, string> DlcList;
|
||||||
|
var dlcListString = "";
|
||||||
|
if (_configModel.Config.DlcList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var (id, name) in _configModel.Config.DlcList)
|
||||||
|
{
|
||||||
|
dlcListString += $"{id}={name},\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListOfDlcs.Text = dlcListString;
|
||||||
|
SetNameById();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckExistance()
|
||||||
|
{
|
||||||
|
|
||||||
|
creamApiApplied.IsChecked = _dllModel.CreamApiApplied();
|
||||||
|
configExists.IsChecked = _configModel.ConfigExists();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
216
Model/CacheModel.cs
Normal file
216
Model/CacheModel.cs
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AngleSharp.Dom;
|
||||||
|
using AngleSharp.Html.Parser;
|
||||||
|
using auto_creamapi.POCOs;
|
||||||
|
using auto_creamapi.Utils;
|
||||||
|
using NinjaNye.SearchExtensions;
|
||||||
|
using NinjaNye.SearchExtensions.Models;
|
||||||
|
using SteamStorefrontAPI;
|
||||||
|
|
||||||
|
namespace auto_creamapi.Model
|
||||||
|
{
|
||||||
|
public class CacheModel
|
||||||
|
{
|
||||||
|
private const string CachePath = "steamapps.json";
|
||||||
|
private const string SteamUri = "https://api.steampowered.com/ISteamApps/GetAppList/v2/";
|
||||||
|
private const string UserAgent =
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||||
|
"Chrome/87.0.4280.88 Safari/537.36";
|
||||||
|
private static List<POCOs.App> _cache = new List<POCOs.App>();
|
||||||
|
|
||||||
|
public readonly List<string> Languages = new List<string>(new[]
|
||||||
|
{
|
||||||
|
"arabic",
|
||||||
|
"bulgarian",
|
||||||
|
"schinese",
|
||||||
|
"tchinese",
|
||||||
|
"czech",
|
||||||
|
"danish",
|
||||||
|
"dutch",
|
||||||
|
"english",
|
||||||
|
"finnish",
|
||||||
|
"french",
|
||||||
|
"german",
|
||||||
|
"greek",
|
||||||
|
"hungarian",
|
||||||
|
"italian",
|
||||||
|
"japanese",
|
||||||
|
"koreana",
|
||||||
|
"norwegian",
|
||||||
|
"polish",
|
||||||
|
"portuguese",
|
||||||
|
"brazilian",
|
||||||
|
"romanian",
|
||||||
|
"russian",
|
||||||
|
"spanish",
|
||||||
|
"latam",
|
||||||
|
"swedish",
|
||||||
|
"thai",
|
||||||
|
"turkish",
|
||||||
|
"ukrainian",
|
||||||
|
"vietnamese"
|
||||||
|
});
|
||||||
|
|
||||||
|
private static readonly Lazy<CacheModel> Lazy =
|
||||||
|
new Lazy<CacheModel>(() => new CacheModel());
|
||||||
|
|
||||||
|
public static CacheModel Instance => Lazy.Value;
|
||||||
|
|
||||||
|
private CacheModel()
|
||||||
|
{
|
||||||
|
UpdateCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UpdateCache()
|
||||||
|
{
|
||||||
|
var updateNeeded = DateTime.Now.Subtract(File.GetCreationTimeUtc(CachePath)).TotalDays >= 1;
|
||||||
|
string cacheString;
|
||||||
|
if (updateNeeded)
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information("Updating cache...");
|
||||||
|
var client = new HttpClient();
|
||||||
|
var httpCall = client.GetAsync(SteamUri);
|
||||||
|
var response = httpCall.Result;
|
||||||
|
var readAsStringAsync = response.Content.ReadAsStringAsync();
|
||||||
|
var responseBody = readAsStringAsync.Result;
|
||||||
|
|
||||||
|
/*var writeAllTextAsync = File.WriteAllTextAsync(CachePath, responseBody, Encoding.UTF8);
|
||||||
|
writeAllTextAsync.RunSynchronously();*/
|
||||||
|
File.WriteAllText(CachePath, responseBody, Encoding.UTF8);
|
||||||
|
cacheString = responseBody;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information("Cache already up to date!");
|
||||||
|
cacheString = File.ReadAllText(CachePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
var steamApps = JsonSerializer.Deserialize<SteamApps>(cacheString);
|
||||||
|
_cache = steamApps.AppList.Apps;
|
||||||
|
MyLogger.Log.Information("Loaded cache into memory!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumerableStringSearch<POCOs.App> GetListOfAppsByName(string name)
|
||||||
|
{
|
||||||
|
var listOfAppsByName = _cache.Search(x => x.Name)
|
||||||
|
.SetCulture(StringComparison.OrdinalIgnoreCase)
|
||||||
|
.ContainingAll(name.Split(' '));
|
||||||
|
return listOfAppsByName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public POCOs.App GetAppByName(string name)
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information($"Trying to get app {name}");
|
||||||
|
var app = _cache.Find(x => x.Name.ToLower().Equals(name.ToLower()));
|
||||||
|
if (app != null) MyLogger.Log.Information($"Successfully got app {app}");
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public POCOs.App GetAppById(int appid)
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information($"Trying to get app with ID {appid}");
|
||||||
|
var app = _cache.Find(x => x.AppId.Equals(appid));
|
||||||
|
if (app != null) MyLogger.Log.Information($"Successfully got app {app}");
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<POCOs.App>> GetListOfDlc(POCOs.App app, bool useSteamDb)
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information("Get DLC");
|
||||||
|
var dlcList = new List<POCOs.App>();
|
||||||
|
if (app != null)
|
||||||
|
{
|
||||||
|
var task = AppDetails.GetAsync(app.AppId);
|
||||||
|
var steamApp = await task;
|
||||||
|
steamApp?.DLC.ForEach(x =>
|
||||||
|
{
|
||||||
|
var result = _cache.Find(y => y.AppId.Equals(x)) ??
|
||||||
|
new POCOs.App {AppId = x, Name = $"Unknown DLC {x}"};
|
||||||
|
dlcList.Add(result);
|
||||||
|
});
|
||||||
|
|
||||||
|
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
||||||
|
MyLogger.Log.Information("Got DLC successfully...");
|
||||||
|
|
||||||
|
// Get DLC from SteamDB
|
||||||
|
// Get Cloudflare cookie
|
||||||
|
// Scrape and parse HTML page
|
||||||
|
// Add missing to DLC list
|
||||||
|
if (useSteamDb)
|
||||||
|
{
|
||||||
|
var steamDbUri = new Uri($"https://steamdb.info/app/{app.AppId}/dlc/");
|
||||||
|
|
||||||
|
/* var handler = new ClearanceHandler();
|
||||||
|
|
||||||
|
var client = new HttpClient(handler);
|
||||||
|
|
||||||
|
var content = client.GetStringAsync(steamDbUri).Result;
|
||||||
|
MyLogger.Log.Debug(content); */
|
||||||
|
|
||||||
|
var client = new HttpClient();
|
||||||
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
||||||
|
|
||||||
|
MyLogger.Log.Information("Get SteamDB App");
|
||||||
|
var httpCall = client.GetAsync(steamDbUri);
|
||||||
|
var response = await httpCall;
|
||||||
|
MyLogger.Log.Debug(httpCall.Status.ToString());
|
||||||
|
MyLogger.Log.Debug(response.EnsureSuccessStatusCode().ToString());
|
||||||
|
|
||||||
|
var readAsStringAsync = response.Content.ReadAsStringAsync();
|
||||||
|
var responseBody = await readAsStringAsync;
|
||||||
|
MyLogger.Log.Debug(readAsStringAsync.Status.ToString());
|
||||||
|
|
||||||
|
var parser = new HtmlParser();
|
||||||
|
var doc = parser.ParseDocument(responseBody);
|
||||||
|
// Console.WriteLine(doc.DocumentElement.OuterHtml);
|
||||||
|
|
||||||
|
var query1 = doc.QuerySelector("#dlc");
|
||||||
|
if (query1 != null)
|
||||||
|
{
|
||||||
|
var query2 = query1.QuerySelectorAll(".app");
|
||||||
|
foreach (var element in query2)
|
||||||
|
{
|
||||||
|
var dlcId = element.GetAttribute("data-appid");
|
||||||
|
var dlcName = $"Unknown DLC {dlcId}";
|
||||||
|
var query3 = element.QuerySelectorAll("td");
|
||||||
|
if (query3 != null)
|
||||||
|
{
|
||||||
|
dlcName = query3[1].Text().Replace("\n", "").Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
var dlcApp = new POCOs.App {AppId = Convert.ToInt32(dlcId), Name = dlcName};
|
||||||
|
var i = dlcList.FindIndex(x => x.CompareId(dlcApp));
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
|
if (dlcList[i].Name.Contains("Unknown DLC")) dlcList[i] = dlcApp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dlcList.Add(dlcApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
||||||
|
MyLogger.Log.Information("Got DLC from SteamDB successfully...");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MyLogger.Log.Error("Could not get DLC from SteamDB1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MyLogger.Log.Error($"Could not find game: {app}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return dlcList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
184
Model/CreamConfigModel.cs
Normal file
184
Model/CreamConfigModel.cs
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using auto_creamapi.Utils;
|
||||||
|
using IniParser;
|
||||||
|
using IniParser.Model;
|
||||||
|
|
||||||
|
namespace auto_creamapi.Model
|
||||||
|
{
|
||||||
|
public sealed class CreamConfigModel
|
||||||
|
{
|
||||||
|
|
||||||
|
// ReSharper disable once MemberCanBePrivate.Global
|
||||||
|
public struct CreamConfig
|
||||||
|
{
|
||||||
|
public int AppId;
|
||||||
|
public string Language;
|
||||||
|
public bool UnlockAll;
|
||||||
|
public bool ExtraProtection;
|
||||||
|
public bool ForceOffline;
|
||||||
|
public Dictionary<int, string> DlcList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CreamConfig _config;
|
||||||
|
|
||||||
|
public CreamConfig Config => _config;
|
||||||
|
|
||||||
|
private static readonly Lazy<CreamConfigModel> Lazy =
|
||||||
|
new Lazy<CreamConfigModel>(() => new CreamConfigModel());
|
||||||
|
|
||||||
|
public static CreamConfigModel Instance => Lazy.Value;
|
||||||
|
|
||||||
|
// ReSharper disable once MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||||
|
private string _configFilePath;
|
||||||
|
|
||||||
|
private CreamConfigModel()
|
||||||
|
{
|
||||||
|
_config.DlcList = new Dictionary<int, string>();
|
||||||
|
SetConfigData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReadFile(string configFilePath)
|
||||||
|
{
|
||||||
|
_configFilePath = configFilePath;
|
||||||
|
if (File.Exists(configFilePath)) {
|
||||||
|
MyLogger.Log.Information($"Config file found @ {configFilePath}, parsing...");
|
||||||
|
var parser = new FileIniDataParser();
|
||||||
|
var data = parser.ReadFile(_configFilePath, Encoding.UTF8);
|
||||||
|
|
||||||
|
SetConfigData(); // clear previous config data
|
||||||
|
_config.AppId = Convert.ToInt32(data["steam"]["appid"]);
|
||||||
|
_config.Language = data["steam"]["language"];
|
||||||
|
_config.UnlockAll = Convert.ToBoolean(data["steam"]["unlockall"]);
|
||||||
|
_config.ExtraProtection = Convert.ToBoolean(data["steam"]["extraprotection"]);
|
||||||
|
_config.ForceOffline = Convert.ToBoolean(data["steam"]["forceoffline"]);
|
||||||
|
|
||||||
|
var dlcCollection = data["dlc"];
|
||||||
|
foreach (var item in dlcCollection)
|
||||||
|
{
|
||||||
|
_config.DlcList.Add(int.Parse(item.KeyName), item.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information($"Config file does not exist @ {configFilePath}, skipping...");
|
||||||
|
SetConfigData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveFile()
|
||||||
|
{
|
||||||
|
var parser = new FileIniDataParser();
|
||||||
|
var data = new IniData();
|
||||||
|
|
||||||
|
data["steam"]["appid"] = _config.AppId.ToString();
|
||||||
|
data["steam"]["language"] = _config.Language;
|
||||||
|
data["steam"]["unlockall"] = _config.UnlockAll.ToString();
|
||||||
|
data["steam"]["extraprotection"] = _config.ExtraProtection.ToString();
|
||||||
|
data["steam"]["forceoffline"] = _config.ForceOffline.ToString();
|
||||||
|
|
||||||
|
data.Sections.AddSection("dlc");
|
||||||
|
foreach (var (key, value) in _config.DlcList)
|
||||||
|
{
|
||||||
|
data["dlc"].AddKey(key.ToString(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.WriteFile(_configFilePath, data, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetConfigData()
|
||||||
|
{
|
||||||
|
_config.AppId = 0;
|
||||||
|
_config.Language = "";
|
||||||
|
_config.UnlockAll = false;
|
||||||
|
_config.ExtraProtection = false;
|
||||||
|
_config.ForceOffline = false;
|
||||||
|
_config.DlcList.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetConfigData(int appId,
|
||||||
|
string language,
|
||||||
|
bool unlockAll,
|
||||||
|
bool extraProtection,
|
||||||
|
bool forceOffline,
|
||||||
|
string dlcList)
|
||||||
|
{
|
||||||
|
_config.AppId = appId;
|
||||||
|
_config.Language = language;
|
||||||
|
_config.UnlockAll = unlockAll;
|
||||||
|
_config.ExtraProtection = extraProtection;
|
||||||
|
_config.ForceOffline = forceOffline;
|
||||||
|
|
||||||
|
SetDlcFromString(dlcList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*private void SetConfigData(int appId,
|
||||||
|
string language,
|
||||||
|
bool unlockAll,
|
||||||
|
bool extraProtection,
|
||||||
|
bool forceOffline,
|
||||||
|
List<POCOs.App> dlcList)
|
||||||
|
{
|
||||||
|
_config.AppId = appId;
|
||||||
|
_config.Language = language;
|
||||||
|
_config.UnlockAll = unlockAll;
|
||||||
|
_config.ExtraProtection = extraProtection;
|
||||||
|
_config.ForceOffline = forceOffline;
|
||||||
|
|
||||||
|
SetDlcFromAppList(dlcList);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
private void SetDlcFromString(string dlcList)
|
||||||
|
{
|
||||||
|
_config.DlcList.Clear();
|
||||||
|
var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)");
|
||||||
|
using var reader = new StringReader(dlcList);
|
||||||
|
string line;
|
||||||
|
while ((line = reader.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
var match = expression.Match(line);
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
_config.DlcList.Add(int.Parse(match.Groups["id"].Value), match.Groups["name"].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*private void SetDlcFromAppList(List<POCOs.App> dlcList)
|
||||||
|
{
|
||||||
|
_config.DlcList.Clear();
|
||||||
|
dlcList.ForEach(x => _config.DlcList.Add(x.AppId, x.Name));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
var str = $"INI file: {_configFilePath}, " +
|
||||||
|
$"AppID: {_config.AppId}, " +
|
||||||
|
$"Language: {_config.Language}, " +
|
||||||
|
$"UnlockAll: {_config.UnlockAll}, " +
|
||||||
|
$"ExtraProtection: {_config.ExtraProtection}, " +
|
||||||
|
$"ForceOffline: {_config.ForceOffline}, " +
|
||||||
|
$"DLC ({_config.DlcList.Count}):\n[\n";
|
||||||
|
if (_config.DlcList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var (key, value) in _config.DlcList)
|
||||||
|
{
|
||||||
|
str += $" {key}={value},\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
str += "]";
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ConfigExists()
|
||||||
|
{
|
||||||
|
return File.Exists(_configFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
244
Model/CreamDllModel.cs
Normal file
244
Model/CreamDllModel.cs
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using auto_creamapi.Utils;
|
||||||
|
using SharpCompress.Archives;
|
||||||
|
using SharpCompress.Common;
|
||||||
|
using SharpCompress.Readers;
|
||||||
|
using HttpProgress;
|
||||||
|
|
||||||
|
namespace auto_creamapi.Model
|
||||||
|
{
|
||||||
|
public class CreamDllModel
|
||||||
|
{
|
||||||
|
private struct CreamDll
|
||||||
|
{
|
||||||
|
public readonly string Filename;
|
||||||
|
public readonly string OrigFilename;
|
||||||
|
public readonly string Hash;
|
||||||
|
|
||||||
|
public CreamDll(string filename, string origFilename)
|
||||||
|
{
|
||||||
|
Filename = filename;
|
||||||
|
OrigFilename = origFilename;
|
||||||
|
Hash = "";
|
||||||
|
|
||||||
|
using var md5 = MD5.Create();
|
||||||
|
using var stream = File.OpenRead(Filename);
|
||||||
|
Hash = BitConverter
|
||||||
|
.ToString(md5.ComputeHash(stream))
|
||||||
|
.Replace("-", string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly Lazy<CreamDllModel> Lazy =
|
||||||
|
new Lazy<CreamDllModel>(() => new CreamDllModel());
|
||||||
|
|
||||||
|
public static CreamDllModel Instance => Lazy.Value;
|
||||||
|
public string TargetPath { get; set; }
|
||||||
|
|
||||||
|
private readonly Dictionary<string, CreamDll> _creamDlls = new Dictionary<string, CreamDll>();
|
||||||
|
private static readonly string HashPath = Path.Combine(Directory.GetCurrentDirectory(), "cream_api.md5");
|
||||||
|
private const string X86Arch = "x86";
|
||||||
|
private const string X64Arch = "x64";
|
||||||
|
|
||||||
|
private bool _x86Exists;
|
||||||
|
private bool _x64Exists;
|
||||||
|
|
||||||
|
private CreamDllModel()
|
||||||
|
{
|
||||||
|
if (!(File.Exists("steam_api.dll") && File.Exists("steam_api64.dll")))
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information("Missing files, trying to download...");
|
||||||
|
new Action(async() => await DownloadDll(CsRinRuLogin.Username, CsRinRuLogin.Password))();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Init()
|
||||||
|
{
|
||||||
|
_creamDlls.Add(X86Arch, new CreamDll("steam_api.dll", "steam_api_o.dll"));
|
||||||
|
_creamDlls.Add(X64Arch, new CreamDll("steam_api64.dll", "steam_api64_o.dll"));
|
||||||
|
|
||||||
|
if (!File.Exists(HashPath))
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information("Writing md5sum file...");
|
||||||
|
File.WriteAllLines(HashPath, new[]
|
||||||
|
{
|
||||||
|
$"{_creamDlls[X86Arch].Hash} {_creamDlls[X86Arch].Filename}",
|
||||||
|
$"{_creamDlls[X64Arch].Hash} {_creamDlls[X64Arch].Filename}"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DownloadDll(string username, string password)
|
||||||
|
{
|
||||||
|
var wnd = new DownloadWindow();
|
||||||
|
wnd.Show();
|
||||||
|
var container = new CookieContainer();
|
||||||
|
var handler = new HttpClientHandler {CookieContainer = container};
|
||||||
|
var client = new HttpClient(handler);
|
||||||
|
var formContent = new FormUrlEncodedContent(new[]
|
||||||
|
{
|
||||||
|
new KeyValuePair<string, string>("username", username),
|
||||||
|
new KeyValuePair<string, string>("password", password),
|
||||||
|
new KeyValuePair<string, string>("redirect", "./ucp.php?mode=login"),
|
||||||
|
new KeyValuePair<string, string>("login", "login")
|
||||||
|
});
|
||||||
|
var response1 = await client.PostAsync("https://cs.rin.ru/forum/ucp.php?mode=login", formContent);
|
||||||
|
MyLogger.Log.Debug($"Login Status Code: {response1.EnsureSuccessStatusCode().StatusCode.ToString()}");
|
||||||
|
var cookie = container.GetCookies(new Uri("https://cs.rin.ru/forum/ucp.php?mode=login"))
|
||||||
|
.FirstOrDefault(c => c.Name.Contains("_sid"));
|
||||||
|
MyLogger.Log.Debug($"Login Cookie: {cookie}");
|
||||||
|
var response2 = await client.GetAsync("https://cs.rin.ru/forum/viewtopic.php?t=70576");
|
||||||
|
MyLogger.Log.Debug(
|
||||||
|
$"Download Page Status Code: {response2.EnsureSuccessStatusCode().StatusCode.ToString()}");
|
||||||
|
var content = response2.Content.ReadAsStringAsync();
|
||||||
|
var contentResult = await content;
|
||||||
|
|
||||||
|
var expression =
|
||||||
|
new Regex(".*<a href=\"\\.(?<url>\\/download\\/file\\.php\\?id=.*)\">(?<filename>.*)<\\/a>.*");
|
||||||
|
using var reader = new StringReader(contentResult);
|
||||||
|
string line;
|
||||||
|
var archiveFileList = new Dictionary<string, string>();
|
||||||
|
while ((line = await reader.ReadLineAsync()) != null)
|
||||||
|
{
|
||||||
|
var match = expression.Match(line);
|
||||||
|
// ReSharper disable once InvertIf
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
archiveFileList.Add(match.Groups["filename"].Value,
|
||||||
|
$"https://cs.rin.ru/forum{match.Groups["url"].Value}");
|
||||||
|
MyLogger.Log.Debug(archiveFileList.LastOrDefault().Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*foreach (var (filename, url) in archiveFileList)
|
||||||
|
{
|
||||||
|
MyLogger.Log.Information($"Downloading file: {filename}");
|
||||||
|
var fileResponse = await client.GetAsync(url);
|
||||||
|
var download = fileResponse.Content.ReadAsByteArrayAsync();
|
||||||
|
await File.WriteAllBytesAsync(filename, await download);
|
||||||
|
}*/
|
||||||
|
MyLogger.Log.Debug("Choosing first element from list...");
|
||||||
|
var (filename, url) = archiveFileList.FirstOrDefault();
|
||||||
|
MyLogger.Log.Information("Start download...");
|
||||||
|
wnd.FilenameLabel.Content = filename;
|
||||||
|
/*var fileResponse = await client.GetAsync(url);
|
||||||
|
var download = fileResponse.Content.ReadAsByteArrayAsync();
|
||||||
|
await File.WriteAllBytesAsync(filename, await download);
|
||||||
|
MyLogger.Log.Information($"Download success? {download.IsCompletedSuccessfully}");*/
|
||||||
|
var progress = new Progress<ICopyProgress>(
|
||||||
|
x =>
|
||||||
|
{
|
||||||
|
wnd.PercentLabel.Content = x.PercentComplete.ToString("P");
|
||||||
|
wnd.ProgressBar.Dispatcher.Invoke(() => wnd.ProgressBar.Value = x.PercentComplete,
|
||||||
|
DispatcherPriority.Background);
|
||||||
|
});
|
||||||
|
await using (var fileStream = File.OpenWrite(filename))
|
||||||
|
{
|
||||||
|
var task = client.GetAsync(url, fileStream, progress);
|
||||||
|
var response = await task;
|
||||||
|
/*if (task.IsCompletedSuccessfully)
|
||||||
|
{
|
||||||
|
wnd.PercentLabel.Content = "100,00%";
|
||||||
|
wnd.ProgressBar.Value = 1;
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
MyLogger.Log.Information("Start extraction...");
|
||||||
|
var options = new ReaderOptions {Password = "cs.rin.ru"};
|
||||||
|
var archive = ArchiveFactory.Open(filename, options);
|
||||||
|
var expression1 = new Regex(@"nonlog_build\\steam_api(?:64)?\.dll");
|
||||||
|
foreach (var entry in archive.Entries)
|
||||||
|
{
|
||||||
|
// ReSharper disable once InvertIf
|
||||||
|
if (!entry.IsDirectory && expression1.IsMatch(entry.Key))
|
||||||
|
{
|
||||||
|
MyLogger.Log.Debug(entry.Key);
|
||||||
|
entry.WriteToDirectory(Directory.GetCurrentDirectory(), new ExtractionOptions
|
||||||
|
{
|
||||||
|
ExtractFullPath = false,
|
||||||
|
Overwrite = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MyLogger.Log.Information("Extraction done!");
|
||||||
|
wnd.Close();
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
if (_x86Exists) CopyDll(X86Arch);
|
||||||
|
if (_x64Exists) CopyDll(X64Arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyDll(string arch)
|
||||||
|
{
|
||||||
|
var sourceSteamApiDll = _creamDlls[arch].Filename;
|
||||||
|
var targetSteamApiDll = Path.Combine(TargetPath, _creamDlls[arch].Filename);
|
||||||
|
var targetSteamApiOrigDll = Path.Combine(TargetPath, _creamDlls[arch].OrigFilename);
|
||||||
|
var targetSteamApiDllBackup = Path.Combine(TargetPath, $"{_creamDlls[arch].Filename}.backup");
|
||||||
|
MyLogger.Log.Information($"Creating CreamAPI DLL @ {targetSteamApiDll}");
|
||||||
|
// Create backup of steam_api.dll
|
||||||
|
File.Copy(targetSteamApiDll, targetSteamApiDllBackup, true);
|
||||||
|
// Check if steam_api_o.dll already exists
|
||||||
|
// If missing rename original file
|
||||||
|
if (!File.Exists(targetSteamApiOrigDll))
|
||||||
|
File.Move(targetSteamApiDll, targetSteamApiOrigDll, true);
|
||||||
|
// Copy creamapi dll
|
||||||
|
File.Copy(sourceSteamApiDll, targetSteamApiDll, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckExistence()
|
||||||
|
{
|
||||||
|
var x86file = Path.Combine(TargetPath, "steam_api.dll");
|
||||||
|
var x64file = Path.Combine(TargetPath, "steam_api64.dll");
|
||||||
|
_x86Exists = File.Exists(x86file);
|
||||||
|
_x64Exists = File.Exists(x64file);
|
||||||
|
if (_x86Exists) MyLogger.Log.Information($"x86 SteamAPI DLL found: {x86file}");
|
||||||
|
if (_x64Exists) MyLogger.Log.Information($"x64 SteamAPI DLL found: {x64file}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CreamApiApplied(string arch)
|
||||||
|
{
|
||||||
|
bool a = File.Exists(Path.Combine(TargetPath, _creamDlls[arch].OrigFilename));
|
||||||
|
bool b = GetHash(Path.Combine(TargetPath, _creamDlls[arch].Filename)).Equals(_creamDlls[arch].Hash);
|
||||||
|
return a & b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CreamApiApplied()
|
||||||
|
{
|
||||||
|
bool a = CreamApiApplied("x86");
|
||||||
|
bool b = CreamApiApplied("x64");
|
||||||
|
return a | b;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetHash(string filename)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
using var md5 = MD5.Create();
|
||||||
|
using var stream = File.OpenRead(filename);
|
||||||
|
return BitConverter
|
||||||
|
.ToString(md5.ComputeHash(stream))
|
||||||
|
.Replace("-", string.Empty);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
POCOs/SteamAppPOCOs.cs
Normal file
36
POCOs/SteamAppPOCOs.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace auto_creamapi.POCOs
|
||||||
|
{
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
[JsonPropertyName("appid")]
|
||||||
|
public int AppId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"AppId: {AppId}, Name: {Name}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CompareId(App app)
|
||||||
|
{
|
||||||
|
return AppId.Equals(app.AppId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Applist
|
||||||
|
{
|
||||||
|
[JsonPropertyName("apps")]
|
||||||
|
public List<App> Apps { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SteamApps
|
||||||
|
{
|
||||||
|
[JsonPropertyName("applist")]
|
||||||
|
public Applist AppList { get; set; }
|
||||||
|
}
|
||||||
|
}
|
26
SearchResultWindow.xaml
Normal file
26
SearchResultWindow.xaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<Window x:Class="auto_creamapi.SearchResultWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:poco="clr-namespace:auto_creamapi.POCOs"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Search Results" Width="420" Height="540" MinWidth="420" MinHeight="540">
|
||||||
|
<Grid Margin="10,10,10,10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Content="Select a game..." HorizontalAlignment="Left" Margin="0,0,0,10" VerticalAlignment="Top"/>
|
||||||
|
<DataGrid Name="DgApps" Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single" d:DataContext="{d:DesignInstance poco:App}" MouseDoubleClick="DgApps_OnMouseDoubleClick">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="AppID" Binding="{Binding AppId}"></DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="Game Name" Binding="{Binding Name}"></DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Button Content="OK" HorizontalAlignment="Right" Margin="0,10,70,0" Grid.Row="2" VerticalAlignment="Top" Width="60" Click="OK_OnClick"/>
|
||||||
|
<Button Content="Cancel" HorizontalAlignment="Right" Margin="0,10,0,0" Grid.Row="2" VerticalAlignment="Top" Width="60" Click="Cancel_OnClick"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
59
SearchResultWindow.xaml.cs
Normal file
59
SearchResultWindow.xaml.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using auto_creamapi.Utils;
|
||||||
|
using NinjaNye.SearchExtensions;
|
||||||
|
using NinjaNye.SearchExtensions.Models;
|
||||||
|
|
||||||
|
namespace auto_creamapi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for SearchResultWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SearchResultWindow
|
||||||
|
{
|
||||||
|
public SearchResultWindow(IEnumerable<POCOs.App> list)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DgApps.ItemsSource = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OK_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
GetSelectedApp();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DgApps_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
GetSelectedApp();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Cancel_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetSelectedApp()
|
||||||
|
{
|
||||||
|
if (Application.Current.MainWindow is MainWindow currentMainWindow)
|
||||||
|
{
|
||||||
|
var app = (POCOs.App) DgApps.SelectedItem;
|
||||||
|
MyLogger.Log.Information($"Successfully got app {app}");
|
||||||
|
currentMainWindow.Game.Text = app.Name;
|
||||||
|
currentMainWindow.AppId.Text = app.AppId.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
Utils/CsRinRuLogin.EXAMPLE.cs
Normal file
13
Utils/CsRinRuLogin.EXAMPLE.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace auto_creamapi.Utils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// To use this:
|
||||||
|
/// Rename CsRinRuLogin_REMOVETHIS to CsRinRuLogin
|
||||||
|
/// Enter the relevant info below
|
||||||
|
/// </summary>
|
||||||
|
public class CsRinRuLogin_REMOVETHIS
|
||||||
|
{
|
||||||
|
public const string Username = "Enter username here";
|
||||||
|
public const string Password = "Enter password here";
|
||||||
|
}
|
||||||
|
}
|
14
Utils/MyLogger.cs
Normal file
14
Utils/MyLogger.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using Serilog;
|
||||||
|
using Serilog.Core;
|
||||||
|
|
||||||
|
namespace auto_creamapi.Utils
|
||||||
|
{
|
||||||
|
public class MyLogger
|
||||||
|
{
|
||||||
|
public static readonly Logger Log = new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Debug()
|
||||||
|
.WriteTo.Console()
|
||||||
|
.WriteTo.File("autocreamapi.log", rollingInterval: RollingInterval.Day)
|
||||||
|
.CreateLogger();
|
||||||
|
}
|
||||||
|
}
|
40
auto-creamapi.csproj
Normal file
40
auto-creamapi.csproj
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<RootNamespace>auto_creamapi</RootNamespace>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AngleSharp" Version="0.14.0" />
|
||||||
|
<PackageReference Include="bloomtom.HttpProgress" Version="2.3.2" />
|
||||||
|
<PackageReference Include="Dirkster.WatermarkControlsLib" Version="1.1.0" />
|
||||||
|
<PackageReference Include="ini-parser-netstandard" Version="2.5.2" />
|
||||||
|
<PackageReference Include="NinjaNye.SearchExtensions" Version="3.0.1" />
|
||||||
|
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||||
|
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||||
|
<PackageReference Include="SteamStorefrontAPI.NETStandard" Version="1.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="App.xaml" />
|
||||||
|
<Page Remove="ConsoleApp1\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="ConsoleApp1\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Remove="ConsoleApp1\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="ConsoleApp1\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
25
auto-creamapi.sln
Normal file
25
auto-creamapi.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.30413.136
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "auto-creamapi", "auto-creamapi.csproj", "{F49CEA2D-367E-4F57-A4A1-DA3D8F1D97EC}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F49CEA2D-367E-4F57-A4A1-DA3D8F1D97EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F49CEA2D-367E-4F57-A4A1-DA3D8F1D97EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F49CEA2D-367E-4F57-A4A1-DA3D8F1D97EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F49CEA2D-367E-4F57-A4A1-DA3D8F1D97EC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {7D90E0EE-9CBB-4C94-A02A-28555D26D06C}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
2
auto-creamapi.sln.DotSettings
Normal file
2
auto-creamapi.sln.DotSettings
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=creamapi/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
Loading…
Reference in New Issue
Block a user