Added file content preview for csharp files

This commit is contained in:
Antoine Pilote
2024-08-15 22:58:13 -04:00
parent 4f7dd45328
commit 3c5990fd07
2 changed files with 26 additions and 0 deletions

View File

@@ -209,6 +209,11 @@ void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
DrawWrenScriptPanel(CreateRef<WrenScript>(file, true));
break;
}
case FileType::NetScript:
{
DrawNetScriptPanel(file);
break;
}
case FileType::Prefab:
{
//Ref<Prefab> prefab = CreateRef<Prefab>(file->GetRelativePath());
@@ -486,3 +491,23 @@ void EditorSelectionPanel::DrawWrenScriptPanel(Ref<Nuake::WrenScript> wrenFile)
ImGui::PopTextWrapPos();
}
void EditorSelectionPanel::DrawNetScriptPanel(Ref<Nuake::File> file)
{
auto filePath = file->GetRelativePath();
std::string fileContent = Nuake::FileSystem::ReadFile(filePath);
ImGui::Text("Content");
ImGui::SameLine(ImGui::GetWindowWidth() - 90);
if (ImGui::Button("Open..."))
{
Nuake::OS::OpenIn(file->GetAbsolutePath());
}
ImGui::Separator();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetWindowWidth());
ImGui::Text(fileContent.c_str(), ImGui::GetWindowWidth());
ImGui::PopTextWrapPos();
}

View File

@@ -70,4 +70,5 @@ private:
void DrawMaterialPanel(Ref<Nuake::Material> material);
void DrawProjectPanel(Ref<Nuake::Project> project);
void DrawWrenScriptPanel(Ref<Nuake::WrenScript> wrenFile);
void DrawNetScriptPanel(Ref<Nuake::File> file);
};