2023-02-24

[C#]最近維護一個.NET Framework專案學習到的東西

  1. .NET Framework可以移轉到NET Core,可以透過.NET Portability Analyzer來進行分析
  2. .NET Framework只有支援Windows平台
  3. 如何正確判斷程式語言是C#開發
    1. 觀察是否有程式進入點public static void Main
    2. 副檔名是否為cs
    3. 程式內容是否有namespace關鍵字開頭
    4. 程式內容是否有using關鍵字開頭
    5. 程式內容是否有class關鍵字開頭
  4. 如何判斷該專案使用.NET Framework的版本
    1. 專案 > Solution Explorer > Properties > Application > Target Framework


遇到一些狀況與解決方案

問題一、檔案產生後不會自動加密出現錯誤

It is NOT certain that the key belongs to the person named

in the user ID.  If you *really* know what you are doing,

you may answer the next question with yes.

解決方案

gpg --edit-key YOUR@KEY.ID

gpg> trust

Please decide how far you trust this user to correctly verify other users' keys

(by looking at passports, checking fingerprints from different sources, etc.)


  1 = I don't know or won't say

  2 = I do NOT trust

  3 = I trust marginally

  4 = I trust fully

  5 = I trust ultimately

  m = back to the main menu


Your decision? 5

Do you really want to set this key to ultimate trust? (y/N) y

資料來源:https://askubuntu.com/questions/288853/why-is-gpg-getting-upset-and-how-do-i-stop-it


問題二、可以將昨天產生的檔案刪除嗎

string OldfileName = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");

string path = System.Configuration.ConfigurationManager.AppSettings["FilePath"];

string OldfileName1 = path + "\\" + OldfileName + ".csv.gpg";

string OldfileName2 = path + "\\" + OldfileName + ".xls.gpg";

log.Info("刪除檔案:" + OldfileName1);

File.Delete(OldfileName1);

log.Info("刪除檔案:" + OldfileName2);

File.Delete(OldfileName2);



從以前一直覺得.NET很厲害,但是就是一直沒學好他,很多似懂非懂的觀念,但是現在ChatGPT派上用場,釐清一些觀念外,也幫忙開發程式 

沒有留言:

張貼留言