dksnebekd2 / OTP_backend

MIT License
0 stars 0 forks source link

GPT 이용한 오픈소스 분석과 데이터 저장 코드 작성 #5

Open dksnebekd2 opened 3 months ago

dksnebekd2 commented 3 months ago

main.cpp 파일에서 openai.cpp, analysis.cpp, save_js.cpp 파일 실행하는 방식으로 백엔드 구성 완료. [테스트 미완.]

C#에서 백엔드 실행파일을 실행시키는 예제 코드 ( 프론트엔드 상황에 따라 코드 변경 권장.)

using System.Diagnostics;

public class BackendRunner
{
    public void RunBackend(string directoryPath)
    {
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.FileName = "backend.exe"; // 백엔드 실행 파일명
        startInfo.Arguments = directoryPath; // 사용자가 입력한 경로 ( 백엔드와 프론트엔드 둘다 
        startInfo.RedirectStandardOutput = true;
        startInfo.UseShellExecute = false;
        startInfo.CreateNoWindow = true;

        using (Process process = Process.Start(startInfo))
        {
            string output = process.StandardOutput.ReadToEnd();
            process.WaitForExit();

            Console.WriteLine("분석 결과: " + output); // 백엔드 인터페이스에 맞게 꾸며야함.
        }
    }
}