public void LoadPresentationFromStorage() { //A fake presentation info info[@"name"] = @"Pitch for Paul"; info[@"presentor"] = @"POI"; for (int i = 0; i < 16; i++) { Console.WriteLine("Processing index: " + i); POISlide slide = new POIStaticSlide(i, this); Insert(slide); } List<int> duration = new List<int>(); duration.Add(500); duration.Add(500); duration.Add(500); duration.Add(500); //POISlide slide2 = new POIAnimationSlide(duration, 12, this); //Insert(slide2); }
public override void deserialize(byte[] buffer, ref int offset) { size = fieldSize; slideList = new Dictionary<string, POISlide>(); //Deserialize the presenation ID deserializeInt32(buffer, ref offset, ref presId); //Create the folder if the directory does not exist String folderPath = Path.Combine(POIArchive.ArchiveHome, BasePath); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } //Deserialize the info length int infoLength = 0; deserializeInt32(buffer, ref offset, ref infoLength); byte[] infoBytes = buffer.Skip(offset).Take(infoLength).ToArray(); offset += infoLength; string infoString = Encoding.UTF8.GetString(infoBytes); JavaScriptSerializer jsonParser = new JavaScriptSerializer(); info = jsonParser.Deserialize<Dictionary<string, string>>(infoString); size += infoLength; //Deserialize the number of slides int numSlides = 0; deserializeInt32(buffer, ref offset, ref numSlides); for (int i = 0; i < numSlides; i++) { int curType = 0; deserializeInt32(buffer, ref offset, ref curType); size += sizeof(int); POISlide curSlide = null; if (curType == (int)SlideType.Static) { curSlide = new POIStaticSlide(this); } else { curSlide = new POIAnimationSlide(this); } curSlide.deserialize(buffer, ref offset); Insert(curSlide); size += curSlide.Size; } sizeChanged = false; }