|
0
|
1 |
using System; |
|
|
2 |
using System.Net; |
|
|
3 |
using System.Windows; |
|
|
4 |
using System.Windows.Controls; |
|
|
5 |
using System.Windows.Documents; |
|
|
6 |
using System.Windows.Ink; |
|
|
7 |
using System.Windows.Input; |
|
|
8 |
using System.Windows.Media; |
|
|
9 |
using System.Windows.Media.Animation; |
|
|
10 |
using System.Windows.Shapes; |
|
|
11 |
using Iri.Modernisation.Data.Models; |
|
|
12 |
|
|
|
13 |
namespace Iri.Modernisation.Data.LDTClass |
|
|
14 |
{ |
|
|
15 |
public class LDTFileReader |
|
|
16 |
{ |
|
|
17 |
private LDTFile _ldtFile; |
|
|
18 |
private VideoBook _videoBook; |
|
|
19 |
public VideoBook VideoBook |
|
|
20 |
{ |
|
|
21 |
get |
|
|
22 |
{ |
|
|
23 |
return _videoBook; |
|
|
24 |
} |
|
|
25 |
} |
|
|
26 |
public LDTFileReader(String LDTPath) |
|
|
27 |
{ |
|
|
28 |
_ldtFile = new LDTFile(); |
|
|
29 |
_ldtFile.Load(LDTPath); |
|
|
30 |
ConvertLdtToVideoBook(); |
|
|
31 |
} |
|
|
32 |
public LDTFileReader(LDTFile ldtFile) |
|
|
33 |
{ |
|
|
34 |
_ldtFile = ldtFile; |
|
|
35 |
ConvertLdtToVideoBook(); |
|
|
36 |
} |
|
|
37 |
private void ConvertLdtToVideoBook() |
|
|
38 |
{ |
|
|
39 |
if (_ldtFile != null) |
|
|
40 |
{ |
|
|
41 |
// Initialisation du VideoBook |
|
|
42 |
_videoBook = new VideoBook() |
|
|
43 |
{ |
|
|
44 |
Title = _ldtFile.Project.Title, |
|
|
45 |
Author = new User() |
|
|
46 |
{ |
|
|
47 |
UserName = _ldtFile.Project.User, |
|
|
48 |
|
|
|
49 |
}, |
|
|
50 |
Duration = new TimeSpan() |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
}; |
|
|
54 |
|
|
|
55 |
// Initialisation des index |
|
|
56 |
foreach (LDTAnnotationsContent LDTAC in _ldtFile.Annotations) |
|
|
57 |
{ |
|
|
58 |
foreach(LDTElement LDTE in LDTAC.Content[2].Elements) |
|
|
59 |
{ |
|
|
60 |
_videoBook.Chapters[0].Index.Add(new SegmentIndex(_videoBook.Chapters[0]) |
|
|
61 |
{ |
|
|
62 |
Title = LDTE.Title, |
|
|
63 |
Description = LDTE.Abstract, |
|
|
64 |
Tags = LDTE.Tags, |
|
|
65 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
|
66 |
Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur), |
|
|
67 |
}); |
|
|
68 |
_videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur)); |
|
|
69 |
} |
|
|
70 |
foreach (LDTElement LDTE in LDTAC.Content[3].Elements) |
|
|
71 |
{ |
|
|
72 |
_videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0]) |
|
|
73 |
{ |
|
|
74 |
Title = LDTE.Title, |
|
|
75 |
Description = LDTE.Abstract, |
|
|
76 |
Tags = LDTE.Tags, |
|
|
77 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
|
78 |
Duration = new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur+5000)), |
|
|
79 |
Type = PolemicElementType.Polemic |
|
|
80 |
}); |
|
|
81 |
// _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur))); |
|
|
82 |
} |
|
|
83 |
foreach (LDTElement LDTE in LDTAC.Content[1].Elements) |
|
|
84 |
{ |
|
|
85 |
_videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0]) |
|
|
86 |
{ |
|
|
87 |
Title = LDTE.Title, |
|
|
88 |
Description = LDTE.Abstract, |
|
|
89 |
Tags = LDTE.Tags, |
|
|
90 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
|
91 |
Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur), |
|
|
92 |
Type = PolemicElementType.Reference |
|
|
93 |
}); |
|
|
94 |
// _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur)); |
|
|
95 |
} |
|
|
96 |
|
|
|
97 |
} |
|
|
98 |
// Initialisation des Annotations |
|
|
99 |
//Initialisation des Liens |
|
|
100 |
} |
|
|
101 |
else |
|
|
102 |
{ |
|
|
103 |
throw new Exception("Fichier LDT Null"); |
|
|
104 |
} |
|
|
105 |
|
|
|
106 |
} |
|
|
107 |
} |
|
|
108 |
} |