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 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);
        }
Example #3
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 #4
0
        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;
        }
Example #5
0
        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);
        }
Example #6
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);
        }
Example #7
0
 public MyDictKVP(DDictionary dict, string key, object value = null) : base(dict, key, value)
 {
 }
Example #8
0
 public DynamicProductKVP(DDictionary dict, string key, object value = null) : base(dict, key, value)
 {
 }
Example #9
0
 public void LoadAll()
 {
     CentreElements = StaticHub.ResourceManager.GetAllOfSerializedObjects <T>(ResourceType);
 }
Example #10
0
 public CentreSerializationBase(string type)
 {
     ResourceType   = type;
     CentreElements = new DDictionary <string, T>();
 }
 public DynamicResource64KeyValuePair(DDictionary dict, string key, object value = null) : base(dict, key, value)
 {
 }
Example #12
0
 public SectionGrid()
 {
     SectionCoreMapping = new DDictionary <IParticleSection, Point3>(new Dictionary <IParticleSection, Point3>(), new Dictionary <Point3, IParticleSection>());
 }
Example #13
0
 public void LoadAllResources()
 {
     Resources = _fileAssistant.GetAllResourceFilesFromFolder(RESOURCE_PATH);
 }