Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
I3csstatus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
I3csstatus
Commits
d6587bf8
Commit
d6587bf8
authored
2 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
ModuleException and use in ModuleI3Status
parent
ee9a523c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Program.cs
+17
-3
17 additions, 3 deletions
Program.cs
with
17 additions
and
3 deletions
Program.cs
+
17
−
3
View file @
d6587bf8
...
...
@@ -42,6 +42,9 @@ namespace i3csstatus {
Color
?
color
=
null
);
class
ModuleException
:
Exception
{
}
[
System
.
AttributeUsage
(
System
.
AttributeTargets
.
Class
,
AllowMultiple
=
true
)]
public
class
ModuleName
:
System
.
Attribute
{
...
...
@@ -82,6 +85,13 @@ namespace i3csstatus {
[
ModuleName
(
"i3status"
)]
class
ModuleI3Status
:
Module
{
class
ModuleI3StatusException
:
ModuleException
{
public
override
string
ToString
()
{
return
$"I3Status don't work correctly."
;
}
}
string
name
;
string
configuration
;
Element
[]
elements
;
...
...
@@ -131,9 +141,13 @@ namespace i3csstatus {
public
override
void
GetBegin
()
{
process
.
KillBySignal
(
10
);
string
str
=
process
.
StandardOutput
.
ReadLine
()[
1
..];
Console
.
WriteLine
(
str
);
JsonArray
json
=
JsonObject
.
Parse
(
str
).
AsArray
();
string
line
=
process
.
StandardOutput
.
ReadLine
();
if
(
line
==
null
)
{
throw
new
ModuleI3StatusException
();
}
Console
.
WriteLine
(
line
[
1
..]);
JsonArray
json
=
JsonObject
.
Parse
(
line
[
1
..]).
AsArray
();
if
(
json
.
Count
!=
modules
.
Count
)
throw
new
Exception
(
"Parse i3status error"
);
for
(
int
i
=
0
;
i
<
modules
.
Count
;
i
++)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment