mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-26 14:51:42 +00:00
Compare commits
103 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0130737789 | |||
| 1ab2f99783 | |||
| da00fa5c96 | |||
| 0a46950ca9 | |||
| 9ac4ffdc34 | |||
| 17635ccba0 | |||
| 69589075e5 | |||
| 4b547e19c4 | |||
| 053faec343 | |||
| b8ac76d2a9 | |||
| b81d45765a | |||
| 372b8c6463 | |||
| 5de26381bb | |||
| 16fd4992f8 | |||
| 7835a53717 | |||
| f15632f2d0 | |||
| b56c0e578d | |||
| 969590d9f2 | |||
| 3e87a0d50e | |||
| 690c98527f | |||
| 5242b0009b | |||
| 1f14bd77e7 | |||
| f2b1cdfcc9 | |||
| ad1df3227b | |||
| 05f132ab1b | |||
| ee858921dc | |||
| 750292bfba | |||
| 982bb4d0c8 | |||
| 8e5fea54cd | |||
| 882d39b8f3 | |||
| ffcc7405a7 | |||
| b3e7436e95 | |||
| d319fc19f9 | |||
| a56757302e | |||
| 1ad30ba49d | |||
| 04e2188437 | |||
| b4c4f52fd1 | |||
| f079488840 | |||
| 4bae3f0250 | |||
| 4c9ec85d6f | |||
| 4761fc70fe | |||
| 3abc12f4bc | |||
| 99982cacb6 | |||
| 344ab81728 | |||
| 2e8862be8b | |||
| 2a641e99ae | |||
| 9a43166d49 | |||
| 3f54df252c | |||
| 2054bd12d5 | |||
| 8ddec3cdfe | |||
| 89d7fcb816 | |||
| 8ff960189e | |||
| 31c38ac8ad | |||
| 5102e25266 | |||
| 4f57977483 | |||
| 64f79703b2 | |||
| ba7930ae89 | |||
| 50f9ff2a76 | |||
| b4398bcbce | |||
| ad0c3bc09d | |||
| a84f444c8f | |||
| 229d92a4aa | |||
| a093840b35 | |||
| c705caac8f | |||
| ef8e12e20d | |||
| 317d8b9754 | |||
| a6c5e01a9d | |||
| e77a04e447 | |||
| cddc6ea2d3 | |||
| f00015b00f | |||
| 9016f96b6a | |||
| 06748d6f83 | |||
| acf187fc6b | |||
| 1e65cd4a06 | |||
| c185533bb5 | |||
| 56ae190695 | |||
| 44382b369b | |||
| fb18d4c5f3 | |||
| 2f3055cb44 | |||
| e3f1202eba | |||
| a98e10f001 | |||
| 3385036dbe | |||
| f618accd80 | |||
| 787326f355 | |||
| 99be9d64c6 | |||
| a286403ef4 | |||
| a0d1cf8ba3 | |||
| 7eab9fddd1 | |||
| 769f102d16 | |||
| 80d7c09b0d | |||
| e6ae762d5a | |||
| 89ca08f6cf | |||
| e401bcccfd | |||
| 195ac95b36 | |||
| d1f660381e | |||
| c8aa7ba8e7 | |||
| 50a7d21d52 | |||
| aa092bdd67 | |||
| 6a1b03163c | |||
| 9a277d07db | |||
| fcd4056619 | |||
| 4cc69e9a57 | |||
| 672ca22662 |
@@ -0,0 +1,218 @@
|
||||
name: Build and Publish Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'src/NebulaAuth/NebulaAuth.csproj'
|
||||
- 'changelog/*.json'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Checkout
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Setup .NET
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Extract version via MSBuild
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Extract version from csproj
|
||||
id: ver
|
||||
run: |
|
||||
VERSION=$(dotnet msbuild src/NebulaAuth/NebulaAuth.csproj -getProperty:AssemblyVersion)
|
||||
echo "Detected version $VERSION"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Validate JSON changelog
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Validate changelog JSON
|
||||
run: |
|
||||
VERSION="${{ steps.ver.outputs.version }}"
|
||||
FILE="changelog/${VERSION}.json"
|
||||
|
||||
echo "Checking changelog file $FILE"
|
||||
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "ERROR: changelog JSON not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
jq empty "$FILE"
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Generate HTML changelog (legacy AutoUpdater)
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Generate HTML changelog
|
||||
run: |
|
||||
VERSION="${{ steps.ver.outputs.version }}"
|
||||
JSON="changelog/${VERSION}.json"
|
||||
HTML="changelog/${VERSION}.html"
|
||||
|
||||
echo "Generating HTML changelog"
|
||||
|
||||
jq -r '
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<head>",
|
||||
"<meta charset=\"UTF-8\">",
|
||||
"<title>Changelog</title>",
|
||||
"<style>",
|
||||
"body { font-family: Segoe UI, sans-serif; background:#eeeeee; padding:20px; }",
|
||||
".change { background:white; padding:25px; border-radius:10px; }",
|
||||
"li { margin-bottom:6px; }",
|
||||
"</style>",
|
||||
"</head>",
|
||||
"<body>",
|
||||
"<div class=\"change\">",
|
||||
"<ul>",
|
||||
(.changes[] |
|
||||
"<li><b>\(.type):</b> \(.text)" +
|
||||
(if .link then " <a href=\"\(.link)\">details</a>" else "" end) +
|
||||
"</li>"
|
||||
),
|
||||
"</ul>",
|
||||
"</div>",
|
||||
"</body>",
|
||||
"</html>"
|
||||
' "$JSON" > "$HTML"
|
||||
|
||||
echo "Generated $HTML"
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Build application
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Build NebulaAuth
|
||||
run: |
|
||||
dotnet publish src/NebulaAuth/NebulaAuth.csproj \
|
||||
-c Release \
|
||||
-o build \
|
||||
-p:EnableWindowsTargeting=true
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Package ZIP
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Package release
|
||||
run: |
|
||||
cd build
|
||||
zip -r ../NebulaAuth.${{ steps.ver.outputs.version }}.zip *
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Generate SHA256 checksum
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Generate checksum
|
||||
id: checksum
|
||||
run: |
|
||||
FILE="NebulaAuth.${{ steps.ver.outputs.version }}.zip"
|
||||
HASH=$(sha256sum "$FILE" | awk '{print $1}')
|
||||
echo "checksum=$HASH" >> $GITHUB_OUTPUT
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Generate update.xml
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Generate update.xml
|
||||
run: |
|
||||
VERSION="${{ steps.ver.outputs.version }}"
|
||||
CHECKSUM="${{ steps.checksum.outputs.checksum }}"
|
||||
|
||||
cat > NebulaAuth/update.xml <<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>$VERSION</version>
|
||||
<url>https://github.com/${{ github.repository }}/releases/download/$VERSION/NebulaAuth.$VERSION.zip</url>
|
||||
<changelog>https://achiez.github.io/${{ github.event.repository.name }}/changelog/$VERSION.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
<checksum algorithm="SHA256">$CHECKSUM</checksum>
|
||||
</item>
|
||||
EOF
|
||||
|
||||
echo "Generated update.xml"
|
||||
cat NebulaAuth/update.xml
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Generate GitHub Release Notes
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Generate release notes
|
||||
id: notes
|
||||
run: |
|
||||
VERSION="${{ steps.ver.outputs.version }}"
|
||||
FILE="changelog/${VERSION}.json"
|
||||
|
||||
BODY=$(jq -r '
|
||||
.changes[] |
|
||||
"- **\(.type):** \(.text)" +
|
||||
(if .link then " (\(.link))" else "" end)
|
||||
' "$FILE")
|
||||
|
||||
echo "body<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$BODY" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Commit generated files
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Commit generated files
|
||||
run: |
|
||||
git config user.name "github-actions"
|
||||
git config user.email "actions@github.com"
|
||||
|
||||
git add NebulaAuth/update.xml
|
||||
git add changelog/*.html
|
||||
|
||||
git commit -m "chore(release): ${{ steps.ver.outputs.version }}" || echo "No changes"
|
||||
git push
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Create git tag
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Create tag
|
||||
run: |
|
||||
VERSION="${{ steps.ver.outputs.version }}"
|
||||
git tag -a "$VERSION" -m "Release $VERSION"
|
||||
git push origin "$VERSION"
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Publish GitHub Release
|
||||
# --------------------------------------------------------
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ steps.ver.outputs.version }}
|
||||
name: Release ${{ steps.ver.outputs.version }}
|
||||
body: ${{ steps.notes.outputs.body }}
|
||||
files: |
|
||||
NebulaAuth.${{ steps.ver.outputs.version }}.zip
|
||||
+3
-1
@@ -360,4 +360,6 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
|
||||
todo/
|
||||
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
-175
@@ -1,175 +0,0 @@
|
||||
## creative commons
|
||||
|
||||
# Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
|
||||
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
|
||||
|
||||
### Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
|
||||
|
||||
* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
|
||||
|
||||
* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
|
||||
|
||||
## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
||||
|
||||
### Section 1 – Definitions.
|
||||
|
||||
a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
||||
|
||||
b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. __BY-NC-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License.
|
||||
|
||||
d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
||||
|
||||
e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
||||
|
||||
f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
||||
|
||||
g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
|
||||
|
||||
h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
||||
|
||||
i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
j. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
|
||||
|
||||
k. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
|
||||
|
||||
l. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
||||
|
||||
m. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
||||
|
||||
n. __You__ means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
||||
|
||||
### Section 2 – Scope.
|
||||
|
||||
a. ___License grant.___
|
||||
|
||||
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
|
||||
|
||||
B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
|
||||
|
||||
2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
||||
|
||||
3. __Term.__ The term of this Public License is specified in Section 6(a).
|
||||
|
||||
4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
||||
|
||||
5. __Downstream recipients.__
|
||||
|
||||
A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
||||
|
||||
B. __Additional offer from the Licensor – Adapted Material.__ Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
|
||||
|
||||
C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
||||
|
||||
6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. ___Other rights.___
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
|
||||
|
||||
### Section 3 – License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
||||
|
||||
a. ___Attribution.___
|
||||
|
||||
1. If You Share the Licensed Material (including in modified form), You must:
|
||||
|
||||
A. retain the following if it is supplied by the Licensor with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
||||
|
||||
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
||||
|
||||
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
||||
|
||||
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
||||
|
||||
b. ___ShareAlike.___
|
||||
|
||||
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
|
||||
|
||||
1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
|
||||
|
||||
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
|
||||
|
||||
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
|
||||
|
||||
### Section 4 – Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
|
||||
|
||||
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
||||
|
||||
### Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
|
||||
|
||||
b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
||||
|
||||
### Section 6 – Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
||||
|
||||
### Section 7 – Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
||||
|
||||
### Section 8 – Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
||||
|
||||
> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
|
||||
>
|
||||
> Creative Commons may be contacted at creativecommons.org
|
||||
@@ -1,14 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SteamLibForked\SteamLibForked.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,51 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using SteamLib.Utility.MaFiles;
|
||||
|
||||
var currentPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
if (currentPath != null)
|
||||
Environment.CurrentDirectory = currentPath;
|
||||
|
||||
|
||||
Console.WriteLine(currentPath);
|
||||
foreach (var path in args)
|
||||
{
|
||||
|
||||
if (Path.Exists(path) == false)
|
||||
{
|
||||
Console.WriteLine($"NOT VALID PATH: '{path}'");
|
||||
continue;
|
||||
}
|
||||
Console.WriteLine("Reading: " + path);
|
||||
try
|
||||
{
|
||||
var text = File.ReadAllText(path);
|
||||
var maf = MafileSerializer.Deserialize(text, out _);
|
||||
var legacy = MafileSerializer.SerializeLegacy(maf, Formatting.Indented);
|
||||
var name = Path.GetFileNameWithoutExtension(path);
|
||||
Write(legacy, name);
|
||||
|
||||
Console.WriteLine("DONE: " + name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ERROR: {ex.Message}");
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.WriteLine("-----------------------------------------");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine("Press any key to exit...");
|
||||
Console.ReadKey();
|
||||
|
||||
|
||||
void Write(string maf, string name)
|
||||
{
|
||||
|
||||
var path = Path.Combine(name + "_legacy.mafile");
|
||||
File.WriteAllText(path, maf);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33205.214
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NebulaAuth", "NebulaAuth\NebulaAuth.csproj", "{0FD01700-6D5C-451B-93BA-0860647E8F13}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{09F02072-F91D-4DAA-87BC-A34D3E150570} = {09F02072-F91D-4DAA-87BC-A34D3E150570}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NebulaAuth.LegacyConverter", "NebulaAuth.LegacyConverter\NebulaAuth.LegacyConverter.csproj", "{2D78A7D9-986A-4890-8A91-7ABD57A91830}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamLibForked", "SteamLibForked\SteamLibForked.csproj", "{09F02072-F91D-4DAA-87BC-A34D3E150570}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "changelog", "changelog", "{161BFADE-FCF3-45D1-82EA-8A1B187529F7}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
changelog\1.3.4.html = changelog\1.3.4.html
|
||||
changelog\1.4.4.html = changelog\1.4.4.html
|
||||
changelog\1.4.5.html = changelog\1.4.5.html
|
||||
changelog\1.4.6.html = changelog\1.4.6.html
|
||||
changelog\1.4.7.html = changelog\1.4.7.html
|
||||
changelog\1.4.8.html = changelog\1.4.8.html
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0FD01700-6D5C-451B-93BA-0860647E8F13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0FD01700-6D5C-451B-93BA-0860647E8F13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0FD01700-6D5C-451B-93BA-0860647E8F13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0FD01700-6D5C-451B-93BA-0860647E8F13}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2D78A7D9-986A-4890-8A91-7ABD57A91830}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2D78A7D9-986A-4890-8A91-7ABD57A91830}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2D78A7D9-986A-4890-8A91-7ABD57A91830}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2D78A7D9-986A-4890-8A91-7ABD57A91830}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{09F02072-F91D-4DAA-87BC-A34D3E150570}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{09F02072-F91D-4DAA-87BC-A34D3E150570}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{09F02072-F91D-4DAA-87BC-A34D3E150570}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{09F02072-F91D-4DAA-87BC-A34D3E150570}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FA34DDD5-BDC0-4C0A-B347-4ECDBF446900}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,2 +1,3 @@
|
||||
<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:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CheckNamespace/@EntryIndexedValue">DO_NOT_SHOW</s:String></wpf:ResourceDictionary>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CheckNamespace/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=MAAC/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -0,0 +1,28 @@
|
||||
<Solution>
|
||||
<Folder Name="/changelog/">
|
||||
<File Path="changelog/1.3.4.html" />
|
||||
<File Path="changelog/1.4.4.html" />
|
||||
<File Path="changelog/1.4.5.html" />
|
||||
<File Path="changelog/1.4.6.html" />
|
||||
<File Path="changelog/1.4.7.html" />
|
||||
<File Path="changelog/1.4.8.html" />
|
||||
<File Path="changelog/1.4.9.html" />
|
||||
<File Path="changelog/1.5.0.html" />
|
||||
<File Path="changelog/1.5.1.html" />
|
||||
<File Path="changelog/1.5.2.html" />
|
||||
<File Path="changelog/1.5.3.html" />
|
||||
<File Path="changelog/1.5.4.html" />
|
||||
<File Path="changelog/1.5.5.html" />
|
||||
<File Path="changelog/1.5.6.html" />
|
||||
<File Path="changelog/1.7.1.html" />
|
||||
<File Path="changelog/1.7.2.html" />
|
||||
<File Path="changelog/1.7.3.html" />
|
||||
<File Path="changelog/1.7.4.html" />
|
||||
<File Path="changelog/1.8.0.html" />
|
||||
<File Path="changelog/1.8.1.html" />
|
||||
<File Path="changelog/1.8.2.html" />
|
||||
<File Path="changelog/1.8.3.json" />
|
||||
</Folder>
|
||||
<Project Path="src/NebulaAuth/NebulaAuth.csproj" />
|
||||
<Project Path="src/SteamLibForked/SteamLibForked.csproj" />
|
||||
</Solution>
|
||||
@@ -1,51 +0,0 @@
|
||||
<Application x:Class="NebulaAuth.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:NebulaAuth"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:theme="clr-namespace:NebulaAuth.Theme"
|
||||
xmlns:converters="clr-namespace:NebulaAuth.Converters"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:background="clr-namespace:NebulaAuth.Converters.Background"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<SolidColorBrush x:Key="MaterialDesignPaper">#1E2025</SolidColorBrush>
|
||||
<FontFamily x:Key="Roboto">pack://application:,,,/Fonts/Roboto/#Roboto</FontFamily>
|
||||
<FontFamily x:Key="RobotoSymbols">pack://application:,,,/Fonts/Roboto/#Roboto Symbols</FontFamily>
|
||||
<converters:CoefficientConverter x:Key="CoefficientConverter"/>
|
||||
<converters:ReverseBooleanConverter x:Key="ReverseBooleanConverter"/>
|
||||
<converters:OnOffBoolTextConverter x:Key="OnOffBoolTextConverter"/>
|
||||
<converters:SelectedProxyTextConverter x:Key="SelectedProxyTextConverter"/>
|
||||
<converters:ProxyTextConverter x:Key="ProxyTextConverter"/>
|
||||
<converters:ProxyDataTextConverter x:Key="ProxyDataTextConverter"/>
|
||||
<converters:MultiCommandParameterConverter x:Key="MultiCommandParameterConverter"/>
|
||||
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
|
||||
<!-- Background converters-->
|
||||
<background:BackgroundImageVisibleConverter x:Key="BackgroundImageVisibleConverter"/>
|
||||
<background:BackgroundSourceConverter x:Key="BackgroundSourceConverter"/>
|
||||
|
||||
<system:Boolean x:Key="True">True</system:Boolean>
|
||||
<system:Boolean x:Key="False">False</system:Boolean>
|
||||
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
||||
|
||||
<materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="LightGreen" SecondaryColor="Purple" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.snackbar.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Dark.xaml" />
|
||||
<!-- Theme-->
|
||||
<ResourceDictionary Source="Theme/Brushes.xaml"/>
|
||||
<ResourceDictionary Source="Theme/WindowStyle/WindowStyle.xaml"/>
|
||||
|
||||
<!--Controls-->
|
||||
<ResourceDictionary Source="View/ConfirmationTemplates.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,35 +0,0 @@
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.Model.Exceptions;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using CodingSeb.Localization;
|
||||
|
||||
namespace NebulaAuth;
|
||||
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
|
||||
LocManager.Init();
|
||||
LocManager.SetApplicationLocalization(Settings.Instance.Language);
|
||||
try
|
||||
{
|
||||
Shell.Initialize();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msg = ex.Message;
|
||||
if (ex is CantAlignTimeException)
|
||||
{
|
||||
msg = Loc.Tr(LocManager.GetCodeBehind("CantAlignTimeError"));
|
||||
}
|
||||
|
||||
MessageBox.Show(msg);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
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)
|
||||
)]
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace NebulaAuth.Converters;
|
||||
|
||||
[ValueConversion(typeof(double), typeof(double))]
|
||||
public class CoefficientConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return System.Convert.ToDouble(value) * System.Convert.ToDouble(parameter, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (double)value / (double)parameter;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace NebulaAuth.Converters;
|
||||
|
||||
public class OnOffBoolTextConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not bool b)
|
||||
{
|
||||
throw new InvalidCastException($"Can't cast value {value} to 'bool'");
|
||||
}
|
||||
|
||||
return b ? "вкл" : "выкл";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using AchiesUtilities.Web.Proxy;
|
||||
using NebulaAuth.Model.Entities;
|
||||
|
||||
namespace NebulaAuth.Converters;
|
||||
|
||||
public class ProxyTextConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not MaProxy p)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return $"{p.Id}: {p.Data.Address}:{p.Data.Port}";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProxyDataTextConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not ProxyData p)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return $"{p.Address}:{p.Port}";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace NebulaAuth.Converters;
|
||||
|
||||
public class ReverseBooleanConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return !(bool)value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return !(bool)value;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using NebulaAuth.Model.Entities;
|
||||
|
||||
namespace NebulaAuth.Converters;
|
||||
|
||||
public class SelectedProxyTextConverter : IMultiValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values[0] is not MaProxy proxy)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var proxyExist = (bool)values[1];
|
||||
return proxyExist ? $"{proxy.Id}: {proxy.Data.Address}" : "";
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace NebulaAuth.Converters;
|
||||
|
||||
public class ValueConverterGroup : List<IValueConverter>, IValueConverter
|
||||
{
|
||||
#region IValueConverter Members
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return this.Aggregate(value, (current, converter) => converter.Convert(current, targetType, parameter, culture));
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using NebulaAuth.View;
|
||||
using NebulaAuth.View.Dialogs;
|
||||
using NebulaAuth.ViewModel.Other;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||||
|
||||
namespace NebulaAuth.Core;
|
||||
|
||||
public static class DialogsController
|
||||
{
|
||||
|
||||
#region CommonDialogs
|
||||
|
||||
public static async Task<bool> ShowConfirmCancelDialog(string? msg = null)
|
||||
{
|
||||
|
||||
var content = msg == null ? new ConfirmCancelDialog() : new ConfirmCancelDialog(msg);
|
||||
|
||||
var result = await DialogHost.Show(content);
|
||||
return result != null && (bool) result;
|
||||
}
|
||||
|
||||
//public static async Task<string?> ShowTextFieldDialog(string? msg = null)
|
||||
//{
|
||||
// var content = msg == null ? new TextFieldDialog() : new TextFieldDialog(msg);
|
||||
// var result = await DialogHost.Show(content);
|
||||
// return result as string;
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
public static async Task<LoginAgainVM?> ShowLoginAgainDialog(string username)
|
||||
{
|
||||
var vm = new LoginAgainVM
|
||||
{
|
||||
UserName = username
|
||||
};
|
||||
var content = new LoginAgainDialog
|
||||
{
|
||||
DataContext = vm
|
||||
};
|
||||
var result = await DialogHost.Show(content);
|
||||
if (result is true)
|
||||
{
|
||||
return vm;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static async Task<LoginAgainOnImportVM?> ShowLoginAgainOnImportDialog(Mafile mafile, IEnumerable<MaProxy> proxies)
|
||||
{
|
||||
var vm = new LoginAgainOnImportVM(mafile, proxies);
|
||||
var content = new LoginAgainOnImportDialog()
|
||||
{
|
||||
DataContext = vm
|
||||
};
|
||||
var result = await DialogHost.Show(content);
|
||||
if (result is true)
|
||||
{
|
||||
return vm;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static async Task ShowProxyManager(MaProxy? currentProxy)
|
||||
{
|
||||
var vm = new ProxyManagerVM();
|
||||
var view = new ProxyManagerView
|
||||
{
|
||||
DataContext = vm
|
||||
};
|
||||
await DialogHost.Show(view);
|
||||
}
|
||||
public static void CloseDialog()
|
||||
{
|
||||
DialogHost.Close(null);
|
||||
}
|
||||
public static async Task ShowLinkerDialog()
|
||||
{
|
||||
var vm = new LinkAccountVM();
|
||||
var view = new LinkerView()
|
||||
{
|
||||
DataContext = vm
|
||||
};
|
||||
await DialogHost.Show(view);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
using AutoUpdaterDotNET;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.View;
|
||||
using NebulaAuth.ViewModel.Other;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
|
||||
namespace NebulaAuth.Core;
|
||||
|
||||
public static class UpdateManager
|
||||
{
|
||||
private const string UPDATE_URL = "https://raw.githubusercontent.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/master/NebulaAuth/update.xml";
|
||||
public static void CheckForUpdates()
|
||||
{
|
||||
string jsonPath = Path.Combine(Environment.CurrentDirectory, "update-settings.json");
|
||||
AutoUpdater.PersistenceProvider = new JsonFilePersistenceProvider(jsonPath);
|
||||
AutoUpdater.ShowSkipButton = false;
|
||||
if (Settings.Instance.AllowAutoUpdate)
|
||||
AutoUpdater.UpdateMode = Mode.ForcedDownload;
|
||||
AutoUpdater.Start(UPDATE_URL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static UpdateManager()
|
||||
{
|
||||
//AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
|
||||
|
||||
}
|
||||
|
||||
private static async void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
|
||||
{
|
||||
if (args.Error == null)
|
||||
{
|
||||
if (args.IsUpdateAvailable)
|
||||
{
|
||||
DialogResult dialogResult;
|
||||
var dialog = new UpdaterView()
|
||||
{
|
||||
DataContext = new UpdaterVM(args)
|
||||
};
|
||||
|
||||
await DialogHost.Show(dialog);
|
||||
Application.Current.Shutdown();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.Error is WebException)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void RunUpdate(UpdateInfoEventArgs args)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (AutoUpdater.DownloadUpdate(args))
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}, DispatcherPriority.ContextIdle);
|
||||
}
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
<w:FontScaleWindow x:Class="NebulaAuth.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:w="clr-namespace:NebulaAuth.Theme"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:windowStyle="clr-namespace:NebulaAuth.Theme.WindowStyle"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:converters="clr-namespace:NebulaAuth.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:entities="clr-namespace:NebulaAuth.Model.Entities"
|
||||
xmlns:viewModel="clr-namespace:NebulaAuth.ViewModel"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
MinHeight="500" MinWidth="500" DefaultFontSize="18" ScaleCoefficient="0.4"
|
||||
Title="NebulaAuth" Height="800" Width="730" Style="{StaticResource MainWindow}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Foreground="#FFF5F5F5"
|
||||
FontFamily="{md:MaterialDesignFont}"
|
||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance viewModel:MainVM}"
|
||||
|
||||
|
||||
>
|
||||
<b:Interaction.Behaviors>
|
||||
<windowStyle:WindowChromeRenderedBehavior />
|
||||
</b:Interaction.Behaviors>
|
||||
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Command="{Binding Path=CopyMafileFromBufferCommand}"
|
||||
Key="V"
|
||||
Modifiers="Control"/>
|
||||
</Window.InputBindings>
|
||||
<Border Name="DragNDropBorder" Panel.ZIndex="3" Opacity="1" AllowDrop="True" DragDrop.DragEnter="Rectangle_DragEnter" DragLeave="Rectangle_DragLeave" Drop="Rectangle_Drop">
|
||||
<md:DialogHost DialogOpened="DialogHost_DialogOpened" DialogClosed="DialogHost_DialogClosed">
|
||||
<Grid ZIndex="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Image Grid.RowSpan="2" Opacity="0.6" Stretch="UniformToFill" RenderOptions.BitmapScalingMode="LowQuality" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding Settings.BackgroundMode, Converter={StaticResource BackgroundImageVisibleConverter}}" Source="{Binding Settings.BackgroundMode, Mode=OneWay, Converter={StaticResource BackgroundSourceConverter}}" />
|
||||
<Rectangle Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" Fill="#FF1F1D1D" Visibility="{Binding Settings.BackgroundMode, Converter={StaticResource BackgroundImageVisibleConverter}}" />
|
||||
<Rectangle Name="DragNDropOverlay" Grid.Row="0" Grid.RowSpan="3" Panel.ZIndex="1" Fill="#242123" Opacity="0.9" Visibility="Hidden" />
|
||||
<StackPanel Name="DragNDropPanel" Grid.Row="0" ZIndex="2" w:FontScaleWindow.Scale="1" w:FontScaleWindow.ResizeFont="True" Grid.RowSpan="3" Visibility="Hidden" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<TextBlock FontWeight="Bold" Foreground="#9a65b8" Text="{Tr MainWindow.Global.DragNDropHint}"/>
|
||||
<md:PackIcon Foreground="#9a65b8" HorizontalAlignment="Center" Width="36" Height="36" Kind="FileReplaceOutline" />
|
||||
</StackPanel>
|
||||
<ToolBarTray IsLocked="True" Grid.Row="0">
|
||||
<ToolBarTray.Background>
|
||||
<SolidColorBrush Opacity="0.6" Color="#FF1A1C25" />
|
||||
</ToolBarTray.Background>
|
||||
<ToolBar Background="#00FFFFFF" ClipToBounds="False" Style="{StaticResource MaterialDesignToolBar}" w:FontScaleWindow.Scale="0.75" w:FontScaleWindow.ResizeFont="True">
|
||||
<Menu>
|
||||
<MenuItem Header="{Tr MainWindow.Menu.File.Caption}">
|
||||
<MenuItem Header="{Tr MainWindow.Menu.File.Import}" Command="{Binding AddMafileCommand}" />
|
||||
<MenuItem Header="{Tr MainWindow.Menu.File.Remove}" Command="{Binding RemoveMafileCommand}" />
|
||||
<MenuItem Header="{Tr MainWindow.Menu.File.OpenFolder}" Command="{Binding OpenMafileFolderCommand}" />
|
||||
<MenuItem IsEnabled="False" Header="⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯" Height="15" />
|
||||
<MenuItem Header="{Tr MainWindow.Menu.File.Settings}" Command="{Binding OpenSettingsDialogCommand}" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Menu>
|
||||
<MenuItem Header="{Tr MainWindow.Menu.Account.Caption}">
|
||||
<MenuItem Header="{Tr MainWindow.Menu.Account.Link}" Command="{Binding LinkAccountCommand}" />
|
||||
<MenuItem Header="{Tr MainWindow.Menu.Account.Unlink}" Command="{Binding RemoveAuthenticatorCommand}"/>
|
||||
<MenuItem IsEnabled="False" Header="⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯" Height="15" />
|
||||
<MenuItem Header="{Tr MainWindow.Menu.Account.RefreshSession}" Command="{Binding RefreshSessionCommand}" />
|
||||
<MenuItem Header="{Tr MainWindow.Menu.Account.LoginAgain}" Command="{Binding LoginAgainCommand}" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Separator />
|
||||
<ComboBox ToolTip="{Tr MainWindow.AppBar.GroupToolTip}" MinWidth="100" Margin="8,0,8,0" VerticalAlignment="Center" md:HintAssist.Hint="{Tr MainWindow.AppBar.GroupsHint}" md:TextFieldAssist.HasClearButton="True" IsEditable="True" ItemsSource="{Binding Groups}" SelectedValue="{Binding SelectedGroup}">
|
||||
<FrameworkElement.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="md:PackIcon">
|
||||
<Setter Property="Width" Value="15" />
|
||||
<Setter Property="Height" Value="15" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</FrameworkElement.Resources>
|
||||
<UIElement.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding AddGroupCommand}" CommandParameter="{Binding Path=Text, RelativeSource={RelativeSource AncestorType=ComboBox}}" />
|
||||
</UIElement.InputBindings>
|
||||
</ComboBox>
|
||||
<ComboBox ToolTip="{Tr MainWindow.AppBar.Proxy.ProxyManipulateToolTip}" MinWidth="100" Margin="8,0,8,0" VerticalAlignment="Center" md:HintAssist.Hint="{Tr MainWindow.AppBar.Proxy.ProxyHint}" md:ComboBoxAssist.ShowSelectedItem="False" SelectedItem="{Binding SelectedProxy}" ItemsSource="{Binding Proxies}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type entities:MaProxy}">
|
||||
<TextBlock Text="{Binding Converter={StaticResource ProxyTextConverter}, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
<FrameworkElement.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{Tr MainWindow.AppBar.Proxy.ProxyOpenManagerHint}" Command="{Binding OpenProxyManagerCommand}" />
|
||||
</ContextMenu>
|
||||
</FrameworkElement.ContextMenu>
|
||||
<UIElement.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding RemoveProxyCommand}" />
|
||||
</UIElement.InputBindings>
|
||||
</ComboBox>
|
||||
<md:PackIcon Kind="StopAlert" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#FFFF0000" Margin="3" ToolTipService.InitialShowDelay="300">
|
||||
<md:PackIcon.ToolTip>
|
||||
<TextBlock>
|
||||
<Run Text="{Tr MainWindow.AppBar.Proxy.ProxyAlert.MafileProxyInUse, IsDynamic=False}"/>
|
||||
<Run Text=" "/><Run Text="{Binding SelectedMafile.Proxy.Data, FallbackValue='', Mode=OneWay}"/>
|
||||
</TextBlock>
|
||||
</md:PackIcon.ToolTip>
|
||||
<UIElement.Visibility>
|
||||
<Binding Path="ProxyExist">
|
||||
<Binding.Converter>
|
||||
<converters:ValueConverterGroup>
|
||||
<converters:ReverseBooleanConverter />
|
||||
<BooleanToVisibilityConverter />
|
||||
</converters:ValueConverterGroup>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</UIElement.Visibility>
|
||||
</md:PackIcon>
|
||||
<md:PackIcon Kind="StopAlert" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#FFFFA500" Margin="3" ToolTip="{Tr MainWindow.AppBar.Proxy.ProxyAlert.DefaultInUse}" ToolTipService.InitialShowDelay="300" Visibility="{Binding IsDefaultProxy, Converter={StaticResource BooleanToVisibilityConverter}}" ></md:PackIcon>
|
||||
<CheckBox FontSize="14" Style="{StaticResource MaterialDesignFilterChipSecondaryCheckBox}" IsChecked="{Binding TradeTimerEnabled}" Content="{Tr MainWindow.AppBar.TradeTimerHint}"/>
|
||||
<CheckBox FontSize="14" Style="{StaticResource MaterialDesignFilterChipSecondaryCheckBox}" IsChecked="{Binding MarketTimerEnabled}" Content="{Tr MainWindow.AppBar.MarketTimerHint}"/>
|
||||
<TextBox w:FontScaleWindow.Scale="0.8" w:FontScaleWindow.ResizeFont="True" md:HintAssist.Hint="{Tr Common.Abbreviations.Time.Seconds}" Margin="10,0,0,0" MinWidth="30" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding TimerCheckSeconds, UpdateSourceTrigger=PropertyChanged, Delay=700}" PreviewTextInput="UIElement_OnPreviewTextInput" />
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<Grid Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*" />
|
||||
<ColumnDefinition Width="0.6*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox Grid.Row="0" w:FontScaleWindow.Scale="0.8" w:FontScaleWindow.ResizeFont="True" Margin="10,15,10,15" DisplayMemberPath="AccountName" ItemsSource="{Binding MaFiles}" SelectedValue="{Binding SelectedMafile}">
|
||||
<FrameworkElement.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{Tr MainWindow.ContextMenus.Mafile.AddToGroup}" ItemsSource="{Binding Groups}">
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignMenuItem}" TargetType="{x:Type MenuItem}">
|
||||
<Setter Property="MenuItem.Command" Value="{Binding DataContext.AddToGroupCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
|
||||
<Setter Property="MenuItem.CommandParameter">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource MultiCommandParameterConverter}">
|
||||
<Binding />
|
||||
<Binding Path="PlacementTarget.SelectedValue" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{Tr MainWindow.ContextMenus.Mafile.RemoveFromGroup}" Command="{Binding Path=RemoveGroupCommand}" CommandParameter="{Binding Path=PlacementTarget.SelectedValue, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" />
|
||||
</ContextMenu>
|
||||
</FrameworkElement.ContextMenu>
|
||||
</ListBox>
|
||||
<TextBox Style="{StaticResource MaterialDesignFloatingHintTextBox}" md:TextFieldAssist.HasClearButton="True" w:FontScaleWindow.Scale="0.7" w:FontScaleWindow.ResizeFont="True" Grid.Row="1" Margin="10" md:HintAssist.Hint="{Tr MainWindow.LeftPart.SearchBoxHint}" Text="{Binding SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
<md:Card Grid.Column="1" Margin="10,10,15,10" UniformCornerRadius="15">
|
||||
<Control.Background>
|
||||
<SolidColorBrush Color="#FF1A1D25" Opacity="0.6" />
|
||||
</Control.Background>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox w:FontScaleWindow.Scale="1.1" w:FontScaleWindow.ResizeFont="True" IsReadOnly="True" HorizontalContentAlignment="Center" Background="#00FFFFFF" Style="{StaticResource MaterialDesignFilledTextBox}" Text="{Binding Code, FallbackValue=Code}" PreviewMouseDown="SteamGuard_DoubleClick" />
|
||||
<Grid Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar Margin="5" Foreground="#FF9932CC" Height="15" md:TransitionAssist.DisableTransitions="True" Value="{Binding CodeProgress}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Button w:FontScaleWindow.Scale="0.7" w:FontScaleWindow.ResizeFont="True" Grid.Row="1" Style="{StaticResource MaterialDesignOutlinedButton}" Margin="10" Command="{Binding GetConfirmationsCommand}" Width="{Binding Path=ActualWidth, Converter={StaticResource CoefficientConverter}, ConverterParameter=0.6, RelativeSource={RelativeSource AncestorType=md:Card}}">
|
||||
<TextBlock TextWrapping="Wrap" TextTrimming="WordEllipsis" Text="{Tr MainWindow.RightPart.LoadConfirmations}"/>
|
||||
</Button>
|
||||
<ListBox md:RippleAssist.IsDisabled="True" Focusable="False" Grid.Row="2" w:FontScaleWindow.Scale="0.72" w:FontScaleWindow.ResizeFont="True" Margin="10" Visibility="{Binding ConfirmationsVisible, Converter={StaticResource BooleanToVisibilityConverter}}" ItemsSource="{Binding Confirmations}" SelectionChanged="Selector_OnSelectionChanged">
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource MaterialDesignListBoxItem}" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
</ListBox>
|
||||
<Button Grid.Row="3" Margin="1,0,1,3" w:FontScaleWindow.Scale="0.8" w:FontScaleWindow.ResizeFont="True" Command="{Binding ConfirmLoginCommand}" Content="{Tr MainWindow.RightPart.ConfirmLogin}"/>
|
||||
</Grid>
|
||||
</md:Card>
|
||||
</Grid>
|
||||
<Border Grid.Row="2" BorderBrush="#FF696969">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Opacity="0.5" Color="DimGray" />
|
||||
</Border.Background>
|
||||
<Grid>
|
||||
<ToolBarPanel Orientation="Horizontal" Margin="5" w:FontScaleWindow.Scale="0.73" w:FontScaleWindow.ResizeFont="True">
|
||||
<TextBlock FontWeight="Bold" Text="{Tr MainWindow.Footer.Account}" />
|
||||
<TextBlock Text="{Binding SelectedMafile.AccountName}" />
|
||||
<TextBlock Text="|" Margin="10,0,10,0" />
|
||||
<TextBlock FontWeight="Bold" Text="{Tr MainWindow.Footer.Group}" />
|
||||
<TextBlock FontWeight="Normal" Text="{Binding SelectedMafile.Group, TargetNullValue=' ', FallbackValue=' ', Mode=OneWay}" />
|
||||
</ToolBarPanel>
|
||||
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" w:FontScaleWindow.Scale="0.7" w:FontScaleWindow.ResizeFont="True" Margin="0,0,10,0">
|
||||
<Hyperlink NavigateUri="https://github.com/achiez" Foreground="{DynamicResource PrimaryHueMidBrush}" RequestNavigate="Hyperlink_OnRequestNavigate">by achies</Hyperlink>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
<md:Snackbar Grid.Row="1" FontSize="20" MessageQueue="{Binding MessageQueue}" />
|
||||
</Grid>
|
||||
</md:DialogHost>
|
||||
</Border>
|
||||
</w:FontScaleWindow>
|
||||
@@ -1,144 +0,0 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.View.Dialogs;
|
||||
using NebulaAuth.ViewModel;
|
||||
using NebulaAuth.ViewModel.Other;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace NebulaAuth;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
|
||||
private static string CodeCopiedString => LocManager.GetOrDefault("CodeCopied", "MainWindow", "CodeCopied");
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
base.DataContext = new MainVM();
|
||||
Application.Current.MainWindow = this;
|
||||
TrayManager.InitializeTray();
|
||||
ThemeManager.InitializeTheme();
|
||||
base.Title = base.Title + " " + Assembly.GetExecutingAssembly().GetName().Version?.ToString(3);
|
||||
this.Loaded += OnApplicationStarted;
|
||||
}
|
||||
|
||||
private async void OnApplicationStarted(object? sender, EventArgs e)
|
||||
{
|
||||
if (Settings.Instance.IsPasswordSet == false) return;
|
||||
await Dispatcher.BeginInvoke(ShowSetPasswordDialog, DispatcherPriority.ContextIdle);
|
||||
}
|
||||
|
||||
private async Task ShowSetPasswordDialog()
|
||||
{
|
||||
var vm = new SetEncryptPasswordVM();
|
||||
var dialog = new SetCryptPasswordDialog()
|
||||
{
|
||||
DataContext = vm
|
||||
};
|
||||
var result = await DialogHost.Show(dialog);
|
||||
var pass = vm.Password;
|
||||
if (result is true && string.IsNullOrWhiteSpace(pass) == false)
|
||||
{
|
||||
PHandler.SetPassword(pass);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var lb = (ListBox)sender;
|
||||
lb.SelectedValue = null;
|
||||
}
|
||||
|
||||
private async void SteamGuard_DoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var tb = (TextBox)sender;
|
||||
if (tb.Text == CodeCopiedString) return;
|
||||
var code = tb.Text;
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(code);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Shell.Logger.Error(ex);
|
||||
return;
|
||||
}
|
||||
tb.Text = CodeCopiedString;
|
||||
await Task.Delay(200);
|
||||
if (tb.Text == CodeCopiedString)
|
||||
{
|
||||
tb.Text = code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Dran'n'Drop
|
||||
private void UIElement_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if (int.TryParse(e.Text, out _) == false) e.Handled = true;
|
||||
|
||||
}
|
||||
|
||||
private void Rectangle_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop) == false)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
DragNDropPanel.Visibility = Visibility.Visible;
|
||||
DragNDropOverlay.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private async void Rectangle_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop) == false) return;
|
||||
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop)!;
|
||||
if (filePaths.Length == 0) return;
|
||||
if (this.DataContext is MainVM mainVm)
|
||||
{
|
||||
await mainVm.AddMafile(filePaths);
|
||||
}
|
||||
DragNDropPanel.Visibility = Visibility.Hidden;
|
||||
DragNDropOverlay.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private void Rectangle_DragLeave(object sender, DragEventArgs e)
|
||||
{
|
||||
DragNDropPanel.Visibility = Visibility.Hidden;
|
||||
DragNDropOverlay.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
|
||||
private void DialogHost_DialogOpened(object sender, DialogOpenedEventArgs eventArgs)
|
||||
{
|
||||
DragNDropBorder.AllowDrop = false;
|
||||
}
|
||||
|
||||
private void DialogHost_DialogClosed(object sender, DialogClosedEventArgs eventArgs)
|
||||
{
|
||||
DragNDropBorder.AllowDrop = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.ToString())
|
||||
{
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AchiesUtilities.Web.Proxy;
|
||||
|
||||
namespace NebulaAuth.Model.Comparers;
|
||||
|
||||
public class ProxyDataComparer : IEqualityComparer<ProxyData>
|
||||
{
|
||||
public bool Equals(ProxyData? x, ProxyData? y)
|
||||
{
|
||||
return Equal(x, y);
|
||||
|
||||
}
|
||||
|
||||
public static bool Equal(ProxyData? x, ProxyData? y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
return x.Address == y.Address
|
||||
&& x.Port == y.Port
|
||||
&& x.Username == y.Username
|
||||
&& x.Password == y.Password;
|
||||
|
||||
}
|
||||
|
||||
public int GetHashCode(ProxyData obj)
|
||||
{
|
||||
return HashCode.Combine(obj.Address, obj.Port, obj.Username, obj.Password);
|
||||
}
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
using AchiesUtilities.Web.Proxy;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using SteamLib.Account;
|
||||
using SteamLib.Api.Mobile;
|
||||
using SteamLib.Authentication;
|
||||
using SteamLib.Authentication.LoginV2;
|
||||
using SteamLib.Core.Interfaces;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.ProtoCore;
|
||||
using SteamLib.ProtoCore.Services;
|
||||
using SteamLib.SteamMobile;
|
||||
using SteamLib.SteamMobile.Confirmations;
|
||||
using SteamLib.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using SteamLib.Api;
|
||||
using SteamLib.Core.Enums;
|
||||
|
||||
namespace NebulaAuth.Model;
|
||||
|
||||
|
||||
public static class MaClient
|
||||
{
|
||||
private static HttpClientHandler ClientHandler { get; }
|
||||
|
||||
private static HttpClient Client { get; }
|
||||
|
||||
private static DynamicProxy Proxy { get; }
|
||||
|
||||
public static ProxyData? DefaultProxy { get; set; }
|
||||
|
||||
static MaClient()
|
||||
{
|
||||
Proxy = new DynamicProxy(null);
|
||||
var pair = ClientBuilder.BuildMobileClient(Proxy, null);
|
||||
Client = pair.Client;
|
||||
ClientHandler = pair.Handler;
|
||||
}
|
||||
|
||||
public static void ClearCookies()
|
||||
{
|
||||
foreach (Cookie allCookie in ClientHandler.CookieContainer.GetAllCookies())
|
||||
{
|
||||
allCookie.Expired = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetAccount(Mafile? account)
|
||||
{
|
||||
ClearCookies();
|
||||
if (account != null)
|
||||
{
|
||||
if (account.SessionData != null)
|
||||
{
|
||||
ClientHandler.CookieContainer.SetSteamMobileCookiesWithMobileToken(account.SessionData);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClientHandler.CookieContainer.ClearSteamCookies();
|
||||
ClientHandler.CookieContainer.AddMinimalMobileCookies();
|
||||
AdmissionHelper.TransferCommunityCookies(ClientHandler.CookieContainer);
|
||||
}
|
||||
Proxy.SetData(account.Proxy?.Data);
|
||||
}
|
||||
}
|
||||
|
||||
public static Task<IEnumerable<Confirmation>> GetConfirmations(Mafile mafile)
|
||||
{
|
||||
ValidateMafile(mafile);
|
||||
SetProxy(mafile);
|
||||
return SteamMobileConfirmationsApi.GetConfirmations(Client, mafile, mafile.SessionData!.SteamId.Steam64);
|
||||
}
|
||||
|
||||
public static async Task LoginAgain(Mafile mafile, string password, bool savePassword, ICaptchaResolver? resolver)
|
||||
{
|
||||
SetProxy(mafile);
|
||||
var sgGenerator = new SteamGuardCodeGenerator(mafile.SharedSecret);
|
||||
var options = new LoginV2ExecutorOptions(LoginV2Executor.NullConsumer, Client)
|
||||
{
|
||||
Logger = Shell.ExtensionsLogger,
|
||||
SteamGuardProvider = sgGenerator,
|
||||
DeviceDetails = LoginV2ExecutorOptions.GetMobileDefaultDevice(),
|
||||
WebsiteId = "Mobile"
|
||||
};
|
||||
ClientHandler.CookieContainer.ClearMobileSessionCookies();
|
||||
var result = await LoginV2Executor.DoLogin(options, mafile.AccountName, password);
|
||||
AdmissionHelper.TransferCommunityCookies(ClientHandler.CookieContainer);
|
||||
mafile.SessionData = (MobileSessionData)result;
|
||||
if(PHandler.IsPasswordSet)
|
||||
mafile.Password = (savePassword ? PHandler.Encrypt(password) : null);
|
||||
Storage.UpdateMafile(mafile);
|
||||
}
|
||||
|
||||
public static async Task RefreshSession(Mafile mafile)
|
||||
{
|
||||
ValidateMafile(mafile, true);
|
||||
SetProxy(mafile);
|
||||
var token = mafile.SessionData!.GetMobileToken();
|
||||
if (token == null || token.Value.IsExpired)
|
||||
{
|
||||
var sessionToken = await SteamMobileApi.RefreshJwt(Client, mafile.SessionData!.RefreshToken.Token, mafile.SessionData.SteamId.Steam64);
|
||||
var newToken = SteamTokenHelper.Parse(sessionToken);
|
||||
mafile.SessionData.SetMobileToken(newToken);
|
||||
}
|
||||
|
||||
var communityToken = mafile.SessionData!.GetToken(SteamDomain.Community);
|
||||
if (communityToken == null || communityToken.Value.IsExpired)
|
||||
{
|
||||
var communityTokenString = await SteamGlobalApi.RefreshJwt(Client, SteamDomain.Community);
|
||||
var newToken = SteamTokenHelper.Parse(communityTokenString);
|
||||
mafile.SessionData.SetToken(SteamDomain.Community, newToken);
|
||||
}
|
||||
|
||||
Storage.UpdateMafile(mafile);
|
||||
ClientHandler.CookieContainer.SetSteamMobileCookiesWithMobileToken(mafile.SessionData);
|
||||
}
|
||||
|
||||
public static Task<bool> SendConfirmation(Mafile mafile, Confirmation confirmation, bool confirm)
|
||||
{
|
||||
ValidateMafile(mafile);
|
||||
SetProxy(mafile);
|
||||
return SteamMobileConfirmationsApi.SendConfirmation(Client, confirmation, mafile.SessionData!.SteamId.Steam64, mafile, confirm);
|
||||
}
|
||||
|
||||
public static Task<bool> SendMultipleConfirmation(Mafile mafile, IEnumerable<Confirmation> confirmations, bool confirm)
|
||||
{
|
||||
var enumerable = confirmations.ToList();
|
||||
if (!enumerable.Any())
|
||||
{
|
||||
return Task.FromResult(result: false);
|
||||
}
|
||||
|
||||
ValidateMafile(mafile);
|
||||
SetProxy(mafile);
|
||||
return SteamMobileConfirmationsApi.SendMultipleConfirmations(Client, enumerable, mafile.SessionData!.SteamId.Steam64, mafile, confirm);
|
||||
}
|
||||
|
||||
public static Task<RemoveAuthenticator_Response> RemoveAuthenticator(Mafile mafile)
|
||||
{
|
||||
ValidateMafile(mafile);
|
||||
SetProxy(mafile);
|
||||
if (mafile.RevocationCode == null)
|
||||
{
|
||||
throw new InvalidOperationException("This mafile does not have R-Code");
|
||||
}
|
||||
var token = mafile.SessionData!.GetMobileToken()!;
|
||||
return SteamMobileApi.RemoveAuthenticator(Client, token.Value.Token, mafile.RevocationCode);
|
||||
}
|
||||
|
||||
private static void SetProxy(Mafile mafile)
|
||||
{
|
||||
Proxy.SetData(mafile.Proxy?.Data ?? DefaultProxy);
|
||||
}
|
||||
|
||||
private static void ValidateMafile(Mafile mafile, bool ignoreAccessToken = false)
|
||||
{
|
||||
if (mafile.SessionData == null) throw new SessionInvalidException();
|
||||
if (mafile.SessionData.RefreshToken.IsExpired)
|
||||
throw new SessionExpiredException();
|
||||
|
||||
if (ignoreAccessToken == false)
|
||||
{
|
||||
var access = mafile.SessionData.GetMobileToken();
|
||||
if (access == null || access.Value.IsExpired)
|
||||
throw new SessionExpiredException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static async Task<LoginConfirmationResult> ConfirmLoginRequest(Mafile mafile)
|
||||
{
|
||||
if (mafile.SessionData == null)
|
||||
{
|
||||
throw new SessionExpiredException();
|
||||
}
|
||||
|
||||
ValidateMafile(mafile);
|
||||
var token = mafile.SessionData.GetMobileToken()!.Value;
|
||||
SetProxy(mafile);
|
||||
|
||||
var uri = "https://api.steampowered.com/IAuthenticationService/GetAuthSessionsForAccount/v1?access_token=" + token.Token;
|
||||
GetAuthSessionsForAccount_Response getsess;
|
||||
try
|
||||
{
|
||||
getsess = await Client.GetProto<GetAuthSessionsForAccount_Response>(uri, new EmptyMessage());
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
when (ex.StatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
throw new SessionExpiredException(string.Empty, ex);
|
||||
}
|
||||
|
||||
if (getsess.ClientIds.Count == 0)
|
||||
{
|
||||
return new LoginConfirmationResult
|
||||
{
|
||||
Error = LoginConfirmationError.NoRequests
|
||||
};
|
||||
}
|
||||
if (getsess.ClientIds.Count > 1)
|
||||
{
|
||||
return new LoginConfirmationResult
|
||||
{
|
||||
Error = LoginConfirmationError.MoreThanOneRequest
|
||||
};
|
||||
}
|
||||
var clientId = getsess.ClientIds.Single();
|
||||
var infoUri = "https://api.steampowered.com/IAuthenticationService/GetAuthSessionInfo/v1?access_token=" + token.Token;
|
||||
var infoReq = new GetAuthSessionInfo_Request
|
||||
{
|
||||
ClientId = clientId
|
||||
};
|
||||
var infoResp = await Client.PostProto<GetAuthSessionInfo_Response>(infoUri, infoReq);
|
||||
var updateUri = "https://api.steampowered.com/IAuthenticationService/UpdateAuthSessionWithMobileConfirmation/v1?access_token=" + token.Token;
|
||||
var updateReq = new UpdateAuthSessionWithMobileConfirmation_Request
|
||||
{
|
||||
ClientId = clientId,
|
||||
Confirm = true,
|
||||
Persistence = 1,
|
||||
Steamid = mafile.SessionData.SteamId.Steam64.ToUlong(),
|
||||
Version = 1
|
||||
};
|
||||
updateReq.ComputeSignature(mafile.SharedSecret);
|
||||
await Client.PostProtoEnsureSuccess(updateUri, updateReq);
|
||||
return new LoginConfirmationResult
|
||||
{
|
||||
Country = infoResp.Country,
|
||||
IP = infoResp.IP,
|
||||
Success = true
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using SteamLib.Exceptions;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NebulaAuth.Model;
|
||||
|
||||
public static class SessionHandler
|
||||
{
|
||||
public static event EventHandler? LoginStarted;
|
||||
public static event EventHandler? LoginCompleted;
|
||||
|
||||
public static async Task<T> Handle<T>(Func<Task<T>> func, Mafile mafile)
|
||||
{
|
||||
string? password = null;
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(mafile.Password))
|
||||
{
|
||||
password = PHandler.Decrypt(mafile.Password);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
var refreshed = false;
|
||||
try
|
||||
{
|
||||
return await func();
|
||||
}
|
||||
catch (SessionExpiredException) when (mafile.SessionData is not { RefreshToken.IsExpired: true})
|
||||
{
|
||||
refreshed = await TryRefresh(mafile);
|
||||
}
|
||||
catch (SessionInvalidException)
|
||||
when (password != null)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
if (refreshed)
|
||||
{
|
||||
Shell.Logger.Debug("Token on mafile {name} {steamid} refreshed", mafile.AccountName,
|
||||
mafile.SessionData?.SteamId);
|
||||
try
|
||||
{
|
||||
return await func();
|
||||
}
|
||||
catch (Exception ex3)
|
||||
when (password != null && ex3 is SessionExpiredException or SessionInvalidException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (password == null)
|
||||
{
|
||||
throw new SessionInvalidException();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
LoginStarted?.Invoke(null, EventArgs.Empty);
|
||||
await MaClient.LoginAgain(mafile, password, savePassword: true, null);
|
||||
Shell.Logger.Debug("Mafile {name} {steamid} succesfully auto-relogined", mafile.AccountName,
|
||||
mafile.SessionData?.SteamId);
|
||||
}
|
||||
finally
|
||||
{
|
||||
LoginCompleted?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
return await func();
|
||||
}
|
||||
|
||||
private static async Task<bool> TryRefresh(Mafile mafile)
|
||||
{
|
||||
try
|
||||
{
|
||||
await MaClient.RefreshSession(mafile);
|
||||
SnackbarController.SendSnackbar(LocManager.GetCodeBehindOrDefault("SessionWasRefreshedAutomatically", "SessionHandler", "SessionWasRefreshedAutomatically"));
|
||||
return true;
|
||||
}
|
||||
catch (SessionInvalidException)
|
||||
{
|
||||
Shell.Logger.Debug("Token on mafile {name} {steamid} not refreshed", mafile.AccountName, mafile.SessionData?.SteamId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
using NebulaAuth.Core;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows.Media;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace NebulaAuth.Model;
|
||||
|
||||
public partial class Settings : ObservableObject
|
||||
{
|
||||
#region Properties
|
||||
|
||||
[ObservableProperty] private bool _disableTimersOnChange = true;
|
||||
[ObservableProperty] private BackgroundMode _backgroundMode = BackgroundMode.Default;
|
||||
[ObservableProperty] private bool _hideToTray;
|
||||
[ObservableProperty] private int _timerSeconds = 60;
|
||||
[ObservableProperty] private Color? _backgroundColor;
|
||||
[ObservableProperty] private Color? _iconColor;
|
||||
[ObservableProperty] private bool _isPasswordSet;
|
||||
[ObservableProperty] private LocalizationLanguage _language = LocalizationLanguage.English;
|
||||
[ObservableProperty] private bool _legacyMode = true;
|
||||
[ObservableProperty] private bool _allowAutoUpdate;
|
||||
[ObservableProperty] private bool _useAccountNameAsMafileName;
|
||||
#endregion
|
||||
|
||||
public static Settings Instance { get; }
|
||||
static Settings()
|
||||
{
|
||||
if (File.Exists("settings.json") == false)
|
||||
{
|
||||
Instance = new();
|
||||
Instance.PropertyChanged += SettingsOnPropertyChanged;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText("settings.json");
|
||||
var settings = JsonConvert.DeserializeObject<Settings>(json) ?? throw new NullReferenceException();
|
||||
Instance = settings;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SnackbarController.SendSnackbar("Ошибка при загрузке настроек. Настройки были сброшены");
|
||||
SnackbarController.SendSnackbar(ex.Message);
|
||||
Instance = new();
|
||||
}
|
||||
Instance.PropertyChanged += SettingsOnPropertyChanged;
|
||||
}
|
||||
|
||||
private static void SettingsOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(Instance, Formatting.Indented);
|
||||
File.WriteAllText("settings.json", json);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public enum BackgroundMode
|
||||
{
|
||||
Default, Custom, Color
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using NebulaAuth.Model.Exceptions;
|
||||
using NLog;
|
||||
using SteamLib.Core;
|
||||
using SteamLib.SteamMobile;
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
|
||||
namespace NebulaAuth.Model;
|
||||
|
||||
public static class Shell
|
||||
{
|
||||
public static Logger Logger { get; } = LogManager.GetLogger("Logger");
|
||||
public static ILogger ExtensionsLogger { get; private set; } = null!;
|
||||
public static void Initialize()
|
||||
{
|
||||
|
||||
var lp = new NLog.Extensions.Logging.NLogLoggerProvider();
|
||||
var logger = lp.CreateLogger("SteamLib");
|
||||
HealthMonitor.FatalLogger = logger;
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
|
||||
|
||||
var loggerFactory = new NLog.Extensions.Logging.NLogLoggerFactory();
|
||||
ExtensionsLogger = loggerFactory.CreateLogger("Logger");
|
||||
|
||||
try
|
||||
{
|
||||
TimeAligner.AlignTime();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new CantAlignTimeException("", ex);
|
||||
}
|
||||
ExtensionsLogger.LogDebug("Application started");
|
||||
}
|
||||
|
||||
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Logger.Fatal((Exception)e.ExceptionObject);
|
||||
}
|
||||
}
|
||||
@@ -1,307 +0,0 @@
|
||||
using NebulaAuth.Model.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SteamLib;
|
||||
using SteamLib.Account;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.SteamMobile;
|
||||
using SteamLib.Utility.MaFiles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace NebulaAuth.Model;
|
||||
|
||||
public static class Storage
|
||||
{
|
||||
public const string MAFILE_F = "maFiles";
|
||||
public const string REMOVED_F = "maFiles_removed";
|
||||
|
||||
public static string MafileFolder { get; } = Path.GetFullPath(MAFILE_F);
|
||||
public static string RemovedMafileFolder { get; } = Path.GetFullPath(REMOVED_F);
|
||||
|
||||
public static ObservableCollection<Mafile> MaFiles { get; } = new();
|
||||
|
||||
public static readonly int DuplicateFound;
|
||||
static Storage()
|
||||
{
|
||||
if (Directory.Exists(MafileFolder) == false)
|
||||
{
|
||||
Directory.CreateDirectory(MafileFolder);
|
||||
}
|
||||
|
||||
if (Directory.Exists(RemovedMafileFolder) == false)
|
||||
{
|
||||
Directory.CreateDirectory(RemovedMafileFolder);
|
||||
}
|
||||
|
||||
var files = Directory.GetFiles(MafileFolder);
|
||||
var hashNames = new HashSet<string>();
|
||||
var hashIds = new HashSet<SteamId>();
|
||||
var comparer = new MafileNameComparer(Settings.Instance.UseAccountNameAsMafileName);
|
||||
var ordered = files.Order(comparer).ToList();
|
||||
foreach (var file in ordered)
|
||||
{
|
||||
if (Path.GetExtension(file).Equals(".mafile", StringComparison.OrdinalIgnoreCase) == false) continue;
|
||||
try
|
||||
{
|
||||
var data = ReadMafile(file);
|
||||
|
||||
if (hashNames.Contains(data.AccountName) || (data.SessionData != null && hashIds.Contains(data.SessionData.SteamId)))
|
||||
{
|
||||
DuplicateFound++;
|
||||
Shell.Logger.Error("Duplicate mafile {file}", Path.GetFileName(file));
|
||||
continue;
|
||||
}
|
||||
hashNames.Add(data.AccountName);
|
||||
if (data.SessionData != null) hashIds.Add(data.SessionData.SteamId);
|
||||
MaFiles.Add(data);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Shell.Logger.Error(ex, "Can't load mafile {file}", Path.GetFileName(file));
|
||||
}
|
||||
}
|
||||
|
||||
MaFiles = new ObservableCollection<Mafile>(MaFiles.OrderBy(m => m.AccountName));
|
||||
}
|
||||
|
||||
|
||||
public static void AddNewMafile(string path, bool overwrite)
|
||||
{
|
||||
Mafile data;
|
||||
try
|
||||
{
|
||||
data = ReadMafile(path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Shell.Logger.Warn(ex, "Can't load mafile");
|
||||
throw new FormatException("File data is not valid", ex);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(data.AccountName))
|
||||
throw new FormatException("File data is not valid. Missing AccountName");
|
||||
|
||||
try
|
||||
{
|
||||
var code = SteamGuardCodeGenerator.GenerateCode(data.SharedSecret);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new FormatException("Can't generate code on this mafile", ex);
|
||||
}
|
||||
|
||||
|
||||
if (data.SessionData == null)
|
||||
throw new SessionInvalidException("File data is not valid. Missing SessionData")
|
||||
{
|
||||
Data = { { "mafile", data } }
|
||||
};
|
||||
|
||||
|
||||
if (overwrite == false && File.Exists(CreatePathForMafile(data)))
|
||||
{
|
||||
throw new IOException("File already exist and overwrite is False");
|
||||
}
|
||||
|
||||
|
||||
SaveMafile(data);
|
||||
}
|
||||
|
||||
|
||||
public static Mafile ReadMafile(string path)
|
||||
{
|
||||
var str = File.ReadAllText(path);
|
||||
var mafile = MafileSerializer.Deserialize(str, out var mafileData);
|
||||
if (mafileData.IsExtended == false)
|
||||
throw new FormatException("Mafile is not extended data");
|
||||
|
||||
|
||||
var props = mafileData.UnusedProperties ?? new Dictionary<string, JProperty>();
|
||||
var proxy = GetPropertyValue<MaProxy>("Proxy", props);
|
||||
var group = GetPropertyValue<string>("Group", props);
|
||||
var password = GetPropertyValue<string>("Password", props);
|
||||
return Mafile.FromMobileDataExtended((MobileDataExtended)mafile, proxy, group, password);
|
||||
}
|
||||
|
||||
public static string SerializeMafile(Mafile data)
|
||||
{
|
||||
var props = new Dictionary<string, object?>
|
||||
{
|
||||
{nameof(Mafile.Proxy), data.Proxy},
|
||||
{nameof(Mafile.Group), data.Group},
|
||||
{nameof(Mafile.Password), data.Password}
|
||||
};
|
||||
return SerializeMafile(data, props);
|
||||
}
|
||||
|
||||
public static string SerializeMafile(MobileDataExtended data, Dictionary<string, object?>? properties)
|
||||
{
|
||||
if (Settings.Instance.LegacyMode)
|
||||
{
|
||||
return MafileSerializer.SerializeLegacy(data, Formatting.Indented, properties);
|
||||
}
|
||||
else
|
||||
{
|
||||
return MafileSerializer.Serialize(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static T? GetPropertyValue<T>(string name, Dictionary<string, JProperty> dictionary)
|
||||
{
|
||||
if (dictionary.TryGetValue(name, out var prop) == false) return default;
|
||||
var value = prop.Value;
|
||||
try
|
||||
{
|
||||
return value.ToObject<T>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Shell.Logger.Warn(ex, "Can't deserialize property {name}", name);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveMafile(Mafile data)
|
||||
{
|
||||
var path = CreatePathForMafile(data);
|
||||
var str = SerializeMafile(data);
|
||||
File.WriteAllText(Path.GetFullPath(path), str);
|
||||
|
||||
var existed = MaFiles.SingleOrDefault(m => m.AccountName == data.AccountName);
|
||||
if (existed != null)
|
||||
{
|
||||
var index = MaFiles.IndexOf(existed);
|
||||
MaFiles[index] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaFiles.Add(data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateMafile(Mafile data)
|
||||
{
|
||||
var path = CreatePathForMafile(data);
|
||||
var str = SerializeMafile(data);
|
||||
File.WriteAllText(Path.GetFullPath(path), str);
|
||||
}
|
||||
|
||||
public static void RemoveMafile(Mafile data)
|
||||
{
|
||||
var path = CreatePathForMafile(data);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
MaFiles.Remove(data);
|
||||
}
|
||||
public static void MoveToRemoved(Mafile data)
|
||||
{
|
||||
var path = CreatePathForMafile(data);
|
||||
var copyPath = Path.Combine(REMOVED_F, data.SessionData!.SteamId + ".mafile");
|
||||
var copyPathCompleted = copyPath;
|
||||
var i = 0;
|
||||
while (File.Exists(copyPathCompleted))
|
||||
{
|
||||
i++;
|
||||
copyPathCompleted = copyPath + $" ({i})";
|
||||
}
|
||||
File.Copy(path, copyPathCompleted, false);
|
||||
File.Delete(path);
|
||||
MaFiles.Remove(data);
|
||||
}
|
||||
|
||||
private static string CreatePathForMafile(Mafile data)
|
||||
{
|
||||
string fileName;
|
||||
if (Settings.Instance.UseAccountNameAsMafileName)
|
||||
{
|
||||
fileName = CreateFileNameWithAccountName(data.AccountName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(data.SessionData == null)
|
||||
throw new NullReferenceException("SessionData was null can't retrieve SteamId"); //FIXME: think about better way to handle
|
||||
|
||||
fileName = CreateFileNameWithSteamId(data.SessionData.SteamId);
|
||||
}
|
||||
|
||||
return Path.Combine(MafileFolder, fileName);
|
||||
}
|
||||
|
||||
private static string CreateFileNameWithAccountName(string accountName) => accountName + ".mafile";
|
||||
private static string CreateFileNameWithSteamId(SteamId steamId) => steamId.Steam64.Id + ".mafile";
|
||||
|
||||
public static string? TryFindMafilePath(Mafile data)
|
||||
//FIXME: write mode to mafile instead of searching it. Search sometimes represents not actual mafile (in case of duplicate steamId + accountName)
|
||||
{
|
||||
var pathFileName = Path.Combine(MafileFolder, CreateFileNameWithAccountName(data.AccountName));
|
||||
string? pathSteamId = null;
|
||||
if (data.SessionData != null)
|
||||
{
|
||||
pathSteamId = Path.Combine(MafileFolder, CreateFileNameWithSteamId(data.SessionData.SteamId));
|
||||
}
|
||||
|
||||
var steamIdExist = pathSteamId != null && File.Exists(pathSteamId);
|
||||
var accountNameExist = File.Exists(pathFileName);
|
||||
|
||||
if (steamIdExist && accountNameExist)
|
||||
{
|
||||
return Settings.Instance.UseAccountNameAsMafileName ? pathFileName : pathSteamId;
|
||||
}
|
||||
if (steamIdExist ^ accountNameExist)
|
||||
{
|
||||
return steamIdExist ? pathSteamId : pathFileName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool ValidateCanSave(Mafile data)
|
||||
{
|
||||
return Settings.Instance.UseAccountNameAsMafileName || data.SessionData != null;
|
||||
}
|
||||
}
|
||||
|
||||
internal class MafileNameComparer : IComparer<string>
|
||||
{
|
||||
public bool MafileNameMode { get; }
|
||||
private const string MAF_64_START = "765";
|
||||
private static readonly IComparer<string> _defaultComparer = Comparer<string>.Default;
|
||||
public MafileNameComparer(bool mafileNameMode)
|
||||
{
|
||||
MafileNameMode = mafileNameMode;
|
||||
}
|
||||
|
||||
|
||||
public int Compare(string? x, string? y)
|
||||
{
|
||||
if (x == null && y == null) return 0;
|
||||
if (x == null) return -1;
|
||||
if (y == null) return 1;
|
||||
|
||||
|
||||
bool xisSteamId = Path.GetFileName(x).StartsWith(MAF_64_START);
|
||||
bool yisSteamId = Path.GetFileName(y).StartsWith(MAF_64_START);
|
||||
|
||||
if (xisSteamId ^ yisSteamId)
|
||||
{
|
||||
if (MafileNameMode)
|
||||
{
|
||||
return xisSteamId ? 1 : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return yisSteamId ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
return _defaultComparer.Compare(x, y);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<SatelliteResourceLanguages>ru</SatelliteResourceLanguages>
|
||||
<ApplicationIcon>Theme\nebula lock.ico</ApplicationIcon>
|
||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||
<AssemblyVersion>1.4.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Theme\Background.jpg" />
|
||||
<None Remove="Theme\nebula lock.ico" />
|
||||
<None Remove="Theme\nebula.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||
<PackageReference Include="MaterialDesignExtensions" Version="3.3.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||
<PackageReference Include="NLog" Version="5.1.2" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Theme\Background.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Theme\nebula lock.ico" />
|
||||
<Resource Include="Theme\nebula.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Model\Utility\" />
|
||||
<Folder Include="Model\Exceptions\" />
|
||||
<Folder Include="Theme\Fonts\Новая папка\" />
|
||||
<Folder Include="ViewModel\Other\" />
|
||||
<Folder Include="Utility\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SteamLib\SteamLib\SteamLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,67 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<SatelliteResourceLanguages>en;ru;ua</SatelliteResourceLanguages>
|
||||
<ApplicationIcon>Theme\lock.ico</ApplicationIcon>
|
||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||
<AssemblyVersion>1.4.7</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Theme\Background.jpg" />
|
||||
<None Remove="Theme\lock.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autoupdater.NET.Official" Version="1.8.4" />
|
||||
<PackageReference Include="CodingSeb.Localization.JsonFileLoader" Version="1.3.0" />
|
||||
<PackageReference Include="CodingSeb.Localization.WPF" Version="1.3.0" />
|
||||
<PackageReference Include="CodingSebLocalization.Fody" Version="1.3.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||
<PackageReference Include="MaterialDesignExtensions" Version="4.0.0-a02" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
|
||||
<PackageReference Include="NLog" Version="5.2.8" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Theme\Background.jpg">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Theme\lock.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Model\Exceptions\" />
|
||||
<Folder Include="Utility\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SteamLibForked\SteamLibForked.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="View\Dialogs\LoginAgainOnImportDialog.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="localization.loc.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,9 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<!--Card-->
|
||||
<SolidColorBrush x:Key="MaterialDesignCardBackground" Color="#26292E"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PrimaryHueMidBrush" Color="#FF9056B1"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PrimaryHueLightBrush" Color="#FF9C70B5"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="#FF851BC1"></SolidColorBrush>
|
||||
</ResourceDictionary>
|
||||
@@ -1,200 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace NebulaAuth.Theme;
|
||||
|
||||
public partial class FontScaleWindow : Window
|
||||
{
|
||||
|
||||
private readonly Func<double, double, double> _diagonal = (h, w) => Math.Sqrt(h * h + w * w);
|
||||
private double _currentDiagonal;
|
||||
private double _defaultDiagonal = 1;
|
||||
private readonly HashSet<FrameworkElement> _cachedObjects = new();
|
||||
private bool _loaded = false;
|
||||
|
||||
public FontScaleWindow()
|
||||
{
|
||||
Loaded += OnLoaded;
|
||||
|
||||
}
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var w = (FontScaleWindow)sender;
|
||||
w._defaultDiagonal = _diagonal(MinHeight, MinWidth);
|
||||
w.SizeChanged += OnSizeChanged;
|
||||
w.Loaded -= OnLoaded;
|
||||
_loaded = true;
|
||||
w.Width += 1;
|
||||
w.Width -= 1;
|
||||
}
|
||||
|
||||
|
||||
//<-------------------Window-------------------->
|
||||
public double DefaultFontSize
|
||||
{
|
||||
get => (double)GetValue(DefaultFontSizeProperty);
|
||||
set => SetValue(DefaultFontSizeProperty, value);
|
||||
}
|
||||
|
||||
public double ScaleCoefficient
|
||||
{
|
||||
get => (double)GetValue(ScaleCoefficientProperty);
|
||||
set => SetValue(ScaleCoefficientProperty, value);
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for ScaleCoefficient. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty ScaleCoefficientProperty =
|
||||
DependencyProperty.Register("ScaleCoefficient", typeof(double), typeof(FontScaleWindow), new PropertyMetadata(1d));
|
||||
|
||||
|
||||
public static readonly DependencyProperty DefaultFontSizeProperty =
|
||||
DependencyProperty.Register("DefaultFontSize", typeof(double), typeof(FontScaleWindow), new PropertyMetadata(20d));
|
||||
|
||||
|
||||
private static readonly DependencyPropertyKey ParentScaleWindowKey
|
||||
= DependencyProperty.RegisterAttachedReadOnly(
|
||||
"ParentScaleWindow",
|
||||
typeof(FontScaleWindow), typeof(FontScaleWindow),
|
||||
new FrameworkPropertyMetadata(default(FontScaleWindow),
|
||||
FrameworkPropertyMetadataOptions.None));
|
||||
|
||||
public static readonly DependencyProperty ParentScaleWindowProperty
|
||||
= ParentScaleWindowKey.DependencyProperty;
|
||||
|
||||
private static FontScaleWindow? GetParentScaleWindow(DependencyObject element) =>
|
||||
(FontScaleWindow)element.GetValue(ParentScaleWindowProperty);
|
||||
private static void SetParentScaleWindow(DependencyObject element, FontScaleWindow value) =>
|
||||
element.SetValue(ParentScaleWindowKey, value);
|
||||
|
||||
|
||||
public static readonly DependencyProperty ResizeFontProperty = DependencyProperty.RegisterAttached(
|
||||
"ResizeFont", typeof(bool), typeof(FontScaleWindow), new FrameworkPropertyMetadata(false, ResizeCallBack));
|
||||
|
||||
public static void SetResizeFont(DependencyObject element, bool value)
|
||||
=> element.SetValue(ResizeFontProperty, value);
|
||||
public static bool GetResizeFont(DependencyObject element)
|
||||
=> (bool)element.GetValue(ResizeFontProperty);
|
||||
|
||||
private static bool SetWindow(FrameworkElement el)
|
||||
{
|
||||
var w = GetWindow(el);
|
||||
if (w is not FontScaleWindow fsWindow) return false;
|
||||
SetParentScaleWindow(el, fsWindow);
|
||||
if (fsWindow._cachedObjects.Contains(el)) return true;
|
||||
fsWindow._cachedObjects.Add(el);
|
||||
el.Unloaded += ObjOnUnloaded;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void ObjOnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var el = (FrameworkElement)sender;
|
||||
if (GetParentScaleWindow(el) == null)
|
||||
{
|
||||
if (!SetWindow(el))
|
||||
{
|
||||
el.Loaded -= ObjOnLoaded;
|
||||
return;
|
||||
}
|
||||
}
|
||||
ResizeCallBack(sender, new DependencyPropertyChangedEventArgs());
|
||||
}
|
||||
|
||||
private static void ResizeCallBack(object? sender, DependencyPropertyChangedEventArgs eventArgs)
|
||||
{
|
||||
if (sender is not FrameworkElement obj) return;
|
||||
var window = GetParentScaleWindow(obj);
|
||||
if (window != null && !window._cachedObjects.Contains(obj))
|
||||
{
|
||||
if (!SetWindow(obj)) return;
|
||||
}
|
||||
else if (window == null)
|
||||
{
|
||||
obj.Loaded += ObjOnLoaded;
|
||||
}
|
||||
|
||||
if (window is not { _loaded: true }) return;
|
||||
CalculateFontSizeResized(obj);
|
||||
}
|
||||
private static void ObjOnUnloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var obj = (FrameworkElement)sender;
|
||||
var w = GetParentScaleWindow(obj)!;
|
||||
w._cachedObjects.Remove(obj);
|
||||
obj.Unloaded -= ObjOnUnloaded;
|
||||
obj.Loaded -= ObjOnLoaded;
|
||||
}
|
||||
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
_currentDiagonal = _diagonal(e.NewSize.Width, e.NewSize.Height);
|
||||
foreach (var cached in _cachedObjects)
|
||||
{
|
||||
CalculateFontSizeResized(cached);
|
||||
}
|
||||
}
|
||||
//<-------------------Window-------------------->
|
||||
|
||||
|
||||
//<-------------------Scaling-------------------->
|
||||
|
||||
public static readonly DependencyProperty ScaleProperty = DependencyProperty.RegisterAttached(
|
||||
"Scale", typeof(double), typeof(FontScaleWindow), new FrameworkPropertyMetadata(0.9999d ,FrameworkPropertyMetadataOptions.Inherits, ScalePropertyCallback));
|
||||
|
||||
public static void SetScale(DependencyObject element, double value)
|
||||
=> element.SetValue(ScaleProperty, value);
|
||||
public static double GetScale(DependencyObject element)
|
||||
=> (double)element.GetValue(ScaleProperty);
|
||||
|
||||
|
||||
private static void ScalePropertyCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var window = GetParentScaleWindow(d);
|
||||
if (window == null)
|
||||
{
|
||||
var w = GetWindow(d);
|
||||
if (w is FontScaleWindow fsWindow)
|
||||
{
|
||||
SetParentScaleWindow(d, fsWindow);
|
||||
}
|
||||
}
|
||||
ResizeElement(d);
|
||||
}
|
||||
|
||||
public static void ResizeElement(DependencyObject d)
|
||||
{
|
||||
var set = d.ReadLocalValue(ScaleProperty) != DependencyProperty.UnsetValue;
|
||||
if (set)
|
||||
{
|
||||
if (GetResizeFont(d))
|
||||
{
|
||||
CalculateFontSizeResized(d);
|
||||
}
|
||||
else
|
||||
{
|
||||
CalculateFontSize(d);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public static void CalculateFontSize(DependencyObject d)
|
||||
{
|
||||
var window = GetParentScaleWindow(d);
|
||||
if (window == null) return;
|
||||
var fontSize = GetScale(d) * window._defaultDiagonal;
|
||||
d.SetValue(FontSizeProperty, fontSize);
|
||||
}
|
||||
|
||||
public static void CalculateFontSizeResized(DependencyObject d)
|
||||
{
|
||||
var window = GetParentScaleWindow(d);
|
||||
if (window == null) return;
|
||||
var windowsScale = Math.Pow(window._currentDiagonal / window._defaultDiagonal, window.ScaleCoefficient);
|
||||
var elScale = GetScale(d);
|
||||
var fontSize = window.DefaultFontSize * elScale * windowsScale;
|
||||
d.SetValue(FontSizeProperty, fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace LolzFucker.Theme
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для Palette.xaml
|
||||
/// </summary>
|
||||
public partial class Palette : UserControl
|
||||
{
|
||||
public Palette()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace NebulaAuth.Theme.WindowStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для WindowStyle.xaml
|
||||
/// </summary>
|
||||
partial class WindowStyle
|
||||
{
|
||||
public WindowStyle()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnCloseClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var window = (Window)((FrameworkElement)sender).TemplatedParent;
|
||||
|
||||
window.Close();
|
||||
}
|
||||
|
||||
private void OnMaximizeRestoreClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var window = (Window)((FrameworkElement)sender).TemplatedParent;
|
||||
|
||||
window.WindowState = window.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
|
||||
}
|
||||
|
||||
private void OnMinimizeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var window = (Window)((FrameworkElement)sender).TemplatedParent;
|
||||
|
||||
window.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 490 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 906 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 213 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 126 KiB |
@@ -1,97 +0,0 @@
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.Exceptions.General;
|
||||
using SteamLib.ProtoCore.Exceptions;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NebulaAuth.Utility;
|
||||
|
||||
public static class ExceptionHandler
|
||||
{
|
||||
private const string EXCEPTION_HANDLER_LOC_PATH = "ExceptionHandler";
|
||||
public static bool Handle(Exception ex, string? prefix = null, string? postfix = null, bool handleAllExceptions = false)
|
||||
{
|
||||
string msg;
|
||||
Shell.Logger.Error(ex);
|
||||
switch (ex)
|
||||
{
|
||||
case SessionExpiredException:
|
||||
{
|
||||
msg = "SessionExpiredException".GetCodeBehindLocalization();
|
||||
break;
|
||||
}
|
||||
case SessionInvalidException:
|
||||
{
|
||||
msg = "SessionExpiredException".GetCodeBehindLocalization();
|
||||
break;
|
||||
}
|
||||
case TaskCanceledException e:
|
||||
{
|
||||
msg = e.InnerException is TimeoutException
|
||||
? "TimeoutException".GetCodeBehindLocalization()
|
||||
: "TaskCanceledException".GetCodeBehindLocalization();
|
||||
break;
|
||||
}
|
||||
case HttpRequestException e:
|
||||
{
|
||||
var str = "RequestError".GetCommonLocalization() + ": ";
|
||||
if (e.StatusCode != null)
|
||||
{
|
||||
msg = str + e.StatusCode;
|
||||
}
|
||||
else if (e.InnerException != null)
|
||||
{
|
||||
msg = (str + e.InnerException.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = (str + e.Message);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case UnsupportedResponseException:
|
||||
{
|
||||
msg = "UnsupportedResponseException".GetCodeBehindLocalization();
|
||||
break;
|
||||
}
|
||||
case CantLoadConfirmationsException e:
|
||||
{
|
||||
msg = e.Message;
|
||||
break;
|
||||
}
|
||||
case EResultException e:
|
||||
{
|
||||
msg = "Error".GetCommonLocalization() + ": " + ErrorTranslatorHelper.TranslateEResult(e.Result);
|
||||
break;
|
||||
}
|
||||
case LoginException e:
|
||||
{
|
||||
msg = "LoginException".GetCodeBehindLocalization() + ": " + ErrorTranslatorHelper.TranslateLoginError(e.Error);
|
||||
break;
|
||||
}
|
||||
case not null when handleAllExceptions:
|
||||
{
|
||||
msg = "UnknownException".GetCodeBehindLocalization() + ex.Message;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
SnackbarController.SendSnackbar(prefix + msg + postfix);
|
||||
return true;
|
||||
}
|
||||
private static string GetCommonLocalization(this string key)
|
||||
{
|
||||
return LocManager.GetCommonOrDefault(key, key);
|
||||
}
|
||||
|
||||
private static string GetCodeBehindLocalization(this string key)
|
||||
{
|
||||
return LocManager.GetCodeBehindOrDefault(key, EXCEPTION_HANDLER_LOC_PATH, key);
|
||||
}
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:confirmations="clr-namespace:SteamLib.SteamMobile.Confirmations;assembly=SteamLibForked"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:theme="clr-namespace:NebulaAuth.Theme"
|
||||
xmlns:converters="clr-namespace:NebulaAuth.Converters"
|
||||
xmlns:entities="clr-namespace:NebulaAuth.Model.Entities"
|
||||
>
|
||||
|
||||
|
||||
<DataTemplate DataType="{x:Type confirmations:Confirmation}">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" DockPanel.Dock="Left" Kind="QuestionMark" Margin="0,0,10,0"/>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="1" Text="{Binding TypeName}"></TextBlock>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="2" HorizontalAlignment="Right" Text="{Binding Time, StringFormat=t}"/>
|
||||
<Button Margin="5,0,0,0" VerticalAlignment="Center" Grid.Column="3" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ConfirmCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Check"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="4" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CancelCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Close" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type confirmations:TradeConfirmation}">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<materialDesign:PackIcon VerticalAlignment="Center" Width="20" Height="20" Kind="AccountArrowRight" Margin="0,0,10,0"></materialDesign:PackIcon>
|
||||
<Image Grid.Column="1" VerticalAlignment="Center" DockPanel.Dock="Left" Width="24" Height="24" Source="{Binding UserAvatarUri}" Margin="0,0,10,0"></Image>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="2" TextWrapping="WrapWithOverflow" >
|
||||
<Run Text="{Tr MainWindow.ConfirmationTemplates.TradeWith, IsDynamic=False}"/>
|
||||
<Run Text="{Binding UserName}" FontWeight="Bold"></Run>
|
||||
</TextBlock>
|
||||
<materialDesign:PackIcon Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,0,5,0" Kind="Gift" Visibility="{Binding IsReceiveNothing, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="4" HorizontalAlignment="Right" Text="{Binding Time, StringFormat=t}"/>
|
||||
<Button Margin="5,0,0,0" VerticalAlignment="Center" Grid.Column="5" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ConfirmCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Check"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="6" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CancelCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Close" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type confirmations:AccountRecoveryConfirmation}">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" DockPanel.Dock="Left" Kind="LockOutline" Margin="0,0,10,0"/>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="1" Text="{Tr MainWindow.ConfirmationTemplates.Recovery}"/>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="2" HorizontalAlignment="Right" Text="{Binding Time, StringFormat=t}"/>
|
||||
<Button Margin="5,0,0,0" VerticalAlignment="Center" Grid.Column="3" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ConfirmCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Check"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="4" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CancelCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Close" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type confirmations:MarketConfirmation}">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<materialDesign:PackIcon VerticalAlignment="Center" Width="20" Height="20" Kind="ShoppingCart" Margin="0,0,10,0"></materialDesign:PackIcon>
|
||||
<Border Grid.Column="1" Background="{DynamicResource MaterialDesignPaper}" MaxHeight="36" HorizontalAlignment="Center" BorderBrush="{DynamicResource PrimaryHueMidBrush}" BorderThickness="0.6" Margin="0,0,10,0">
|
||||
<Image HorizontalAlignment="Center" VerticalAlignment="Center" MaxWidth="32" MaxHeight="32" Source="{Binding ItemImageUri}" ></Image>
|
||||
</Border>
|
||||
<Grid Grid.Column="2">
|
||||
<TextBlock VerticalAlignment="Center" x:Name="ItemName" theme:FontScaleWindow.ResizeFont="True" TextWrapping="WrapWithOverflow" Text="{Binding ItemName}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Foreground="LightGray" Text="{Binding PriceString}">
|
||||
<TextBlock.FontSize>
|
||||
<Binding ElementName="ItemName" Path="FontSize" ConverterParameter="0.7">
|
||||
<Binding.Converter>
|
||||
<converters:CoefficientConverter/>
|
||||
</Binding.Converter>
|
||||
</Binding>
|
||||
</TextBlock.FontSize>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="4" HorizontalAlignment="Left" Margin="5,0,0,0" Text="{Binding Time, StringFormat=t}"/>
|
||||
<Button Margin="5,0,0,0" VerticalAlignment="Center" Grid.Column="5" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ConfirmCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Check"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="6" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CancelCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Close" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type confirmations:RegisterApiKeyConfirmation}">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" DockPanel.Dock="Left" Kind="KeyLink" Margin="0,0,10,0"/>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="1" Text="{Tr MainWindow.ConfirmationTemplates.ApiKey}"></TextBlock>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="2" HorizontalAlignment="Right" Text="{Binding Time, StringFormat=t}"/>
|
||||
<Button Margin="5,0,0,0" VerticalAlignment="Center" Grid.Column="3" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ConfirmCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Check"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="4" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CancelCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Close" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type entities:MarketMultiConfirmation}">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<materialDesign:PackIcon VerticalAlignment="Center" Width="20" Height="20" Kind="ShoppingCartPlus" Margin="0,0,10,0"></materialDesign:PackIcon>
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="1">
|
||||
<Run Text="{Tr MainWindow.ConfirmationTemplates.Market, IsDynamic=False}"/>
|
||||
<Run Text="{Binding Confirmations.Count, Mode=OneWay}"/>
|
||||
<Run Text="{Tr Common.Abbreviations.Count.Items, IsDynamic=False}"/>
|
||||
</TextBlock>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Grid.Column="2" HorizontalAlignment="Left" Margin="5,0,0,0" Text="{Binding Time, StringFormat=t}"/>
|
||||
<Button Margin="5,0,0,0" VerticalAlignment="Center" Grid.Column="3" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ConfirmCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Check"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="4" Style="{StaticResource MaterialDesignIconButton}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CancelCommand}"
|
||||
CommandParameter="{Binding }">
|
||||
<materialDesign:PackIcon Kind="Close" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -1,46 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.Dialogs.ConfirmCancelDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:theme="clr-namespace:NebulaAuth.Theme"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="100" d:DesignWidth="400"
|
||||
Height="Auto" Width="Auto" MaxWidth="500"
|
||||
Background="{DynamicResource WindowBackground}">
|
||||
<Grid Margin="15">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock theme:FontScaleWindow.Scale="0.8"
|
||||
theme:FontScaleWindow.ResizeFont="True"
|
||||
HorizontalAlignment="Center" Margin="10,10,10,15"
|
||||
Text="Подтвердите действие"
|
||||
x:Name="ConfirmTextBlock"
|
||||
TextWrapping="WrapWithOverflow"/>
|
||||
<Grid Grid.Row="1" Margin="10,0,10,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button DockPanel.Dock="Left"
|
||||
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
|
||||
CommandParameter="{StaticResource True}"
|
||||
FontSize="{Binding ElementName=ConfirmTextBlock, Path=FontSize,
|
||||
Converter={StaticResource CoefficientConverter},
|
||||
ConverterParameter=0.85}">
|
||||
ОК
|
||||
</Button>
|
||||
<Button Grid.Column="1" DockPanel.Dock="Right"
|
||||
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
|
||||
CommandParameter="{StaticResource False}"
|
||||
FontSize="{Binding ElementName=ConfirmTextBlock, Path=FontSize,
|
||||
Converter={StaticResource CoefficientConverter},
|
||||
ConverterParameter=0.85}">
|
||||
Отмена
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace NebulaAuth.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для ConfirmCancelDialog.xaml
|
||||
/// </summary>
|
||||
public partial class ConfirmCancelDialog : UserControl
|
||||
{
|
||||
public ConfirmCancelDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ConfirmCancelDialog(string msg)
|
||||
{
|
||||
InitializeComponent();
|
||||
ConfirmTextBlock.Text = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.Dialogs.LoginAgainDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:theme="clr-namespace:NebulaAuth.Theme"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
|
||||
xmlns:model="clr-namespace:NebulaAuth.Model"
|
||||
xmlns:entities="clr-namespace:NebulaAuth.Model.Entities"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="250" d:DesignWidth="800"
|
||||
theme:FontScaleWindow.Scale="0.9" theme:FontScaleWindow.ResizeFont="True"
|
||||
Foreground="WhiteSmoke" Cursor="Hand"
|
||||
d:DataContext="{d:DesignInstance other:LoginAgainVM}"
|
||||
Background="{DynamicResource WindowBackground}">
|
||||
|
||||
<Grid MinHeight="100" MinWidth="300" Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock theme:FontScaleWindow.Scale="0.9" theme:FontScaleWindow.ResizeFont="True" Margin="10,0,0,0" HorizontalAlignment="Left">
|
||||
<Run Text="{Tr LoginAgainDialog.LoginFor, IsDynamic=False}"/>
|
||||
<Run FontWeight="Bold" Text="{Binding UserName}"/>
|
||||
</TextBlock>
|
||||
<TextBox Text="{Binding Password}" Margin="10,10,10,0" Grid.Row="1" Style="{StaticResource MaterialDesignFloatingHintTextBox}" materialDesign:HintAssist.Hint="{Tr LoginAgainDialog.PasswordBox}"></TextBox>
|
||||
<CheckBox Grid.Row="2" Margin="10,10,10,0" IsEnabled="{Binding Source={x:Static model:PHandler.IsPasswordSet}}" IsChecked="{Binding SavePassword}" Content="{Tr LoginAgainDialog.SaveEncryptedPassword}"/>
|
||||
<Grid Grid.Row="3" Margin="10,10,10,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button IsDefault="True" Margin="0,0,5,5" Style="{StaticResource MaterialDesignOutlinedButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="{StaticResource True}" Content="{Tr LoginAgainDialog.LoginButton}"/>
|
||||
<Button IsCancel="True" Grid.Column="1" Margin="5,0,0,5" Style="{StaticResource MaterialDesignOutlinedButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="{StaticResource False}" Content="{Tr LoginAgainDialog.CancelButton}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace NebulaAuth.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для LoginAgainDialog.xaml
|
||||
/// </summary>
|
||||
public partial class LoginAgainDialog : UserControl
|
||||
{
|
||||
public LoginAgainDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.Dialogs.LoginAgainOnImportDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:theme="clr-namespace:NebulaAuth.Theme"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
|
||||
xmlns:model="clr-namespace:NebulaAuth.Model"
|
||||
xmlns:entities="clr-namespace:NebulaAuth.Model.Entities"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="250" d:DesignWidth="800"
|
||||
theme:FontScaleWindow.Scale="0.9" theme:FontScaleWindow.ResizeFont="True"
|
||||
Foreground="WhiteSmoke" Cursor="Hand"
|
||||
d:DataContext="{d:DesignInstance other:LoginAgainOnImportVM}"
|
||||
Background="{DynamicResource WindowBackground}">
|
||||
|
||||
<Grid MinHeight="100" MinWidth="300" Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock theme:FontScaleWindow.Scale="0.9" theme:FontScaleWindow.ResizeFont="True" Margin="10,0,0,0" HorizontalAlignment="Left">
|
||||
<Run Text="{Tr LoginAgainDialog.LoginFor, IsDynamic=False}"/>
|
||||
<Run FontWeight="Bold" Text="{Binding UserName}"/>
|
||||
</TextBlock>
|
||||
<TextBox Text="{Binding Password}" Margin="10,10,10,0" Grid.Row="1" Style="{StaticResource MaterialDesignFloatingHintTextBox}" materialDesign:HintAssist.Hint="{Tr LoginAgainDialog.PasswordBox}"></TextBox>
|
||||
<ComboBox ToolTip="{Tr LoginAgainDialog.ProxyToolTip}" Grid.Row="2" Margin="10,18,10,0" materialDesign:HintAssist.Hint="{Tr Common.Proxy}" ItemsSource="{Binding Proxies}" SelectedItem="{Binding SelectedProxy}" >
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type entities:MaProxy}">
|
||||
<TextBlock Text="{Binding Converter={StaticResource ProxyTextConverter}, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
<UIElement.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding RemoveProxyCommand}" />
|
||||
</UIElement.InputBindings>
|
||||
</ComboBox>
|
||||
<CheckBox Grid.Row="3" Margin="10,10,10,0" IsEnabled="{Binding Source={x:Static model:PHandler.IsPasswordSet}}" IsChecked="{Binding SavePassword}" Content="{Tr LoginAgainDialog.SaveEncryptedPassword}"/>
|
||||
<CheckBox Grid.Row="4" Margin="10,10,10,0" IsEnabled="{Binding MafileHasProxy}" Content="{Tr LoginAgainDialog.UseMafileProxy}" IsChecked="{Binding UseMafileProxy}"/>
|
||||
<Grid Grid.Row="5" Margin="10,10,10,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button IsDefault="True" Margin="0,5,5,5" Style="{StaticResource MaterialDesignOutlinedButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="{StaticResource True}" Content="{Tr LoginAgainDialog.LoginButton}"/>
|
||||
<Button IsCancel="True" Grid.Column="1" Margin="5,5,0,5" Style="{StaticResource MaterialDesignOutlinedButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="{StaticResource False}" Content="{Tr LoginAgainDialog.CancelButton}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace NebulaAuth.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для LoginAgainDialog.xaml
|
||||
/// </summary>
|
||||
public partial class LoginAgainOnImportDialog
|
||||
{
|
||||
public LoginAgainOnImportDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.Dialogs.SetCryptPasswordDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:NebulaAuth.View.Dialogs"
|
||||
xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
|
||||
xmlns:theme="clr-namespace:NebulaAuth.Theme"
|
||||
xmlns:model="clr-namespace:NebulaAuth.Model"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d"
|
||||
Foreground="WhiteSmoke" Cursor="Hand"
|
||||
d:DataContext="{d:DesignInstance other:LoginAgainVM}"
|
||||
Background="{DynamicResource WindowBackground}">
|
||||
|
||||
<Grid MinHeight="100" MinWidth="300" MaxWidth="400" Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock IsHitTestVisible="False" TextWrapping="Wrap" FontWeight="Normal" Text="{Tr SetEncryptedPasswordDialog.DialogText}" theme:FontScaleWindow.Scale="0.8" theme:FontScaleWindow.ResizeFont="True" Margin="10,0,0,0" HorizontalAlignment="Left"/>
|
||||
<PasswordBox FontSize="16" materialDesign:PasswordBoxAssist.Password="{Binding Password}" Margin="10" Grid.Row="1" Style="{StaticResource MaterialDesignFloatingHintRevealPasswordBox}" materialDesign:HintAssist.Hint="{Tr SetEncryptedPasswordDialog.Password}"></PasswordBox>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Margin="10,5,5,5" Style="{StaticResource MaterialDesignOutlinedButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="{StaticResource True}" Content="{Tr SetEncryptedPasswordDialog.Ok}"/>
|
||||
<Button IsCancel="True" Grid.Column="1" Margin="5,5,10,5" Style="{StaticResource MaterialDesignOutlinedButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="{StaticResource False}" Content="{Tr SetEncryptedPasswordDialog.Cancel}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace NebulaAuth.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для SetCryptPasswordDialog.xaml
|
||||
/// </summary>
|
||||
public partial class SetCryptPasswordDialog : UserControl
|
||||
{
|
||||
public SetCryptPasswordDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.Dialogs.WaitLoginDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:theme="clr-namespace:NebulaAuth.Theme"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
theme:FontScaleWindow.ResizeFont="True" theme:FontScaleWindow.Scale="1"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="{DynamicResource WindowBackground}">
|
||||
<Grid Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}" IsIndeterminate="True"></ProgressBar>
|
||||
<TextBlock Margin="10,0,0,0" Grid.Column="1" Text="{Tr WaitLoginDialog.Text}" VerticalAlignment="Center"></TextBlock>
|
||||
</Grid>
|
||||
<Grid x:Name="CaptchaGrid" Margin="0,25,0,0" Visibility="Collapsed" Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image x:Name="CaptchaImage" Stretch="Uniform"></Image>
|
||||
<TextBox Grid.Row="1" Style="{StaticResource MaterialDesignFloatingHintTextBox}" x:Name="CaptchaTB"/>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Click="SendCaptchaBtn_Click">Отправить</Button>
|
||||
<Button Grid.Column="1" Click="CancelButton_OnClick">Отмена</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,72 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using SteamLib.Core.Interfaces;
|
||||
using SteamLib.Exceptions;
|
||||
|
||||
namespace NebulaAuth.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для WaitLoginDialog.xaml
|
||||
/// </summary>
|
||||
public partial class WaitLoginDialog : ICaptchaResolver
|
||||
{
|
||||
private TaskCompletionSource<string> _tcs = new();
|
||||
public WaitLoginDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public async Task<string> Resolve(Uri imageUrl, HttpClient client)
|
||||
{
|
||||
|
||||
CaptchaGrid.Visibility = Visibility.Visible;
|
||||
var stream = await client.GetStreamAsync(imageUrl);
|
||||
return await Application.Current.Dispatcher.Invoke(async () =>
|
||||
{
|
||||
var image = await LoadImage(stream);
|
||||
CaptchaImage.Source = image;
|
||||
try
|
||||
{
|
||||
return await _tcs.Task;
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
throw new LoginException(LoginError.CaptchaRequired);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async Task<BitmapImage> LoadImage(Stream stream)
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
await stream.CopyToAsync(ms);
|
||||
ms.Position = 0;
|
||||
|
||||
var image = new BitmapImage();
|
||||
|
||||
image.BeginInit();
|
||||
image.CacheOption = BitmapCacheOption.OnLoad;
|
||||
image.StreamSource = ms;
|
||||
image.EndInit();
|
||||
await stream.DisposeAsync();
|
||||
return image;
|
||||
}
|
||||
|
||||
private void CancelButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_tcs.SetCanceled();
|
||||
}
|
||||
|
||||
private void SendCaptchaBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(CaptchaTB.Text)) return;
|
||||
var oldTcs = _tcs;
|
||||
_tcs = new TaskCompletionSource<string>();
|
||||
oldTcs.SetResult(CaptchaTB.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.LinkerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:NebulaAuth.View"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Foreground="WhiteSmoke"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
MinHeight="640"
|
||||
MinWidth="400"
|
||||
Background="{DynamicResource WindowBackground}"
|
||||
d:DataContext="{d:DesignInstance other:LinkAccountVM}"
|
||||
FontSize="18">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource WindowBackground}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.Resources>
|
||||
<Style TargetType="materialDesign:PackIcon">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=StackPanel}, Path=Tag}" Value="False">
|
||||
<Setter Property="Foreground" Value="IndianRed"/>
|
||||
<Setter Property="Kind" Value="CheckBoxOutlineBlank"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=StackPanel}, Path=Tag}" Value="True">
|
||||
<Setter Property="Foreground" Value="Green"/>
|
||||
<Setter Property="Kind" Value="CheckBoxOutline"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=StackPanel}, Path=Tag}" Value="True">
|
||||
<Setter Property="Foreground" Value="Gray"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock FontStyle="Normal" Foreground="DarkGray" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Text="{Tr LinkerDialog.Title}"/>
|
||||
<Button Grid.Column="1" Width="30" Height="30" Style="{StaticResource MaterialDesignIconForegroundButton}" HorizontalAlignment="Right" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}">
|
||||
<materialDesign:PackIcon Kind="Close" Width="24" Height="24" Foreground="IndianRed"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Separator Background="DarkGray" Grid.Row="1"></Separator>
|
||||
<Grid Grid.Row="2" Margin="10,20,10,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox Padding="10" FontSize="16" Style="{StaticResource MaterialDesignOutlinedComboBox}" SelectedValue="{Binding SelectedProxy}" ItemsSource="{Binding Proxies}" materialDesign:HintAssist.Hint="{Tr LinkerDialog.Proxy}" IsEnabled="{Binding IsPasswordFieldVisible}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock>
|
||||
<Run Text="{Binding Key, Mode=OneWay}"/><Run Text=":"/>
|
||||
<Run Text="{Binding Value.Address, Mode=OneWay}"/>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Button Grid.Column="1" IsEnabled="{Binding IsPasswordFieldVisible}" Margin="5,0,0,0" Command="{Binding ResetProxyCommand}" Content="{materialDesign:PackIcon Trash}"/>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="3" Orientation="Horizontal" Margin="10" Tag="{Binding IsLogin}">
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Tr LinkerDialog.Authorization}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal" Margin="10" Tag="{Binding IsEmailCode}">
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Tr LinkerDialog.EmailCode}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="5" Orientation="Horizontal" Margin="10" Tag="{Binding IsPhoneNumber}">
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Tr LinkerDialog.PhoneNumber}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="6" Orientation="Horizontal" Margin="10" Tag="{Binding IsEmailConfirmation}">
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Tr LinkerDialog.EmailLink}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="7" Orientation="Horizontal" Margin="10" Tag="{Binding IsLinkCode}">
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Tr LinkerDialog.SmsOrCode}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="8" Orientation="Horizontal" Margin="10" Tag="{Binding IsCompleted}">
|
||||
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Tr LinkerDialog.Completed}"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="9" Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Padding="10" Text="{Binding FieldText}" Visibility="{Binding IsFieldVisible, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignOutlinedTextBox}" FontSize="16" Margin="0,0,0,10"></TextBox>
|
||||
<TextBox Grid.Row="1" Padding="10" Text="{Binding PassFieldText}" Visibility="{Binding IsPasswordFieldVisible, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignOutlinedTextBox}" FontSize="16"/>
|
||||
<GroupBox Grid.Row="2" MaxWidth="400" BorderBrush="{StaticResource PrimaryHueMidBrush}" VerticalAlignment="Bottom" BorderThickness="1" Margin="0,10,0,0" Padding="5">
|
||||
<GroupBox.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Tr LinkerDialog.Message}" FontSize="16" Foreground="GhostWhite"/>
|
||||
</DataTemplate>
|
||||
</GroupBox.HeaderTemplate>
|
||||
<TextBlock Foreground="GhostWhite" FontSize="16" Text="{Binding HintText}" HorizontalAlignment="Stretch" TextWrapping="Wrap"/>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
<Button Grid.Row="10" FontSize="18" Command="{Binding ProceedCommand}" Content="{Tr LinkerDialog.ProceedButton}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace NebulaAuth.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для LinkerView.xaml
|
||||
/// </summary>
|
||||
public partial class LinkerView : UserControl
|
||||
{
|
||||
public LinkerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.ProxyManagerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:NebulaAuth.View"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Foreground="WhiteSmoke"
|
||||
FontFamily="{md:MaterialDesignFont}"
|
||||
MinHeight="500"
|
||||
MinWidth="400"
|
||||
MaxHeight="550"
|
||||
d:DataContext="{d:DesignInstance other:ProxyManagerVM}"
|
||||
Background="{DynamicResource WindowBackground}">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource WindowBackground}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Margin="10" FontStyle="Normal" Foreground="DarkGray" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Text="{Tr ProxyManagerDialog.Title}"/>
|
||||
<Button Margin="0,0,10,0" IsCancel="True" Grid.Column="1" Width="30" Height="30" Style="{StaticResource MaterialDesignIconForegroundButton}" HorizontalAlignment="Right" Command="{x:Static md:DialogHost.CloseDialogCommand}">
|
||||
<md:PackIcon Kind="Close" Width="24" Height="24" Foreground="IndianRed"></md:PackIcon>
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
<Separator Grid.Row="1"></Separator>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock HorizontalAlignment="Stretch"
|
||||
Margin="15" FontSize="16">
|
||||
<Run Text="{Tr ProxyManagerDialog.DefaultProxy, IsDynamic=False}"/>
|
||||
<Run Text="{Binding DefaultProxy.Key, StringFormat='
0:', FallbackValue='X', Mode=OneWay}"/>
|
||||
<Run Text="{Binding DefaultProxy.Value, Converter='{StaticResource ProxyDataTextConverter}', Mode=OneWay, FallbackValue=''}"/>
|
||||
</TextBlock>
|
||||
|
||||
<Button Grid.Column="1" Command="{Binding SetDefaultCommand}">
|
||||
<md:PackIcon Kind="HeartBoxOutline" Width="20" Height="20"></md:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="2" Command="{Binding RemoveDefaultCommand}" Cursor="Hand">
|
||||
<md:PackIcon Kind="ClearBox" Width="20" Height="20"></md:PackIcon>
|
||||
</Button>
|
||||
</Grid>
|
||||
<md:Card Grid.Row="3" Margin="10">
|
||||
<ListBox FontSize="14" SelectedValue="{Binding SelectedProxy}" ItemsSource="{Binding Proxies}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MaterialDesignListBoxItem}">
|
||||
<Setter Property="Tag" Value="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext}"/>
|
||||
<Setter Property="ContextMenu">
|
||||
<Setter.Value>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{Tr MainWindow.ContextMenus.Proxy.Copy}"
|
||||
Command="{Binding PlacementTarget.Tag.CopyProxyCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding Value}"/>
|
||||
<MenuItem Header="{Tr MainWindow.ContextMenus.Proxy.CopyAddress}"
|
||||
Command="{Binding PlacementTarget.Tag.CopyProxyAddressCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding Value}"/>
|
||||
</ContextMenu>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock>
|
||||
<Run Text="{Binding Key, Mode=OneWay}"/><Run Text=": "/>
|
||||
<Run Text="{Binding Value, Mode=OneWay, Converter={StaticResource ProxyDataTextConverter}}"/>
|
||||
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</md:Card>
|
||||
<Grid Grid.Row="4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Text="{Binding AddProxyField}" FontSize="12" md:TextFieldAssist.HasClearButton="True" AcceptsReturn="True" MaxHeight="100" Style="{StaticResource MaterialDesignOutlinedTextBox}" Margin="15" md:HintAssist.Hint="IP:PORT:USER:PASS{ID}"></TextBox>
|
||||
<Button IsDefault="True" Grid.Column="1" Command="{Binding AddProxyCommand}">
|
||||
<md:PackIcon Kind="Add"></md:PackIcon>
|
||||
</Button>
|
||||
<Button Grid.Column="2" Command="{Binding RemoveProxyCommand}">
|
||||
<md:PackIcon Kind="Trash"></md:PackIcon>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace NebulaAuth.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для ProxyManagerView.xaml
|
||||
/// </summary>
|
||||
public partial class ProxyManagerView : UserControl
|
||||
{
|
||||
public ProxyManagerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.SettingsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="700"
|
||||
Foreground="WhiteSmoke"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
MinHeight="300"
|
||||
MinWidth="400"
|
||||
|
||||
MaxWidth="200"
|
||||
d:DataContext="{d:DesignInstance other:SettingsVM}"
|
||||
Background="{DynamicResource WindowBackground}">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource WindowBackground}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<Grid>
|
||||
<Grid Margin="15,10,15,15">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock FontStyle="Normal" Foreground="DarkGray" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Text="{Tr SettingsDialog.Title}"/>
|
||||
<Button IsCancel="True" Grid.Column="1" Width="30" Height="30" Style="{StaticResource MaterialDesignIconForegroundButton}" HorizontalAlignment="Right" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}">
|
||||
<materialDesign:PackIcon Kind="Close" Width="24" Height="24" Foreground="IndianRed"></materialDesign:PackIcon>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Separator Grid.Row="1" Margin="0,10,0,0" />
|
||||
|
||||
<StackPanel Grid.Row="2" Margin="10,30,10,10" Orientation="Vertical" HorizontalAlignment="Center">
|
||||
<ComboBox Style="{StaticResource MaterialDesignOutlinedComboBox}" FontSize="16" ItemsSource="{Binding BackgroundModes}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding BackgroundMode}" materialDesign:HintAssist.Hint="{Tr SettingsDialog.BackgroundHint}" ></ComboBox>
|
||||
<ComboBox Style="{StaticResource MaterialDesignFloatingHintComboBox}" Margin="0,20,0,0" FontSize="16" ItemsSource="{Binding Languages}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding Language}" materialDesign:HintAssist.Hint="{Tr LanguageWord}" ></ComboBox>
|
||||
<CheckBox Margin="0,20,0,0" FontSize="16" IsChecked="{Binding DisableTimersOnChange}" Content="{Tr SettingsDialog.DisableTimersOnSwitch}"/>
|
||||
<CheckBox Margin="0,10,0,0" FontSize="16" IsChecked="{Binding HideToTray}" Content="{Tr SettingsDialog.MinimizeToTray}"/>
|
||||
<CheckBox Margin="0,10,0,0" FontSize="16" IsChecked="{Binding UseIcon}" Content="{Tr SettingsDialog.UseIndicator}"/>
|
||||
<materialDesign:ColorPicker IsEnabled="{Binding UseIcon}" Color="{Binding IconColor, Delay=50}" />
|
||||
<CheckBox Margin="0,10,0,5" FontSize="16" IsChecked="{Binding UseBackground}" Content="{Tr SettingsDialog.UseCustomColor}"/>
|
||||
|
||||
<materialDesign:ColorPicker Height="100" IsEnabled="{Binding UseBackground}" Color="{Binding BackgroundColor, Delay=50}" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<PasswordBox MinWidth="250" materialDesign:PasswordBoxAssist.Password="{Binding Password}" Height="Auto" VerticalAlignment="Center" FontSize="16" Margin="0,10,0,0"
|
||||
Style="{StaticResource MaterialDesignFloatingHintRevealPasswordBox}"
|
||||
materialDesign:HintAssist.Hint="{Tr SettingsDialog.PasswordBox.CurrentCryptPassword}"
|
||||
materialDesign:HintAssist.HelperText="{Tr SettingsDialog.PasswordBox.Hint}"></PasswordBox>
|
||||
<Button Command="{Binding SetPasswordCommand}" Margin="5,0,0,0" VerticalAlignment="Bottom" Grid.Column="1"> <materialDesign:PackIcon Kind="ContentSave"/></Button>
|
||||
</Grid>
|
||||
<CheckBox Margin="0,20,0,0" FontSize="16" IsChecked="{Binding LegacyMode}" Content="{Tr SettingsDialog.LegacyMafileMode}" ToolTip="{Tr SettingsDialog.LegacyMafileModeHint}"/>
|
||||
<CheckBox Margin="0,10,0,0" FontSize="16" IsChecked="{Binding AllowAutoUpdate}" Content="{Tr SettingsDialog.AllowAutoUpdate}"/>
|
||||
<CheckBox Margin="0,10,0,0" FontSize="16" IsChecked="{Binding UseAccountNameAsMafileName}" >
|
||||
<TextBlock TextWrapping="WrapWithOverflow" Text="{Tr SettingsDialog.UseAccountName}" />
|
||||
</CheckBox>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace NebulaAuth.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для SettingsView.xaml
|
||||
/// </summary>
|
||||
public partial class SettingsView : UserControl
|
||||
{
|
||||
public SettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ColorPicker_OnColorChanged(object sender, RoutedPropertyChangedEventArgs<Color> e)
|
||||
{
|
||||
Debug.WriteLine(e.NewValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
<UserControl x:Class="NebulaAuth.View.UpdaterView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:NebulaAuth.View"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
|
||||
xmlns:wpf="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="700"
|
||||
d:DesignWidth="500"
|
||||
Foreground="WhiteSmoke"
|
||||
FontFamily="{materialDesign:MaterialDesignFont}"
|
||||
d:DataContext="{d:DesignInstance other:UpdaterVM}"
|
||||
Background="{DynamicResource WindowBackground}"
|
||||
Padding="10"
|
||||
MaxWidth="500">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource WindowBackground}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock FontSize="24" Text="Обновления"/>
|
||||
<Separator Grid.Row="1"></Separator>
|
||||
|
||||
<TextBlock FontSize="16" Margin="5,10,0,10" TextWrapping="WrapWithOverflow" Grid.Row="2" >
|
||||
<Run Text="Доступна новая версия:"/>
|
||||
<Run FontWeight="Bold" Text="{Binding UpdateInfoEventArgs.CurrentVersion}"/>
|
||||
<Run Text="
Вы используете версию"/>
|
||||
<Run FontWeight="Bold" Text="{Binding UpdateInfoEventArgs.InstalledVersion}"/>
|
||||
<Run Text="Хотите обновить программу?"/>
|
||||
</TextBlock>
|
||||
<Expander Header="Что изменилось?" Grid.Row="3">
|
||||
<!--<wpf:WebView2 HorizontalAlignment="Stretch" Height="300"
|
||||
Source="{Binding UpdateInfoEventArgs.ChangelogURL}"
|
||||
/>-->
|
||||
</Expander>
|
||||
<Grid Grid.Row="4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="OK" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" />
|
||||
<Button IsCancel="True" Grid.Column="1" Content="Cancel" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" />
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace NebulaAuth.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для UpdaterView.xaml
|
||||
/// </summary>
|
||||
public partial class UpdaterView : UserControl
|
||||
{
|
||||
public UpdaterView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using SteamLib.SteamMobile;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace NebulaAuth.ViewModel;
|
||||
|
||||
public partial class MainVM
|
||||
{
|
||||
private Timer _codeTimer;
|
||||
[ObservableProperty] private double _codeProgress;
|
||||
[ObservableProperty] private string _code;
|
||||
|
||||
|
||||
[MemberNotNull(nameof(_codeTimer))]
|
||||
[MemberNotNull(nameof(_code))]
|
||||
private void CreateCodeTimer()
|
||||
{
|
||||
var currentTime = TimeAligner.GetSteamTime();
|
||||
_codeTimer = new Timer(UpdateCode, null, 0, 1000);
|
||||
}
|
||||
|
||||
private void UpdateCode(object? state = null)
|
||||
{
|
||||
var currentTime = TimeAligner.GetSteamTime();
|
||||
var untilChange = currentTime - currentTime / 30L * 30L;
|
||||
var codeProgress = untilChange / 30D * 100;
|
||||
|
||||
string? code = null;
|
||||
if (untilChange == 0 && SelectedMafile != null)
|
||||
{
|
||||
code = SteamGuardCodeGenerator.GenerateCode(SelectedMafile!.SharedSecret);
|
||||
}
|
||||
|
||||
if(Application.Current == null) return;
|
||||
Application.Current.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
CodeProgress = codeProgress;
|
||||
if (code != null) Code = code;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,241 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Microsoft.Win32;
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.View;
|
||||
using NebulaAuth.ViewModel.Other;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using AchiesUtilities.Extensions;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using SteamLib.Exceptions;
|
||||
using NebulaAuth.Utility;
|
||||
using NebulaAuth.View.Dialogs;
|
||||
|
||||
namespace NebulaAuth.ViewModel;
|
||||
|
||||
public partial class MainVM //File //TODO: Refactor
|
||||
{
|
||||
|
||||
public Settings Settings => Settings.Instance;
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenMafileFolder()
|
||||
{
|
||||
var mafile = SelectedMafile;
|
||||
|
||||
var path = Storage.MafileFolder;
|
||||
string? mafilePath = null;
|
||||
if (mafile != null)
|
||||
{
|
||||
mafilePath = Storage.TryFindMafilePath(mafile);
|
||||
}
|
||||
if (mafilePath != null)
|
||||
{
|
||||
path = $"/select, \"{mafilePath}\""; ;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var processStartInfo = new ProcessStartInfo("explorer.exe", path);
|
||||
Process.Start(processStartInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SnackbarController.SendSnackbar(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private Task AddMafile()
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Filter = "Mafile|*.mafile;*.maFile",
|
||||
Multiselect = false,
|
||||
|
||||
};
|
||||
var fs = openFileDialog.ShowDialog();
|
||||
if (fs != true) return Task.CompletedTask;
|
||||
var path = openFileDialog.FileName;
|
||||
return AddMafile(new[] { path });
|
||||
|
||||
}
|
||||
public async Task AddMafile(string[] path)
|
||||
{
|
||||
bool? confirmOverwrite = null;
|
||||
var added = 0;
|
||||
var notAdded = 0;
|
||||
var errors = 0;
|
||||
foreach (var str in path)
|
||||
{
|
||||
try
|
||||
{
|
||||
Storage.AddNewMafile(str, confirmOverwrite ?? false);
|
||||
added++;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
errors++;
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
confirmOverwrite ??= await DialogsController.ShowConfirmCancelDialog(GetLocalizationOrDefault("ConfirmMafileOverwrite"));
|
||||
|
||||
if (confirmOverwrite == true)
|
||||
{
|
||||
Storage.AddNewMafile(str, true);
|
||||
added++;
|
||||
}
|
||||
else if (confirmOverwrite == false)
|
||||
{
|
||||
notAdded++;
|
||||
}
|
||||
}
|
||||
catch (SessionInvalidException ex)
|
||||
{
|
||||
if (path.Length == 1 && ex.Data.Contains("mafile"))
|
||||
{
|
||||
var mafile = (Mafile)ex.Data["mafile"]!;
|
||||
if (await HandleAddMafileWithoutSession(mafile))
|
||||
{
|
||||
added++;
|
||||
}
|
||||
else
|
||||
{
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SnackbarController.SendSnackbar($"{GetLocalizationOrDefault("MafileImportError")} {Path.GetFileName(str)}{GetLocalizationOrDefault("MissingSessionInMafile")}", TimeSpan.FromSeconds(4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var msg = GetLocalizationOrDefault("Import");
|
||||
if (added > 0)
|
||||
{
|
||||
msg += $" {GetLocalizationOrDefault("ImportAdded")} {added}.";
|
||||
}
|
||||
if (notAdded > 0)
|
||||
{
|
||||
msg += $" {GetLocalizationOrDefault("ImportSkipped")} {notAdded}.";
|
||||
}
|
||||
|
||||
if (errors > 0)
|
||||
{
|
||||
msg += $" {GetLocalizationOrDefault("ImportErrors")} {errors}.";
|
||||
}
|
||||
SnackbarController.SendSnackbar(msg, TimeSpan.FromSeconds(2));
|
||||
}
|
||||
|
||||
private async Task<bool> HandleAddMafileWithoutSession(Mafile data)
|
||||
{
|
||||
var loginAgainVm = await DialogsController.ShowLoginAgainOnImportDialog(data, Proxies);
|
||||
if (loginAgainVm == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var password = loginAgainVm.Password;
|
||||
if (!loginAgainVm.UseMafileProxy)
|
||||
{
|
||||
data.Proxy = loginAgainVm.SelectedProxy;
|
||||
}
|
||||
var waitDialog = new WaitLoginDialog();
|
||||
var wait = DialogHost.Show(waitDialog);
|
||||
try
|
||||
{
|
||||
await MaClient.LoginAgain(data, password, loginAgainVm.SavePassword, waitDialog);
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("SuccessfulLogin"));
|
||||
}
|
||||
catch (LoginException ex)
|
||||
{
|
||||
SnackbarController.SendSnackbar(ErrorTranslatorHelper.TranslateLoginError(ex.Error), TimeSpan.FromSeconds(1.5));
|
||||
}
|
||||
catch (Exception ex)
|
||||
when (ExceptionHandler.Handle(ex))
|
||||
{
|
||||
Shell.Logger.Error(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DialogsController.CloseDialog();
|
||||
await wait;
|
||||
}
|
||||
var result = data.SessionData != null;
|
||||
if (!result) return result;
|
||||
Storage.SaveMafile(data);
|
||||
{
|
||||
ResetQuery();
|
||||
SearchText = data.AccountName ?? string.Empty;
|
||||
SelectedMafile = data;
|
||||
} //As this operation used only for 1 mafile at time, we can safely assume that we can select it for convenience
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task RemoveMafile()
|
||||
{
|
||||
if (SelectedMafile == null) return;
|
||||
var confirm =
|
||||
await DialogsController.ShowConfirmCancelDialog(GetLocalizationOrDefault("RemoveMafileConfirmation"));
|
||||
|
||||
if (!confirm) return;
|
||||
try
|
||||
{
|
||||
Storage.MoveToRemoved(SelectedMafile);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("CantRemoveAlreadyExist"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SnackbarController.SendSnackbar(
|
||||
$"{GetLocalizationOrDefault("CantRemoveMafile")} {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task OpenSettingsDialog()
|
||||
{
|
||||
var vm = new SettingsVM();
|
||||
var view = new SettingsView()
|
||||
{
|
||||
DataContext = vm
|
||||
};
|
||||
await DialogHost.Show(view);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task CopyMafileFromBuffer()
|
||||
{
|
||||
StringCollection files;
|
||||
try
|
||||
{
|
||||
files = Clipboard.GetFileDropList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Shell.Logger.Error(ex);
|
||||
return;
|
||||
}
|
||||
|
||||
var arr = files.Cast<string>().ToArray();
|
||||
if (arr.All(p => p.ContainsIgnoreCase("mafile") == false)) return;
|
||||
|
||||
|
||||
|
||||
await AddMafile(arr);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using NebulaAuth.Core;
|
||||
|
||||
namespace NebulaAuth.ViewModel;
|
||||
|
||||
public partial class MainVM
|
||||
{
|
||||
private const string LOC_PATH = "MainVM";
|
||||
private static string? GetLocalization(string key)
|
||||
{
|
||||
return LocManager.GetCodeBehind(LOC_PATH, key);
|
||||
}
|
||||
|
||||
private static string GetLocalizationOrDefault(string key)
|
||||
{
|
||||
return LocManager.GetCodeBehindOrDefault(key, LOC_PATH, key);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using NebulaAuth.View.Dialogs;
|
||||
|
||||
namespace NebulaAuth.ViewModel;
|
||||
|
||||
public partial class MainVM //Other
|
||||
{
|
||||
private void SessionHandlerOnLoginCompleted(object? sender, EventArgs e)
|
||||
{
|
||||
var currentSession = DialogHost.GetDialogSession(null);
|
||||
Application.Current.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (currentSession is { Content: WaitLoginDialog, IsEnded: false })
|
||||
{
|
||||
try
|
||||
{
|
||||
currentSession.Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
//Ignored
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async void SessionHandlerOnLoginStarted(object? sender, EventArgs e)
|
||||
{
|
||||
if (DialogHost.IsDialogOpen(null)) return;
|
||||
await Application.Current.Dispatcher.BeginInvoke(async () =>
|
||||
{
|
||||
await DialogHost.Show(new WaitLoginDialog());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NebulaAuth.Model.Comparers;
|
||||
|
||||
namespace NebulaAuth.ViewModel;
|
||||
|
||||
public partial class MainVM
|
||||
{
|
||||
public ObservableCollection<MaProxy> Proxies { get; }
|
||||
|
||||
public MaProxy? SelectedProxy
|
||||
{
|
||||
get => _selectedProxy;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _selectedProxy, value))
|
||||
{
|
||||
OnPropertyChanged(nameof(IsDefaultProxy));
|
||||
OnProxyChanged();
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
private MaProxy? _selectedProxy;
|
||||
|
||||
[ObservableProperty] private bool _proxyExist = true;
|
||||
public bool IsDefaultProxy => SelectedProxy == null && MaClient.DefaultProxy != null;
|
||||
private bool _handleProxyChange;
|
||||
|
||||
private void SetCurrentProxy()
|
||||
{
|
||||
if (ReferenceEquals(_selectedProxy, SelectedMafile?.Proxy) == false && _selectedProxy?.Equals(SelectedMafile?.Proxy) == false)
|
||||
_handleProxyChange = true;
|
||||
|
||||
if (SelectedMafile == null)
|
||||
{
|
||||
SelectedProxy = null;
|
||||
return;
|
||||
}
|
||||
if (SelectedMafile.Proxy == null)
|
||||
{
|
||||
SelectedProxy = SelectedMafile.Proxy;
|
||||
}
|
||||
else
|
||||
{
|
||||
var existed = Proxies.FirstOrDefault(p => p.Id == SelectedMafile.Proxy.Id);
|
||||
|
||||
|
||||
if (existed == null || ProxyDataComparer.Equal(existed.Data, SelectedMafile.Proxy.Data) == false)
|
||||
{
|
||||
SelectedProxy = SelectedMafile.Proxy;
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedProxy = existed;
|
||||
}
|
||||
}
|
||||
|
||||
CheckProxyExist();
|
||||
|
||||
}
|
||||
|
||||
private void CheckProxyExist()
|
||||
{
|
||||
if (SelectedProxy == null)
|
||||
{
|
||||
ProxyExist = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedId = SelectedProxy.Id;
|
||||
ProxyExist = ProxyStorage.Proxies.TryGetValue(selectedId, out var existedProxy)
|
||||
&& ProxyStorage.CompareProxy(SelectedProxy.Data, existedProxy);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task OpenProxyManager()
|
||||
{
|
||||
await DialogsController.ShowProxyManager(SelectedProxy);
|
||||
var oldSelection = SelectedProxy;
|
||||
Proxies.Clear();
|
||||
foreach (var kvp in ProxyStorage.Proxies)
|
||||
{
|
||||
Proxies.Add(new MaProxy(kvp.Key, kvp.Value));
|
||||
}
|
||||
SelectedProxy = oldSelection;
|
||||
SetCurrentProxy();
|
||||
OnPropertyChanged(nameof(IsDefaultProxy));
|
||||
_handleProxyChange = false;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void RemoveProxy()
|
||||
{
|
||||
if(SelectedProxy == null) return;
|
||||
if (SelectedMafile == null) return;
|
||||
if (!ValidateCanSaveAndWarn(SelectedMafile)) return;
|
||||
SelectedMafile.Proxy = null;
|
||||
SelectedProxy = null;
|
||||
Storage.UpdateMafile(SelectedMafile);
|
||||
ProxyExist = true;
|
||||
}
|
||||
|
||||
private void OnProxyChanged()
|
||||
{
|
||||
if (_handleProxyChange)
|
||||
{
|
||||
_handleProxyChange = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (SelectedMafile == null) return;
|
||||
if (!ValidateCanSaveAndWarn(SelectedMafile)) return;
|
||||
ProxyExist = true;
|
||||
SelectedMafile.Proxy = SelectedProxy;
|
||||
Storage.UpdateMafile(SelectedMafile);
|
||||
}
|
||||
|
||||
private bool ValidateCanSaveAndWarn(Mafile data)
|
||||
{
|
||||
var canSave = Storage.ValidateCanSave(data);
|
||||
if (!canSave)
|
||||
{
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("CantRetrieveSteamIDToUpdate"));
|
||||
}
|
||||
return canSave;
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using NebulaAuth.Utility;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.SteamMobile.Confirmations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace NebulaAuth.ViewModel;
|
||||
|
||||
public partial class MainVM //Timer
|
||||
{
|
||||
private readonly Timer _confirmTimer;
|
||||
[ObservableProperty] private bool _marketTimerEnabled;
|
||||
[ObservableProperty] private bool _tradeTimerEnabled;
|
||||
private int _timerCheckSeconds = Settings.Instance.TimerSeconds;
|
||||
public int TimerCheckSeconds
|
||||
{
|
||||
get => _timerCheckSeconds;
|
||||
set => SetTimer(value);
|
||||
}
|
||||
|
||||
|
||||
private async void ConfirmByTimer(object? state = null)
|
||||
{
|
||||
if (SelectedMafile == null)
|
||||
return;
|
||||
var selected = SelectedMafile;
|
||||
if (InterruptTimer(selected, null)) return;
|
||||
List<Confirmation> conf;
|
||||
try
|
||||
{
|
||||
conf = (await HandleTimerRequest(() => MaClient.GetConfirmations(selected), SelectedMafile)).ToList();
|
||||
}
|
||||
catch (ApplicationException ex)
|
||||
{
|
||||
Shell.Logger.Warn(ex, "Error GetConf in timer.");
|
||||
return;
|
||||
}
|
||||
if (InterruptTimer(selected, conf)) return;
|
||||
var toConfirm = new List<Confirmation>();
|
||||
if (MarketTimerEnabled)
|
||||
{
|
||||
var market = conf.Where(c => c.ConfType == ConfirmationType.MarketSellTransaction);
|
||||
toConfirm.AddRange(market);
|
||||
}
|
||||
if (TradeTimerEnabled)
|
||||
{
|
||||
var trade = conf.Where(c => c.ConfType == ConfirmationType.Trade);
|
||||
toConfirm.AddRange(trade);
|
||||
}
|
||||
if (InterruptTimer(selected, toConfirm)) return;
|
||||
bool result;
|
||||
try
|
||||
{
|
||||
Shell.Logger.Debug("Sending confirmations. Count: {count}", toConfirm.Count);
|
||||
result = await HandleTimerRequest(() => MaClient.SendMultipleConfirmation(SelectedMafile, toConfirm, confirm: true), SelectedMafile);
|
||||
}
|
||||
catch (ApplicationException ex)
|
||||
{
|
||||
Shell.Logger.Warn(ex, "MultiConf error in Timer.");
|
||||
return;
|
||||
}
|
||||
SnackbarController.SendSnackbar(result ? $"{GetLocalizationOrDefault("TimerConfirmed")} {toConfirm.Count}" : GetLocalizationOrDefault("TimerNotConfirmed"));
|
||||
}
|
||||
|
||||
private bool InterruptTimer(Mafile cachedValue, List<Confirmation>? confirmations)
|
||||
{
|
||||
return SelectedMafile == null
|
||||
|| (MarketTimerEnabled || TradeTimerEnabled) == false
|
||||
|| SelectedMafile != cachedValue
|
||||
|| confirmations is { Count: 0 };
|
||||
|
||||
}
|
||||
|
||||
private void OffTimer(bool dispatcher)
|
||||
{
|
||||
if (dispatcher)
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(OffTimerInline));
|
||||
}
|
||||
else
|
||||
{
|
||||
OffTimerInline();
|
||||
}
|
||||
return;
|
||||
|
||||
void OffTimerInline()
|
||||
{
|
||||
MarketTimerEnabled = false;
|
||||
TradeTimerEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<T> HandleTimerRequest<T>(Func<Task<T>> func, Mafile mafile)
|
||||
{
|
||||
Exception innerException;
|
||||
try
|
||||
{
|
||||
return await SessionHandler.Handle(func, mafile);
|
||||
}
|
||||
catch (SessionInvalidException ex)
|
||||
{
|
||||
Shell.Logger.Warn("Session error while requesting in timer. Timer disabled");
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("TimerSessionError"));
|
||||
OffTimer(dispatcher: true);
|
||||
innerException = ex;
|
||||
}
|
||||
catch (Exception ex) when (ExceptionHandler.Handle(ex, GetLocalizationOrDefault("TimerPrefix")))
|
||||
{
|
||||
innerException = ex;
|
||||
}
|
||||
throw new ApplicationException("Swallowed", innerException);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void SetTimer(int value)
|
||||
{
|
||||
if (_timerCheckSeconds == value) return;
|
||||
if (value < 10)
|
||||
{
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("TimerTooFast"));
|
||||
OnPropertyChanged(nameof(TimerCheckSeconds));
|
||||
return;
|
||||
}
|
||||
|
||||
Settings.TimerSeconds = value;
|
||||
_timerCheckSeconds = value;
|
||||
OnPropertyChanged(nameof(TimerCheckSeconds));
|
||||
_confirmTimer.Change(value * 1000, value * 1000);
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("TimerChanged"));
|
||||
}
|
||||
}
|
||||
@@ -1,418 +0,0 @@
|
||||
using AchiesUtilities.Collections;
|
||||
using AchiesUtilities.Web.Proxy;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.Model.Entities;
|
||||
using NebulaAuth.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using SteamLib;
|
||||
using SteamLib.Account;
|
||||
using SteamLib.Authentication;
|
||||
using SteamLib.Authentication.LoginV2;
|
||||
using SteamLib.Core.Interfaces;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.Exceptions.Mobile;
|
||||
using SteamLib.ProtoCore.Exceptions;
|
||||
using SteamLib.SteamMobile.AuthenticatorLinker;
|
||||
using SteamLib.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using NebulaAuth.Core;
|
||||
using SteamLib.Utility.MaFiles;
|
||||
|
||||
namespace NebulaAuth.ViewModel.Other;
|
||||
|
||||
public partial class LinkAccountVM : ObservableObject, IEmailProvider, IPhoneNumberProvider, ISmsCodeProvider
|
||||
{
|
||||
private const string LOCALIZATION_KEY = "LinkVM";
|
||||
private static Logger Logger => Shell.Logger;
|
||||
private static Microsoft.Extensions.Logging.ILogger Logger2 => Shell.ExtensionsLogger;
|
||||
#region Properties
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(IsPasswordFieldVisible))]
|
||||
private bool _isLogin;
|
||||
|
||||
|
||||
[ObservableProperty] private bool _isEmailCode;
|
||||
[ObservableProperty] private bool _isPhoneNumber;
|
||||
[ObservableProperty] private bool _isEmailConfirmation;
|
||||
[ObservableProperty] private bool _isLinkCode;
|
||||
[ObservableProperty] private bool _isCompleted;
|
||||
|
||||
[ObservableProperty] private bool _isFieldVisible = true;
|
||||
|
||||
|
||||
|
||||
[ObservableProperty] private string _fieldText;
|
||||
[ObservableProperty] private string _passFieldText;
|
||||
[ObservableProperty] private string _hintText = GetLocalizationOrDefault("EnterLoginAndPassword");
|
||||
|
||||
private TaskCompletionSource<string> _emailCodeTcs = new();
|
||||
private TaskCompletionSource<long?> _phoneNumberTcs = new();
|
||||
private TaskCompletionSource _emailConfTcs = new();
|
||||
private TaskCompletionSource<string> _linkCodeTcs = new();
|
||||
|
||||
private bool isLinkStarted;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ProceedCommand))]
|
||||
private bool _canProceed = true;
|
||||
public bool IsPasswordFieldVisible => !IsLogin;
|
||||
|
||||
private LoginV2ExecutorOptions _loginV2ExecutorOptions;
|
||||
private SteamAuthenticatorLinker _linker;
|
||||
private MobileSessionData _sessionData;
|
||||
|
||||
#endregion
|
||||
|
||||
#region HttpClient
|
||||
|
||||
private static HttpClient Client { get; }
|
||||
private static HttpClientHandler Handler { get; }
|
||||
private static DynamicProxy Proxy { get; }
|
||||
public ObservableDictionary<int, ProxyData> Proxies => ProxyStorage.Proxies;
|
||||
|
||||
public KeyValuePair<int, ProxyData>? SelectedProxy
|
||||
{
|
||||
get => _selectedProxy;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectedProxy, value);
|
||||
SetProxy();
|
||||
}
|
||||
}
|
||||
private KeyValuePair<int, ProxyData>? _selectedProxy;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
public LinkAccountVM()
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
{
|
||||
if (MaClient.DefaultProxy != null)
|
||||
{
|
||||
var def = Proxies.FirstOrDefault(p => p.Value.Equals(MaClient.DefaultProxy));
|
||||
if (def.Value != null!)
|
||||
{
|
||||
SelectedProxy = def;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand(AllowConcurrentExecutions = true, CanExecute = nameof(CanProceed))]
|
||||
public async Task Proceed()
|
||||
{
|
||||
if (IsCompleted)
|
||||
DialogHost.Close(null);
|
||||
|
||||
CanProceed = false;
|
||||
|
||||
#region Login
|
||||
|
||||
if (IsLogin == false)
|
||||
{
|
||||
SetProxy();
|
||||
ClearCookies();
|
||||
_loginV2ExecutorOptions = new LoginV2ExecutorOptions(LoginV2Executor.NullConsumer, Client)
|
||||
{
|
||||
DeviceDetails = LoginV2ExecutorOptions.GetMobileDefaultDevice(),
|
||||
WebsiteId = "Mobile",
|
||||
EmailAuthProvider = this,
|
||||
Logger = Logger2
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
IsLogin = true;
|
||||
var userName = FieldText;
|
||||
var pass = PassFieldText;
|
||||
FieldText = string.Empty;
|
||||
IsFieldVisible = false;
|
||||
HintText = string.Empty;
|
||||
_sessionData = (MobileSessionData)await LoginV2Executor.DoLogin(_loginV2ExecutorOptions, userName, pass);
|
||||
Handler.CookieContainer.SetSteamMobileCookiesWithMobileToken(_sessionData);
|
||||
IsEmailCode = true;
|
||||
}
|
||||
catch (EResultException ex)
|
||||
{
|
||||
Logger.Error(ex, "Link exception on login");
|
||||
HintText = GetLocalizationOrDefault("CantLogin") + ErrorTranslatorHelper.TranslateEResult(ex.Result);
|
||||
InvokeOnDispatcher(ResetState);
|
||||
return;
|
||||
}
|
||||
catch (LoginException ex)
|
||||
{
|
||||
Logger.Error(ex, "Link exception on login");
|
||||
HintText = GetLocalizationOrDefault("CantLogin") + ErrorTranslatorHelper.TranslateLoginError(ex.Error);
|
||||
InvokeOnDispatcher(ResetState);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, "Link exception on login");
|
||||
HintText = GetLocalizationOrDefault("CantLogin") + ex.Message;
|
||||
InvokeOnDispatcher(ResetState);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (IsEmailCode == false)
|
||||
{
|
||||
_emailCodeTcs.SetResult(FieldText);
|
||||
HintText = string.Empty;
|
||||
FieldText = string.Empty;
|
||||
_emailCodeTcs = new TaskCompletionSource<string>();
|
||||
IsFieldVisible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (isLinkStarted)
|
||||
goto linkStarted;
|
||||
|
||||
try
|
||||
{
|
||||
isLinkStarted = true;
|
||||
var linkOptions = new LinkOptions(Client, LoginV2Executor.NullConsumer, this,
|
||||
null, this, this, backupHandler: Backup, Logger2);
|
||||
_linker = new SteamAuthenticatorLinker(linkOptions);
|
||||
var result = await _linker.LinkAccount(_sessionData);
|
||||
IsLinkCode = true;
|
||||
IsCompleted = true;
|
||||
var mafile = Mafile.FromMobileDataExtended(result);
|
||||
Storage.SaveMafile(mafile);
|
||||
File.Delete(Path.Combine("mafiles_backup", mafile.AccountName + ".mafile"));
|
||||
HintText =
|
||||
string.Format(GetLocalizationOrDefault("MafileLinked"),
|
||||
mafile.RevocationCode,
|
||||
mafile.SessionData?.SteamId.Steam64);
|
||||
|
||||
CanProceed = true;
|
||||
return;
|
||||
}
|
||||
catch (AuthenticatorLinkerException ex)
|
||||
{
|
||||
Logger.Error(ex, "Link exception");
|
||||
HintText = $"{GetLocalizationCommon("Error")}: {ErrorTranslatorHelper.TranslateLinkerError(ex.Error)}";
|
||||
InvokeOnDispatcher(ResetState);
|
||||
return;
|
||||
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
var msg = ex.StatusCode?.ToString() ?? ex.Message;
|
||||
HintText = $"{GetLocalizationCommon("RequestError")}: {msg}";
|
||||
InvokeOnDispatcher(ResetState);
|
||||
return;
|
||||
}
|
||||
catch (EResultException ex)
|
||||
{
|
||||
Logger.Error(ex, "Link exception");
|
||||
HintText = GetLocalizationOrDefault("ErrorWithCode") + ErrorTranslatorHelper.TranslateEResult(ex.Result);
|
||||
InvokeOnDispatcher(ResetState);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, "Link exception");
|
||||
HintText = GetLocalizationOrDefault("UnknownError") + ex.Message;
|
||||
InvokeOnDispatcher(ResetState);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
linkStarted:
|
||||
if (IsPhoneNumber == false)
|
||||
{
|
||||
var phoneText = FieldText;
|
||||
FieldText = string.Empty;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(phoneText))
|
||||
{
|
||||
HintText = string.Empty;
|
||||
IsFieldVisible = false;
|
||||
_phoneNumberTcs.SetResult(null);
|
||||
_phoneNumberTcs = new();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(phoneText) && phoneText.Length >= 4 && long.TryParse(phoneText, out var phone))
|
||||
{
|
||||
HintText = string.Empty;
|
||||
IsFieldVisible = false;
|
||||
_phoneNumberTcs.SetResult(phone);
|
||||
_phoneNumberTcs = new();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
HintText = GetLocalizationOrDefault("PleaseEnterCorrectPhone");
|
||||
CanProceed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsEmailConfirmation == false)
|
||||
{
|
||||
HintText = string.Empty;
|
||||
_emailConfTcs.SetResult();
|
||||
_emailConfTcs = new();
|
||||
CanProceed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsLinkCode == false)
|
||||
{
|
||||
var linkCode = FieldText;
|
||||
FieldText = string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(linkCode) && linkCode.Length >= 4)
|
||||
{
|
||||
HintText = string.Empty;
|
||||
IsFieldVisible = false;
|
||||
_linkCodeTcs.SetResult(linkCode);
|
||||
_linkCodeTcs = new();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
HintText = GetLocalizationOrDefault("PleaseEnterCorrectCode");
|
||||
CanProceed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void ResetProxy()
|
||||
{
|
||||
if (IsPasswordFieldVisible == false) return;
|
||||
SelectedProxy = null;
|
||||
}
|
||||
|
||||
private void InvokeOnDispatcher(Action action)
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(action, null);
|
||||
}
|
||||
|
||||
private void ResetState()
|
||||
{
|
||||
PassFieldText = string.Empty;
|
||||
IsLogin = false;
|
||||
IsFieldVisible = true;
|
||||
IsEmailCode = false;
|
||||
isLinkStarted = false;
|
||||
IsPhoneNumber = false;
|
||||
IsEmailConfirmation = false;
|
||||
CanProceed = true;
|
||||
_emailCodeTcs = new TaskCompletionSource<string>();
|
||||
}
|
||||
|
||||
private void Backup(MobileDataExtended data)
|
||||
{
|
||||
if (Directory.Exists("mafiles_backup") == false)
|
||||
{
|
||||
Directory.CreateDirectory("mafiles_backup");
|
||||
}
|
||||
var json = Storage.SerializeMafile(data, null);
|
||||
File.WriteAllText(Path.Combine("mafiles_backup", data.AccountName + ".mafile"), json);
|
||||
}
|
||||
|
||||
#region Providers
|
||||
|
||||
public int MaxRetryCount { get; }
|
||||
public Task<string> GetEmailAuthCode(ILoginConsumer caller)
|
||||
{
|
||||
CanProceed = true;
|
||||
HintText = GetLocalizationOrDefault("EnterEmailCode");
|
||||
IsFieldVisible = true;
|
||||
return _emailCodeTcs.Task;
|
||||
}
|
||||
|
||||
public Task<string> GetAddAuthenticatorCode(ILoginConsumer caller)
|
||||
{
|
||||
IsPhoneNumber = true;
|
||||
IsEmailConfirmation = true;
|
||||
CanProceed = true;
|
||||
HintText = GetLocalizationOrDefault("EnterEmailCode");
|
||||
IsFieldVisible = true;
|
||||
return _linkCodeTcs.Task;
|
||||
}
|
||||
|
||||
public Task ConfirmEmailLink(ILoginConsumer caller, EmailConfirmationType confirmationType)
|
||||
{
|
||||
IsPhoneNumber = true;
|
||||
CanProceed = true;
|
||||
HintText = GetLocalizationOrDefault("ClickOnEmailLink");
|
||||
return _emailConfTcs.Task;
|
||||
}
|
||||
|
||||
public Task<long?> GetPhoneNumber(ILoginConsumer caller)
|
||||
{
|
||||
CanProceed = true;
|
||||
HintText = GetLocalizationOrDefault("EnterPhoneNumber");
|
||||
IsFieldVisible = true;
|
||||
return _phoneNumberTcs.Task;
|
||||
}
|
||||
public async Task<int> GetSmsCode(ILoginConsumer caller, long? phoneNumber, string? hint)
|
||||
{
|
||||
IsPhoneNumber = true;
|
||||
IsEmailConfirmation = true;
|
||||
CanProceed = true;
|
||||
HintText = string.Format(GetLocalizationOrDefault("PhoneHint"), hint);
|
||||
IsFieldVisible = true;
|
||||
var code = await _linkCodeTcs.Task;
|
||||
return int.Parse(code);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Client
|
||||
|
||||
static LinkAccountVM()
|
||||
{
|
||||
Proxy = new DynamicProxy(null);
|
||||
var clientPair = ClientBuilder.BuildMobileClient(Proxy, null);
|
||||
Client = clientPair.Client;
|
||||
Handler = clientPair.Handler;
|
||||
}
|
||||
|
||||
private void ClearCookies()
|
||||
{
|
||||
Handler.CookieContainer.ClearMobileSessionCookies();
|
||||
}
|
||||
|
||||
private void SetProxy()
|
||||
{
|
||||
Proxy.SetData(SelectedProxy?.Value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private static string GetLocalizationOrDefault(string key)
|
||||
{
|
||||
return LocManager.GetCodeBehindOrDefault(key, LOCALIZATION_KEY, key);
|
||||
}
|
||||
|
||||
private static string GetLocalizationCommon(string key)
|
||||
{
|
||||
return LocManager.GetCommonOrDefault(key, key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using NebulaAuth.Model;
|
||||
using NebulaAuth.Model.Entities;
|
||||
|
||||
namespace NebulaAuth.ViewModel.Other;
|
||||
|
||||
public partial class LoginAgainVM : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private string _password = null!;
|
||||
[ObservableProperty] private bool _savePassword;
|
||||
[ObservableProperty] private string _userName = null!;
|
||||
|
||||
public LoginAgainVM()
|
||||
{ }
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
using AchiesUtilities.Collections;
|
||||
using AchiesUtilities.Web.Proxy;
|
||||
using AutoUpdaterDotNET;
|
||||
using CodingSeb.Localization.WPF;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using NebulaAuth.Core;
|
||||
using NebulaAuth.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
|
||||
namespace NebulaAuth.ViewModel.Other;
|
||||
|
||||
public partial class ProxyManagerVM : ObservableObject
|
||||
{
|
||||
private const string LOCALIZATION_KEY = "ProxyManagerVM";
|
||||
|
||||
[ObservableProperty] private KeyValuePair<int, ProxyData>? _selectedProxy;
|
||||
[ObservableProperty] private string _addProxyField = string.Empty;
|
||||
[ObservableProperty] private KeyValuePair<int, ProxyData>? _defaultProxy;
|
||||
public ObservableDictionary<int, ProxyData> Proxies => ProxyStorage.Proxies;
|
||||
|
||||
private static readonly Regex IdRegex = new(@"(?:\{(\d+)\})");
|
||||
|
||||
|
||||
public ProxyManagerVM()
|
||||
{
|
||||
if (MaClient.DefaultProxy != null)
|
||||
DefaultProxy = Proxies.FirstOrDefault(kvp => kvp.Value.Equals(MaClient.DefaultProxy));
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void AddProxy()
|
||||
{
|
||||
if (string.IsNullOrEmpty(AddProxyField)) return;
|
||||
if (AddProxyField.Contains(Environment.NewLine))
|
||||
{
|
||||
var split = AddProxyField.Split(Environment.NewLine);
|
||||
var idPresent = (bool?)null;
|
||||
var proxies = new List<KeyValuePair<int?, ProxyData>>();
|
||||
var i = 0;
|
||||
foreach (var str in split)
|
||||
{
|
||||
i++;
|
||||
int? id = null;
|
||||
var match = IdRegex.Match(str);
|
||||
if (match.Success) id = int.Parse(match.Groups[1].Value);
|
||||
idPresent ??= match.Success;
|
||||
|
||||
if (idPresent.Value != match.Success)
|
||||
{
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("WrongFormatSomeIdsMissing"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (ProxyStorage.DefaultScheme.TryParse(str, out var proxy))
|
||||
{
|
||||
if (id != null && proxies.Any(kvp => kvp.Key == id))
|
||||
{
|
||||
SnackbarController.SendSnackbar(string.Format(GetLocalizationOrDefault("DuplicateId"), id));
|
||||
return;
|
||||
}
|
||||
proxies.Add(new KeyValuePair<int?, ProxyData>(id, proxy));
|
||||
}
|
||||
else
|
||||
{
|
||||
SnackbarController.SendSnackbar(string.Format(GetLocalizationOrDefault("WrongFormatOnLine"), i));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var kvp in proxies)
|
||||
{
|
||||
ProxyStorage.SetProxy(kvp.Key, kvp.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int? id = null;
|
||||
var input = AddProxyField;
|
||||
if (IdRegex.IsMatch(AddProxyField))
|
||||
{
|
||||
id = int.Parse(IdRegex.Match(AddProxyField).Groups[1].Value);
|
||||
input = IdRegex.Replace(input, "");
|
||||
}
|
||||
|
||||
if (ProxyStorage.DefaultScheme.TryParse(input, out var data))
|
||||
{
|
||||
ProxyStorage.SetProxy(id, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
SnackbarController.SendSnackbar(GetLocalizationOrDefault("WrongFormat"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
AddProxyField = string.Empty;
|
||||
CheckIfDefaultProxyStay();
|
||||
}
|
||||
|
||||
private void CheckIfDefaultProxyStay()
|
||||
{
|
||||
if (!DefaultProxy.HasValue || Proxies.Any(kvp => kvp.Equals(DefaultProxy.Value))) return;
|
||||
DefaultProxy = null;
|
||||
MaClient.DefaultProxy = null;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void RemoveProxy()
|
||||
{
|
||||
if (SelectedProxy == null) return;
|
||||
ProxyStorage.RemoveProxy(SelectedProxy.Value.Key);
|
||||
CheckIfDefaultProxyStay();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SetDefault()
|
||||
{
|
||||
if (SelectedProxy == null) return;
|
||||
DefaultProxy = SelectedProxy;
|
||||
MaClient.DefaultProxy = SelectedProxy.Value.Value;
|
||||
ProxyStorage.Save();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void RemoveDefault()
|
||||
{
|
||||
DefaultProxy = null;
|
||||
MaClient.DefaultProxy = null;
|
||||
ProxyStorage.Save();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void CopyProxy(ProxyData? data)
|
||||
{
|
||||
if (data == null) return;
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(ProxyStorage.GetProxyString(data));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Shell.Logger.Error(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void CopyProxyAddress(ProxyData? obj)
|
||||
{
|
||||
if (obj == null) return;
|
||||
Clipboard.SetText(obj.ToString(ProxyStorage.ADDRESS_FORMAT));
|
||||
}
|
||||
|
||||
private static string GetLocalizationOrDefault(string key)
|
||||
{
|
||||
return LocManager.GetCodeBehindOrDefault(key, LOCALIZATION_KEY, key);
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using NebulaAuth.Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using NebulaAuth.Core;
|
||||
|
||||
namespace NebulaAuth.ViewModel.Other;
|
||||
|
||||
public partial class SettingsVM : ObservableObject
|
||||
{
|
||||
public Settings Settings => Settings.Instance;
|
||||
|
||||
public bool DisableTimersOnChange
|
||||
{
|
||||
get => Settings.DisableTimersOnChange;
|
||||
set => Settings.DisableTimersOnChange = value;
|
||||
}
|
||||
public BackgroundMode BackgroundMode
|
||||
{
|
||||
get => Settings.BackgroundMode;
|
||||
set => Settings.BackgroundMode = value;
|
||||
}
|
||||
|
||||
public bool HideToTray
|
||||
{
|
||||
get => Settings.HideToTray;
|
||||
set => Settings.HideToTray = value;
|
||||
}
|
||||
|
||||
public Dictionary<BackgroundMode, string> BackgroundModes => new()
|
||||
{
|
||||
{BackgroundMode.Default, LocManager.GetOrDefault("Default", "SettingsDialog", "BackgroundMode", "Default")},
|
||||
{BackgroundMode.Custom, LocManager.GetOrDefault("Default", "SettingsDialog", "BackgroundMode", "Custom")},
|
||||
{BackgroundMode.Color, LocManager.GetOrDefault("Default", "SettingsDialog", "BackgroundMode", "NoBackground")},
|
||||
};
|
||||
|
||||
public Dictionary<LocalizationLanguage, string> Languages { get; } = new()
|
||||
{
|
||||
{LocalizationLanguage.English, "English"},
|
||||
{LocalizationLanguage.Russian, "Русский"},
|
||||
{LocalizationLanguage.Ukrainian, "Українська"}
|
||||
};
|
||||
|
||||
public Color? BackgroundColor
|
||||
{
|
||||
get => Settings.BackgroundColor;
|
||||
set => Settings.BackgroundColor = value;
|
||||
}
|
||||
|
||||
public Color? IconColor
|
||||
{
|
||||
get => Settings.IconColor;
|
||||
set => Settings.IconColor = value;
|
||||
|
||||
}
|
||||
|
||||
public bool UseIcon
|
||||
{
|
||||
get => IconColor != null;
|
||||
set
|
||||
{
|
||||
if (value == false)
|
||||
IconColor = null;
|
||||
else
|
||||
IconColor = Color.FromRgb(202, 39, 39);
|
||||
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(IconColor));
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseBackground
|
||||
{
|
||||
get => BackgroundColor != null;
|
||||
set
|
||||
{
|
||||
if (value == false)
|
||||
BackgroundColor = null;
|
||||
else
|
||||
BackgroundColor = Color.FromRgb(202, 39, 39);
|
||||
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(BackgroundColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public LocalizationLanguage Language
|
||||
{
|
||||
get => Settings.Language;
|
||||
set
|
||||
{
|
||||
Settings.Language = value;
|
||||
LocManager.SetApplicationLocalization(value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool LegacyMode
|
||||
{
|
||||
get => Settings.LegacyMode;
|
||||
set => Settings.LegacyMode = value;
|
||||
}
|
||||
|
||||
public bool AllowAutoUpdate
|
||||
{
|
||||
get => Settings.AllowAutoUpdate;
|
||||
set => Settings.AllowAutoUpdate = value;
|
||||
}
|
||||
|
||||
public bool UseAccountNameAsMafileName
|
||||
{
|
||||
get => Settings.UseAccountNameAsMafileName;
|
||||
set => Settings.UseAccountNameAsMafileName = value;
|
||||
}
|
||||
|
||||
[ObservableProperty] private string _password;
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
public void SetPassword()
|
||||
{
|
||||
PHandler.SetPassword(Password);
|
||||
Settings.IsPasswordSet = PHandler.IsPasswordSet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using AutoUpdaterDotNET;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
|
||||
namespace NebulaAuth.ViewModel.Other;
|
||||
|
||||
public partial class UpdaterVM : ObservableObject
|
||||
{
|
||||
|
||||
public UpdateInfoEventArgs UpdateInfoEventArgs { get; }
|
||||
public UpdaterVM(UpdateInfoEventArgs args)
|
||||
{
|
||||
UpdateInfoEventArgs = args;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.4.8.0</version>
|
||||
<url>https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.4.8/NebulaAuth.1.4.8.zip</url>
|
||||
<changelog>https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.4.8.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.8.2</version>
|
||||
<url>https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/download/1.8.2/NebulaAuth.1.8.2.zip</url>
|
||||
<changelog>https://achiez.github.io/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/changelog/1.8.2.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
|
||||
+25
-17
@@ -2,24 +2,32 @@
|
||||
|
||||
## Описание
|
||||
|
||||
NebulaAuth — это приложение для эмуляции действий из мобильного приложения Steam. Которая заменяет ваш смартфон при работе в Steam.
|
||||
<h3 align="center" style="margin-bottom:0">
|
||||
<a href="https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/latest">Скачать последнюю версию</a>
|
||||
</h3>
|
||||
|
||||
<h3 align="center">NebulaAuth — это приложение для эмуляции действий из мобильного приложения Steam. Которая заменяет ваш смартфон при работе в Steam.</h3>
|
||||
<h4 align="center"><a href="https://t.me/nebulaauth">Официальная группа в Telegram</a></h4>
|
||||
|
||||
|
||||
## Основные преимущества
|
||||
|
||||
- **Локализация на трёх языках**: английском, русском и украинском.
|
||||
- **Полная функциональность Steam Desktop Authenticator** переосмысление [старого приложения](https://github.com/Jessecar96/SteamDesktopAuthenticator)
|
||||
- **Использование прокси**
|
||||
- **Группировка мафайлов** для улучшения управления.
|
||||
- **Автоматическое подтверждение трейдов/продаж на ТП** для экономии времени.
|
||||
- **Массовый импорт файлов карт** с помощью Drag'n'Drop или CTRL+V для удобства.
|
||||
- **Настройка дизайна** для персонализации интерфейса.
|
||||
- **Полная функциональность Steam Desktop Authenticator**, переосмысление [старого приложения](https://github.com/Jessecar96/SteamDesktopAuthenticator)
|
||||
- **Поддержка прокси** во всех процессах работы с аккаунтом.
|
||||
- **Группировка мафайлов** для продвинутого контроля.
|
||||
- **Автоматическое подтверждение трейдов/действий на ТП** для экономии времени.
|
||||
- **Массовый импорт мафайлов** с помощью Drag'n'Drop или CTRL+V для удобства.
|
||||
- **Настройка внешнего вида** для персонализации интерфейса.
|
||||
- **Возможность подтвердить вход в учетную запись без ввода кода** для облегчения доступа.
|
||||
- **Автообновление** программы для использования новейших функций.
|
||||
- **Автоматический повторный вход в случае проблем с сеансом** для непрерывной работы.
|
||||
- **Автоматический повторный вход в случае проблем с сессией** для непрерывной работы.
|
||||
- **Интуитивно понятный интерфейс** с подсказками и удобствами
|
||||
- **Постоянная поддержка** кода приложения и других функций.
|
||||
|
||||
## Монтаж
|
||||
## Установка
|
||||
|
||||
1. Если приложение не запускается, необходимо установить [.net Desktop Runtime 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-8.0.1-windows-x64-installer)
|
||||
1. Если приложение не запускается, необходимо установить [.NET Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
||||
2. [Скачать программу из релизов этого репозитория на Github](https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/latest)
|
||||
* *Для сохранности ваших данных скачивайте приложение только отсюда*
|
||||
4. Распакуйте ZIP-файл в любую папку.
|
||||
@@ -35,28 +43,28 @@ NebulaAuth — это приложение для эмуляции действ
|
||||
- управление аккаунтом (вход, привязка, отвязка)
|
||||
- группировка
|
||||
- выбор прокси
|
||||
- индикатор с подсказкой об используемом прокси (светится либо желтым, либо красным, при наведении отобразит дополнительную информацию)
|
||||
- индикатор с подсказкой об используемом прокси (горит либо желтым, либо красным, при наведении отобразит дополнительную информацию)
|
||||
- таймеры для автоматического подтверждения трейдов/продаж на торговой площадке
|
||||
- как часто проверять подтверждения при включенных таймерах (в секундах)
|
||||
- интервал таймера подтверждений (в секундах)
|
||||
2. Список ваших аккаунтов
|
||||
3. Код подтверждения входа (нажмите, чтобы скопировать)
|
||||
4. Главное окно подтверждений
|
||||
5. Поиск по логину или SteamID (7xxxxxxxxxxxxx)
|
||||
6. Подтвердить вход с другого устройства.
|
||||
6. Подтвердить вход на другогом устройстве.
|
||||
7. Гиперссылка на официальную страницу приложения с указанием авторства.
|
||||
|
||||
## Настройки
|
||||

|
||||
|
||||
|
||||
1. Режим фона. Переключите, если вы хотите отключить фон или установить собственный (поместите файл «Background.png» в папку приложения)
|
||||
2. Язык локализации
|
||||
1. Режим фона. Используйте, если вы хотите отключить фон или установить собственный (поместите файл «Background.png» в папку приложения)
|
||||
2. Язык приложения
|
||||
3. Отключить таймеры при переключении между аккаунтами
|
||||
4. Скрывать в трей при сворачивании
|
||||
5. Индикатор с цветом. Маленький кружочек на значке панели задач с произвольным цветом. Полезно при использовании нескольких окон.
|
||||
6. Пользовательский цвет приложения.
|
||||
7. Текущий пароль шифрования. Если установлено, вы можете сохранять зашифрованные пароли в mafile, чтобы облегчить повторный вход в систему при проблемах с сеансом. (Не рекомендуется)
|
||||
8. Режим устаревших файлов. Режим совместимости Mafile. Если установлено, приложение будет сохранять файлы в старом стандартном формате (по умолчанию: включено).
|
||||
7. Текущий пароль шифрования. Если установлено, вы можете сохранять зашифрованные пароли в mafile, чтобы облегчить повторный вход в систему при проблемах с сессией. (Не рекомендуется)
|
||||
8. Режим устаревших файлов. Режим совместимости Mafile с другими клиентами (SDA и т.д.). Если установлено, приложение будет сохранять файлы в старом стандартном формате (по умолчанию: включено).
|
||||
9. Разрешить автообновление без подтверждения
|
||||
|
||||
|
||||
|
||||
+22
-15
@@ -2,24 +2,31 @@
|
||||
|
||||
## Опис
|
||||
|
||||
NebulaAuth - це програма для емуляції дій з мобільного додатку Steam. Яка замінює ваш смартфон під час роботи в Steam.
|
||||
<h3 align="center" style="margin-bottom:0">
|
||||
<a href="https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/latest">Завантажити останню версію</a>
|
||||
</h3>
|
||||
|
||||
<h3 align="center">NebulaAuth - це програма для емуляції дій з мобільного додатку Steam. Яка замінює ваш смартфон під час роботи в Steam.</h3>
|
||||
<h4 align="center"><a href="https://t.me/nebulaauth">Офіційна група в Telegram</a></h4>
|
||||
|
||||
## Основні переваги
|
||||
|
||||
- **Локалізація трьома мовами**: англійською, російською та українською.
|
||||
- **Повна функціональність Steam Desktop Authenticator** переосмислення [старої програми](https://github.com/Jessecar96/SteamDesktopAuthenticator)
|
||||
- **Використання проксі**
|
||||
- **Угруповання мафайлів** для покращення керування.
|
||||
- **Автоматичне підтвердження трейдів/продаж на маркеті** для економії часу.
|
||||
- **Масовий імпорт файлів карт** за допомогою Drag'n'Drop або CTRL+V для зручності.
|
||||
- **Налаштування дизайну** для персоналізації інтерфейсу.
|
||||
- **Підтримка проксі** у всіх процесах роботи з обліковим записом.
|
||||
- **Угруповання мафайлів** для просунутого контролю.
|
||||
- **Автоматичне підтвердження трейдів/дій на маркеті** для економії часу.
|
||||
- **Масовий імпорт мафайлів** за допомогою Drag'n'Drop або CTRL+V для зручності.
|
||||
- **Налаштування зовнішнього вигляду** для персоналізації інтерфейсу.
|
||||
- **Можливість підтвердити вхід до облікового запису без введення коду** для полегшення доступу.
|
||||
- **Автооновлення** програми для використання новітніх функцій.
|
||||
- **Автоматичний повторний вхід у разі проблем із сеансом** для безперервної роботи.
|
||||
- **Автоматичний повторний вхід у разі проблем із сесією** для безперервної роботи.
|
||||
- **Інтуїтивно зрозумілий інтерфейс** з підказками та зручностями
|
||||
- **Постійна підтримка** коду програми та інших функцій.
|
||||
|
||||
## Монтаж
|
||||
|
||||
1. Якщо програма не запускається, необхідно встановити [.NET Desktop Runtime 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-8.0.1-windows-x64-installer)
|
||||
1. Якщо програма не запускається, необхідно встановити [.NET Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
||||
2. [Завантажити програму з релізів цього репозиторію на Github](https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/latest)
|
||||
* *Для збереження ваших даних завантажуйте програму тільки звідси*
|
||||
4. Розпакуйте ZIP-файл у будь-яку папку.
|
||||
@@ -33,28 +40,28 @@ NebulaAuth - це програма для емуляції дій з мобіл
|
||||
- керування файлами та налаштування
|
||||
- керування акаунтом (вхід, прив'язка, відв'язування)
|
||||
- угруповання
|
||||
- Вибір проксі
|
||||
- вибір проксі
|
||||
- індикатор з підказкою про проксі (світиться або жовтим, або червоним, при наведенні відобразить додаткову інформацію)
|
||||
- таймери для автоматичного підтвердження трейдів/продажів на торговому майданчику
|
||||
- як часто перевіряти підтвердження при увімкнених таймерах (у секундах)
|
||||
- таймери для автоматичного підтвердження трейдів/продажів на маркеті
|
||||
- інтервал таймера підтверджень (у секундах)
|
||||
2. Список ваших облікових записів
|
||||
3. Код підтвердження входу (натисніть, щоб скопіювати)
|
||||
4. Головне вікно підтвердження
|
||||
5. Пошук за логіном або SteamID (7xxxxxxxxxxxxx)
|
||||
6. Підтвердити вхід із іншого пристрою.
|
||||
6. Підтвердити вхід на іншому пристрою.
|
||||
7. Гіперпосилання на офіційну сторінку додатку із зазначенням авторства.
|
||||
|
||||
## Налаштування
|
||||

|
||||
|
||||
1. Режим фону. Перемкніть, якщо ви хочете вимкнути фон або встановити власний (помістіть файл "Background.png" у папку програми)
|
||||
1. Режим фону. Використовуйте, якщо ви хочете вимкнути фон або встановити власний (помістіть файл "Background.png" у папку програми)
|
||||
2. Мова локалізації
|
||||
3. Вимкнути таймери під час перемикання між обліковими записами
|
||||
4. Приховувати у трей при згортанні
|
||||
5. Індикатор із кольором. Маленький кружечок на піктограмі панелі завдань з довільним кольором. Корисно при використанні кількох вікон.
|
||||
6. Власний колір програми.
|
||||
7. Поточний пароль шифрування. Якщо встановлено, ви можете зберігати зашифровані паролі в mafile, щоб полегшити повторний вхід до системи у разі проблеми з сеансом. (Не рекомендується)
|
||||
8. Режим застарілих файлів. Режим сумісності Mafile. Якщо встановлено, програма зберігатиме файли у старому стандартному форматі (за замовчуванням: увімкнено).
|
||||
7. Поточний пароль шифрування. Якщо встановлено, ви можете зберігати зашифровані паролі в mafile, щоб полегшити повторний вхід до системи у разі проблеми з сесією. (Не рекомендується)
|
||||
8. Режим застарілих файлів. Режим сумісності Mafile з іншими клієнтами (SDA тощо). Якщо встановлено, програма зберігатиме файли у старому стандартному форматі (за замовчуванням: увімкнено).
|
||||
9. Дозволити автооновлення без підтвердження
|
||||
|
||||
|
||||
|
||||
@@ -3,32 +3,37 @@
|
||||
* [Русский](README-RU.md)
|
||||
* [Українська](README-UA.md)
|
||||
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
<h3 align="center" style="margin-bottom:0">
|
||||
<a href="https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/latest">Latest release</a>
|
||||
<a href="https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/latest">Download latest version</a>
|
||||
</h3>
|
||||
|
||||
<h3 align="center">NebulaAuth is an application for emulating actions from the Steam Mobile App. Which replaces your smartphone when operating on Steam. </h3>
|
||||
|
||||
<h4 align="center"><a href="https://t.me/nebulaauth">Official Telegram Group</a></h4>
|
||||
|
||||
|
||||
## Main advantages
|
||||
|
||||
- **Localization in three languages**: English, Russian and Ukrainian.
|
||||
- **Full functionality of Steam Desktop Authenticator** reimagining [old app](https://github.com/Jessecar96/SteamDesktopAuthenticator)
|
||||
- **Using a proxy**
|
||||
- **Proxy support** in all account work processes.
|
||||
- **Mafile grouping** for improved management.
|
||||
- **Automatic confirmation of trades/trading platform** to save time.
|
||||
- **Bulk import of map files** via Drag'n'Drop or CTRL+V for convenience.
|
||||
- **Automatic confirmations of trades/market actions** to save time.
|
||||
- **Bulk import of .mafiles** via Drag'n'Drop or CTRL+V for convenience.
|
||||
- **Design customization** to personalize the interface.
|
||||
- **Ability to confirm account login without entering a code** for easier access.
|
||||
- **Auto-update** program to use the latest features.
|
||||
- **Automatic relogin in case of problems with the session** for continuous operation.
|
||||
- **Intuitive interface** with tips and conveniences
|
||||
- **Continious support** of application code and other features.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
1. If the application does not start, you need to install [.net desktop runtime 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-desktop-8.0.1-windows-x64-installer)
|
||||
1. If the application does not start, you need to install [.NET Desktop Runtime](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
||||
2. [Download the program from the releases of this repository on Github](https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/releases/latest)
|
||||
* *For the safety of your data, download the application only from here*
|
||||
4. Unpack the .zip file to any folder
|
||||
@@ -45,12 +50,12 @@
|
||||
- proxy selection
|
||||
- an indicator with a hint about the proxy used (lit either yellow or red, when hovered it will display additional information)
|
||||
- timers for automatic confirmation of trade offers/sale offers on the marketplace
|
||||
- how often to check confirmations when timers are enabled (in seconds)
|
||||
- confirmation timer interval (in seconds)
|
||||
2. List of your accounts
|
||||
3. Login confirmation code (click to copy)
|
||||
4. Main confirmation window
|
||||
5. Search by login or SteamID (7xxxxxxxxxxxxx)
|
||||
6. Confirm login from another device
|
||||
6. Confirm login on another device
|
||||
7. Hyperlink to the official application page with attribution
|
||||
|
||||
## Settings
|
||||
@@ -63,7 +68,7 @@
|
||||
5. Indicator with color. Small ellipse on your task-bar icon with custom color. Useful when using multiple windows
|
||||
6. Custom background color of application
|
||||
7. Current encryption password. If set you can save encrypted passwords to mafile to help re-login on session troubles. (Not recommended)
|
||||
8. Legacy mafile mode. Mafile compability mode. If set application will save mafiles with old standart format (Default: checked)
|
||||
8. Legacy mafile mode. Mafile compability mode for another applications (SDA and etc). If checked application will save mafiles with old standart format (Default: checked)
|
||||
9. Allow auto-update without confirmation
|
||||
|
||||
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
using SteamLib.Utility;
|
||||
|
||||
namespace SteamLib.Account;
|
||||
|
||||
public struct SteamId //TODO: validation in parse methods
|
||||
{
|
||||
public SteamId64 Steam64 { get; }
|
||||
public SteamId2 Steam2 { get; }
|
||||
public SteamId3 Steam3 { get; }
|
||||
public SteamId(SteamId64 steam64, char type = 'U', short universe = 0)
|
||||
{
|
||||
Steam64 = steam64;
|
||||
Steam2 = steam64.ToSteam2(universe);
|
||||
Steam3 = steam64.ToSteam3(type);
|
||||
}
|
||||
|
||||
public SteamId(SteamId2 steam2, char type = 'U')
|
||||
{
|
||||
Steam2 = steam2;
|
||||
Steam64 = steam2.ToSteam64();
|
||||
Steam3 = steam2.ToSteam3(type);
|
||||
}
|
||||
|
||||
public SteamId(SteamId3 steam3, byte universe = 0)
|
||||
{
|
||||
Steam3 = steam3;
|
||||
Steam64 = steam3.ToSteam64();
|
||||
Steam2 = steam3.ToSteam2(universe);
|
||||
}
|
||||
|
||||
public static SteamId FromSteam64(long steam64, char type = 'U', short universe = 0) => new(new SteamId64(steam64), type, universe);
|
||||
public override string ToString() => Steam64.ToString();
|
||||
public static bool TryParse(string input, out SteamId result) => SteamIdParser.TryParse(input, out result);
|
||||
|
||||
/// <exception cref="FormatException"></exception>
|
||||
public static SteamId Parse(string input) => SteamIdParser.Parse(input);
|
||||
public static bool operator ==(SteamId left, SteamId right) => left.Equals(right);
|
||||
public static bool operator !=(SteamId left, SteamId right) => !left.Equals(right);
|
||||
public bool Equals(SteamId other) => Steam64.Equals(other.Steam64);
|
||||
public override bool Equals(object? obj) => obj is SteamId other && Equals(other);
|
||||
public override int GetHashCode() => Steam64.GetHashCode();
|
||||
}
|
||||
|
||||
public struct SteamId64
|
||||
{
|
||||
public const long SEED = 76561197960265728L;
|
||||
public long Id { get; }
|
||||
public SteamId64(long id)
|
||||
{
|
||||
if (id < SEED)
|
||||
throw new ArgumentOutOfRangeException(nameof(id),$"Invalid SteamID provided {id}");
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public SteamId2 ToSteam2(short universe = 0)
|
||||
{
|
||||
var accountIdLowBit = (byte)(Id & 1);
|
||||
var accountIdHighBits = (int)(Id >> 1) & 0x7FFFFFF;
|
||||
return new SteamId2((byte)universe, accountIdLowBit, accountIdHighBits);
|
||||
}
|
||||
|
||||
public SteamId3 ToSteam3(char type = 'U')
|
||||
{
|
||||
var accountIdLowBit = (byte)(Id & 1);
|
||||
var accountIdHighBits = (int)(Id >> 1) & 0x7FFFFFF;
|
||||
return new SteamId3(accountIdLowBit + accountIdHighBits * 2, type);
|
||||
}
|
||||
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Id.ToString();
|
||||
}
|
||||
|
||||
public ulong ToUlong() => (ulong)Id;
|
||||
public long ToLong() => Id;
|
||||
|
||||
public bool Equals(SteamId64 other) => Id == other.Id;
|
||||
public override bool Equals(object? obj) => obj is SteamId64 other && Equals(other);
|
||||
public override int GetHashCode() => Id.GetHashCode();
|
||||
public static bool operator ==(SteamId64 left, SteamId64 right) => left.Equals(right);
|
||||
public static bool operator !=(SteamId64 left, SteamId64 right) => !left.Equals(right);
|
||||
public static bool TryParse(string input, out SteamId64 result) => SteamIdParser.TryParse64(input, out result);
|
||||
/// <exception cref="FormatException"></exception>
|
||||
public static SteamId64 Parse(string input) => SteamIdParser.Parse64(input);
|
||||
|
||||
public static implicit operator long(SteamId64 steamId64) => steamId64.ToLong();
|
||||
}
|
||||
|
||||
public struct SteamId2
|
||||
{
|
||||
|
||||
public byte Universe { get; }
|
||||
public byte LowestBit { get; }
|
||||
public int HighestBit { get; }
|
||||
|
||||
|
||||
public SteamId2(byte lowestBit, int highestBit)
|
||||
{
|
||||
if(lowestBit > 1)
|
||||
throw new ArgumentOutOfRangeException(nameof(lowestBit), $"Invalid SteamID2 lowestBit provided {lowestBit}. Max value is 1");
|
||||
|
||||
if(highestBit < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(highestBit), $"Invalid SteamID2 highestBit provided {highestBit}");
|
||||
|
||||
LowestBit = lowestBit;
|
||||
HighestBit = highestBit;
|
||||
Universe = 0;
|
||||
}
|
||||
|
||||
public SteamId2(byte universe, byte lowestBit, int highestBit)
|
||||
{
|
||||
Universe = universe;
|
||||
LowestBit = lowestBit;
|
||||
HighestBit = highestBit;
|
||||
}
|
||||
|
||||
public SteamId64 ToSteam64() => new SteamId64(SteamId64.SEED + LowestBit + HighestBit * 2);
|
||||
|
||||
public SteamId3 ToSteam3(char type = 'U') => new SteamId3(HighestBit * 2 + LowestBit);
|
||||
|
||||
public override string ToString() => $"STEAM_{Universe}:{LowestBit}:{HighestBit}";
|
||||
|
||||
public bool Equals(SteamId2 other) => Universe == other.Universe && LowestBit == other.LowestBit && HighestBit == other.HighestBit;
|
||||
public override bool Equals(object? obj) => obj is SteamId2 other && Equals(other);
|
||||
public override int GetHashCode() => HashCode.Combine(Universe, LowestBit, HighestBit);
|
||||
public static bool operator ==(SteamId2 left, SteamId2 right) => left.Equals(right);
|
||||
public static bool operator !=(SteamId2 left, SteamId2 right) => !left.Equals(right);
|
||||
public static bool TryParse(string input, out SteamId2 result) => SteamIdParser.TryParse2(input, out result);
|
||||
/// <exception cref="FormatException"></exception>
|
||||
public static SteamId2 Parse(string input) => SteamIdParser.Parse2(input);
|
||||
}
|
||||
|
||||
public struct SteamId3
|
||||
{
|
||||
public char Type { get; }
|
||||
public int Id { get; }
|
||||
|
||||
public SteamId3(int id, char type = 'U')
|
||||
{
|
||||
if (id < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(id), $"Invalid SteamID provided {id}");
|
||||
Type = type;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public SteamId2 ToSteam2(byte universe = 0)
|
||||
{
|
||||
var bit = Id % 2;
|
||||
var highestBits = Id / 2;
|
||||
return new SteamId2(universe, (byte)bit, highestBits);
|
||||
}
|
||||
|
||||
|
||||
public SteamId64 ToSteam64() => new SteamId64(SteamId64.SEED + Id);
|
||||
public override string ToString() => $"[{Type}:1:{Id}]";
|
||||
|
||||
public string ToString(bool withBrackets)
|
||||
{
|
||||
if (withBrackets)
|
||||
{
|
||||
return ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"{Type}:1:{Id}";
|
||||
}
|
||||
}
|
||||
|
||||
public int ToInt() => Id;
|
||||
public bool Equals(SteamId3 other) => Type == other.Type && Id == other.Id;
|
||||
public override bool Equals(object? obj) => obj is SteamId3 other && Equals(other);
|
||||
public readonly override int GetHashCode() => HashCode.Combine(Type, Id);
|
||||
public static bool operator ==(SteamId3 left, SteamId3 right) => left.Equals(right);
|
||||
public static bool operator !=(SteamId3 left, SteamId3 right) => !left.Equals(right);
|
||||
public static bool TryParse(string input, out SteamId3 result) => SteamIdParser.TryParse3(input, out result);
|
||||
|
||||
/// <exception cref="FormatException"></exception>
|
||||
public static SteamId3 Parse(string input) => SteamIdParser.Parse3(input);
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
using System.Net;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SteamLib.Core;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.ProtoCore;
|
||||
using SteamLib.ProtoCore.Enums;
|
||||
using SteamLib.ProtoCore.Exceptions;
|
||||
using SteamLib.ProtoCore.Services;
|
||||
|
||||
namespace SteamLib.Api.Mobile;
|
||||
|
||||
|
||||
[PublicAPI]
|
||||
public static class SteamMobileApi
|
||||
//TODO: cancellation token
|
||||
//TODO: HealthMonitor
|
||||
{
|
||||
|
||||
private const string GENERATE_ACCESS_TOKEN =
|
||||
SteamConstants.STEAM_API + "IAuthenticationService/GenerateAccessTokenForApp/v1";
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="refreshToken"></param>
|
||||
/// <param name="steamId"></param>
|
||||
/// <returns>Refreshed AccessToken</returns>
|
||||
/// <exception cref="SessionInvalidException"></exception>
|
||||
public static async Task<string> RefreshJwt(HttpClient client, string refreshToken, long steamId)
|
||||
{
|
||||
var req = new GenerateAccessTokenForApp_Request
|
||||
{
|
||||
RefreshToken = refreshToken,
|
||||
SteamId = steamId,
|
||||
TokenRenewalType = true
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var resp = await client.PostProto<GenerateAccessTokenForApp_Response>(GENERATE_ACCESS_TOKEN, req);
|
||||
return resp.AccessToken;
|
||||
}
|
||||
catch (EResultException ex)
|
||||
when (ex.Result == EResult.AccessDenied)
|
||||
{
|
||||
throw new SessionInvalidException("RefreshToken is not accepted by Steam. You must login again and use new token");
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<bool> HasPhoneAttached(HttpClient client, string sessionId)
|
||||
{
|
||||
var data = new Dictionary<string, string>
|
||||
{
|
||||
{"op", "has_phone"},
|
||||
{"arg", "null"},
|
||||
{"sessionid", sessionId}
|
||||
|
||||
};
|
||||
var content = new FormUrlEncodedContent(data);
|
||||
var resp = await client.PostAsync(SteamConstants.STEAM_COMMUNITY + "steamguard/phoneajax", content);
|
||||
var respContent = await resp.EnsureSuccessStatusCode().Content.ReadAsStringAsync();
|
||||
var json = JObject.Parse(respContent);
|
||||
return json["has_phone"]!.Value<bool>();
|
||||
}
|
||||
|
||||
|
||||
public static async Task<RemoveAuthenticator_Response> RemoveAuthenticator(HttpClient client, string accessToken, string rCode)
|
||||
{
|
||||
var req = SteamConstants.STEAM_API + "ITwoFactorService/RemoveAuthenticator/v1?access_token=" + accessToken;
|
||||
var reqData = new RemoveAuthenticator_Request
|
||||
{
|
||||
RevocationCode = rCode,
|
||||
RevocationReason = 1,
|
||||
SteamGuardScheme = 1
|
||||
};
|
||||
try
|
||||
{
|
||||
return await client.PostProto<RemoveAuthenticator_Response>(req, reqData);
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
when (ex.StatusCode is HttpStatusCode.Unauthorized)
|
||||
{
|
||||
throw new SessionExpiredException("Session expired");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
using SteamLib.Core;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.SteamMobile.Confirmations;
|
||||
using SteamLib.SteamMobile;
|
||||
using System.Net;
|
||||
using AchiesUtilities.Web.Extensions;
|
||||
using SteamLib.Web.Scrappers.JSON;
|
||||
using SteamLib.Core.StatusCodes;
|
||||
using SteamLib.Utility;
|
||||
|
||||
namespace SteamLib.Api.Mobile;
|
||||
|
||||
public static class SteamMobileConfirmationsApi
|
||||
{
|
||||
private const string CONF = SteamConstants.STEAM_COMMUNITY + "mobileconf";
|
||||
private const string CONF_OP = SteamConstants.STEAM_COMMUNITY + "mobileconf/ajaxop";
|
||||
private const string MULTI_CONF_OP = SteamConstants.STEAM_COMMUNITY + "mobileconf/multiajaxop";
|
||||
|
||||
public static async Task<IEnumerable<Confirmation>> GetConfirmations(HttpClient client, MobileData data, long steamId)
|
||||
{
|
||||
var nvc = GetConfirmationKvp(steamId, data.DeviceId, data.IdentitySecret, "list");
|
||||
|
||||
var req = new Uri(CONF + "/getlist" + nvc.ToQueryString());
|
||||
var reqMsg = new HttpRequestMessage(HttpMethod.Get, req);
|
||||
var resp = await client.SendAsync(reqMsg);
|
||||
|
||||
var respStr = await resp.Content.ReadAsStringAsync();
|
||||
if (resp.StatusCode == HttpStatusCode.Redirect)
|
||||
{
|
||||
throw new SessionExpiredException("Mobile session expired");
|
||||
}
|
||||
|
||||
resp.EnsureSuccessStatusCode();
|
||||
|
||||
|
||||
return HealthMonitor.LogOnException(respStr, MobileConfirmationScrapper.Scrap, typeof(SessionExpiredException));
|
||||
}
|
||||
|
||||
public static async Task<bool> SendConfirmation(HttpClient client, Confirmation confirmation, long steamId, MobileData data, bool confirm)
|
||||
{
|
||||
var op = confirm ? "allow" : "cancel";
|
||||
|
||||
var query = GetConfirmationKvp(steamId, data.DeviceId, data.IdentitySecret, op).ToList();
|
||||
|
||||
var id = confirmation.Id.ToString();
|
||||
var key = confirmation.Nonce.ToString();
|
||||
|
||||
query.Insert(0, new KeyValuePair<string, string>("op", op));
|
||||
query.Add(new KeyValuePair<string, string>("cid", id));
|
||||
query.Add(new KeyValuePair<string, string>("ck", key));
|
||||
|
||||
var req = CONF_OP + query.ToQueryString();
|
||||
var resp = await client.GetStringAsync(req);
|
||||
var successCode = HealthMonitor.LogOnException(resp, () => SteamStatusCode.Translate<SteamStatusCode>(resp, out _));
|
||||
|
||||
return successCode.Equals(SteamStatusCode.Ok);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static async Task<bool> SendMultipleConfirmations(HttpClient client, IEnumerable<Confirmation> confirmations,
|
||||
long steamId, MobileData data, bool confirm)
|
||||
{
|
||||
var op = confirm ? "allow" : "cancel";
|
||||
var query = GetConfirmationKvp(steamId, data.DeviceId, data.IdentitySecret, op).ToList();
|
||||
query.Insert(0, new KeyValuePair<string, string>("op", op));
|
||||
|
||||
foreach (var confirmation in confirmations)
|
||||
{
|
||||
query.Add(new KeyValuePair<string, string>("cid[]", confirmation.Id.ToString()));
|
||||
query.Add(new KeyValuePair<string, string>("ck[]", confirmation.Nonce.ToString()));
|
||||
}
|
||||
|
||||
var content = new FormUrlEncodedContent(query);
|
||||
var resp = await client.PostAsync(MULTI_CONF_OP, content);
|
||||
var respStr = await resp.Content.ReadAsStringAsync();
|
||||
var successCode = HealthMonitor.LogOnException(respStr, () => SteamStatusCode.Translate<SteamStatusCode>(respStr, out _));
|
||||
return successCode.Equals(SteamStatusCode.Ok);
|
||||
|
||||
}
|
||||
|
||||
internal static IEnumerable<KeyValuePair<string, string>> GetConfirmationKvp(long steamId, string deviceId, string identitySecret, string tag = "conf")
|
||||
{
|
||||
var time = TimeAligner.GetSteamTime();
|
||||
var hash = EncryptionHelper.GenerateConfirmationHash(time, identitySecret, tag);
|
||||
return new KeyValuePair<string, string>[]
|
||||
{
|
||||
new("p", deviceId),
|
||||
new("a", steamId.ToString()),
|
||||
new("k", hash),
|
||||
new("t", time.ToString()),
|
||||
new("m", "react"),
|
||||
new("tag", tag)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using SteamLib.Authentication;
|
||||
using SteamLib.Core;
|
||||
using SteamLib.Core.Enums;
|
||||
using SteamLib.Core.StatusCodes;
|
||||
using SteamLib.Exceptions;
|
||||
|
||||
namespace SteamLib.Api;
|
||||
|
||||
public static class SteamGlobalApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Raw AccessToken value
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="domain"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="SessionInvalidException"></exception>
|
||||
public static async Task<string> RefreshJwt(HttpClient client, SteamDomain domain, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var domainUri = SteamDomains.GetDomain(domain);
|
||||
var data = new Dictionary<string, string>
|
||||
{
|
||||
{"redir", domainUri}
|
||||
};
|
||||
var cont = new FormUrlEncodedContent(data);
|
||||
var resp = await client.PostAsync("https://login.steampowered.com/jwt/ajaxrefresh", cont, cancellationToken);
|
||||
var respStr = await resp.EnsureSuccessStatusCode().Content.ReadAsStringAsync(cancellationToken);
|
||||
var jwtRefresh = JsonConvert.DeserializeObject<JwtRefreshJson>(respStr);
|
||||
if (jwtRefresh?.Success != true)
|
||||
{
|
||||
Exception? inner = null;
|
||||
if (jwtRefresh?.Error != null)
|
||||
{
|
||||
var errorCode = jwtRefresh.Error.Value;
|
||||
var translated = SteamStatusCode.Translate<SteamStatusCode>(errorCode, out _);
|
||||
inner = new SteamStatusCodeException(translated, respStr);
|
||||
}
|
||||
throw new SessionInvalidException("AjaxRefresh was not successful. 'steamRefresh_steam' cookie is missing or refresh token is invalid", inner);
|
||||
|
||||
}
|
||||
|
||||
data = new Dictionary<string, string>()
|
||||
{
|
||||
{"steamID", jwtRefresh.SteamId.ToString()},
|
||||
{"nonce", jwtRefresh.Nonce},
|
||||
{"redir", jwtRefresh.Redir},
|
||||
{"auth", jwtRefresh.Auth},
|
||||
};
|
||||
|
||||
cont = new FormUrlEncodedContent(data);
|
||||
var update = await client.PostAsync(jwtRefresh.LoginUrl, cont, cancellationToken);
|
||||
var updateResp = await update.Content.ReadAsStringAsync(cancellationToken);
|
||||
if (updateResp != "{\"result\":1}")
|
||||
{
|
||||
throw new SessionInvalidException(
|
||||
"AjaxRefresh (set-token) response was not successful. Response string stored in Exception.Data")
|
||||
{
|
||||
Data = {{"Response", updateResp}}
|
||||
};
|
||||
}
|
||||
return SteamTokenHelper.ExtractJwtFromSetCookiesHeader(update.Headers);
|
||||
}
|
||||
|
||||
|
||||
private class JwtRefreshJson
|
||||
{
|
||||
[JsonProperty("success")] public bool Success { get; set; }
|
||||
[JsonProperty("login_url")] public string LoginUrl { get; set; } = string.Empty;
|
||||
[JsonProperty("steamID")] public long SteamId { get; set; }
|
||||
[JsonProperty("nonce")] public string Nonce { get; set; } = string.Empty;
|
||||
[JsonProperty("redir")] public string Redir { get; set; } = string.Empty;
|
||||
[JsonProperty("auth")] public string Auth { get; set; } = string.Empty;
|
||||
[JsonProperty("error")] public int? Error { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SteamLib.Authentication;
|
||||
using SteamLib.Core.Interfaces;
|
||||
using SteamLib.Exceptions;
|
||||
|
||||
namespace SteamLib.Login.Default;
|
||||
|
||||
[Obsolete("Method removed from Steam")]
|
||||
public class LoginExecutor
|
||||
{
|
||||
public static ILoginConsumer NullConsumer { get; } = new NullLoginConsumer();
|
||||
public ILoginConsumer Caller { get; }
|
||||
public HttpClient HttpClient { get; }
|
||||
public ILogger? Logger { get; init; }
|
||||
public IEmailProvider? EmailAuthProvider { get; init; }
|
||||
public ICaptchaResolver? CaptchaResolver { get; init; }
|
||||
public ISteamGuardProvider? SteamGuardProvider { get; init; }
|
||||
|
||||
private LoginExecutor(LoginExecutorOptions options)
|
||||
{
|
||||
Caller = options.Consumer;
|
||||
HttpClient = options.HttpClient;
|
||||
Logger = options.Logger;
|
||||
EmailAuthProvider = options.EmailAuthProvider;
|
||||
SteamGuardProvider = options.SteamGuardProvider;
|
||||
CaptchaResolver = options.CaptchaResolver;
|
||||
}
|
||||
|
||||
|
||||
public static async Task<TransferParameters> DoLogin(LoginExecutorOptions options, string username, string password, CancellationToken cancellationToken = default) //TODO: logs
|
||||
{
|
||||
var executor = new LoginExecutor(options);
|
||||
var client = executor.HttpClient;
|
||||
|
||||
LoginStage loginStage = new GetRsaStage(username);
|
||||
loginStage = await ((GetRsaStage)loginStage).Proceed(client, cancellationToken);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (loginStage is ReadyToLoginStage rdyToLoginStage)
|
||||
{
|
||||
loginStage = await rdyToLoginStage.Proceed(client, password, string.Empty, cancellationToken);
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
var twoFactorTry = 0;
|
||||
var emailTry = 0;
|
||||
while (loginStage.GetType() != typeof(LoginErrorStage) && loginStage is not LoginSuccessStage)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
switch (loginStage)
|
||||
{
|
||||
case CaptchaNeededStage captchaNeededStage:
|
||||
{
|
||||
if (executor.CaptchaResolver == null) throw new LoginException(LoginError.CaptchaRequired);
|
||||
var captchaText = await executor.CaptchaResolver.Resolve(captchaNeededStage.CaptchaImage, client);
|
||||
loginStage = await captchaNeededStage.Proceed(client, captchaText, cancellationToken);
|
||||
break;
|
||||
}
|
||||
case EmailAuthStage emailAuthStage:
|
||||
{
|
||||
if (executor.EmailAuthProvider == null) throw new LoginException(LoginError.EmailAuthRequired);
|
||||
if (emailTry > executor.EmailAuthProvider.MaxRetryCount) throw new LoginException(LoginError.InvalidEmailAuthCode);
|
||||
var code = await executor.EmailAuthProvider.GetEmailAuthCode(executor.Caller);
|
||||
loginStage = await emailAuthStage.Proceed(client, code, cancellationToken);
|
||||
emailTry++;
|
||||
break;
|
||||
}
|
||||
case TwoFactorStage twoFactorStage:
|
||||
{
|
||||
if (executor.SteamGuardProvider == null) throw new LoginException(LoginError.SteamGuardRequired);
|
||||
if (twoFactorTry > executor.SteamGuardProvider.MaxRetryCount) throw new LoginException(LoginError.InvalidTwoFactorCode);
|
||||
var twoFactor = await executor.SteamGuardProvider.GetSteamGuardCode(executor.Caller);
|
||||
loginStage = await twoFactorStage.Proceed(client, twoFactor, cancellationToken);
|
||||
twoFactorTry++;
|
||||
break;
|
||||
}
|
||||
case ReadyToLoginStage readyToLoginStage: //When captcha proceeded, stage goes there
|
||||
{
|
||||
loginStage = await readyToLoginStage.Proceed(client, password, string.Empty, cancellationToken);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(loginStage));
|
||||
}
|
||||
}
|
||||
if (loginStage is LoginErrorStage error)
|
||||
{
|
||||
var content = await error.Response.Content.ReadAsStringAsync(cancellationToken);
|
||||
if (content.Contains("The account name or password that you have entered is incorrect"))
|
||||
{
|
||||
throw new LoginException(LoginError.InvalidCredentials);
|
||||
}
|
||||
throw new LoginException(content);
|
||||
}
|
||||
|
||||
|
||||
if (loginStage is not LoginSuccessStage successStage)
|
||||
{
|
||||
throw new InvalidOperationException("Unexpected login stage at this point. " + loginStage.GetType())
|
||||
{
|
||||
Data = { { "stage", loginStage } }
|
||||
};
|
||||
}
|
||||
|
||||
return successStage.TransferParameters;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SteamLib.Core.Interfaces;
|
||||
|
||||
namespace SteamLib.Login.Default;
|
||||
|
||||
|
||||
public class LoginExecutorOptions
|
||||
{
|
||||
public ILoginConsumer Consumer { get; }
|
||||
public HttpClient HttpClient { get; }
|
||||
public ILogger? Logger { get; init; }
|
||||
public IEmailProvider? EmailAuthProvider { get; init; }
|
||||
public ICaptchaResolver? CaptchaResolver { get; init; }
|
||||
public ISteamGuardProvider? SteamGuardProvider { get; init; }
|
||||
public LoginExecutorOptions(ILoginConsumer consumer, HttpClient httpClient)
|
||||
{
|
||||
Consumer = consumer;
|
||||
HttpClient = httpClient;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SteamLib.Login.Default;
|
||||
|
||||
#pragma warning disable CS8618
|
||||
/// <summary>
|
||||
/// Class to Deserialize the json response strings after the login/>
|
||||
/// </summary>
|
||||
internal class LoginResultJson
|
||||
{
|
||||
[JsonProperty("success")] public bool Success { get; set; }
|
||||
[JsonProperty("message")] public string Message { get; set; }
|
||||
[JsonProperty("captcha_needed")] public bool CaptchaNeeded { get; set; }
|
||||
[JsonProperty("captcha_gid")] public string CaptchaGid { get; set; }
|
||||
[JsonProperty("emailauth_needed")] public bool EmailAuthNeeded { get; set; }
|
||||
[JsonProperty("emailsteamid")] public string EmailSteamId { get; set; }
|
||||
[JsonProperty("requires_twofactor")] public bool RequiresTwoFactor { get; set; }
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
using AchiesUtilities.Web.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SteamLib.Authentication;
|
||||
using SteamLib.Utility;
|
||||
|
||||
namespace SteamLib.Login.Default;
|
||||
|
||||
internal abstract class LoginStage
|
||||
{
|
||||
protected Dictionary<string, string> Data { get; }
|
||||
protected LoginStage()
|
||||
{
|
||||
Data = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
protected LoginStage(Dictionary<string, string> data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
protected bool CheckIfLoginCompleted(LoginResultJson json)
|
||||
{
|
||||
return !json.CaptchaNeeded && !json.EmailAuthNeeded && !json.RequiresTwoFactor && json.Success;
|
||||
}
|
||||
protected async Task<LoginResultJson> ConvertJson(HttpResponseMessage response)
|
||||
{
|
||||
response.EnsureSuccessStatusCode();
|
||||
var webResponseString = await response.Content.ReadAsStringAsync();
|
||||
return JsonConvert.DeserializeObject<LoginResultJson>(webResponseString)!;
|
||||
}
|
||||
protected async Task<LoginSuccessStage> CompleteLogin(HttpResponseMessage response)
|
||||
{
|
||||
var jsonStr = await response.Content.ReadAsStringAsync();
|
||||
var json = JObject.Parse(jsonStr);
|
||||
var transferParameters = json["transfer_parameters"]!.ToObject<TransferParameters>()!;
|
||||
return new LoginSuccessStage(transferParameters);
|
||||
}
|
||||
protected async Task<HttpResponseMessage> LoginRequest(HttpClient client, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await client.PostAsync("https://steamcommunity.com/login/dologin", new FormUrlEncodedContent(Data), cancellationToken);
|
||||
}
|
||||
}
|
||||
internal class LoginErrorStage : LoginStage
|
||||
{
|
||||
public readonly string ErrorString;
|
||||
public readonly int ErrorCode;
|
||||
public readonly LoginStage Stage;
|
||||
public readonly HttpResponseMessage Response;
|
||||
public LoginErrorStage(string errorString, HttpResponseMessage responseMessage, LoginStage stage)
|
||||
{
|
||||
ErrorString = errorString;
|
||||
Stage = stage;
|
||||
ErrorCode = Utilities.GetSuccessCode(responseMessage.Content.ReadAsStringSync());
|
||||
Response = responseMessage;
|
||||
}
|
||||
}
|
||||
internal class GetRsaStage : LoginStage
|
||||
{
|
||||
public GetRsaStage(Dictionary<string, string> data) : base(data) { }
|
||||
public GetRsaStage(string userName)
|
||||
{
|
||||
Data["username"] = userName;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns> <see cref="ReadyToLoginStage"/> if success</returns>
|
||||
public async Task<LoginStage> Proceed(HttpClient client, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var content = new FormUrlEncodedContent(Data);
|
||||
var response = await client.PostAsync("https://steamcommunity.com/login/getrsakey", content, cancellationToken);
|
||||
var responseString = await response.Content.ReadAsStringAsync(cancellationToken);
|
||||
var rsaJson = JsonConvert.DeserializeObject<RsaKeyJson>(responseString)!;
|
||||
if (!rsaJson.success)
|
||||
return new LoginErrorStage("Can't get RSA", response, this);
|
||||
|
||||
Data["rsatimestamp"] = rsaJson.timestamp;
|
||||
return new ReadyToLoginStage(Data, rsaJson.publickey_exp, rsaJson.publickey_mod);
|
||||
}
|
||||
|
||||
}
|
||||
internal class ReadyToLoginStage : LoginStage
|
||||
{
|
||||
private readonly string _publicKeyExp;
|
||||
private readonly string _publicKeyMod;
|
||||
internal ReadyToLoginStage(Dictionary<string, string> data, string publicKeyExp, string publicKeyMod) : base(data)
|
||||
{
|
||||
_publicKeyExp = publicKeyExp;
|
||||
_publicKeyMod = publicKeyMod;
|
||||
}
|
||||
|
||||
public async Task<LoginStage> Proceed(HttpClient client, string password, string loginFriendlyName, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var encryptedBase64Password = EncryptionHelper.ToBase64EncryptedPassword(_publicKeyExp, _publicKeyMod, password);
|
||||
var unixTimestamp = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
Data["password"] = encryptedBase64Password;
|
||||
Data["remember_login"] = "true";
|
||||
Data["loginfriendlyname"] = loginFriendlyName;
|
||||
Data["donotcache"] = unixTimestamp + "000"; // Added three "0"'s because Steam has a weird unix timestamp interpretation.
|
||||
|
||||
_ = await client.GetAsync("https://steamcommunity.com/", cancellationToken);
|
||||
var webResponse = await LoginRequest(client, cancellationToken);
|
||||
var result = await ConvertJson(webResponse);
|
||||
|
||||
if (CheckIfLoginCompleted(result))
|
||||
{
|
||||
return await CompleteLogin(webResponse);
|
||||
}
|
||||
|
||||
if (result.CaptchaNeeded)
|
||||
{
|
||||
return new CaptchaNeededStage(Data, result.CaptchaGid);
|
||||
}
|
||||
|
||||
if (result.EmailAuthNeeded)
|
||||
{
|
||||
return new EmailAuthStage(Data);
|
||||
}
|
||||
|
||||
if (result.RequiresTwoFactor)
|
||||
{
|
||||
return new TwoFactorStage(Data);
|
||||
}
|
||||
|
||||
return new LoginErrorStage("Can't proceed login.", webResponse, this);
|
||||
}
|
||||
}
|
||||
internal class TwoFactorStage : LoginStage
|
||||
{
|
||||
internal TwoFactorStage(Dictionary<string, string> data) : base(data) { }
|
||||
public async Task<LoginStage> Proceed(HttpClient client, string twoFactorCode, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Data["twofactorcode"] = twoFactorCode;
|
||||
var webResponse = await LoginRequest(client, cancellationToken);
|
||||
var result = await ConvertJson(webResponse);
|
||||
|
||||
if (CheckIfLoginCompleted(result))
|
||||
{
|
||||
return await CompleteLogin(webResponse);
|
||||
}
|
||||
|
||||
if (result.CaptchaNeeded)
|
||||
{
|
||||
return new CaptchaNeededStage(Data, result.CaptchaGid);
|
||||
}
|
||||
|
||||
if (result.RequiresTwoFactor)
|
||||
{
|
||||
return new TwoFactorStage(Data);
|
||||
}
|
||||
|
||||
return new LoginErrorStage("Can't proceed login. Bad TwoFactor code", webResponse, this);
|
||||
}
|
||||
|
||||
}
|
||||
internal class EmailAuthStage : LoginStage
|
||||
{
|
||||
internal EmailAuthStage(Dictionary<string, string> data) : base(data) { }
|
||||
|
||||
public async Task<LoginStage> Proceed(HttpClient client, string emailCode, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Data["emailauth"] = emailCode;
|
||||
var webResponse = await LoginRequest(client, cancellationToken);
|
||||
var result = await ConvertJson(webResponse);
|
||||
|
||||
if (CheckIfLoginCompleted(result))
|
||||
{
|
||||
return await CompleteLogin(webResponse);
|
||||
}
|
||||
|
||||
if (result.CaptchaNeeded)
|
||||
{
|
||||
return new CaptchaNeededStage(Data, result.CaptchaGid);
|
||||
}
|
||||
|
||||
if (result.EmailAuthNeeded)
|
||||
{
|
||||
return new EmailAuthStage(Data);
|
||||
}
|
||||
|
||||
|
||||
return new LoginErrorStage("Can't proceed login. Bad Email code", webResponse, this);
|
||||
}
|
||||
}
|
||||
internal class CaptchaNeededStage : LoginStage
|
||||
{
|
||||
internal Uri CaptchaImage { get; }
|
||||
public CaptchaNeededStage(Dictionary<string, string> data, string captchaGid) : base(data)
|
||||
{
|
||||
captchaGid = Uri.EscapeDataString(captchaGid);
|
||||
Data["captchagid"] = captchaGid;
|
||||
CaptchaImage = new Uri("https://steamcommunity.com/login/rendercaptcha?gid=" + captchaGid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="captchaText"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns><see cref="ReadyToLoginStage"/> or <see cref="LoginErrorStage"/></returns>
|
||||
public async Task<LoginStage> Proceed(HttpClient client, string captchaText, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Data["captcha_text"] = captchaText;
|
||||
//When captcha required we need to do login from start
|
||||
|
||||
var rsaStage = new GetRsaStage(Data);
|
||||
var res = await rsaStage.Proceed(client, cancellationToken);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
internal class LoginSuccessStage : LoginStage
|
||||
{
|
||||
public TransferParameters TransferParameters { get; }
|
||||
public LoginSuccessStage(TransferParameters transferParameters)
|
||||
{
|
||||
TransferParameters = transferParameters;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using SteamLib.Core.Interfaces;
|
||||
|
||||
namespace SteamLib.Login.Default;
|
||||
|
||||
internal class NullLoginConsumer : ILoginConsumer
|
||||
{
|
||||
public string FriendlyName { get; } = "null";
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable IdentifierTypo
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace SteamLib.Login.Default;
|
||||
|
||||
/// <summary>
|
||||
/// Class to Deserialize the json response strings of the getResKey request/>
|
||||
/// </summary>
|
||||
internal class RsaKeyJson
|
||||
{
|
||||
public bool success { get; set; }
|
||||
public string publickey_mod { get; set; }
|
||||
public string publickey_exp { get; set; }
|
||||
public string timestamp { get; set; }
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SteamLib.Authentication.LoginV2;
|
||||
|
||||
class FinalizeLoginJson
|
||||
{
|
||||
[JsonProperty("steamID")]
|
||||
public ulong SteamId { get; set; }
|
||||
|
||||
[JsonProperty("transfer_info")]
|
||||
public List<TransferInfo> TransferInfo { get; set; }
|
||||
}
|
||||
|
||||
class TransferInfo
|
||||
{
|
||||
[JsonProperty("url")]
|
||||
public string Url { get; set; }
|
||||
|
||||
[JsonProperty("params")]
|
||||
public TransferInfoParams TransferInfoParams { get; set; }
|
||||
}
|
||||
|
||||
|
||||
class TransferInfoParams
|
||||
{
|
||||
[JsonProperty("nonce")]
|
||||
public string Nonce { get; set; }
|
||||
|
||||
[JsonProperty("auth")]
|
||||
public string Auth { get; set; }
|
||||
}
|
||||
@@ -1,246 +0,0 @@
|
||||
using AchiesUtilities.Web.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SteamLib.Account;
|
||||
using SteamLib.Core;
|
||||
using SteamLib.Core.Enums;
|
||||
using SteamLib.Core.Interfaces;
|
||||
using SteamLib.Core.StatusCodes;
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.Login.Default;
|
||||
using SteamLib.ProtoCore;
|
||||
using SteamLib.ProtoCore.Enums;
|
||||
using SteamLib.ProtoCore.Exceptions;
|
||||
using SteamLib.ProtoCore.Services;
|
||||
using SteamLib.Utility;
|
||||
using SteamLib.Web;
|
||||
|
||||
namespace SteamLib.Authentication.LoginV2;
|
||||
|
||||
public class LoginV2Executor
|
||||
{
|
||||
public static ILoginConsumer NullConsumer { get; } = new NullLoginConsumer();
|
||||
public ILoginConsumer Caller { get; }
|
||||
public HttpClient HttpClient { get; }
|
||||
public ILogger? Logger { get; init; }
|
||||
public IEmailProvider? EmailAuthProvider { get; init; }
|
||||
public ICaptchaResolver? CaptchaResolver { get; init; }
|
||||
public ISteamGuardProvider? SteamGuardProvider { get; init; }
|
||||
public string WebsiteId { get; init; }
|
||||
public DeviceDetails DeviceDetails { get; init; }
|
||||
private LoginV2Executor(LoginV2ExecutorOptions options)
|
||||
{
|
||||
Caller = options.Consumer;
|
||||
HttpClient = options.HttpClient;
|
||||
Logger = options.Logger;
|
||||
EmailAuthProvider = options.EmailAuthProvider;
|
||||
SteamGuardProvider = options.SteamGuardProvider;
|
||||
WebsiteId = options.GetWebsiteIdOrDefault();
|
||||
DeviceDetails = options.DeviceDetails ?? DeviceDetails.CreateDefault();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Do login on <see href="https://steamcommunity.com/">SteamCommunity</see>.<br/>
|
||||
/// Some functions requires proper SessionId. But <see cref="SessionData"/> contains only SteamCommunity related SessionId and some functions on other services may not work
|
||||
/// </summary>
|
||||
/// <param name="options"></param>
|
||||
/// <param name="username"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns><see cref="SessionData"/> or <see cref="MobileSessionData"/> depending on which token type is returned</returns>
|
||||
/// <exception cref="LoginException"></exception>
|
||||
/// <exception cref="EResultException"></exception>
|
||||
/// <exception cref="NotSupportedException"></exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public static async Task<ISessionData> DoLogin(LoginV2ExecutorOptions options, string username, string password, CancellationToken cancellationToken = default) //TODO: logs
|
||||
{
|
||||
var executor = new LoginV2Executor(options);
|
||||
var client = executor.HttpClient;
|
||||
|
||||
var globalData = await SteamWebApi.GetMarketGlobalInfo(client, cancellationToken);
|
||||
var sessionId = globalData.SessionId;
|
||||
|
||||
var rsgMsg = new GetPasswordRSAPublicKey_Request
|
||||
{
|
||||
AccountName = username
|
||||
};
|
||||
var rsaResp = await client.GetProto<GetPasswordRSAPublicKey_Response>(
|
||||
"https://api.steampowered.com/IAuthenticationService/GetPasswordRSAPublicKey/v1", rsgMsg, cancellationToken: cancellationToken);
|
||||
|
||||
|
||||
var encodedPassword = EncryptionHelper.ToBase64EncryptedPassword(rsaResp.PublickKeyExp, rsaResp.PublickKeyMod, password);
|
||||
|
||||
|
||||
var beginAuthMsg = new BeginAuthSessionViaCredentials_Request
|
||||
{
|
||||
DeviceFriendlyName = string.Empty,
|
||||
AccountName = username,
|
||||
EncryptedPassword = encodedPassword,
|
||||
EncryptionTimestamp = rsaResp.Timestamp,
|
||||
RememberLogin = true,
|
||||
PlatformType = executor.DeviceDetails.PlatformType,
|
||||
Persistence = 1,
|
||||
WebsiteId = executor.WebsiteId,
|
||||
DeviceDetails = executor.DeviceDetails,
|
||||
};
|
||||
|
||||
BeginAuthSessionViaCredentials_Response beginAuthResp;
|
||||
try
|
||||
{
|
||||
beginAuthResp = await client.PostProto<BeginAuthSessionViaCredentials_Response>(
|
||||
"https://api.steampowered.com/IAuthenticationService/BeginAuthSessionViaCredentials/v1", beginAuthMsg, cancellationToken: cancellationToken);
|
||||
|
||||
}
|
||||
catch (EResultException ex)
|
||||
when (ex.Result == EResult.InvalidPassword)
|
||||
{
|
||||
throw new LoginException(LoginError.InvalidCredentials);
|
||||
}
|
||||
|
||||
|
||||
var clientId = beginAuthResp.ClientId;
|
||||
var steamId = (long)beginAuthResp.Steamid;
|
||||
|
||||
var conf = beginAuthResp.AllowedConfirmations.FirstOrDefault(c =>
|
||||
c.ConfirmationType is EAuthSessionGuardType.EmailCode or EAuthSessionGuardType.DeviceCode);
|
||||
|
||||
conf ??= beginAuthResp.AllowedConfirmations.FirstOrDefault();
|
||||
|
||||
switch (conf?.ConfirmationType)
|
||||
{
|
||||
case EAuthSessionGuardType.None:
|
||||
break;
|
||||
case EAuthSessionGuardType.DeviceCode:
|
||||
case EAuthSessionGuardType.EmailCode:
|
||||
await UpdateWithCode(executor, clientId, (ulong)steamId, conf.ConfirmationType);
|
||||
break;
|
||||
case EAuthSessionGuardType.Unknown:
|
||||
case EAuthSessionGuardType.DeviceConfirmation:
|
||||
case EAuthSessionGuardType.EmailConfirmation:
|
||||
case EAuthSessionGuardType.MachineToken:
|
||||
case EAuthSessionGuardType.LegacyMachineAuth:
|
||||
throw new NotSupportedException(
|
||||
$"Auth confirmation type of {conf.ConfirmationType} is not implemented yet");
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(conf.ConfirmationType), conf?.ConfirmationType, "Unknown confirmation type or null");
|
||||
}
|
||||
|
||||
var pollSessionMsg = new PollAuthSessionStatus_Request
|
||||
{
|
||||
ClientId = clientId,
|
||||
RequestId = beginAuthResp.RequestId,
|
||||
|
||||
};
|
||||
|
||||
var pollResp =
|
||||
await client.PostProto<PollAuthSessionStatus_Response>(
|
||||
"https://api.steampowered.com/IAuthenticationService/PollAuthSessionStatus/v1", pollSessionMsg, cancellationToken: cancellationToken);
|
||||
|
||||
SteamAuthToken refreshToken;
|
||||
try
|
||||
{
|
||||
refreshToken = SteamTokenHelper.Parse(pollResp.RefreshToken);
|
||||
if (refreshToken.Type is not (SteamAccessTokenType.Refresh or SteamAccessTokenType.MobileRefresh))
|
||||
throw new ArgumentException("Refresh token must be of type Refresh or MobileRefresh. No 'renew' audience found in JWT.",
|
||||
nameof(pollResp.RefreshToken)); //Argument exception for less code
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
throw new LoginException(null,
|
||||
"Steam returned invalid refresh token or it's schema was unsupported. See inner exception for more details",
|
||||
LoginError.UndefinedError, ex);
|
||||
}
|
||||
|
||||
var data = new Dictionary<string, string>
|
||||
{
|
||||
{"nonce", pollResp.RefreshToken},
|
||||
{"sessionid", sessionId}
|
||||
};
|
||||
|
||||
var finalize = await client.PostAsync("https://login.steampowered.com/jwt/finalizelogin", new FormUrlEncodedContent(data), cancellationToken);
|
||||
var finalizeContent = await finalize.EnsureSuccessStatusCode().Content.ReadAsStringAsync(cancellationToken);
|
||||
|
||||
var finalizeResp =
|
||||
HealthMonitor.LogOnException(finalizeContent, () => JsonConvert.DeserializeObject<FinalizeLoginJson>(finalizeContent)!);
|
||||
|
||||
|
||||
List<SteamAuthToken> tokens = new();
|
||||
foreach (var transferInfo in finalizeResp.TransferInfo)
|
||||
{
|
||||
var transferData = new Dictionary<string, string>
|
||||
{
|
||||
{"nonce", transferInfo.TransferInfoParams.Nonce},
|
||||
{"auth", transferInfo.TransferInfoParams.Auth},
|
||||
{"steamID", steamId.ToString()}
|
||||
};
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var req = new HttpRequestMessage(HttpMethod.Post, transferInfo.Url);
|
||||
req.Content = new FormUrlEncodedContent(transferData);
|
||||
req.Headers.Referrer = SteamDomains.GetDomainUri(SteamDomain.Store);
|
||||
var transferResp = await client.SendAsync(req, cancellationToken);
|
||||
var transferContent = await transferResp.ReadAsStringEnsureSuccessAsync(cancellationToken);
|
||||
var status = JObject.Parse(transferContent);
|
||||
var result = status["result"]?.Value<int>();
|
||||
if(result != null)
|
||||
SteamStatusCode.ValidateSuccessOrThrow(result.Value); //TODO: Fix steam.tv token transfer (result always 8). But who really cares..
|
||||
|
||||
var tokenStr = SteamTokenHelper.ExtractJwtFromSetCookiesHeader(transferResp.Headers);
|
||||
var token = SteamTokenHelper.Parse(tokenStr);
|
||||
tokens.Add(token);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
executor.Logger?.Log(LogLevel.Warning, ex, "Can't transfer tokens for URI: {uri}", transferInfo.Url);
|
||||
}
|
||||
}
|
||||
|
||||
var accessToken = SteamTokenHelper.Parse(pollResp.AccessToken);
|
||||
|
||||
if (accessToken.Type == SteamAccessTokenType.Mobile)
|
||||
{
|
||||
return new MobileSessionData(sessionId, SteamId.FromSteam64(steamId), refreshToken, accessToken, tokens);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new SessionData(sessionId, SteamId.FromSteam64(steamId), refreshToken, tokens);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static async Task UpdateWithCode(LoginV2Executor executor, ulong clientId, ulong steamId, EAuthSessionGuardType guardType)
|
||||
{
|
||||
string? code;
|
||||
if (guardType == EAuthSessionGuardType.DeviceCode)
|
||||
{
|
||||
if(executor.SteamGuardProvider != null)
|
||||
code = await executor.SteamGuardProvider.GetSteamGuardCode(executor.Caller);
|
||||
else
|
||||
{
|
||||
throw new LoginException(LoginError.SteamGuardRequired);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var t = executor.EmailAuthProvider?.GetEmailAuthCode(executor.Caller) ??
|
||||
throw new LoginException(LoginError.EmailAuthRequired);
|
||||
code = await t;
|
||||
}
|
||||
var updateCodeMsg = new UpdateAuthSessionWithSteamGuardCode_Request
|
||||
{
|
||||
ClientId = clientId,
|
||||
Code = code,
|
||||
CodeType = guardType,
|
||||
Steamid = steamId
|
||||
};
|
||||
|
||||
await executor.HttpClient.PostProtoEnsureSuccess(new Uri("https://api.steampowered.com/IAuthenticationService/UpdateAuthSessionWithSteamGuardCode/v1"), updateCodeMsg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SteamLib.Core.Interfaces;
|
||||
using SteamLib.ProtoCore.Enums;
|
||||
using SteamLib.ProtoCore.Services;
|
||||
|
||||
namespace SteamLib.Authentication.LoginV2;
|
||||
|
||||
public class LoginV2ExecutorOptions
|
||||
{
|
||||
public ILoginConsumer Consumer { get; }
|
||||
public HttpClient HttpClient { get; }
|
||||
public ILogger? Logger { get; init; }
|
||||
public IEmailProvider? EmailAuthProvider { get; init; }
|
||||
public ISteamGuardProvider? SteamGuardProvider { get; init; }
|
||||
public DeviceDetails? DeviceDetails { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the website id that the login will be performed for.
|
||||
/// Known values are "Unknown", "Client", "Mobile", "Website", "Store", "Community", "Partner", "SteamStats".
|
||||
/// Default value will be set to "Community"
|
||||
/// </summary>
|
||||
/// <value>The website id.</value>
|
||||
public string? WebsiteId { get; init; }
|
||||
public LoginV2ExecutorOptions(ILoginConsumer consumer, HttpClient httpClient)
|
||||
{
|
||||
Consumer = consumer;
|
||||
HttpClient = httpClient;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string GetWebsiteIdOrDefault()
|
||||
{
|
||||
return WebsiteId ?? "Community";
|
||||
}
|
||||
|
||||
|
||||
public static DeviceDetails GetMobileDefaultDevice() //FORTEST
|
||||
{
|
||||
return new DeviceDetails("Pixel 6 Pro", EAuthTokenPlatformType.MobileApp, -500, 528);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SteamLib.Authentication;
|
||||
|
||||
#pragma warning disable CS8618
|
||||
public class TransferParameters
|
||||
{
|
||||
[JsonProperty("steamid")]
|
||||
public long SteamId { get; set; }
|
||||
|
||||
[JsonProperty("token_secure")]
|
||||
public string TokenSecure { get; set; }
|
||||
|
||||
[JsonProperty("auth")]
|
||||
public string Auth { get; set; }
|
||||
|
||||
[JsonProperty("remember_login")]
|
||||
public bool RememberLogin { get; set; }
|
||||
|
||||
[JsonProperty("webcookie")]
|
||||
public string WebCookie { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,758 +0,0 @@
|
||||
// ReSharper disable All
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace SteamLib.Core.Enums;
|
||||
|
||||
|
||||
public enum Country
|
||||
{
|
||||
|
||||
Afghanistan,
|
||||
Aland_Islands,
|
||||
Albania,
|
||||
Algeria,
|
||||
American_Samoa,
|
||||
Andorra,
|
||||
Angola,
|
||||
Anguilla,
|
||||
Antigua_and_Barbuda,
|
||||
Argentina,
|
||||
Armenia,
|
||||
Aruba,
|
||||
Australia,
|
||||
Austria,
|
||||
Azerbaijan,
|
||||
Bahamas,
|
||||
Bahrain,
|
||||
Bangladesh,
|
||||
Barbados,
|
||||
Belarus,
|
||||
Belgium,
|
||||
Belize,
|
||||
Bhutan,
|
||||
Bolivia,
|
||||
Bosnia_and_Herzegovina,
|
||||
Botswana,
|
||||
Brazil,
|
||||
Brunei_Darussalam,
|
||||
Bulgaria,
|
||||
Burundi,
|
||||
Cambodia,
|
||||
Cameroon,
|
||||
Canada,
|
||||
Cape_Verde,
|
||||
Cayman_Islands,
|
||||
Chad,
|
||||
Chile,
|
||||
China,
|
||||
Colombia,
|
||||
Congo,
|
||||
Costa_Rica,
|
||||
Cote_d_Ivoire,
|
||||
Croatia,
|
||||
Cyprus,
|
||||
Czech_Republic,
|
||||
Denmark,
|
||||
Dominica,
|
||||
Dominican_Republic,
|
||||
Ecuador,
|
||||
Egypt,
|
||||
El_Salvador,
|
||||
Estonia,
|
||||
Eswatini,
|
||||
Ethiopia,
|
||||
Faroe_Islands,
|
||||
Finland,
|
||||
France,
|
||||
French_Guiana,
|
||||
French_Polynesia,
|
||||
Gabon,
|
||||
Georgia,
|
||||
Germany,
|
||||
Ghana,
|
||||
Gibraltar,
|
||||
Greece,
|
||||
Greenland,
|
||||
Grenada,
|
||||
Guadeloupe,
|
||||
Guam,
|
||||
Guatemala,
|
||||
Guernsey,
|
||||
Guyana,
|
||||
Haiti,
|
||||
Honduras,
|
||||
Hong_Kong,
|
||||
Hungary,
|
||||
Iceland,
|
||||
India,
|
||||
Indonesia,
|
||||
Iran,
|
||||
Iraq,
|
||||
Ireland,
|
||||
Isle_of_Man,
|
||||
Israel,
|
||||
Italy,
|
||||
Jamaica,
|
||||
Japan,
|
||||
Jersey,
|
||||
Jordan,
|
||||
Kazakhstan,
|
||||
Kenya,
|
||||
Korea,
|
||||
Kuwait,
|
||||
Kyrgyzstan,
|
||||
Laos,
|
||||
Latvia,
|
||||
Lebanon,
|
||||
Libya,
|
||||
Liechtenstein,
|
||||
Lithuania,
|
||||
Luxembourg,
|
||||
Macau,
|
||||
Macedonia,
|
||||
Madagascar,
|
||||
Malaysia,
|
||||
Maldives,
|
||||
Mali,
|
||||
Malta,
|
||||
Martinique,
|
||||
Mauritius,
|
||||
Mayotte,
|
||||
Mexico,
|
||||
Moldova,
|
||||
Monaco,
|
||||
Mongolia,
|
||||
Montenegro,
|
||||
Morocco,
|
||||
Mozambique,
|
||||
Myanmar,
|
||||
Namibia,
|
||||
Nepal,
|
||||
Netherlands,
|
||||
New_Zealand,
|
||||
Nicaragua,
|
||||
Nigeria,
|
||||
Northern_Mariana_Islands,
|
||||
Norway,
|
||||
Oman,
|
||||
Pakistan,
|
||||
Palestinian_Territory,
|
||||
Panama,
|
||||
Papua_New_Guinea,
|
||||
Paraguay,
|
||||
Peru,
|
||||
Philippines,
|
||||
Poland,
|
||||
Portugal,
|
||||
Puerto_Rico,
|
||||
Qatar,
|
||||
Reunion,
|
||||
Romania,
|
||||
Russian_Federation,
|
||||
Rwanda,
|
||||
Saint_Kitts_and_Nevis,
|
||||
Saint_Lucia,
|
||||
Saint_Vincent_and_the_Grenadines,
|
||||
Saudi_Arabia,
|
||||
Senegal,
|
||||
Serbia,
|
||||
Seychelles,
|
||||
Singapore,
|
||||
Slovakia,
|
||||
Slovenia,
|
||||
South_Africa,
|
||||
Spain,
|
||||
Sri_Lanka,
|
||||
Sudan,
|
||||
Suriname,
|
||||
Sweden,
|
||||
Switzerland,
|
||||
Taiwan,
|
||||
Tajikistan,
|
||||
Tanzania,
|
||||
Thailand,
|
||||
Togo,
|
||||
Trinidad_and_Tobago,
|
||||
Tunisia,
|
||||
Turkey,
|
||||
Turkmenistan,
|
||||
Turks_and_Caicos_Islands,
|
||||
Uganda,
|
||||
Ukraine,
|
||||
United_Arab_Emirates,
|
||||
United_Kingdom,
|
||||
United_States,
|
||||
Uruguay,
|
||||
Uzbekistan,
|
||||
Venezuela,
|
||||
Viet_Nam,
|
||||
Virgin_Islands,
|
||||
Yemen,
|
||||
Zambia,
|
||||
Zimbabwe,
|
||||
|
||||
}
|
||||
public static class CountryResolver
|
||||
{
|
||||
public static IReadOnlyDictionary<Country, string> ResolveString { get; } = new Dictionary<Country, string>
|
||||
{
|
||||
{ Country.Afghanistan , "Afghanistan" },
|
||||
{ Country.Aland_Islands , "Aland Islands" },
|
||||
{ Country.Albania , "Albania" },
|
||||
{ Country.Algeria , "Algeria" },
|
||||
{ Country.American_Samoa , "American Samoa" },
|
||||
{ Country.Andorra , "Andorra" },
|
||||
{ Country.Angola , "Angola" },
|
||||
{ Country.Anguilla , "Anguilla" },
|
||||
{ Country.Antigua_and_Barbuda , "Antigua and Barbuda" },
|
||||
{ Country.Argentina , "Argentina" },
|
||||
{ Country.Armenia , "Armenia" },
|
||||
{ Country.Aruba , "Aruba" },
|
||||
{ Country.Australia , "Australia" },
|
||||
{ Country.Austria , "Austria" },
|
||||
{ Country.Azerbaijan , "Azerbaijan" },
|
||||
{ Country.Bahamas , "Bahamas" },
|
||||
{ Country.Bahrain , "Bahrain" },
|
||||
{ Country.Bangladesh , "Bangladesh" },
|
||||
{ Country.Barbados , "Barbados" },
|
||||
{ Country.Belarus , "Belarus" },
|
||||
{ Country.Belgium , "Belgium" },
|
||||
{ Country.Belize , "Belize" },
|
||||
{ Country.Bhutan , "Bhutan" },
|
||||
{ Country.Bolivia , "Bolivia" },
|
||||
{ Country.Bosnia_and_Herzegovina , "Bosnia and Herzegovina" },
|
||||
{ Country.Botswana , "Botswana" },
|
||||
{ Country.Brazil , "Brazil" },
|
||||
{ Country.Brunei_Darussalam , "Brunei Darussalam" },
|
||||
{ Country.Bulgaria , "Bulgaria" },
|
||||
{ Country.Burundi , "Burundi" },
|
||||
{ Country.Cambodia , "Cambodia" },
|
||||
{ Country.Cameroon , "Cameroon" },
|
||||
{ Country.Canada , "Canada" },
|
||||
{ Country.Cape_Verde , "Cape Verde" },
|
||||
{ Country.Cayman_Islands , "Cayman Islands" },
|
||||
{ Country.Chad , "Chad" },
|
||||
{ Country.Chile , "Chile" },
|
||||
{ Country.China , "China" },
|
||||
{ Country.Colombia , "Colombia" },
|
||||
{ Country.Congo , "Congo, the Democratic Republic of the" },
|
||||
{ Country.Costa_Rica , "Costa Rica" },
|
||||
{ Country.Cote_d_Ivoire , "Cote d'Ivoire" },
|
||||
{ Country.Croatia , "Croatia" },
|
||||
{ Country.Cyprus , "Cyprus" },
|
||||
{ Country.Czech_Republic , "Czech Republic" },
|
||||
{ Country.Denmark , "Denmark" },
|
||||
{ Country.Dominica , "Dominica" },
|
||||
{ Country.Dominican_Republic , "Dominican Republic" },
|
||||
{ Country.Ecuador , "Ecuador" },
|
||||
{ Country.Egypt , "Egypt" },
|
||||
{ Country.El_Salvador , "El Salvador" },
|
||||
{ Country.Estonia , "Estonia" },
|
||||
{ Country.Eswatini , "Eswatini" },
|
||||
{ Country.Ethiopia , "Ethiopia" },
|
||||
{ Country.Faroe_Islands , "Faroe Islands" },
|
||||
{ Country.Finland , "Finland" },
|
||||
{ Country.France , "France" },
|
||||
{ Country.French_Guiana , "French Guiana" },
|
||||
{ Country.French_Polynesia , "French Polynesia" },
|
||||
{ Country.Gabon , "Gabon" },
|
||||
{ Country.Georgia , "Georgia" },
|
||||
{ Country.Germany , "Germany" },
|
||||
{ Country.Ghana , "Ghana" },
|
||||
{ Country.Gibraltar , "Gibraltar" },
|
||||
{ Country.Greece , "Greece" },
|
||||
{ Country.Greenland , "Greenland" },
|
||||
{ Country.Grenada , "Grenada" },
|
||||
{ Country.Guadeloupe , "Guadeloupe" },
|
||||
{ Country.Guam , "Guam" },
|
||||
{ Country.Guatemala , "Guatemala" },
|
||||
{ Country.Guernsey , "Guernsey" },
|
||||
{ Country.Guyana , "Guyana" },
|
||||
{ Country.Haiti , "Haiti" },
|
||||
{ Country.Honduras , "Honduras" },
|
||||
{ Country.Hong_Kong , "Hong Kong" },
|
||||
{ Country.Hungary , "Hungary" },
|
||||
{ Country.Iceland , "Iceland" },
|
||||
{ Country.India , "India" },
|
||||
{ Country.Indonesia , "Indonesia" },
|
||||
{ Country.Iran , "Iran" },
|
||||
{ Country.Iraq , "Iraq" },
|
||||
{ Country.Ireland , "Ireland" },
|
||||
{ Country.Isle_of_Man , "Isle of Man" },
|
||||
{ Country.Israel , "Israel" },
|
||||
{ Country.Italy , "Italy" },
|
||||
{ Country.Jamaica , "Jamaica" },
|
||||
{ Country.Japan , "Japan" },
|
||||
{ Country.Jersey , "Jersey" },
|
||||
{ Country.Jordan , "Jordan" },
|
||||
{ Country.Kazakhstan , "Kazakhstan" },
|
||||
{ Country.Kenya , "Kenya" },
|
||||
{ Country.Korea , "Korea, Republic of" },
|
||||
{ Country.Kuwait , "Kuwait" },
|
||||
{ Country.Kyrgyzstan , "Kyrgyzstan" },
|
||||
{ Country.Laos , "Lao People's Democratic Republic" },
|
||||
{ Country.Latvia , "Latvia" },
|
||||
{ Country.Lebanon , "Lebanon" },
|
||||
{ Country.Libya , "Libya" },
|
||||
{ Country.Liechtenstein , "Liechtenstein" },
|
||||
{ Country.Lithuania , "Lithuania" },
|
||||
{ Country.Luxembourg , "Luxembourg" },
|
||||
{ Country.Macau , "Macau" },
|
||||
{ Country.Macedonia , "Macedonia, the former Yugoslav Republic of" },
|
||||
{ Country.Madagascar , "Madagascar" },
|
||||
{ Country.Malaysia , "Malaysia" },
|
||||
{ Country.Maldives , "Maldives" },
|
||||
{ Country.Mali , "Mali" },
|
||||
{ Country.Malta , "Malta" },
|
||||
{ Country.Martinique , "Martinique" },
|
||||
{ Country.Mauritius , "Mauritius" },
|
||||
{ Country.Mayotte , "Mayotte" },
|
||||
{ Country.Mexico , "Mexico" },
|
||||
{ Country.Moldova , "Moldova, Republic of" },
|
||||
{ Country.Monaco , "Monaco" },
|
||||
{ Country.Mongolia , "Mongolia" },
|
||||
{ Country.Montenegro , "Montenegro" },
|
||||
{ Country.Morocco , "Morocco" },
|
||||
{ Country.Mozambique , "Mozambique" },
|
||||
{ Country.Myanmar , "Myanmar" },
|
||||
{ Country.Namibia , "Namibia" },
|
||||
{ Country.Nepal , "Nepal" },
|
||||
{ Country.Netherlands , "Netherlands" },
|
||||
{ Country.New_Zealand , "New Zealand" },
|
||||
{ Country.Nicaragua , "Nicaragua" },
|
||||
{ Country.Nigeria , "Nigeria" },
|
||||
{ Country.Northern_Mariana_Islands , "Northern Mariana Islands" },
|
||||
{ Country.Norway , "Norway" },
|
||||
{ Country.Oman , "Oman" },
|
||||
{ Country.Pakistan , "Pakistan" },
|
||||
{ Country.Palestinian_Territory , "Palestinian Territory, Occupied" },
|
||||
{ Country.Panama , "Panama" },
|
||||
{ Country.Papua_New_Guinea , "Papua New Guinea" },
|
||||
{ Country.Paraguay , "Paraguay" },
|
||||
{ Country.Peru , "Peru" },
|
||||
{ Country.Philippines , "Philippines" },
|
||||
{ Country.Poland , "Poland" },
|
||||
{ Country.Portugal , "Portugal" },
|
||||
{ Country.Puerto_Rico , "Puerto Rico" },
|
||||
{ Country.Qatar , "Qatar" },
|
||||
{ Country.Reunion , "Reunion" },
|
||||
{ Country.Romania , "Romania" },
|
||||
{ Country.Russian_Federation , "Russian Federation" },
|
||||
{ Country.Rwanda , "Rwanda" },
|
||||
{ Country.Saint_Kitts_and_Nevis , "Saint Kitts and Nevis" },
|
||||
{ Country.Saint_Lucia , "Saint Lucia" },
|
||||
{ Country.Saint_Vincent_and_the_Grenadines , "Saint Vincent and the Grenadines" },
|
||||
{ Country.Saudi_Arabia , "Saudi Arabia" },
|
||||
{ Country.Senegal , "Senegal" },
|
||||
{ Country.Serbia , "Serbia" },
|
||||
{ Country.Seychelles , "Seychelles" },
|
||||
{ Country.Singapore , "Singapore" },
|
||||
{ Country.Slovakia , "Slovakia" },
|
||||
{ Country.Slovenia , "Slovenia" },
|
||||
{ Country.South_Africa , "South Africa" },
|
||||
{ Country.Spain , "Spain" },
|
||||
{ Country.Sri_Lanka , "Sri Lanka" },
|
||||
{ Country.Sudan , "Sudan" },
|
||||
{ Country.Suriname , "Suriname" },
|
||||
{ Country.Sweden , "Sweden" },
|
||||
{ Country.Switzerland , "Switzerland" },
|
||||
{ Country.Taiwan , "Taiwan" },
|
||||
{ Country.Tajikistan , "Tajikistan" },
|
||||
{ Country.Tanzania , "Tanzania, United Republic of" },
|
||||
{ Country.Thailand , "Thailand" },
|
||||
{ Country.Togo , "Togo" },
|
||||
{ Country.Trinidad_and_Tobago , "Trinidad and Tobago" },
|
||||
{ Country.Tunisia , "Tunisia" },
|
||||
{ Country.Turkey , "Turkey" },
|
||||
{ Country.Turkmenistan , "Turkmenistan" },
|
||||
{ Country.Turks_and_Caicos_Islands , "Turks and Caicos Islands" },
|
||||
{ Country.Uganda , "Uganda" },
|
||||
{ Country.Ukraine , "Ukraine" },
|
||||
{ Country.United_Arab_Emirates , "United Arab Emirates" },
|
||||
{ Country.United_Kingdom , "United Kingdom" },
|
||||
{ Country.United_States , "United States" },
|
||||
{ Country.Uruguay , "Uruguay" },
|
||||
{ Country.Uzbekistan , "Uzbekistan" },
|
||||
{ Country.Venezuela , "Venezuela" },
|
||||
{ Country.Viet_Nam , "Viet Nam" },
|
||||
{ Country.Virgin_Islands , "Virgin Islands, U.S." },
|
||||
{ Country.Yemen , "Yemen" },
|
||||
{ Country.Zambia , "Zambia" },
|
||||
{ Country.Zimbabwe , "Zimbabwe" },
|
||||
};
|
||||
public static IReadOnlyDictionary<string, Country> ResolveCountry { get; } = new Dictionary<string, Country>()
|
||||
{
|
||||
{"Afghanistan", Country.Afghanistan},
|
||||
{"Aland Islands", Country.Aland_Islands},
|
||||
{"Albania", Country.Albania},
|
||||
{"Algeria", Country.Algeria},
|
||||
{"American Samoa", Country.American_Samoa},
|
||||
{"Andorra", Country.Andorra},
|
||||
{"Angola", Country.Angola},
|
||||
{"Anguilla", Country.Anguilla},
|
||||
{"Antigua and Barbuda", Country.Antigua_and_Barbuda},
|
||||
{"Argentina", Country.Argentina},
|
||||
{"Armenia", Country.Armenia},
|
||||
{"Aruba", Country.Aruba},
|
||||
{"Australia", Country.Australia},
|
||||
{"Austria", Country.Austria},
|
||||
{"Azerbaijan", Country.Azerbaijan},
|
||||
{"Bahamas", Country.Bahamas},
|
||||
{"Bahrain", Country.Bahrain},
|
||||
{"Bangladesh", Country.Bangladesh},
|
||||
{"Barbados", Country.Barbados},
|
||||
{"Belarus", Country.Belarus},
|
||||
{"Belgium", Country.Belgium},
|
||||
{"Belize", Country.Belize},
|
||||
{"Bhutan", Country.Bhutan},
|
||||
{"Bolivia", Country.Bolivia},
|
||||
{"Bosnia and Herzegovina", Country.Bosnia_and_Herzegovina},
|
||||
{"Botswana", Country.Botswana},
|
||||
{"Brazil", Country.Brazil},
|
||||
{"Brunei Darussalam", Country.Brunei_Darussalam},
|
||||
{"Bulgaria", Country.Bulgaria},
|
||||
{"Burundi", Country.Burundi},
|
||||
{"Cambodia", Country.Cambodia},
|
||||
{"Cameroon", Country.Cameroon},
|
||||
{"Canada", Country.Canada},
|
||||
{"Cape Verde", Country.Cape_Verde},
|
||||
{"Cayman Islands", Country.Cayman_Islands},
|
||||
{"Chad", Country.Chad},
|
||||
{"Chile", Country.Chile},
|
||||
{"China", Country.China},
|
||||
{"Colombia", Country.Colombia},
|
||||
{"Congo, the Democratic Republic of the", Country.Congo},
|
||||
{"Costa Rica", Country.Costa_Rica},
|
||||
{"Cote d'Ivoire", Country.Cote_d_Ivoire},
|
||||
{"Croatia", Country.Croatia},
|
||||
{"Cyprus", Country.Cyprus},
|
||||
{"Czech Republic", Country.Czech_Republic},
|
||||
{"Denmark", Country.Denmark},
|
||||
{"Dominica", Country.Dominica},
|
||||
{"Dominican Republic", Country.Dominican_Republic},
|
||||
{"Ecuador", Country.Ecuador},
|
||||
{"Egypt", Country.Egypt},
|
||||
{"El Salvador", Country.El_Salvador},
|
||||
{"Estonia", Country.Estonia},
|
||||
{"Eswatini", Country.Eswatini},
|
||||
{"Ethiopia", Country.Ethiopia},
|
||||
{"Faroe Islands", Country.Faroe_Islands},
|
||||
{"Finland", Country.Finland},
|
||||
{"France", Country.France},
|
||||
{"French Guiana", Country.French_Guiana},
|
||||
{"French Polynesia", Country.French_Polynesia},
|
||||
{"Gabon", Country.Gabon},
|
||||
{"Georgia", Country.Georgia},
|
||||
{"Germany", Country.Germany},
|
||||
{"Ghana", Country.Ghana},
|
||||
{"Gibraltar", Country.Gibraltar},
|
||||
{"Greece", Country.Greece},
|
||||
{"Greenland", Country.Greenland},
|
||||
{"Grenada", Country.Grenada},
|
||||
{"Guadeloupe", Country.Guadeloupe},
|
||||
{"Guam", Country.Guam},
|
||||
{"Guatemala", Country.Guatemala},
|
||||
{"Guernsey", Country.Guernsey},
|
||||
{"Guyana", Country.Guyana},
|
||||
{"Haiti", Country.Haiti},
|
||||
{"Honduras", Country.Honduras},
|
||||
{"Hong Kong", Country.Hong_Kong},
|
||||
{"Hungary", Country.Hungary},
|
||||
{"Iceland", Country.Iceland},
|
||||
{"India", Country.India},
|
||||
{"Indonesia", Country.Indonesia},
|
||||
{"Iran", Country.Iran},
|
||||
{"Iraq", Country.Iraq},
|
||||
{"Ireland", Country.Ireland},
|
||||
{"Isle of Man", Country.Isle_of_Man},
|
||||
{"Israel", Country.Israel},
|
||||
{"Italy", Country.Italy},
|
||||
{"Jamaica", Country.Jamaica},
|
||||
{"Japan", Country.Japan},
|
||||
{"Jersey", Country.Jersey},
|
||||
{"Jordan", Country.Jordan},
|
||||
{"Kazakhstan", Country.Kazakhstan},
|
||||
{"Kenya", Country.Kenya},
|
||||
{"Korea, Republic of", Country.Korea},
|
||||
{"Kuwait", Country.Kuwait},
|
||||
{"Kyrgyzstan", Country.Kyrgyzstan},
|
||||
{"Lao People's Democratic Republic", Country.Laos},
|
||||
{"Latvia", Country.Latvia},
|
||||
{"Lebanon", Country.Lebanon},
|
||||
{"Libya", Country.Libya},
|
||||
{"Liechtenstein", Country.Liechtenstein},
|
||||
{"Lithuania", Country.Lithuania},
|
||||
{"Luxembourg", Country.Luxembourg},
|
||||
{"Macau", Country.Macau},
|
||||
{"Macedonia, the former Yugoslav Republic of", Country.Macedonia},
|
||||
{"Madagascar", Country.Madagascar},
|
||||
{"Malaysia", Country.Malaysia},
|
||||
{"Maldives", Country.Maldives},
|
||||
{"Mali", Country.Mali},
|
||||
{"Malta", Country.Malta},
|
||||
{"Martinique", Country.Martinique},
|
||||
{"Mauritius", Country.Mauritius},
|
||||
{"Mayotte", Country.Mayotte},
|
||||
{"Mexico", Country.Mexico},
|
||||
{"Moldova, Republic of", Country.Moldova},
|
||||
{"Monaco", Country.Monaco},
|
||||
{"Mongolia", Country.Mongolia},
|
||||
{"Montenegro", Country.Montenegro},
|
||||
{"Morocco", Country.Morocco},
|
||||
{"Mozambique", Country.Mozambique},
|
||||
{"Myanmar", Country.Myanmar},
|
||||
{"Namibia", Country.Namibia},
|
||||
{"Nepal", Country.Nepal},
|
||||
{"Netherlands", Country.Netherlands},
|
||||
{"New Zealand", Country.New_Zealand},
|
||||
{"Nicaragua", Country.Nicaragua},
|
||||
{"Nigeria", Country.Nigeria},
|
||||
{"Northern Mariana Islands", Country.Northern_Mariana_Islands},
|
||||
{"Norway", Country.Norway},
|
||||
{"Oman", Country.Oman},
|
||||
{"Pakistan", Country.Pakistan},
|
||||
{"Palestinian Territory, Occupied", Country.Palestinian_Territory},
|
||||
{"Panama", Country.Panama},
|
||||
{"Papua New Guinea", Country.Papua_New_Guinea},
|
||||
{"Paraguay", Country.Paraguay},
|
||||
{"Peru", Country.Peru},
|
||||
{"Philippines", Country.Philippines},
|
||||
{"Poland", Country.Poland},
|
||||
{"Portugal", Country.Portugal},
|
||||
{"Puerto Rico", Country.Puerto_Rico},
|
||||
{"Qatar", Country.Qatar},
|
||||
{"Reunion", Country.Reunion},
|
||||
{"Romania", Country.Romania},
|
||||
{"Russian Federation", Country.Russian_Federation},
|
||||
{"Rwanda", Country.Rwanda},
|
||||
{"Saint Kitts and Nevis", Country.Saint_Kitts_and_Nevis},
|
||||
{"Saint Lucia", Country.Saint_Lucia},
|
||||
{"Saint Vincent and the Grenadines", Country.Saint_Vincent_and_the_Grenadines},
|
||||
{"Saudi Arabia", Country.Saudi_Arabia},
|
||||
{"Senegal", Country.Senegal},
|
||||
{"Serbia", Country.Serbia},
|
||||
{"Seychelles", Country.Seychelles},
|
||||
{"Singapore", Country.Singapore},
|
||||
{"Slovakia", Country.Slovakia},
|
||||
{"Slovenia", Country.Slovenia},
|
||||
{"South Africa", Country.South_Africa},
|
||||
{"Spain", Country.Spain},
|
||||
{"Sri Lanka", Country.Sri_Lanka},
|
||||
{"Sudan", Country.Sudan},
|
||||
{"Suriname", Country.Suriname},
|
||||
{"Sweden", Country.Sweden},
|
||||
{"Switzerland", Country.Switzerland},
|
||||
{"Taiwan", Country.Taiwan},
|
||||
{"Tajikistan", Country.Tajikistan},
|
||||
{"Tanzania, United Republic of", Country.Tanzania},
|
||||
{"Thailand", Country.Thailand},
|
||||
{"Togo", Country.Togo},
|
||||
{"Trinidad and Tobago", Country.Trinidad_and_Tobago},
|
||||
{"Tunisia", Country.Tunisia},
|
||||
{"Turkey", Country.Turkey},
|
||||
{"Turkmenistan", Country.Turkmenistan},
|
||||
{"Turks and Caicos Islands", Country.Turks_and_Caicos_Islands},
|
||||
{"Uganda", Country.Uganda},
|
||||
{"Ukraine", Country.Ukraine},
|
||||
{"United Arab Emirates", Country.United_Arab_Emirates},
|
||||
{"United Kingdom", Country.United_Kingdom},
|
||||
{"United States", Country.United_States},
|
||||
{"Uruguay", Country.Uruguay},
|
||||
{"Uzbekistan", Country.Uzbekistan},
|
||||
{"Venezuela", Country.Venezuela},
|
||||
{"Viet Nam", Country.Viet_Nam},
|
||||
{"Virgin Islands, U.S.", Country.Virgin_Islands},
|
||||
{"Yemen", Country.Yemen},
|
||||
{"Zambia", Country.Zambia},
|
||||
{"Zimbabwe", Country.Zimbabwe},
|
||||
};
|
||||
|
||||
public static IReadOnlyDictionary<string, Country> ResolveByCountryCode = new ReadOnlyDictionary<string, Country>(
|
||||
new Dictionary<string, Country>()
|
||||
{
|
||||
{"US",Country.United_States},
|
||||
{"CA",Country.Canada},
|
||||
{"AF",Country.Afghanistan},
|
||||
{"AX",Country.Aland_Islands},
|
||||
{"AL",Country.Albania},
|
||||
{"DZ",Country.Algeria},
|
||||
{"AS",Country.American_Samoa},
|
||||
{"AD",Country.Andorra},
|
||||
{"AO",Country.Angola},
|
||||
{"AI",Country.Anguilla},
|
||||
{"AG",Country.Antigua_and_Barbuda},
|
||||
{"AR",Country.Argentina},
|
||||
{"AM",Country.Armenia},
|
||||
{"AW",Country.Aruba},
|
||||
{"AU",Country.Australia},
|
||||
{"AT",Country.Austria},
|
||||
{"AZ",Country.Azerbaijan},
|
||||
{"BS",Country.Bahamas},
|
||||
{"BH",Country.Bahrain},
|
||||
{"BD",Country.Bangladesh},
|
||||
{"BB",Country.Barbados},
|
||||
{"BY",Country.Belarus},
|
||||
{"BE",Country.Belgium},
|
||||
{"BZ",Country.Belize},
|
||||
{"BT",Country.Bhutan},
|
||||
{"BO",Country.Bolivia},
|
||||
{"BA",Country.Bosnia_and_Herzegovina},
|
||||
{"BW",Country.Botswana},
|
||||
{"BR",Country.Brazil},
|
||||
{"BN",Country.Brunei_Darussalam},
|
||||
{"BG",Country.Bulgaria},
|
||||
{"BI",Country.Burundi},
|
||||
{"KH",Country.Cambodia},
|
||||
{"CM",Country.Cameroon},
|
||||
{"CV",Country.Cape_Verde},
|
||||
{"KY",Country.Cayman_Islands},
|
||||
{"TD",Country.Chad},
|
||||
{"CL",Country.Chile},
|
||||
{"CN",Country.China},
|
||||
{"CO",Country.Colombia},
|
||||
{"CD",Country.Congo},
|
||||
{"CR",Country.Costa_Rica},
|
||||
{"CI", Country.Cote_d_Ivoire},
|
||||
{"HR",Country.Croatia},
|
||||
{"CY",Country.Cyprus},
|
||||
{"CZ",Country.Czech_Republic},
|
||||
{"DK",Country.Denmark},
|
||||
{"DM",Country.Dominica},
|
||||
{"DO",Country.Dominican_Republic},
|
||||
{"EC",Country.Ecuador},
|
||||
{"EG",Country.Egypt},
|
||||
{"SV",Country.El_Salvador},
|
||||
{"EE",Country.Estonia},
|
||||
{"ET",Country.Ethiopia},
|
||||
{"FO",Country.Faroe_Islands},
|
||||
{"FI",Country.Finland},
|
||||
{"FR",Country.France},
|
||||
{"GF",Country.French_Guiana},
|
||||
{"PF",Country.French_Polynesia},
|
||||
{"GA",Country.Gabon},
|
||||
{"GE",Country.Georgia},
|
||||
{"DE",Country.Germany},
|
||||
{"GH",Country.Ghana},
|
||||
{"GI",Country.Gibraltar},
|
||||
{"GR",Country.Greece},
|
||||
{"GL",Country.Greenland},
|
||||
{"GD",Country.Grenada},
|
||||
{"GP",Country.Guadeloupe},
|
||||
{"GU",Country.Guam},
|
||||
{"GT",Country.Guatemala},
|
||||
{"GG",Country.Guernsey},
|
||||
{"GY",Country.Guyana},
|
||||
{"HT",Country.Haiti},
|
||||
{"HN",Country.Honduras},
|
||||
{"HK",Country.Hong_Kong},
|
||||
{"HU",Country.Hungary},
|
||||
{"IS",Country.Iceland},
|
||||
{"IN",Country.India},
|
||||
{"ID",Country.Indonesia},
|
||||
{"IQ",Country.Iraq},
|
||||
{"IE",Country.Ireland},
|
||||
{"IR",Country.Iran},
|
||||
{"IM",Country.Isle_of_Man},
|
||||
{"IL",Country.Israel},
|
||||
{"IT",Country.Italy},
|
||||
{"JM",Country.Jamaica},
|
||||
{"JP",Country.Japan},
|
||||
{"JE",Country.Jersey},
|
||||
{"JO",Country.Jordan},
|
||||
{"KZ",Country.Kazakhstan},
|
||||
{"KE",Country.Kenya},
|
||||
{"KR",Country.Korea},
|
||||
{"KW",Country.Kuwait},
|
||||
{"KG",Country.Kyrgyzstan},
|
||||
{"LA",Country.Laos},
|
||||
{"LV",Country.Latvia},
|
||||
{"LB",Country.Lebanon},
|
||||
{"LY",Country.Libya},
|
||||
{"LI",Country.Liechtenstein},
|
||||
{"LT",Country.Lithuania},
|
||||
{"LU",Country.Luxembourg},
|
||||
{"MO",Country.Macau},
|
||||
{"MK",Country.Macedonia},
|
||||
{"MG",Country.Madagascar},
|
||||
{"MY",Country.Malaysia},
|
||||
{"MV",Country.Maldives},
|
||||
{"ML",Country.Mali},
|
||||
{"MT",Country.Malta},
|
||||
{"MQ",Country.Martinique},
|
||||
{"MU",Country.Mauritius},
|
||||
{"YT",Country.Mayotte},
|
||||
{"MX",Country.Mexico},
|
||||
{"MD",Country.Moldova},
|
||||
{"MC",Country.Monaco},
|
||||
{"MN",Country.Mongolia},
|
||||
{"ME",Country.Montenegro},
|
||||
{"MA",Country.Morocco},
|
||||
{"MZ",Country.Mozambique},
|
||||
{"MM",Country.Myanmar},
|
||||
{"NA",Country.Namibia},
|
||||
{"NP",Country.Nepal},
|
||||
{"NL",Country.Netherlands},
|
||||
{"NZ",Country.New_Zealand},
|
||||
{"NI",Country.Nicaragua},
|
||||
{"NG",Country.Nigeria},
|
||||
{"MP",Country.Northern_Mariana_Islands},
|
||||
{"NO",Country.Norway},
|
||||
{"OM",Country.Oman},
|
||||
{"PK",Country.Pakistan},
|
||||
{"PS",Country.Palestinian_Territory},
|
||||
{"PA",Country.Panama},
|
||||
{"PG",Country.Papua_New_Guinea},
|
||||
{"PY",Country.Paraguay},
|
||||
{"PE",Country.Peru},
|
||||
{"PH",Country.Philippines},
|
||||
{"PL",Country.Poland},
|
||||
{"PT",Country.Portugal},
|
||||
{"PR",Country.Puerto_Rico},
|
||||
{"QA",Country.Qatar},
|
||||
{"RE",Country.Reunion},
|
||||
{"RO",Country.Romania},
|
||||
{"RU",Country.Russian_Federation},
|
||||
{"RW",Country.Rwanda},
|
||||
{"LC",Country.Saint_Lucia},
|
||||
{"SA",Country.Saudi_Arabia},
|
||||
{"SN",Country.Senegal},
|
||||
{"RS",Country.Serbia},
|
||||
{"SC",Country.Seychelles},
|
||||
{"SG",Country.Singapore},
|
||||
{"SK",Country.Slovakia},
|
||||
{"SI",Country.Slovenia},
|
||||
{"ZA",Country.South_Africa},
|
||||
{"ES",Country.Spain},
|
||||
{"LK",Country.Sri_Lanka},
|
||||
{"KN",Country.Saint_Kitts_and_Nevis},
|
||||
{"PM", Country.Saint_Vincent_and_the_Grenadines},
|
||||
{"SD",Country.Sudan},
|
||||
{"SR",Country.Suriname},
|
||||
{"SE",Country.Sweden},
|
||||
{"CH",Country.Switzerland},
|
||||
{"TW",Country.Taiwan},
|
||||
{"TJ",Country.Tajikistan},
|
||||
{"TZ",Country.Tanzania},
|
||||
{"TH",Country.Thailand},
|
||||
{"TG",Country.Togo},
|
||||
{"TT",Country.Trinidad_and_Tobago},
|
||||
{"TN",Country.Tunisia},
|
||||
{"TR",Country.Turkey},
|
||||
{"TM",Country.Turkmenistan},
|
||||
{"TC",Country.Turks_and_Caicos_Islands},
|
||||
{"UG",Country.Uganda},
|
||||
{"UA",Country.Ukraine},
|
||||
{"GB",Country.United_Kingdom},
|
||||
{"VI", Country.Virgin_Islands},
|
||||
{"AE",Country.United_Arab_Emirates},
|
||||
{"UY",Country.Uruguay},
|
||||
{"UZ",Country.Uzbekistan},
|
||||
{"VE",Country.Venezuela},
|
||||
{"VN",Country.Viet_Nam},
|
||||
{"YE",Country.Yemen},
|
||||
{"ZM",Country.Zambia},
|
||||
{"ZW",Country.Zimbabwe},
|
||||
});
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
namespace SteamLib.Core.Enums;
|
||||
|
||||
public enum Currency
|
||||
{
|
||||
None = 0,
|
||||
USD = 1,
|
||||
GBP = 2,
|
||||
EUR = 3,
|
||||
CHF = 4,
|
||||
RUB = 5,
|
||||
PLN = 6,
|
||||
BRL = 7,
|
||||
JPY = 8,
|
||||
NOK = 9,
|
||||
IDR = 10,
|
||||
MYR = 11,
|
||||
PHP = 12,
|
||||
SGD = 13,
|
||||
THB = 14,
|
||||
VND = 15,
|
||||
KRW = 16,
|
||||
TRY = 17,
|
||||
UAH = 18,
|
||||
MXN = 19,
|
||||
CAD = 20,
|
||||
AUD = 21,
|
||||
NZD = 22,
|
||||
CNY = 23,
|
||||
INR = 24,
|
||||
CLP = 25,
|
||||
PEN = 26,
|
||||
COP = 27,
|
||||
ZAR = 28,
|
||||
HKD = 29,
|
||||
TWD = 30,
|
||||
SAR = 31,
|
||||
AED = 32,
|
||||
ARS = 34,
|
||||
ILS = 35,
|
||||
KZT = 37,
|
||||
KWD = 38,
|
||||
QAR = 39,
|
||||
CRC = 40,
|
||||
UYU = 41
|
||||
}
|
||||
public static class CurrencyInfo
|
||||
{
|
||||
public static int ToInt(this Currency currency)
|
||||
{
|
||||
return (int)currency;
|
||||
}
|
||||
|
||||
public static string ToIntString(this Currency currency)
|
||||
{
|
||||
return currency.ToInt().ToString();
|
||||
}
|
||||
public static IReadOnlyDictionary<Currency, string> CurrencySymbols { get; } = new Dictionary<Currency, string>
|
||||
{
|
||||
{ Currency.USD, "$" },
|
||||
{ Currency.GBP, "£" },
|
||||
{ Currency.EUR, "€" },
|
||||
{ Currency.CHF, "CHF" },
|
||||
{ Currency.RUB, "pуб." },
|
||||
{ Currency.PLN, "zł" },
|
||||
{ Currency.BRL, "R$" },
|
||||
{ Currency.JPY, "¥" },
|
||||
{ Currency.NOK, "kr" },
|
||||
{ Currency.IDR, "Rp" },
|
||||
{ Currency.MYR, "RM" },
|
||||
{ Currency.PHP, "P" },
|
||||
{ Currency.SGD, "S$" },
|
||||
{ Currency.THB, "฿" },
|
||||
{ Currency.VND, "₫" },
|
||||
{ Currency.KRW, "₩" },
|
||||
{ Currency.TRY, "TL" },
|
||||
{ Currency.UAH, "₴" },
|
||||
{ Currency.MXN, "Mex$" },
|
||||
{ Currency.CAD, "CDN$" },
|
||||
{ Currency.AUD, "A$" },
|
||||
{ Currency.NZD, "NZ$" },
|
||||
{ Currency.CNY, "¥" },
|
||||
{ Currency.INR, "₹" },
|
||||
{ Currency.CLP, "CLP$" },
|
||||
{ Currency.PEN, "S/." },
|
||||
{ Currency.COP, "COL$" },
|
||||
{ Currency.ZAR, "R" },
|
||||
{ Currency.HKD, "HK$" },
|
||||
{ Currency.TWD, "NT$" },
|
||||
{ Currency.SAR, "SR" },
|
||||
{ Currency.AED, "AED" },
|
||||
{ Currency.ARS, "ARS$" },
|
||||
{ Currency.ILS, "₪" },
|
||||
{ Currency.KZT, "₸" },
|
||||
{ Currency.KWD, "KD" },
|
||||
{ Currency.QAR, "QR" },
|
||||
{ Currency.CRC, "₡" },
|
||||
{ Currency.UYU, "$U" },
|
||||
};
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using SteamLib.Api.Mobile;
|
||||
|
||||
namespace SteamLib.Core.Enums;
|
||||
|
||||
public enum SteamAccessTokenType
|
||||
{
|
||||
Unknown = 0,
|
||||
/// <summary>
|
||||
/// Temporary token that returned after login
|
||||
/// </summary>
|
||||
Web,
|
||||
/// <summary>
|
||||
/// Access token that attached to domain
|
||||
/// </summary>
|
||||
AccessToken,
|
||||
/// <summary>
|
||||
/// Refresh token that can be used to refresh AccessToken
|
||||
/// </summary>
|
||||
Refresh,
|
||||
/// <summary>
|
||||
/// Mobile token that can be used to access mobile endpoints. Returned after login or by refreshing with <see cref="SteamMobileApi.RefreshJwt"/>
|
||||
/// </summary>
|
||||
Mobile,
|
||||
/// <summary>
|
||||
/// Refresh token that can be used to refresh Mobile token
|
||||
/// </summary>
|
||||
MobileRefresh,
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SteamLib.Core;
|
||||
|
||||
public static class HealthMonitor
|
||||
{
|
||||
public static ILogger? FatalLogger { get; set; }
|
||||
internal static void LogUnexpected(string response, Exception ex)
|
||||
{
|
||||
FatalLogger?.LogCritical(ex, "Unexpected response detected:\n{response}", response);
|
||||
}
|
||||
|
||||
|
||||
internal static T LogOnException<T>(string resp, Func<T> del)
|
||||
{
|
||||
try
|
||||
{
|
||||
return del();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static T LogOnException<T>(string resp, Func<string, T> del)
|
||||
{
|
||||
try
|
||||
{
|
||||
return del(resp);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
internal static T LogOnException<T>(string resp, Func<T> del, params Type[] exceptExceptions)
|
||||
{
|
||||
try
|
||||
{
|
||||
return del();
|
||||
}
|
||||
catch (Exception ex)
|
||||
when (exceptExceptions.Any(t => t == ex.GetType()) == false)
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static T LogOnException<T>(string resp, Func<string, T> del, params Type[] exceptExceptions)
|
||||
{
|
||||
try
|
||||
{
|
||||
return del(resp);
|
||||
}
|
||||
catch (Exception ex)
|
||||
when (exceptExceptions.Any(t => t == ex.GetType()) == false)
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static T LogOnException<T>(string resp, Func<T> del, Func<Exception, bool> logPredicate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return del();
|
||||
}
|
||||
catch (Exception ex)
|
||||
when (logPredicate(ex))
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static T LogOnException<T>(string resp, Func<string, T> del, Func<Exception, bool> logPredicate)
|
||||
{
|
||||
try
|
||||
{
|
||||
return del(resp);
|
||||
}
|
||||
catch (Exception ex)
|
||||
when (logPredicate(ex))
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void LogOnException(string resp, Action del)
|
||||
{
|
||||
try
|
||||
{
|
||||
del();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
internal static void LogOnException(string resp, Action del, Func<Exception, bool> logPredicate)
|
||||
{
|
||||
try
|
||||
{
|
||||
del();
|
||||
}
|
||||
catch (Exception ex)
|
||||
when (logPredicate(ex))
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal static async Task<T> LogOnExceptionAsync<T>(string resp, Func<Task<T>> del)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await del();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
internal static async Task<T> LogOnExceptionAsync<T>(string resp, Func<Task<T>> del, params Type[] exceptExceptions)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await del();
|
||||
}
|
||||
catch (Exception ex)
|
||||
when (exceptExceptions.Any(t => t == ex.GetType()) == false)
|
||||
{
|
||||
LogUnexpected(resp, ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace SteamLib.Core.Interfaces;
|
||||
|
||||
public interface ICaptchaResolver
|
||||
{
|
||||
public Task<string> Resolve(Uri imageUrl, HttpClient client);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace SteamLib.Core.Interfaces;
|
||||
|
||||
public interface ILoginConsumer
|
||||
{
|
||||
public string FriendlyName { get; }
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace SteamLib.Core.Interfaces;
|
||||
|
||||
public enum EmailConfirmationType
|
||||
{
|
||||
AttachPhoneAuthenticator
|
||||
}
|
||||
public interface IEmailProvider
|
||||
{
|
||||
public int MaxRetryCount { get; }
|
||||
public Task<string> GetEmailAuthCode(ILoginConsumer caller);
|
||||
public Task<string> GetAddAuthenticatorCode(ILoginConsumer caller);
|
||||
|
||||
public Task ConfirmEmailLink(ILoginConsumer caller, EmailConfirmationType confirmationType);
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace SteamLib.Core.Interfaces;
|
||||
|
||||
public interface ISteamGuardProvider
|
||||
{
|
||||
public int MaxRetryCount { get; }
|
||||
public ValueTask<string> GetSteamGuardCode(ILoginConsumer caller);
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
using SteamLib.Exceptions;
|
||||
using SteamLib.Utility;
|
||||
using SteamLib.Utility.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace SteamLib.Core.StatusCodes;
|
||||
|
||||
public partial class SteamStatusCode : Enumeration
|
||||
{
|
||||
public static IReadOnlyDictionary<int, SteamStatusCode> StatusCodes { get; }
|
||||
|
||||
protected SteamStatusCode(int id, string name) : base(id, name) { }
|
||||
|
||||
static SteamStatusCode()
|
||||
{
|
||||
StatusCodes = new ReadOnlyDictionary<int, SteamStatusCode>(GetAll<SteamStatusCode>().ToDictionary(ssc => ssc.Id, ssc => ssc));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to translate status code. If no status code was found <see cref="SteamStatusCodeException"/> with <see cref="Undefined"/> will be thrown
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="response"></param>
|
||||
/// <param name="isUniversal"></param>
|
||||
/// <returns><see cref="SteamStatusCode"/> if value is universal. <typeparamref name="T"/> if value is <typeparamref name="T"/> specific</returns>
|
||||
/// <exception cref="SteamStatusCodeException"></exception>
|
||||
public static SteamStatusCode Translate<T>(string response, out bool isUniversal) where T : SteamStatusCode
|
||||
{
|
||||
int statusCode;
|
||||
try
|
||||
{
|
||||
statusCode = Utilities.GetSuccessCode(response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new SteamStatusCodeException(Undefined, response);
|
||||
}
|
||||
|
||||
return Translate<T>(statusCode, out isUniversal);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Translate <paramref name="statusCode"/> to specific <see cref="T"/> or <see cref="SteamStatusCode"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="statusCode"></param>
|
||||
/// <param name="isUniversal"></param>
|
||||
/// <returns><see cref="SteamStatusCode"/> if value is universal. <typeparamref name="T"/> if value is <typeparamref name="T"/> specific</returns>
|
||||
/// <exception cref="SteamStatusCodeException"></exception>
|
||||
public static SteamStatusCode Translate<T>(int statusCode, out bool isUniversal) where T : SteamStatusCode
|
||||
{
|
||||
if (statusCode < 2)
|
||||
{
|
||||
var status = StatusCodes[statusCode];
|
||||
isUniversal = true;
|
||||
return status;
|
||||
}
|
||||
|
||||
var allSpecific = GetAll<T>();
|
||||
var translated = allSpecific.FirstOrDefault(s => s.Id == statusCode);
|
||||
|
||||
isUniversal = translated == null;
|
||||
|
||||
if (translated != null)
|
||||
{
|
||||
return translated;
|
||||
}
|
||||
if (translated == null && StatusCodes.TryGetValue(statusCode, out var universal))
|
||||
{
|
||||
return universal;
|
||||
}
|
||||
|
||||
return translated ?? new SteamStatusCode(statusCode, nameof(Unknown));
|
||||
}
|
||||
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is not SteamStatusCode translated)
|
||||
return false;
|
||||
|
||||
if (this.Id < 2)
|
||||
{
|
||||
return translated.Id == this.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.Equals(translated);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="response"></param>
|
||||
/// <exception cref="SteamStatusCodeException"></exception>
|
||||
public static void ValidateSuccessOrThrow<T>(string response) where T : SteamStatusCode
|
||||
{
|
||||
var translated = Translate<T>(response, out _);
|
||||
if (translated.Id != 1)
|
||||
throw new SteamStatusCodeException(translated, response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="ValidateSuccessOrThrow{T}(string)"/> with <see cref="SteamStatusCode"/> generic parameter <br/>
|
||||
/// <b>(Used in case when steam status code is not defined for this operation)</b>
|
||||
/// </summary>
|
||||
/// <param name="response"></param>
|
||||
/// <exception cref="SteamStatusCodeException"></exception>
|
||||
public static void ValidateSuccessOrThrow(string response)
|
||||
{
|
||||
ValidateSuccessOrThrow<SteamStatusCode>(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="statusCode"></param>
|
||||
/// <exception cref="SteamStatusCodeException"></exception>
|
||||
public static void ValidateSuccessOrThrow<T>(int statusCode) where T : SteamStatusCode
|
||||
{
|
||||
if (statusCode == 1) return;
|
||||
var translated = Translate<T>(statusCode, out _);
|
||||
throw new SteamStatusCodeException(translated, statusCode.ToString());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Same as <see cref="ValidateSuccessOrThrow{T}(int)"/> with <see cref="SteamStatusCode"/> generic parameter <br/>
|
||||
/// <b>(Used in case when steam status code is not defined for this operation)</b>
|
||||
/// </summary>
|
||||
/// <param name="statusCode"></param>
|
||||
/// <exception cref="SteamStatusCodeException"></exception>
|
||||
public static void ValidateSuccessOrThrow(int statusCode)
|
||||
{
|
||||
ValidateSuccessOrThrow<SteamStatusCode>(statusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates that status code is <see cref="Ok"/> or <typeparamref name="T"/> specific
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="response"></param>
|
||||
/// <param name="isUniversal"></param>
|
||||
/// <exception cref="SteamStatusCodeException"></exception>
|
||||
public static SteamStatusCode TranslateOrThrow<T>(string response, out bool isUniversal) where T : SteamStatusCode
|
||||
{
|
||||
var translated = Translate<T>(response, out isUniversal);
|
||||
if (translated.Id < 1)
|
||||
throw new SteamStatusCodeException(translated, response);
|
||||
return translated;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Name} ({Id})";
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace SteamLib.Exceptions;
|
||||
|
||||
[Serializable]
|
||||
public class CantLoadConfirmationsException : Exception
|
||||
{
|
||||
public LoadConfirmationsError Error { get; init; }
|
||||
public CantLoadConfirmationsException() { }
|
||||
public CantLoadConfirmationsException(string message) : base(message) { }
|
||||
public CantLoadConfirmationsException(string message, Exception inner) : base(message, inner) { }
|
||||
protected CantLoadConfirmationsException(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
|
||||
}
|
||||
|
||||
|
||||
public enum LoadConfirmationsError
|
||||
{
|
||||
Unknown,
|
||||
TryAgainLater,
|
||||
NotSetupToReceiveConfirmations
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using SteamLib.Core.Interfaces;
|
||||
|
||||
namespace SteamLib.Exceptions;
|
||||
|
||||
public class LoginException : Exception
|
||||
{
|
||||
public LoginError Error { get; }
|
||||
public string? Response { get; }
|
||||
public LoginException(LoginError error)
|
||||
: base($"Login was unsuccessful. Error {error}")
|
||||
{
|
||||
Error = error;
|
||||
}
|
||||
|
||||
public LoginException(string response)
|
||||
{
|
||||
Error = LoginError.UndefinedError;
|
||||
Response = response;
|
||||
}
|
||||
|
||||
public LoginException(string? response, string? message, LoginError? error, Exception? innerException) : base(
|
||||
message, innerException)
|
||||
{
|
||||
Response = response;
|
||||
Error = error ?? LoginError.UndefinedError;
|
||||
}
|
||||
}
|
||||
|
||||
public enum LoginError
|
||||
{
|
||||
|
||||
CaptchaRequired,
|
||||
InvalidCredentials,
|
||||
InvalidEmailAuthCode,
|
||||
InvalidTwoFactorCode,
|
||||
/// <summary>
|
||||
/// SteamEmail authentication is required to login but no <see cref="IEmailProvider"/> was provided
|
||||
/// </summary>
|
||||
EmailAuthRequired,
|
||||
/// <summary>
|
||||
/// SteamGuard is required to login but no <see cref="ISteamGuardProvider"/> was provided
|
||||
/// </summary>
|
||||
SteamGuardRequired,
|
||||
/// <summary>
|
||||
/// Some error occurred while trying to login.
|
||||
/// </summary>
|
||||
UndefinedError
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace SteamLib.Exceptions;
|
||||
public class SessionExpiredException : SessionInvalidException
|
||||
{
|
||||
public const string SESSION_EXPIRED_MSG = "Session expired and won't longer work. You must login to get new session";
|
||||
public SessionExpiredException() { }
|
||||
public SessionExpiredException(string message) : base(message) { }
|
||||
public SessionExpiredException(string message, Exception inner) : base(message, inner) { }
|
||||
protected SessionExpiredException(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user