12
12
using SSCHOS = Sucrose . Shared . Core . Helper . OperatingSystem ;
13
13
using SSCHV = Sucrose . Shared . Core . Helper . Version ;
14
14
using SSDMM = Sucrose . Shared . Dependency . Manage . Manager ;
15
+ using SSSHN = Sucrose . Shared . Space . Helper . Network ;
15
16
using SSSHU = Sucrose . Shared . Space . Helper . User ;
16
17
using SSSHW = Sucrose . Shared . Space . Helper . Watchdog ;
17
18
using SSSMAD = Sucrose . Shared . Space . Model . AnalyticsData ;
@@ -44,7 +45,7 @@ public async void Start()
44
45
45
46
SRMI . Watcher = new ( )
46
47
{
47
- NotifyFilter = NotifyFilters . LastWrite | NotifyFilters . FileName | NotifyFilters . DirectoryName ,
48
+ NotifyFilter = NotifyFilters . LastWrite | NotifyFilters . FileName | NotifyFilters . DirectoryName | NotifyFilters . CreationTime ,
48
49
Path = SRMI . Source ,
49
50
Filter = "*.*"
50
51
} ;
@@ -67,19 +68,22 @@ private static async Task GetOnline()
67
68
{
68
69
try
69
70
{
70
- using HttpClient Client = new ( ) ;
71
+ if ( SSSHN . GetHostEntry ( ) )
72
+ {
73
+ using HttpClient Client = new ( ) ;
71
74
72
- HttpResponseMessage Response = new ( ) ;
75
+ HttpResponseMessage Response = new ( ) ;
73
76
74
- Client . DefaultRequestHeaders . Add ( "User-Agent" , SMMM . UserAgent ) ;
77
+ Client . DefaultRequestHeaders . Add ( "User-Agent" , SMMM . UserAgent ) ;
75
78
76
- try
77
- {
78
- Response = await Client . GetAsync ( $ "{ SMR . SoferityWebsite } /{ SMR . SoferityReport } /{ SMR . Online } /{ SSSHU . GetGuid ( ) } /{ SRMI . InitializeTime / 1000 } ") ;
79
- }
80
- catch ( Exception Exception )
81
- {
82
- await SSWW . Watch_CatchException ( Exception ) ;
79
+ try
80
+ {
81
+ Response = await Client . GetAsync ( $ "{ SMR . SoferityWebsite } /{ SMR . SoferityReport } /{ SMR . Online } /{ SSSHU . GetGuid ( ) } /{ SRMI . InitializeTime / 1000 } ") ;
82
+ }
83
+ catch ( Exception Exception )
84
+ {
85
+ await SSWW . Watch_CatchException ( Exception ) ;
86
+ }
83
87
}
84
88
}
85
89
catch ( Exception Exception )
@@ -92,32 +96,41 @@ private static async Task PostStatistic()
92
96
{
93
97
try
94
98
{
95
- using HttpClient Client = new ( ) ;
99
+ if ( SSSHN . GetHostEntry ( ) )
100
+ {
101
+ using HttpClient Client = new ( ) ;
96
102
97
- HttpResponseMessage Response = new ( ) ;
103
+ HttpResponseMessage Response = new ( ) ;
98
104
99
- Client . DefaultRequestHeaders . Add ( "User-Agent" , SMMM . UserAgent ) ;
105
+ Client . DefaultRequestHeaders . Add ( "User-Agent" , SMMM . UserAgent ) ;
100
106
101
- try
102
- {
103
- CultureInfo Culture = new ( SWNM . GetUserDefaultUILanguage ( ) ) ;
107
+ try
108
+ {
109
+ CultureInfo Culture = new ( SWNM . GetUserDefaultUILanguage ( ) ) ;
104
110
105
- SSSMAD AnalyticsData = new ( SMMM . Adult , SSSHU . GetName ( ) , SSSHU . GetModel ( ) , $ "{ SSDMM . StoreType } ", SMMM . Startup , SMMM . Culture . ToUpperInvariant ( ) , SSCHV . GetText ( ) , SSCHF . GetName ( ) , SSSHU . GetProcessor ( ) , SSCHM . GetTotalMemory ( ) , Culture . Name , SSSHU . GetNumberOfCores ( ) , SSCHA . GetText ( ) , SSSHU . GetManufacturer ( ) , $ "{ SMMM . DisplayScreenType } ", Culture . NativeName , SSCHOS . GetText ( ) , SSCHOS . GetProcessArchitectureText ( ) , SSCHV . GetOSText ( ) , SSCHOS . GetProcessorArchitecture ( ) , SWHSI . GetSystemInfoArchitecture ( ) ) ;
111
+ SSSMAD AnalyticsData = new ( SMMM . Adult , SSSHU . GetName ( ) , SSSHU . GetModel ( ) , $ "{ SSDMM . StoreType } ", SMMM . Startup , SMMM . Culture . ToUpperInvariant ( ) , SSCHV . GetText ( ) , SSCHF . GetName ( ) , SSSHU . GetProcessor ( ) , SSCHM . GetTotalMemory ( ) , Culture . Name , SSSHU . GetNumberOfCores ( ) , SSCHA . GetText ( ) , SSSHU . GetManufacturer ( ) , $ "{ SMMM . DisplayScreenType } ", Culture . NativeName , SSCHOS . GetText ( ) , SSCHOS . GetProcessArchitectureText ( ) , SSCHV . GetOSText ( ) , SSCHOS . GetProcessorArchitecture ( ) , SWHSI . GetSystemInfoArchitecture ( ) ) ;
106
112
107
- StringContent Content = new ( JsonConvert . SerializeObject ( AnalyticsData , Formatting . Indented ) , Encoding . UTF8 , "application/json" ) ;
113
+ StringContent Content = new ( JsonConvert . SerializeObject ( AnalyticsData , Formatting . Indented ) , Encoding . UTF8 , "application/json" ) ;
108
114
109
- Response = await Client . PostAsync ( $ "{ SMR . SoferityWebsite } /{ SMR . SoferityReport } /{ SMR . Statistic } /{ SSSHU . GetGuid ( ) } ", Content ) ;
110
- }
111
- catch ( Exception Exception )
112
- {
113
- await SSWW . Watch_CatchException ( Exception ) ;
115
+ Response = await Client . PostAsync ( $ "{ SMR . SoferityWebsite } /{ SMR . SoferityReport } /{ SMR . Statistic } /{ SSSHU . GetGuid ( ) } ", Content ) ;
116
+ }
117
+ catch ( Exception Exception )
118
+ {
119
+ await SSWW . Watch_CatchException ( Exception ) ;
114
120
115
- await Task . Delay ( 3000 ) ;
121
+ await Task . Delay ( 3000 ) ;
116
122
117
- await PostStatistic ( ) ;
118
- }
123
+ await PostStatistic ( ) ;
124
+ }
119
125
120
- if ( ! Response . IsSuccessStatusCode )
126
+ if ( ! Response . IsSuccessStatusCode )
127
+ {
128
+ await Task . Delay ( 3000 ) ;
129
+
130
+ await PostStatistic ( ) ;
131
+ }
132
+ }
133
+ else
121
134
{
122
135
await Task . Delay ( 3000 ) ;
123
136
@@ -138,34 +151,37 @@ private static async Task PostError(string Path)
138
151
{
139
152
try
140
153
{
141
- await Task . Delay ( 50 ) ;
142
-
143
- if ( File . Exists ( Path ) )
154
+ if ( SSSHN . GetHostEntry ( ) )
144
155
{
145
- using HttpClient Client = new ( ) ;
156
+ await Task . Delay ( 50 ) ;
146
157
147
- HttpResponseMessage Response = new ( ) ;
158
+ if ( File . Exists ( Path ) )
159
+ {
160
+ using HttpClient Client = new ( ) ;
148
161
149
- Client . DefaultRequestHeaders . Add ( "User-Agent" , SMMM . UserAgent ) ;
162
+ HttpResponseMessage Response = new ( ) ;
150
163
151
- try
152
- {
153
- SSSMDD DiagnosticsData = JsonConvert . DeserializeObject < SSSMDD > ( SSSHW . Read ( Path ) ) ;
164
+ Client . DefaultRequestHeaders . Add ( "User-Agent" , SMMM . UserAgent ) ;
154
165
155
- StringContent Content = new ( JsonConvert . SerializeObject ( DiagnosticsData , Formatting . Indented ) , Encoding . UTF8 , "application/json" ) ;
166
+ try
167
+ {
168
+ SSSMDD DiagnosticsData = JsonConvert . DeserializeObject < SSSMDD > ( SSSHW . Read ( Path ) ) ;
156
169
157
- Response = await Client . PostAsync ( $ "{ SMR . SoferityWebsite } /{ SMR . SoferityReport } /{ SMR . Error } /{ SSSHU . GetGuid ( ) } ", Content ) ;
158
- }
159
- catch ( Exception Exception )
160
- {
161
- await SSWW . Watch_CatchException ( Exception ) ;
162
- }
170
+ StringContent Content = new ( JsonConvert . SerializeObject ( DiagnosticsData , Formatting . Indented ) , Encoding . UTF8 , "application/json" ) ;
163
171
164
- if ( Response . IsSuccessStatusCode )
165
- {
166
- await Task . Delay ( 50 ) ;
172
+ Response = await Client . PostAsync ( $ "{ SMR . SoferityWebsite } /{ SMR . SoferityReport } /{ SMR . Error } /{ SSSHU . GetGuid ( ) } ", Content ) ;
173
+ }
174
+ catch ( Exception Exception )
175
+ {
176
+ await SSWW . Watch_CatchException ( Exception ) ;
177
+ }
178
+
179
+ if ( Response . IsSuccessStatusCode )
180
+ {
181
+ await Task . Delay ( 50 ) ;
167
182
168
- File . Delete ( Path ) ;
183
+ File . Delete ( Path ) ;
184
+ }
169
185
}
170
186
}
171
187
}
0 commit comments