public static Session Load (FileSystemDatabase fsd, int key) { var toLoad = fsd.Read (key); if (toLoad == null) { return null; } var result = new Session (); result.Id = key; if (toLoad.ContainsKey (ShovelVmStateName)) { result.ShovelVmState = toLoad [ShovelVmStateName]; } if (toLoad.ContainsKey (ShovelVmBytecodeName)) { result.ShovelVmBytecode = toLoad [ShovelVmBytecodeName]; } if (toLoad.ContainsKey (ShovelVmSourcesName)) { result.ShovelVmSources = Encoding.UTF8.GetString (toLoad [ShovelVmSourcesName]); } if (toLoad.ContainsKey (PageContentName)) { result.PageContent.Append (Encoding.UTF8.GetString (toLoad [PageContentName])); } if (toLoad.ContainsKey (ReadStateName)) { result.ReadState = (ReadStates)BitConverter.ToInt32 (toLoad [ReadStateName], 0); } return result; }
public static Session Load(FileSystemDatabase fsd, int key) { var toLoad = fsd.Read(key); if (toLoad == null) { return(null); } var result = new Session(); result.Id = key; if (toLoad.ContainsKey(ShovelVmStateName)) { result.ShovelVmState = toLoad [ShovelVmStateName]; } if (toLoad.ContainsKey(ShovelVmBytecodeName)) { result.ShovelVmBytecode = toLoad [ShovelVmBytecodeName]; } if (toLoad.ContainsKey(ShovelVmSourcesName)) { result.ShovelVmSources = Encoding.UTF8.GetString(toLoad [ShovelVmSourcesName]); } if (toLoad.ContainsKey(PageContentName)) { result.PageContent.Append(Encoding.UTF8.GetString(toLoad [PageContentName])); } if (toLoad.ContainsKey(ReadStateName)) { result.ReadState = (ReadStates)BitConverter.ToInt32(toLoad [ReadStateName], 0); } return(result); }