GameDevWare.Charon.Settings.Validate C# (CSharp) Method

Validate() private method

private Validate ( ) : void
return void
        private void Validate()
        {
            if (this.GameDataPaths == null) this.GameDataPaths = new string[0];
            var newPaths = this.GameDataPaths
                .Select<string, string>(FileUtils.MakeProjectRelative)
                .Where(p => !string.IsNullOrEmpty(p) && File.Exists(p))
                .Distinct()
                .ToArray();

            if (!newPaths.SequenceEqual(this.GameDataPaths))
            {
                this.GameDataPaths = newPaths;
            }

            if (string.IsNullOrEmpty(this.ToolsPath) || File.Exists(this.ToolsPath) == false)
            {
                this.ToolsPath = (from id in AssetDatabase.FindAssets("t:DefaultAsset Charon")
                                  let path = FileUtils.MakeProjectRelative(AssetDatabase.GUIDToAssetPath(id))
                                  where path != null && path.EndsWith(".exe", StringComparison.OrdinalIgnoreCase)
                                  select path).FirstOrDefault() ?? DEFAULT_TOOLS_PATH;
            }

            this.ToolsPath = FileUtils.MakeProjectRelative(this.ToolsPath) ?? ToolsPath;

            if (this.ToolsPort < 5000)
                this.ToolsPort = 5000;
            if (this.ToolsPort > 65535)
                this.ToolsPort = 65535;
        }