示例#1
0
        private void ImportObjects(string[] filePaths)
        {
            var imports = new Dictionary <string, CustomObjectImport>();

            foreach (var filePath in filePaths)
            {
                var import = CustomObjectCollection.LoadImport(filePath);
                import.Decompress();
                imports.Add(Path.GetFileNameWithoutExtension(filePath), import);
            }

            ImportObjects(imports);
        }
        // F e a t u r e s

        private async Task <IEnumerable <CustomObjectImport> > LoadLocalImports()
        {
            var tasks     = new List <Task <CustomObjectImport> >();
            var imports   = new List <CustomObjectImport>();
            var localPath = Publics.General.MyCustomObjectsPath;

            foreach (var filePath in Directory.GetFiles(localPath, "*.rmobj", SearchOption.AllDirectories))
            {
                tasks.Add(Task.Run(() => CustomObjectCollection.LoadImport(filePath)));
            }

            foreach (var task in tasks)
            {
                imports.Add(await task);
            }

            return(imports);
        }