예제 #1
0
        public IDictionary SetContentDictionaryValues(IDictionary data, DalcFileContent content)
        {
            var res = SetValues(data, content, FileContentMap);

            res[FileContentMap["Stream"]] = ((MemoryStream)content.GetStream(FileAccess.Read)).ToArray();
            return(res);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public void Close()
 {
     DalcFs.SaveFile(this);
     if (FileContent != null)
     {
         FileContent.Close();
         FileContent = null;
     }
 }
예제 #5
0
        /// <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);
        }
예제 #6
0
 public DalcFileStream(DalcFileContent content) {
     Content = content;
 }