示例#1
0
        public void ReadMemoryAllocators(string arma3Path)
        {
            try
            {
                Logger.LogDebug("ParameterService", "Starting reading memory allocators");

                BindableCollection <ValueItem> allocators32 = new BindableCollection <ValueItem>();
                BindableCollection <ValueItem> allocators64 = new BindableCollection <ValueItem>();

                if (_fileAccessor.DirectoryExists(Path.Combine(arma3Path, ApplicationConfig.AllocatorsFolder)))
                {
                    allocators32.Add(new ValueItem("system", Resources.Strings.S_PARAMETER_MALLOC_SYSTEM));
                    allocators64.Add(new ValueItem("system", Resources.Strings.S_PARAMETER_MALLOC_SYSTEM));

                    string[] files = _fileAccessor.GetFiles(Path.Combine(arma3Path, ApplicationConfig.AllocatorsFolder), $"*{ApplicationConfig.AllocatorsPattern32}");
                    foreach (string file in files)
                    {
                        if (file.EndsWith(ApplicationConfig.AllocatorsPattern64))
                        {
                            continue;
                        }
                        var name = Path.GetFileNameWithoutExtension(file);
                        allocators32.Add(new ValueItem(name, name + " (x32)"));
                    }

                    string[] filesX64 = _fileAccessor.GetFiles(Path.Combine(arma3Path, ApplicationConfig.AllocatorsFolder), $"*{ApplicationConfig.AllocatorsPattern64}");
                    foreach (string file in filesX64)
                    {
                        var name = Path.GetFileNameWithoutExtension(file);
                        allocators64.Add(new ValueItem(name, name + " (x64)"));
                    }
                }
                else
                {
                    Logger.LogException("ParameterService", "Unable to read memory allocators, no \\Dll folder found in the game folder");
                }

                _malloc32.Values = allocators32;
                _malloc64.Values = allocators64;

                Logger.LogDebug("ParameterService", "Finished reading memory allocators");
            }
            catch (Exception e)
            {
                _malloc32.Values = new BindableCollection <ValueItem>();
                _malloc64.Values = new BindableCollection <ValueItem>();

                Logger.LogException("ParameterService", "Error reading memory allocators", e);
            }
        }
示例#2
0
        public BindableCollection <Repository> ReadRepositories(string arma3SyncPath)
        {
            BindableCollection <Repository> repositories = new BindableCollection <Repository>();

            if (!_fileAccessor.DirectoryExists(arma3SyncPath))
            {
                Logger.LogDebug("Arma3SyncService", "No valid Arma3Sync path defined, skipping reading repositories");
                return(repositories);
            }
            ;

            string[] files = _fileAccessor.GetFiles(Path.Combine(arma3SyncPath, ApplicationConfig.Arma3SyncConfigFolder));
            foreach (string file in files)
            {
                string fileName = Path.GetFileName(file);
                if (fileName != null)
                {
                    repositories.Add(new Repository
                    {
                        Name = fileName.Substring(0, fileName.IndexOf('.')),
                        Path = file
                    });
                }
            }

            Logger.LogDebug("Arma3SyncService", $"Finished reading repositories, found {repositories.Count}");

            return(repositories);
        }