public IDictionary SetContentDictionaryValues(IDictionary data, DalcFileContent content) { var res = SetValues(data, content, FileContentMap); res[FileContentMap["Stream"]] = ((MemoryStream)content.GetStream(FileAccess.Read)).ToArray(); return(res); }
/// <summary> /// Method saves file content /// </summary> /// <param name="fileContent">Instance of file content</param> public void SaveContent(DalcFileContent fileContent) { IDictionary data = FileSystemHelper.SetContentDictionaryValues(new Hashtable(), fileContent); SaveInternal(FileSystemHelper.SetContentDictionaryValues(new Hashtable(), fileContent), fileContent.File, ContentTableName, KeyFieldName); }
public DalcFileContent SetContentProperties(DalcFileContent content, IDictionary data) { var res = (DalcFileContent)SetProperties(content, data, FileContentMap); var dataBuf = (data[FileContentMap["Stream"]] as byte[]) ?? new byte[0]; content.GetStream(FileAccess.Write).Write(dataBuf, 0, dataBuf.Length); return(res); }
public void Close() { DalcFs.SaveFile(this); if (FileContent != null) { FileContent.Close(); FileContent = null; } }
/// <summary> /// Method fills DalcFileContent instance by data from storage they exists /// </summary> /// <param name="fileContent">DalcFileContent instance</param> /// <param name="name">Filename</param> /// <returns></returns> public DalcFileContent GetContent(DalcFileContent fileContent, string name) { if (name.Length > 0) { name = FormatPath(name); } Query q = new Query(ContentTableName, new QueryConditionNode((QField)KeyFieldName, Conditions.Equal, (QConst)name)); IDictionary contentData = Dalc.LoadRecord(q); if (contentData != null) { fileContent = FileSystemHelper.SetContentProperties(fileContent, contentData); } return(fileContent); }
public DalcFileStream(DalcFileContent content) { Content = content; }