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 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
...
...
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/RestClient.cs
View file @
43b5f7d
...
...
@@ -160,6 +160,12 @@ namespace MoyaAdminLib
}
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
)
{
throw
;
...
...
MoyaSignup/Logger.cs
View file @
43b5f7d
...
...
@@ -16,7 +16,7 @@ namespace MoyaSignup
static
Logger
()
{
LogWriter
=
File
.
AppendText
(
"log.txt"
);
LogWriter
=
File
.
AppendText
(
Properties
.
Settings
.
Default
.
LogFile
);
}
public
static
void
Log
(
LogLevel
level
,
string
message
)
...
...
@@ -24,7 +24,7 @@ namespace MoyaSignup
LogWriter
.
Write
(
"[{0}] [{1}] {2}"
,
string
.
Format
(
"{0} {1}"
,
DateTime
.
UtcNow
.
ToLongTimeString
(),
DateTime
.
UtcNow
.
ToLongDateString
()),
level
,
message
+
'\n'
message
+
"\r\n"
);
LogWriter
.
Flush
();
}
...
...
@@ -35,6 +35,6 @@ namespace MoyaSignup
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 {
[
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
{
private
static
Settings
defaultInstance
=
((
Settings
)(
global
::
System
.
Configuration
.
ApplicationSettingsBase
.
Synchronized
(
new
Settings
())));
...
...
@@ -130,5 +130,17 @@ namespace MoyaSignup.Properties {
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 @@
<Setting Name="ApiURL" Type="System.String" Scope="User">
<Value Profile="(Default)">http://myapi.moya.endpoint/MoyaWeb</Value>
</Setting>
<Setting Name="LogFile" Type="System.String" Scope="User">
<Value Profile="(Default)">log.txt</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
MoyaSignup/UserLoginControl.cs
View file @
43b5f7d
...
...
@@ -96,7 +96,6 @@ namespace MoyaSignup
var
client
=
new
RestClient
();
try
{
throw
new
MoyaApiException
(
"test"
,
HttpStatusCode
.
Ambiguous
,
new
WebException
());
var
json
=
client
.
MakeRequest
(
"user"
,
"email="
+
txtEmail
.
Text
);
var
ser
=
new
JavaScriptSerializer
();
var
euser
=
ser
.
Deserialize
<
Eventuser
>(
json
);
...
...
@@ -110,7 +109,9 @@ namespace MoyaSignup
}
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
;
infoLabel
.
Text
=
"Uusi kävijä?"
;
...
...
@@ -119,7 +120,6 @@ namespace MoyaSignup
}
else
{
timer1
.
Stop
();
Logger
.
Error
(
"Connection to MoyaApi failed"
,
ex
);
MessageBox
.
Show
(
...
...
@@ -142,8 +142,6 @@ namespace MoyaSignup
MessageBoxIcon
.
Error
);
}
timer1
.
Stop
();
}
private
void
ShowLogin
(
bool
show
)
...
...
MoyaSignup/app.config
View file @
43b5f7d
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
configSections
>
<
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"
/>
</
sectionGroup
>
</
configSections
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Npgsql"
publicKeyToken
=
"5D8B90D52F46FDA7"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.0.0.0"
newVersion
=
"1.0.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
<
userSettings
>
<
MoyaSignup
.
Properties
.
Settings
>
<
setting
name
=
"ApiApplicationKey"
serializeAs
=
"String"
>
<
value
>
myapiclientid
</
value
>
</
setting
>
<
setting
name
=
"ApiUser"
serializeAs
=
"String"
>
<
value
>
myapiuser
</
value
>
</
setting
>
<
setting
name
=
"ApiPass"
serializeAs
=
"String"
>
<
value
>
myapikey
</
value
>
</
setting
>
<
setting
name
=
"ApplicationVersion"
serializeAs
=
"String"
>
<
value
/>
</
setting
>
<
setting
name
=
"Port"
serializeAs
=
"String"
>
<
value
/>
</
setting
>
<
setting
name
=
"ThermoPrinter"
serializeAs
=
"String"
>
<
value
>
0
</
value
>
</
setting
>
<
setting
name
=
"Camera"
serializeAs
=
"String"
>
<
value
>
Mobius
</
value
>
</
setting
>
<
setting
name
=
"printerPort"
serializeAs
=
"String"
>
<
value
>
COM1
</
value
>
</
setting
>
<
setting
name
=
"ApiURL"
serializeAs
=
"String"
>
<
value
>
http
://
myapi
.
moya
.
endpoint
/
MoyaWeb
</
value
>
</
setting
>
</
MoyaSignup
.
Properties
.
Settings
>
</
userSettings
>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.0"
/></
startup
></
configuration
>
<
configSections
>
<
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"
/>
</
sectionGroup
>
</
configSections
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Npgsql"
publicKeyToken
=
"5D8B90D52F46FDA7"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.0.0.0"
newVersion
=
"1.0.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
<
userSettings
>
<
MoyaSignup
.
Properties
.
Settings
>
<
setting
name
=
"ApiApplicationKey"
serializeAs
=
"String"
>
<
value
>
myapiclientid
</
value
>
</
setting
>
<
setting
name
=
"ApiUser"
serializeAs
=
"String"
>
<
value
>
myapiuser
</
value
>
</
setting
>
<
setting
name
=
"ApiPass"
serializeAs
=
"String"
>
<
value
>
myapikey
</
value
>
</
setting
>
<
setting
name
=
"ApplicationVersion"
serializeAs
=
"String"
>
<
value
/>
</
setting
>
<
setting
name
=
"Port"
serializeAs
=
"String"
>
<
value
/>
</
setting
>
<
setting
name
=
"ThermoPrinter"
serializeAs
=
"String"
>
<
value
>
0
</
value
>
</
setting
>
<
setting
name
=
"Camera"
serializeAs
=
"String"
>
<
value
>
Mobius
</
value
>
</
setting
>
<
setting
name
=
"printerPort"
serializeAs
=
"String"
>
<
value
>
COM1
</
value
>
</
setting
>
<
setting
name
=
"ApiURL"
serializeAs
=
"String"
>
<
value
>
http
://
myapi
.
moya
.
endpoint
/
MoyaWeb
</
value
>
</
setting
>
<
setting
name
=
"LogFile"
serializeAs
=
"String"
>
<
value
>
log
.
txt
</
value
>
</
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