@@ -23,139 +23,20 @@ public class DoomEternal
23
23
public static void EnumerateSaves ( ) {
24
24
Saves = new DoomEternalSavePathCollection ( ) ;
25
25
if ( Directory . Exists ( BnetSavePath ) ) {
26
- Saves . Add ( new DoomEternalSavePath ( "savegame.unencrypted" , BnetSavePathUnencrypted , DoomEternalSavePlatform . BethesdaNet ) ) ;
26
+ Saves . Add ( new DoomEternalSavePath ( "savegame.unencrypted" , DoomEternalSavePlatform . BethesdaNet , false ) ) ;
27
27
foreach ( var single in Directory . GetDirectories ( BnetSavePath , "*.*" , SearchOption . TopDirectoryOnly ) ) {
28
28
if ( Utilities . CheckUUID ( Path . GetFileNameWithoutExtension ( single ) ) )
29
- Saves . Add ( new DoomEternalSavePath ( Path . GetFileNameWithoutExtension ( single ) , BnetSavePath , DoomEternalSavePlatform . BethesdaNet ) ) ;
29
+ Saves . Add ( new DoomEternalSavePath ( Path . GetFileNameWithoutExtension ( single ) , DoomEternalSavePlatform . BethesdaNet ) ) ;
30
30
}
31
31
}
32
32
if ( Directory . Exists ( SteamSavePath ) ) {
33
33
foreach ( var steamId3 in Directory . GetDirectories ( SteamSavePath , "*.*" , SearchOption . TopDirectoryOnly ) ) {
34
- Console . WriteLine ( Path . GetFileNameWithoutExtension ( steamId3 ) ) ;
35
34
foreach ( var single in Directory . GetDirectories ( steamId3 , "*.*" , SearchOption . TopDirectoryOnly ) ) {
36
35
if ( Path . GetFileNameWithoutExtension ( single ) == SteamGameID . ToString ( ) )
37
- Saves . Add ( new DoomEternalSavePath ( Utilities . Id3ToId64 ( Path . GetFileNameWithoutExtension ( steamId3 ) ) , SteamSavePath , DoomEternalSavePlatform . Steam ) ) ;
36
+ Saves . Add ( new DoomEternalSavePath ( Utilities . Id3ToId64 ( Path . GetFileNameWithoutExtension ( steamId3 ) ) , DoomEternalSavePlatform . Steam ) ) ;
38
37
}
39
38
}
40
39
}
41
40
}
42
-
43
- #region Bethesda.net
44
- public static void BnetFileEncrypt ( string fromFile , string toFile , string toUUID ) {
45
- if ( fromFile . EndsWith ( "-BACKUP" ) )
46
- return ;
47
- byte [ ] fromFileData = File . ReadAllBytes ( fromFile ) ;
48
- Directory . CreateDirectory ( Path . GetDirectoryName ( toFile ) ) ;
49
- File . WriteAllBytes ( toFile , Crypto . EncryptAndDigest ( $ "{ toUUID } PAINELEMENTAL{ Path . GetFileName ( toFile ) } ", fromFileData ) ) ;
50
- }
51
-
52
- public static void BnetFileDecrypt ( string fromFile , string fromUUID , string toFile ) {
53
- if ( fromFile . EndsWith ( "-BACKUP" ) )
54
- return ;
55
- byte [ ] fromFileData = Crypto . DecryptAndVerify ( $ "{ fromUUID } PAINELEMENTAL{ Path . GetFileName ( fromFile ) } ", File . ReadAllBytes ( fromFile ) ) ;
56
- Directory . CreateDirectory ( Path . GetDirectoryName ( toFile ) ) ;
57
- File . WriteAllBytes ( toFile , fromFileData ) ;
58
- }
59
-
60
- public static void BnetFileTransfer ( string fromFile , string fromUUID , string toFile , string toUUID ) {
61
- if ( fromFile . EndsWith ( "-BACKUP" ) )
62
- return ;
63
- byte [ ] fromFileData = Crypto . DecryptAndVerify ( $ "{ fromUUID } PAINELEMENTAL{ Path . GetFileName ( fromFile ) } ", File . ReadAllBytes ( fromFile ) ) ;
64
- Directory . CreateDirectory ( Path . GetDirectoryName ( toFile ) ) ;
65
- File . WriteAllBytes ( toFile , Crypto . EncryptAndDigest ( $ "{ toUUID } PAINELEMENTAL{ Path . GetFileName ( toFile ) } ", fromFileData ) ) ;
66
- }
67
-
68
- public static void BnetBulkTransfer ( string fromUUID , string toUUID ) {
69
- string fromDir = Path . Combine ( BnetSavePath , fromUUID ) ;
70
- foreach ( var single in Directory . GetFiles ( fromDir , "*.*" , SearchOption . AllDirectories ) ) {
71
- BnetFileTransfer ( single , fromUUID , single . Replace ( fromUUID , toUUID ) , toUUID ) ;
72
- }
73
- }
74
-
75
- public static void BnetBulkEncrypt ( string fromDir , string toUUID ) {
76
- string toDir = Path . Combine ( BnetSavePath , toUUID ) ;
77
- foreach ( var single in Directory . GetFiles ( fromDir , "*.*" , SearchOption . AllDirectories ) ) {
78
- BnetFileEncrypt ( single , Path . Combine ( toDir , single . Replace ( fromDir , "" ) . Substring ( 1 ) ) , toUUID ) ;
79
- }
80
- }
81
-
82
- public static void BnetBulkDecrypt ( string fromUUID , string toDir ) {
83
- string fromDir = Path . Combine ( BnetSavePath , fromUUID ) ;
84
- foreach ( var single in Directory . GetFiles ( fromDir , "*.*" , SearchOption . AllDirectories ) ) {
85
- BnetFileDecrypt ( single , fromUUID , Path . Combine ( toDir , single . Replace ( Path . Combine ( BnetSavePath , fromUUID ) , "" ) . Substring ( 1 ) ) ) ;
86
- }
87
- }
88
- #endregion
89
-
90
- #region Steam
91
- public static void SteamFileEncrypt ( string fromFile , string toFile , string toId ) {
92
- //toId = Utilities.Id64ToId3(toId);
93
- if ( fromFile . EndsWith ( "-BACKUP" ) )
94
- return ;
95
- byte [ ] fromFileData = File . ReadAllBytes ( fromFile ) ;
96
- Directory . CreateDirectory ( Path . GetDirectoryName ( toFile ) ) ;
97
- File . WriteAllBytes ( toFile , Crypto . EncryptAndDigest ( $ "{ toId } MANCUBUS{ Path . GetFileName ( toFile ) } ", fromFileData ) ) ;
98
- }
99
-
100
- public static void SteamFileDecrypt ( string fromFile , string fromId , string toFile ) {
101
- //fromId = Utilities.Id64ToId3(fromId);
102
- if ( fromFile . EndsWith ( "-BACKUP" ) )
103
- return ;
104
- byte [ ] fromFileData = Crypto . DecryptAndVerify ( $ "{ fromId } MANCUBUS{ Path . GetFileName ( fromFile ) } ", File . ReadAllBytes ( fromFile ) ) ;
105
- Directory . CreateDirectory ( Path . GetDirectoryName ( toFile ) ) ;
106
- File . WriteAllBytes ( toFile , fromFileData ) ;
107
- }
108
-
109
- public static void SteamFileTransfer ( string fromFile , string fromId , string toFile , string toId ) {
110
- fromId = Utilities . Id64ToId3 ( fromId ) ;
111
- toId = Utilities . Id64ToId3 ( toId ) ;
112
- if ( fromFile . EndsWith ( "-BACKUP" ) )
113
- return ;
114
- byte [ ] fromFileData = Crypto . DecryptAndVerify ( $ "{ Utilities . Id3ToId64 ( fromId ) } MANCUBUS{ Path . GetFileName ( fromFile ) } ", File . ReadAllBytes ( fromFile ) ) ;
115
- Directory . CreateDirectory ( Path . GetDirectoryName ( toFile ) ) ;
116
- File . WriteAllBytes ( toFile , Crypto . EncryptAndDigest ( $ "{ Utilities . Id3ToId64 ( toId ) } MANCUBUS{ Path . GetFileName ( toFile ) } ", fromFileData ) ) ;
117
- }
118
-
119
- public static void SteamBulkTransfer ( string fromId , string toId ) {
120
- fromId = Utilities . Id64ToId3 ( fromId ) ;
121
- toId = Utilities . Id64ToId3 ( toId ) ;
122
- string fromDir = Path . Combine ( BnetSavePath , fromId ) ;
123
- foreach ( var single in Directory . GetFiles ( fromDir , "*.*" , SearchOption . AllDirectories ) ) {
124
- SteamFileTransfer ( single , fromId , single . Replace ( fromId , toId ) , toId ) ;
125
- }
126
- }
127
-
128
- public static void SteamBulkEncrypt ( string fromDir , string toId ) {
129
- toId = Utilities . Id64ToId3 ( toId ) ;
130
- string toDir = Path . Combine ( SteamSavePath , toId , SteamGameID . ToString ( ) , "remote" ) ;
131
- foreach ( var single in Directory . GetFiles ( fromDir , "*.*" , SearchOption . AllDirectories ) ) {
132
- SteamFileEncrypt ( single , Path . Combine ( toDir , single . Replace ( fromDir , "" ) . Substring ( 1 ) ) , Utilities . Id3ToId64 ( toId ) ) ;
133
- }
134
- }
135
-
136
- public static void SteamBulkDecrypt ( string fromId , string toDir ) {
137
- fromId = Utilities . Id64ToId3 ( fromId ) ;
138
- string fromDir = Path . Combine ( SteamSavePath , fromId , SteamGameID . ToString ( ) , "remote" ) ;
139
- foreach ( var single in Directory . GetFiles ( fromDir , "*.*" , SearchOption . AllDirectories ) ) {
140
- SteamFileDecrypt ( single , Utilities . Id3ToId64 ( fromId ) , Path . Combine ( toDir , single . Replace ( Path . Combine ( SteamSavePath , fromId , SteamGameID . ToString ( ) , "remote" ) , "" ) . Substring ( 1 ) ) ) ;
141
- }
142
- }
143
- #endregion
144
-
145
- #region Both
146
- public static void BnetToSteamTransfer ( string fromId , string toId ) {
147
- Directory . CreateDirectory ( "tmp" ) ;
148
- BnetBulkDecrypt ( fromId , "tmp" ) ;
149
- SteamBulkEncrypt ( "tmp" , toId ) ;
150
- Directory . Delete ( "tmp" , true ) ;
151
- }
152
-
153
- public static void SteamToBnetTransfer ( string fromId , string toId ) {
154
- Directory . CreateDirectory ( "tmp" ) ;
155
- SteamBulkDecrypt ( fromId , "tmp" ) ;
156
- BnetBulkEncrypt ( "tmp" , toId ) ;
157
- Directory . Delete ( "tmp" , true ) ;
158
- }
159
- #endregion
160
41
}
161
42
}
0 commit comments