| author | Matthieu Totet |
| Tue, 05 Jan 2010 15:53:48 +0100 | |
| changeset 28 | 2d4ec5ab2a40 |
| parent 10 | 12515e11b357 |
| child 30 | 644e3cd48034 |
| permissions | -rw-r--r-- |
| 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 |
{ |
|
|
10
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
58 |
int count=0; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
59 |
int decoupage = LDTAC.Content[2].Elements.Count/4; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
60 |
int selectedChapter = 0; |
| 0 | 61 |
foreach(LDTElement LDTE in LDTAC.Content[2].Elements) |
62 |
{ |
|
|
10
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
63 |
|
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
64 |
|
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
65 |
_videoBook.Chapters[selectedChapter].Index.Add(new SegmentIndex(_videoBook.Chapters[selectedChapter]) |
| 0 | 66 |
{ |
67 |
Title = LDTE.Title, |
|
68 |
Description = LDTE.Abstract, |
|
69 |
Tags = LDTE.Tags, |
|
70 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
71 |
Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur), |
|
|
10
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
72 |
|
| 0 | 73 |
}); |
|
10
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
74 |
count++; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
75 |
if (count % decoupage == 0) |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
76 |
{ |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
77 |
selectedChapter++; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
78 |
if (selectedChapter >= 4) |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
79 |
{ |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
80 |
selectedChapter = 3; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
81 |
} |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
82 |
} |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
83 |
|
| 0 | 84 |
_videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur)); |
85 |
} |
|
86 |
foreach (LDTElement LDTE in LDTAC.Content[3].Elements) |
|
87 |
{ |
|
88 |
_videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0]) |
|
89 |
{ |
|
90 |
Title = LDTE.Title, |
|
91 |
Description = LDTE.Abstract, |
|
92 |
Tags = LDTE.Tags, |
|
93 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
94 |
Duration = new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur+5000)), |
|
| 28 | 95 |
Type = FactoryVideoLivre.AnnotationDescriptions[0] |
| 0 | 96 |
}); |
97 |
// _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur))); |
|
98 |
} |
|
99 |
foreach (LDTElement LDTE in LDTAC.Content[1].Elements) |
|
100 |
{ |
|
101 |
_videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0]) |
|
102 |
{ |
|
103 |
Title = LDTE.Title, |
|
104 |
Description = LDTE.Abstract, |
|
105 |
Tags = LDTE.Tags, |
|
106 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
107 |
Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur), |
|
| 28 | 108 |
Type = FactoryVideoLivre.AnnotationDescriptions[1] |
| 0 | 109 |
}); |
110 |
// _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur)); |
|
111 |
} |
|
112 |
||
113 |
} |
|
114 |
// Initialisation des Annotations |
|
115 |
//Initialisation des Liens |
|
116 |
} |
|
117 |
else |
|
118 |
{ |
|
119 |
throw new Exception("Fichier LDT Null"); |
|
120 |
} |
|
121 |
||
122 |
} |
|
123 |
} |
|
124 |
} |