Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Joona Romppanen
/
Moya Info Tools
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 43b5f7d3
authored
Jun 07, 2017
by
Joona Romppanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Capture 404 in WebEx handler and make logfile path configurable
1 parent
e0d96526
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
54 deletions
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/MoyaAdminLib.csproj
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/RestClient.cs
MoyaSignup/Logger.cs
MoyaSignup/Properties/Settings.Designer.cs
MoyaSignup/Properties/Settings.settings
MoyaSignup/UserLoginControl.cs
MoyaSignup/app.config
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/MoyaAdminLib.csproj
View file @
43b5f7d
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System" />
...
...
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/RestClient.cs
View file @
43b5f7d
...
@@ -160,6 +160,12 @@ namespace MoyaAdminLib
...
@@ -160,6 +160,12 @@ namespace MoyaAdminLib
}
}
catch
(
WebException
e
)
catch
(
WebException
e
)
{
{
var
errorResponse
=
e
.
Response
as
HttpWebResponse
;
if
(
errorResponse
!=
null
&&
errorResponse
.
StatusCode
==
HttpStatusCode
.
NotFound
)
{
throw
new
MoyaApiException
(
"Resource not found"
,
HttpStatusCode
.
NotFound
,
e
);
}
if
(
e
.
Status
==
WebExceptionStatus
.
ConnectFailure
)
if
(
e
.
Status
==
WebExceptionStatus
.
ConnectFailure
)
{
{
throw
;
throw
;
...
...
MoyaSignup/Logger.cs
View file @
43b5f7d
...
@@ -16,7 +16,7 @@ namespace MoyaSignup
...
@@ -16,7 +16,7 @@ namespace MoyaSignup
static
Logger
()
static
Logger
()
{
{
LogWriter
=
File
.
AppendText
(
"log.txt"
);
LogWriter
=
File
.
AppendText
(
Properties
.
Settings
.
Default
.
LogFile
);
}
}
public
static
void
Log
(
LogLevel
level
,
string
message
)
public
static
void
Log
(
LogLevel
level
,
string
message
)
...
@@ -24,7 +24,7 @@ namespace MoyaSignup
...
@@ -24,7 +24,7 @@ namespace MoyaSignup
LogWriter
.
Write
(
"[{0}] [{1}] {2}"
,
LogWriter
.
Write
(
"[{0}] [{1}] {2}"
,
string
.
Format
(
"{0} {1}"
,
DateTime
.
UtcNow
.
ToLongTimeString
(),
DateTime
.
UtcNow
.
ToLongDateString
()),
string
.
Format
(
"{0} {1}"
,
DateTime
.
UtcNow
.
ToLongTimeString
(),
DateTime
.
UtcNow
.
ToLongDateString
()),
level
,
level
,
message
+
'\n'
message
+
"\r\n"
);
);
LogWriter
.
Flush
();
LogWriter
.
Flush
();
}
}
...
@@ -35,6 +35,6 @@ namespace MoyaSignup
...
@@ -35,6 +35,6 @@ namespace MoyaSignup
public
static
void
Error
(
string
message
)
=>
Log
(
LogLevel
.
Error
,
message
);
public
static
void
Error
(
string
message
)
=>
Log
(
LogLevel
.
Error
,
message
);
public
static
void
Error
(
string
message
,
Exception
ex
)
=>
Log
(
LogLevel
.
Error
,
message
+
":\n"
+
ex
);
public
static
void
Error
(
string
message
,
Exception
ex
)
=>
Log
(
LogLevel
.
Error
,
message
+
":\
r\
n"
+
ex
);
}
}
}
}
\ No newline at end of file
MoyaSignup/Properties/Settings.Designer.cs
View file @
43b5f7d
...
@@ -12,7 +12,7 @@ namespace MoyaSignup.Properties {
...
@@ -12,7 +12,7 @@ namespace MoyaSignup.Properties {
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"1
4.0
.0.0"
)]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"1
5.1
.0.0"
)]
internal
sealed
partial
class
Settings
:
global
::
System
.
Configuration
.
ApplicationSettingsBase
{
internal
sealed
partial
class
Settings
:
global
::
System
.
Configuration
.
ApplicationSettingsBase
{
private
static
Settings
defaultInstance
=
((
Settings
)(
global
::
System
.
Configuration
.
ApplicationSettingsBase
.
Synchronized
(
new
Settings
())));
private
static
Settings
defaultInstance
=
((
Settings
)(
global
::
System
.
Configuration
.
ApplicationSettingsBase
.
Synchronized
(
new
Settings
())));
...
@@ -130,5 +130,17 @@ namespace MoyaSignup.Properties {
...
@@ -130,5 +130,17 @@ namespace MoyaSignup.Properties {
this
[
"ApiURL"
]
=
value
;
this
[
"ApiURL"
]
=
value
;
}
}
}
}
[
global
::
System
.
Configuration
.
UserScopedSettingAttribute
()]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Configuration
.
DefaultSettingValueAttribute
(
"log.txt"
)]
public
string
LogFile
{
get
{
return
((
string
)(
this
[
"LogFile"
]));
}
set
{
this
[
"LogFile"
]
=
value
;
}
}
}
}
}
}
MoyaSignup/Properties/Settings.settings
View file @
43b5f7d
...
@@ -29,5 +29,8 @@
...
@@ -29,5 +29,8 @@
<Setting Name="ApiURL" Type="System.String" Scope="User">
<Setting Name="ApiURL" Type="System.String" Scope="User">
<Value Profile="(Default)">http://myapi.moya.endpoint/MoyaWeb</Value>
<Value Profile="(Default)">http://myapi.moya.endpoint/MoyaWeb</Value>
</Setting>
</Setting>
<Setting Name="LogFile" Type="System.String" Scope="User">
<Value Profile="(Default)">log.txt</Value>
</Setting>
</Settings>
</Settings>
</SettingsFile>
</SettingsFile>
\ No newline at end of file
MoyaSignup/UserLoginControl.cs
View file @
43b5f7d
...
@@ -96,7 +96,6 @@ namespace MoyaSignup
...
@@ -96,7 +96,6 @@ namespace MoyaSignup
var
client
=
new
RestClient
();
var
client
=
new
RestClient
();
try
try
{
{
throw
new
MoyaApiException
(
"test"
,
HttpStatusCode
.
Ambiguous
,
new
WebException
());
var
json
=
client
.
MakeRequest
(
"user"
,
"email="
+
txtEmail
.
Text
);
var
json
=
client
.
MakeRequest
(
"user"
,
"email="
+
txtEmail
.
Text
);
var
ser
=
new
JavaScriptSerializer
();
var
ser
=
new
JavaScriptSerializer
();
var
euser
=
ser
.
Deserialize
<
Eventuser
>(
json
);
var
euser
=
ser
.
Deserialize
<
Eventuser
>(
json
);
...
@@ -110,7 +109,9 @@ namespace MoyaSignup
...
@@ -110,7 +109,9 @@ namespace MoyaSignup
}
}
catch
(
WebException
ex
)
catch
(
WebException
ex
)
{
{
if
(
ex
is
MoyaApiException
&&
((
MoyaApiException
)
ex
).
StatusCode
==
HttpStatusCode
.
NotFound
)
timer1
.
Stop
();
var
apiException
=
ex
as
MoyaApiException
;
if
(
apiException
!=
null
&&
apiException
.
StatusCode
==
HttpStatusCode
.
NotFound
)
{
{
CurrentUser
=
null
;
CurrentUser
=
null
;
infoLabel
.
Text
=
"Uusi kävijä?"
;
infoLabel
.
Text
=
"Uusi kävijä?"
;
...
@@ -119,7 +120,6 @@ namespace MoyaSignup
...
@@ -119,7 +120,6 @@ namespace MoyaSignup
}
}
else
else
{
{
timer1
.
Stop
();
Logger
.
Error
(
"Connection to MoyaApi failed"
,
ex
);
Logger
.
Error
(
"Connection to MoyaApi failed"
,
ex
);
MessageBox
.
Show
(
MessageBox
.
Show
(
...
@@ -142,8 +142,6 @@ namespace MoyaSignup
...
@@ -142,8 +142,6 @@ namespace MoyaSignup
MessageBoxIcon
.
Error
MessageBoxIcon
.
Error
);
);
}
}
timer1
.
Stop
();
}
}
private
void
ShowLogin
(
bool
show
)
private
void
ShowLogin
(
bool
show
)
...
...
MoyaSignup/app.config
View file @
43b5f7d
<?
xml
version
=
"1.0"
?>
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
configuration
>
<
configSections
>
<
configSections
>
<
sectionGroup
name
=
"userSettings"
type
=
"System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<
sectionGroup
name
=
"userSettings"
type
=
"System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<
section
name
=
"MoyaSignup.Properties.Settings"
type
=
"System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition
=
"MachineToLocalUser"
requirePermission
=
"false"
/>
<
section
name
=
"MoyaSignup.Properties.Settings"
type
=
"System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition
=
"MachineToLocalUser"
requirePermission
=
"false"
/>
</
sectionGroup
>
</
sectionGroup
>
</
configSections
>
</
configSections
>
<
runtime
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Npgsql"
publicKeyToken
=
"5D8B90D52F46FDA7"
culture
=
"neutral"
/>
<
assemblyIdentity
name
=
"Npgsql"
publicKeyToken
=
"5D8B90D52F46FDA7"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.0.0.0"
newVersion
=
"1.0.0.0"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.0.0.0"
newVersion
=
"1.0.0.0"
/>
</
dependentAssembly
>
</
dependentAssembly
>
</
assemblyBinding
>
</
assemblyBinding
>
</
runtime
>
</
runtime
>
<
userSettings
>
<
userSettings
>
<
MoyaSignup
.
Properties
.
Settings
>
<
MoyaSignup
.
Properties
.
Settings
>
<
setting
name
=
"ApiApplicationKey"
serializeAs
=
"String"
>
<
setting
name
=
"ApiApplicationKey"
serializeAs
=
"String"
>
<
value
>
myapiclientid
</
value
>
<
value
>
myapiclientid
</
value
>
</
setting
>
</
setting
>
<
setting
name
=
"ApiUser"
serializeAs
=
"String"
>
<
setting
name
=
"ApiUser"
serializeAs
=
"String"
>
<
value
>
myapiuser
</
value
>
<
value
>
myapiuser
</
value
>
</
setting
>
</
setting
>
<
setting
name
=
"ApiPass"
serializeAs
=
"String"
>
<
setting
name
=
"ApiPass"
serializeAs
=
"String"
>
<
value
>
myapikey
</
value
>
<
value
>
myapikey
</
value
>
</
setting
>
</
setting
>
<
setting
name
=
"ApplicationVersion"
serializeAs
=
"String"
>
<
setting
name
=
"ApplicationVersion"
serializeAs
=
"String"
>
<
value
/>
<
value
/>
</
setting
>
</
setting
>
<
setting
name
=
"Port"
serializeAs
=
"String"
>
<
setting
name
=
"Port"
serializeAs
=
"String"
>
<
value
/>
<
value
/>
</
setting
>
</
setting
>
<
setting
name
=
"ThermoPrinter"
serializeAs
=
"String"
>
<
setting
name
=
"ThermoPrinter"
serializeAs
=
"String"
>
<
value
>
0
</
value
>
<
value
>
0
</
value
>
</
setting
>
</
setting
>
<
setting
name
=
"Camera"
serializeAs
=
"String"
>
<
setting
name
=
"Camera"
serializeAs
=
"String"
>
<
value
>
Mobius
</
value
>
<
value
>
Mobius
</
value
>
</
setting
>
</
setting
>
<
setting
name
=
"printerPort"
serializeAs
=
"String"
>
<
setting
name
=
"printerPort"
serializeAs
=
"String"
>
<
value
>
COM1
</
value
>
<
value
>
COM1
</
value
>
</
setting
>
</
setting
>
<
setting
name
=
"ApiURL"
serializeAs
=
"String"
>
<
setting
name
=
"ApiURL"
serializeAs
=
"String"
>
<
value
>
http
://
myapi
.
moya
.
endpoint
/
MoyaWeb
</
value
>
<
value
>
http
://
myapi
.
moya
.
endpoint
/
MoyaWeb
</
value
>
</
setting
>
</
setting
>
</
MoyaSignup
.
Properties
.
Settings
>
<
setting
name
=
"LogFile"
serializeAs
=
"String"
>
</
userSettings
>
<
value
>
log
.
txt
</
value
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.0"
/></
startup
></
configuration
>
</
setting
>
</
MoyaSignup
.
Properties
.
Settings
>
</
userSettings
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.0"
/>
</
startup
>
</
configuration
>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment