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); }
public DDictionary <string, byte[]> GetFilesFromFolder(string folderFullPath) { DDictionary <string, byte[]> toReturn = new DDictionary <string, byte[]>(); string[] files = Directory.GetFiles(folderFullPath); foreach (var file in files) { string filename = Path.GetFileName(file); byte[] bytes = File.ReadAllBytes(file); toReturn[filename] = bytes; } return(toReturn); }
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); } }
private void AddResourceToList(string name, string type, byte[] bytes) { if (!Resources.ContainsKey(type)) { Resources[type] = new DDictionary <string, byte[]>(); } if (!name.Contains(".")) { name += "." + _fileAssistant.SerializationType.ToLower(); } //if (!Resources[type].ContainsKey(name)) Resources[type][name] = bytes; }
public DDictionary <string, AnimationGroupElement> GetAllAnimationGroupElements() { DDictionary <string, AnimationGroupElement> dic = new DDictionary <string, AnimationGroupElement>(); foreach (var TimeLine in base.CentreElements) { var AnimationGroupElements = TimeLine.Value.GetAllAnimationGroupElements(); if (AnimationGroupElements == null) { continue; } dic.AddRange(AnimationGroupElements.Where(w => !string.IsNullOrEmpty(w.Name)).ToDictionary(d => d.Name)); } return(dic); }
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); }
public MyDictKVP(DDictionary dict, string key, object value = null) : base(dict, key, value) { }
public DynamicProductKVP(DDictionary dict, string key, object value = null) : base(dict, key, value) { }
public void LoadAll() { CentreElements = StaticHub.ResourceManager.GetAllOfSerializedObjects <T>(ResourceType); }
public CentreSerializationBase(string type) { ResourceType = type; CentreElements = new DDictionary <string, T>(); }
public DynamicResource64KeyValuePair(DDictionary dict, string key, object value = null) : base(dict, key, value) { }
public SectionGrid() { SectionCoreMapping = new DDictionary <IParticleSection, Point3>(new Dictionary <IParticleSection, Point3>(), new Dictionary <Point3, IParticleSection>()); }
public void LoadAllResources() { Resources = _fileAssistant.GetAllResourceFilesFromFolder(RESOURCE_PATH); }