| author | totetm <> |
| Thu, 14 Jan 2010 16:39:50 +0100 | |
| changeset 30 | 644e3cd48034 |
| parent 28 | 2d4ec5ab2a40 |
| child 34 | 4d9ebc6fbbe8 |
| 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; |
|
| 30 | 12 |
using System.Xml.Linq; |
| 0 | 13 |
namespace Iri.Modernisation.Data.LDTClass |
14 |
{ |
|
15 |
public class LDTFileReader |
|
16 |
{ |
|
| 30 | 17 |
public static VideoBook ConvertToVideoBook(XDocument Path) |
| 0 | 18 |
{ |
| 30 | 19 |
LDTFile _ldtFile = new LDTFile(); |
20 |
_ldtFile.Load(Path); |
|
21 |
VideoBook _videoBook = new VideoBook(); |
|
| 0 | 22 |
if (_ldtFile != null) |
23 |
{ |
|
24 |
// Initialisation du VideoBook |
|
25 |
_videoBook = new VideoBook() |
|
26 |
{ |
|
27 |
Title = _ldtFile.Project.Title, |
|
28 |
Author = new User() |
|
29 |
{ |
|
30 |
UserName = _ldtFile.Project.User, |
|
31 |
|
|
32 |
}, |
|
33 |
Duration = new TimeSpan() |
|
34 |
|
|
35 |
||
36 |
}; |
|
37 |
||
38 |
// Initialisation des index |
|
39 |
foreach (LDTAnnotationsContent LDTAC in _ldtFile.Annotations) |
|
40 |
{ |
|
|
10
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
41 |
int count=0; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
42 |
int decoupage = LDTAC.Content[2].Elements.Count/4; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
43 |
int selectedChapter = 0; |
| 0 | 44 |
foreach(LDTElement LDTE in LDTAC.Content[2].Elements) |
45 |
{ |
|
|
10
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
46 |
|
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
47 |
|
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
48 |
_videoBook.Chapters[selectedChapter].Index.Add(new SegmentIndex(_videoBook.Chapters[selectedChapter]) |
| 0 | 49 |
{ |
50 |
Title = LDTE.Title, |
|
51 |
Description = LDTE.Abstract, |
|
52 |
Tags = LDTE.Tags, |
|
53 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
54 |
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
|
55 |
|
| 0 | 56 |
}); |
|
10
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
57 |
count++; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
58 |
if (count % decoupage == 0) |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
59 |
{ |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
60 |
selectedChapter++; |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
61 |
if (selectedChapter >= 4) |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
62 |
{ |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
63 |
selectedChapter = 3; |
|
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 |
} |
|
12515e11b357
Update PolemicElement View : Can Display Correct Color of VideoChapter
Matthieu Totet
parents:
0
diff
changeset
|
66 |
|
| 0 | 67 |
_videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur)); |
68 |
} |
|
69 |
foreach (LDTElement LDTE in LDTAC.Content[3].Elements) |
|
70 |
{ |
|
71 |
_videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0]) |
|
72 |
{ |
|
73 |
Title = LDTE.Title, |
|
74 |
Description = LDTE.Abstract, |
|
75 |
Tags = LDTE.Tags, |
|
76 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
77 |
Duration = new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur+5000)), |
|
| 28 | 78 |
Type = FactoryVideoLivre.AnnotationDescriptions[0] |
| 0 | 79 |
}); |
80 |
// _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)(LDTE.Dur))); |
|
81 |
} |
|
82 |
foreach (LDTElement LDTE in LDTAC.Content[1].Elements) |
|
83 |
{ |
|
84 |
_videoBook.Chapters[0].Annotations.Add(new Annotation(_videoBook.Chapters[0]) |
|
85 |
{ |
|
86 |
Title = LDTE.Title, |
|
87 |
Description = LDTE.Abstract, |
|
88 |
Tags = LDTE.Tags, |
|
89 |
TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin), |
|
90 |
Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur), |
|
| 28 | 91 |
Type = FactoryVideoLivre.AnnotationDescriptions[1] |
| 0 | 92 |
}); |
93 |
// _videoBook.Duration = _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur)); |
|
94 |
} |
|
95 |
||
96 |
} |
|
| 30 | 97 |
return _videoBook; |
| 0 | 98 |
// Initialisation des Annotations |
99 |
//Initialisation des Liens |
|
100 |
} |
|
101 |
else |
|
102 |
{ |
|
103 |
throw new Exception("Fichier LDT Null"); |
|
104 |
} |
|
105 |
||
106 |
} |
|
107 |
} |
|
108 |
} |