Ejemplo n.º 1
0
 private void Init()
 {
     lock (Lock)
         if (_files == null)
         {
             Memory.Log.WriteLine($"{nameof(Strings)} :: {nameof(Init)}");
             _files = new ConcurrentDictionary <FileID, StringsBase>();
             Func <bool>[] func =
             {
                 () => _files.TryAdd(FileID.Namedic,   Namedic.Load()), // area names and kernel require namedic
                 //though there shouldn't be anything reading the strings till this is done processing
                 //Task.WaitAll(tasks.ToArray());
                 () => _files.TryAdd(FileID.MenuGroup, MenuGroup.Load()),
                 () => _files.TryAdd(FileID.AreaNames, Areames.Load()),
                 () => _files.TryAdd(FileID.Kernel,    Kernel.Load()),
             };
             var tasks = Memory.ProcessFunctions(func);
             if (tasks.Any(x => !x))
             {
                 throw new ArgumentException($"{this}::Failed to add to dictionary...");
             }
         }
 }