Files
FlaxEngine/Source/Editor/Modules/SourceCodeEditing/InBuildSourceCodeEditor.cs
Wojciech Figat eebc4951de Merge branch '1.5' into dotnet7
# Conflicts:
#	Source/Platforms/DotNet/NUnit/agents/net40/nunit-agent.exe
#	Source/Platforms/DotNet/NUnit/agents/net40/nunit.engine.api.dll
#	Source/Platforms/DotNet/NUnit/agents/net40/nunit.engine.core.dll
#	Source/Platforms/DotNet/NUnit/agents/net7.0/nunit.agent.addins
#	Source/Platforms/DotNet/NUnit/nunit.engine.api.dll
#	Source/Platforms/DotNet/NUnit/nunit.engine.core.dll
#	Source/Platforms/DotNet/NUnit/nunit.engine.dll
#	Source/Platforms/DotNet/NUnit/nunit3-console.exe
#	Source/Platforms/DotNet/NUnit/nunit3-console.exe.config
#	Source/Platforms/DotNet/NUnit/testcentric.engine.metadata.dll
#	Source/Tools/Flax.Build/Deps/Downloader.cs
#	Source/Tools/Flax.Stats/CodeFrame.cs
#	Source/Tools/Flax.Stats/CodeFrameNode.cs
#	Source/Tools/Flax.Stats/Flax.Stats.Build.cs
#	Source/Tools/Flax.Stats/Languages.cs
#	Source/Tools/Flax.Stats/Program.cs
#	Source/Tools/Flax.Stats/TaskType.cs
#	Source/Tools/Flax.Stats/Tools.cs
#	Source/Tools/FlaxEngine.Tests/TestEditorUtils.cs
2023-01-10 15:49:44 +01:00

143 lines
4.2 KiB
C#

// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System;
namespace FlaxEditor.Modules.SourceCodeEditing
{
/// <summary>
/// In-build source code editor.
/// </summary>
/// <seealso cref="FlaxEditor.Modules.SourceCodeEditing.ISourceCodeEditor" />
internal class InBuildSourceCodeEditor : ISourceCodeEditor
{
/// <summary>
/// The type of the editor.
/// </summary>
public readonly CodeEditorTypes Type;
/// <summary>
/// Initializes a new instance of the <see cref="InBuildSourceCodeEditor"/> class.
/// </summary>
/// <param name="type">The type.</param>
public InBuildSourceCodeEditor(CodeEditorTypes type)
{
Type = type;
switch (type)
{
case CodeEditorTypes.Custom:
Name = "Custom";
break;
case CodeEditorTypes.SystemDefault:
Name = "System Default";
break;
case CodeEditorTypes.VS2008:
Name = "Visual Studio 2008";
break;
case CodeEditorTypes.VS2010:
Name = "Visual Studio 2010";
break;
case CodeEditorTypes.VS2012:
Name = "Visual Studio 2012";
break;
case CodeEditorTypes.VS2013:
Name = "Visual Studio 2013";
break;
case CodeEditorTypes.VS2015:
Name = "Visual Studio 2015";
break;
case CodeEditorTypes.VS2017:
Name = "Visual Studio 2017";
break;
case CodeEditorTypes.VS2019:
Name = "Visual Studio 2019";
break;
case CodeEditorTypes.VS2022:
Name = "Visual Studio 2022";
break;
case CodeEditorTypes.VSCode:
Name = "Visual Studio Code";
break;
case CodeEditorTypes.VSCodeInsiders:
Name = "Visual Studio Code - Insiders";
break;
case CodeEditorTypes.Rider:
Name = "Rider";
break;
default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
/// <inheritdoc />
public string Name { get; set; }
/// <inheritdoc />
public string GenerateProjectCustomArgs
{
get
{
switch (Type)
{
case CodeEditorTypes.VSCodeInsiders:
case CodeEditorTypes.VSCode: return "-vscode -vs2022";
case CodeEditorTypes.Rider: return "-vs2022";
default: return null;
}
}
}
/// <inheritdoc />
public void OpenSolution()
{
CodeEditingManager.OpenSolution(Type);
}
/// <inheritdoc />
public void OpenFile(string path, int line)
{
CodeEditingManager.OpenFile(Type, path, line);
}
/// <inheritdoc />
public void OnFileAdded(string path)
{
switch (Type)
{
case CodeEditorTypes.VS2008:
case CodeEditorTypes.VS2010:
case CodeEditorTypes.VS2012:
case CodeEditorTypes.VS2013:
case CodeEditorTypes.VS2015:
case CodeEditorTypes.VS2017:
case CodeEditorTypes.VS2019:
case CodeEditorTypes.VS2022:
// TODO: finish dynamic files adding to the project
//Editor.Instance.ProgressReporting.GenerateScriptsProjectFiles.RunAsync();
break;
default:
CodeEditingManager.OnFileAdded(Type, path);
break;
}
}
/// <inheritdoc />
public void OnSelected(Editor editor)
{
}
/// <inheritdoc />
public void OnDeselected(Editor editor)
{
}
/// <inheritdoc />
public void OnAdded(Editor editor)
{
}
/// <inheritdoc />
public void OnRemoved(Editor editor)
{
}
}
}