1
1
using Backtrace . Newtonsoft . Linq ;
2
2
using System ;
3
- using System . Collections . Generic ;
4
3
using System . Linq ;
5
- using System . Text ;
6
- using System . Threading . Tasks ;
4
+ using System . Net . Mime ;
7
5
8
6
namespace Backtrace . Unity . Model
9
7
{
10
8
public class BacktraceSourceCode
11
9
{
12
10
public string Id = Guid . NewGuid ( ) . ToString ( ) ;
13
- public string Type { get ; set ; } = "Text" ;
14
- public string Title { get ; set ; } = "Log File" ;
11
+ public readonly string Type = "Text" ;
12
+ public readonly string Title = "Log File" ;
15
13
16
14
public bool HighlightLine = false ;
17
15
public string Text { get ; set ; }
18
16
17
+ public BacktraceSourceCode ( )
18
+ {
19
+ Type = "Text" ;
20
+ Title = "Log File" ;
21
+ }
22
+
19
23
internal BacktraceJObject ToJson ( )
20
24
{
21
25
var json = new BacktraceJObject ( ) ;
22
- json [ Id . ToString ( ) ] = new BacktraceJObject ( )
23
- {
24
- [ "id" ] = Id ,
25
- [ "type" ] = Type ,
26
- [ "title" ] = Title ,
27
- [ "highlightLine" ] = HighlightLine ,
28
- [ "text" ] = Text ,
29
- } ;
26
+ var sourceCode = new BacktraceJObject ( ) ;
27
+ sourceCode [ "id" ] = Id ;
28
+ sourceCode [ "type" ] = Type ;
29
+ sourceCode [ "title" ] = Title ;
30
+ sourceCode [ "highlightLine" ] = HighlightLine ;
31
+ sourceCode [ "text" ] = Text ;
30
32
33
+ json [ Id . ToString ( ) ] = sourceCode ;
31
34
return json ;
32
35
}
33
36
@@ -46,9 +49,7 @@ internal static BacktraceSourceCode Deserialize(JToken token)
46
49
var sourceCode = new BacktraceSourceCode ( )
47
50
{
48
51
Id = rawSourceCode . Value < string > ( "id" ) ,
49
- Text = rawSourceCode . Value < string > ( "text" ) ,
50
- Title = rawSourceCode . Value < string > ( "title" ) ,
51
- Type = rawSourceCode . Value < string > ( "type" )
52
+ Text = rawSourceCode . Value < string > ( "text" )
52
53
} ;
53
54
return sourceCode ;
54
55
}
0 commit comments