Exemplo n.º 1
0
        /// <summary>
        /// Loads the data structure from path. Use path with file name if <see cref="fileDataFilenameMode.propertyValue" />
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path">The path.</param>
        /// <param name="parentFolder">The parent folder.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException">Can't have File Data Structure loaded if no file structure mode specified
        /// or
        /// JSON not implemented yet
        /// or
        /// binary file not implemented yet</exception>
        public static T LoadDataStructure <T>(this String path, folderNode parentFolder = null, ILogBuilder output = null) where T : IFileDataStructure, new()
        {
            fileDataStructureDescriptor descriptor = GetFileDataStructureDescriptor <T>();
            T instance = new T();

            instance = (T)descriptor.LoadDataStructure(path, parentFolder, instance, output);

            return(instance);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the file data structure descriptor for class implementing <see cref="IFileDataStructure"/> interface
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static fileDataStructureDescriptor GetFileDataStructureDescriptor <T>() where T : IFileDataStructure
        {
            Type type = typeof(T);

            fileDataStructureDescriptor descriptor = new fileDataStructureDescriptor();

            descriptor.deployDescriptor(type, null);

            return(descriptor);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Deletes the data structure.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dataStructure">The data structure.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public static Boolean DeleteDataStructure <T>(this T dataStructure, ILogBuilder output = null) where T : IFileDataStructure
        {
            fileDataStructureDescriptor descriptor = GetFileDataStructureDescriptor(dataStructure);

            return(descriptor.DeleteDataStructure(dataStructure, output));
        }
Exemplo n.º 4
0
        public static String SaveDataStructure <T>(this T dataStructure, folderNode parentFolder = null, ILogBuilder output = null) where T : IFileDataStructure
        {
            fileDataStructureDescriptor descriptor = GetFileDataStructureDescriptor(dataStructure);

            return(descriptor.SaveDataStructure(dataStructure, parentFolder, output));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the file data structure descriptor.
        /// </summary>
        /// <param name="dataStructure">The data structure.</param>
        /// <returns></returns>
        public static fileDataStructureDescriptor GetFileDataStructureDescriptor(this IFileDataStructure dataStructure)
        {
            fileDataStructureDescriptor output = new fileDataStructureDescriptor(dataStructure);

            return(output);
        }