C# 如何以正确的编码显示文本?

C# 如何以正确的编码显示文本?,c#,C#,我的c#脚本: 使用系统; 使用系统文本; 使用系统图; 使用System.IO; 使用System.Windows.Forms; 使用fomm.Scripting; 类脚本:FalloutNewVegasBaseScript{ 公共静电门安装; //PNH菜单设置 公共静态表单installPNHForm; 公共静态图片盒背景图片; 公共静态按钮; 公共静态按钮取消按钮; //选项按钮 公共静态收音机按钮读取收音机按钮; 公共静态标签vanillaIconsLabel; 公共静态RadioBu

我的c#脚本:

使用系统;
使用系统文本;
使用系统图;
使用System.IO;
使用System.Windows.Forms;
使用fomm.Scripting;
类脚本:FalloutNewVegasBaseScript{
公共静电门安装;
//PNH菜单设置
公共静态表单installPNHForm;
公共静态图片盒背景图片;
公共静态按钮;
公共静态按钮取消按钮;
//选项按钮
公共静态收音机按钮读取收音机按钮;
公共静态标签vanillaIconsLabel;
公共静态RadioButton Pipboy2005RadioButton;
公共静态标签pnhLabel;
//选项面板
公共静态面板选项面板;
公共静态标签选项标签;
公共静态bool IsPluginActive(字符串pluginName){
字符串[]loadOrder=GetActivePlugins();
对于(inti=0;iusing System;
using System.Text;
using System.Drawing;  
using System.IO;
using System.Windows.Forms;
using fomm.Scripting;


class Script : FalloutNewVegasBaseScript {
public static bool install;

// PNH MENU SETTINGS
public static Form installPNHForm; 
public static PictureBox backgroundPicture; 
public static Button okButton;  
public static Button cancelButton;

// Options buttons  

public static RadioButton ReadiusRadioButton;  
public static Label vanillaIconsLabel;  

public static RadioButton Pipboy2005RadioButton;  
public static Label pnhLabel;  

//Options panel
public static Panel optionsPanel;
public static Label optionsLabel;

public static bool IsPluginActive(String pluginName) {      
    string[] loadOrder = GetActivePlugins();  
    for (int i = 0; i < loadOrder.Length; ++i) {  
        if (loadOrder[i].Equals(pluginName, StringComparison.InvariantCultureIgnoreCase)) {
             return true;  
        }
    }  

    return false;  
} 


public static Image GetImageFromFomod(string filename) {  
    byte[] data = GetFileFromFomod(filename);  
    MemoryStream s = new MemoryStream(data);  
    Image img = Image.FromStream(s);  
    s.Close();  

    return img;  
}  

public static void CreatePNHForm() {    
    setUpPNHForm();

    setUpPNHBackgroundImage();

    setUpPNHHelpertext();

    setUpOptions();

    setUpButtons();

    AttachHandlers();  
}

 public static void setUpOptions() {        
    optionsPanel = new Panel();
    optionsPanel.Location = new Point(10, 180);  
    optionsPanel.Size = new Size(267, 50);  
    optionsPanel.BackColor = Color.WhiteSmoke; 
    optionsPanel.BorderStyle = BorderStyle.FixedSingle;  
    backgroundPicture.Controls.Add(optionsPanel);

    ReadiusRadioButton = new RadioButton();
    ReadiusRadioButton.Checked = true;  
    ReadiusRadioButton.Location = new Point(15, 15);  
    ReadiusRadioButton.Size = new Size(20, 20);  
    vanillaIconsLabel = new Label();  
    vanillaIconsLabel.Text = "�����"; 
    vanillaIconsLabel.Location = new Point(37, 19);  
    vanillaIconsLabel.AutoSize = true;  
    optionsPanel.Controls.Add(ReadiusRadioButton);  
    optionsPanel.Controls.Add(vanillaIconsLabel);

    Pipboy2005RadioButton = new RadioButton();  
    Pipboy2005RadioButton.Checked = false;  
    Pipboy2005RadioButton.Location = new Point(168, 16);  
    Pipboy2005RadioButton.Size = new Size(20, 20);  
    pnhLabel = new Label();  
    pnhLabel.Text = "Pipboy2005";  
    pnhLabel.Location = new Point(190, 19);  
    pnhLabel.AutoSize = true;  
    optionsPanel.Controls.Add(Pipboy2005RadioButton);  
    optionsPanel.Controls.Add(pnhLabel);

}

public static void setUpPNHHelpertext() {
    Panel helperTextPanel = new Panel();
    helperTextPanel.Location = new Point(60, 130);  
    helperTextPanel.Size = new Size(170, 30);  
    helperTextPanel.BackColor = Color.WhiteSmoke; 
    helperTextPanel.BorderStyle = BorderStyle.FixedSingle;  
    backgroundPicture.Controls.Add(helperTextPanel);

    Label helperTextLabel = new Label();   
    helperTextLabel.Text = "Readius or Pipboy 2005?";
    helperTextLabel.Location = new Point(22, 5);  
    helperTextLabel.AutoSize = true; 
    helperTextPanel.Controls.Add(helperTextLabel); 
}

public static void setUpPNHForm() {
    installPNHForm = CreateCustomForm(); 

    installPNHForm.FormBorderStyle = FormBorderStyle.Fixed3D;
    installPNHForm.StartPosition = FormStartPosition.CenterScreen;
    installPNHForm.MaximizeBox = false;
    installPNHForm.Size = new System.Drawing.Size(300, 360); 
    installPNHForm.Text = "Readius vs Pipboy 2005";
}

public static void setUpPNHBackgroundImage() {
    backgroundPicture = new PictureBox();  
    backgroundPicture.Location = new Point(0, 0);  
    backgroundPicture.Size = new Size(292, 327);  

    // load picture file from .fomod and stream into picture box  


    // add BackgroundPicture to list of controls  
    installPNHForm.Controls.Add(backgroundPicture);
}


public static void setUpButtons() {
    okButton = new Button();  
    okButton.Text = "Install";  
    okButton.BackColor = Color.Silver;  
    okButton.Location = new Point(148, 286);  
    okButton.Size = new Size(130, 33);  

    // cancel button  
    cancelButton = new Button();  
    cancelButton.Text = "Cancel";  
    cancelButton.BackColor = Color.Silver;  
    cancelButton.Location = new Point(9, 286);  
    cancelButton.Size = new Size(130, 33);  

    backgroundPicture.Controls.Add(okButton);  
    backgroundPicture.Controls.Add(cancelButton);     
}



public static void AttachHandlers() {  

    //Attach a handler that will fire when the apply button is clicked  
    okButton.Click += delegate(object sender, EventArgs args) {  
        install = true;  
        installPNHForm.Close(); 
    };  

    cancelButton.Click += delegate(object sender, EventArgs args) {  
        install = false;  
        installPNHForm.Close();  
    };  
} 


public static bool OnActivate() {
    CreatePNHForm();
    installPNHForm.ShowDialog(); 

    if (install) {
        InstallMenu();
    }

    return install;
}

public static int GetPluginIndex(String pluginName)
{
string[] loadOrder = GetAllPlugins();
for (int i = 0; i < loadOrder.Length; ++i)
{
    if (loadOrder[i].Equals(pluginName, StringComparison.InvariantCultureIgnoreCase))
        return i;
}
return -1;
}
public static void PlaceAtPlugin(String targetPlugin, String pluginToMove, int offset)
{
int targetPluginIndex = GetPluginIndex(targetPlugin);
int pluginToMoveIndex = GetPluginIndex(pluginToMove);
if (targetPluginIndex != -1 && pluginToMoveIndex != -1)
{
    int[] pluginIdxArray = { pluginToMoveIndex };
    SetLoadOrder(pluginIdxArray, targetPluginIndex + offset);
}
}
public static void PlaceAfterPlugin(String targetPlugin, String pluginToMove)
{
PlaceAtPlugin(targetPlugin, pluginToMove, 1);
}
public static void PlaceBeforePlugin(String targetPlugin, String pluginToMove)
{
PlaceAtPlugin(targetPlugin, pluginToMove, 0);
}

public static void InstallMenu() {

    if (ReadiusRadioButton.Checked) {
        CopyDataFile("Readius_NV.bsa", "Readius_NV.bsa");
        InstallFileFromFomod("Readius_NV.esp");
        if (IsPluginActive("WMX-ArenovalisTextures.esp")) 
    {
        PlaceAfterPlugin("WMX-ArenovalisTextures.esp", "Readius_NV.esp");
    }
        if (IsPluginActive("TheUltimateGhostOverhaul.esp")) 
    {
        PlaceAfterPlugin("TheUltimateGhostOverhaul.esp", "Readius_NV.esp");
    }
        SetPluginActivation("Readius_NV.esp", true);
    } else if (Pipboy2005RadioButton.Checked) {
        CopyDataFile("Pipboy2500.bsa", "Pipboy2500.bsa");
        InstallFileFromFomod("Pipboy2500.esp");
        if (IsPluginActive("WMX-ArenovalisTextures.esp")) 
    {
        PlaceAfterPlugin("WMX-ArenovalisTextures.esp", "Pipboy2500.esp");
    }
        if (IsPluginActive("TheUltimateGhostOverhaul.esp")) 
    {
        PlaceAfterPlugin("TheUltimateGhostOverhaul.esp", "Pipboy2500.esp");
    }
        SetPluginActivation("Pipboy2500.esp", true);
    }   

}