Example #1
0
        public DDictionary <string, DDictionary <string, byte[]> > GetAllResourceFilesFromFolder(string folderPath)
        {
            DDictionary <string, DDictionary <string, byte[]> > toReturn = new DDictionary <string, DDictionary <string, byte[]> >();

            string[] directories = Directory.GetDirectories(folderPath);
            foreach (var directory in directories)
            {
                var directoryName = Path.GetFileName(directory);

                var dic = GetFilesFromFolder(directory);
                if (dic.Count > 0)
                {
                    toReturn.Add(directoryName, dic);
                }

                var childDic = GetAllResourceFilesFromFolder(directory);
                if (childDic.Count > 0)
                {
                    foreach (var childDicPair in childDic)
                    {
                        toReturn.Add(Path.Combine(directoryName, childDicPair.Key), childDicPair.Value);
                    }
                }
            }
            return(toReturn);
        }
Example #2
0
        public void LoadAll()
        {
            CentreElements = new DDictionary <string, T>();

            var elements = StaticHub.ResourceManager.GetAllResources(ResourceType);

            foreach (var element in elements)
            {
                T si = new T();
                si.LoadBytes(element.Value);
                si.Name = element.Key;
                CentreElements.Add(element.Key, si);
            }
        }
Example #3
0
        public DDictionary <string, T> GetAllOfSerializedObjects <T>(string type) where T : class
        {
            DDictionary <string, T> toReturn = new DDictionary <string, T>();

            if (Resources.ContainsKey(type))
            {
                DDictionary <string, byte[]> resourcesWithType = Resources[type];

                foreach (var resourceWithType in resourcesWithType)
                {
                    var fileNamewithExtension = resourceWithType.Key;
                    var obj = _fileAssistant.Deserialize <T>(fileNamewithExtension, resourceWithType.Value);
                    toReturn.Add(fileNamewithExtension, obj);
                }
            }
            return(toReturn);
        }