0

私は新しい Raspberry PI 3 で実行するために移植したい ac# winform アプリケーションを持っています。そうではありません。私のwinformアプリはクォートを使用しています。net、aforge ライブラリ、および .net などの一般的な .net ライブラリsystem.configuration。何か変更が必要な場合は、UI以外のコードは簡単に変換できるはずだと誰かが言ったので、ログクラスから始めます。これは、車輪を再発明する必要があるようです。startes に特化するには、以下の関数を見てください。を使用するすべてのコードsystem.configuration動作しないでしょう。アプリを機能させる簡単な方法はありますか、それともほとんどすべてのコードを文字通り変換する必要がありますか。aforge ライブラリは PI でも動作しますか? quart.net は機能しますか? 今のところ、「適切な」ウィンドウが動作する小型のウィンドウズ PC をあきらめて購入したいと思っています。

C# Winform コード

class Logging
{

    public void Write_To_Log_File(String Message, String Procedure, String Error_Code, String Error_String)
    {
        try
        {
            // If the log file is bigger than allowed size then archive
            if (File.Exists(@ConfigurationManager.AppSettings["LogSavePath"]))
            {

                FileInfo file = new FileInfo(@ConfigurationManager.AppSettings["LogSavePath"]);
                if (file.Length > Convert.ToInt32(ConfigurationManager.AppSettings["FileLogSizeLimit"]))
                {
                    // Rename the file
                    File.Move(@ConfigurationManager.AppSettings["LogSavePath"], @ConfigurationManager.AppSettings["LogSavePath"] + string.Format("{0:yyyy-MM-dd_hh-mm-ss-tt}", DateTime.Now) + ".csv");
                }

            }
            // If log file does not exist then create it and add the headers
            if (File.Exists(@ConfigurationManager.AppSettings["LogSavePath"]))
            {
            }
            else
            {
                // Create the file
                System.IO.File.Create("LogSavePath");
                // Add data
                string[] Headers = { "Time" + "," + "_Message" + "," + "Procedure" + "," + "Error_Code" + "," + "Error_String" };
                System.IO.File.AppendAllLines(@ConfigurationManager.AppSettings["LogSavePath"], Headers);
            }
            if (File.Exists(@ConfigurationManager.AppSettings["LogSavePath"]))
            {
                string[] Log = { DateTime.Now.ToString() + "," + Message + "," + Procedure + "," + Error_Code + "," + Error_String };
                System.IO.File.AppendAllLines(@ConfigurationManager.AppSettings["LogSavePath"], Log);
            }

        }
        catch
        {

        }
    }
}
4

1 に答える 1