Skip to content

Commit

Permalink
[fix :]优化注释
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodBoyboy666 committed Feb 17, 2024
1 parent 31f210d commit c14765a
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions 嗷呜语言翻译器/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ private void translate_btn_Click(object sender, EventArgs e)
}
}
#region ToAowu主逻辑
/// <summary>
/// 地球语转换为嗷呜语
/// </summary>
/// <param name="text">文本内容</param>
/// <returns></returns>
private string Maintranslate(string text)
{
string translated_text = "";
Expand All @@ -46,8 +51,11 @@ private string Maintranslate(string text)
}
return translated_text;
}

private void Toeight(ref char[] chars)//向前补齐8位
/// <summary>
/// 向前补齐8位
/// </summary>
/// <param name="chars">需要补齐的字符</param>
private void Toeight(ref char[] chars)
{
while (chars.Length < 8)
{
Expand All @@ -59,7 +67,11 @@ private void Toeight(ref char[] chars)//向前补齐8位
chars[0] = '0';
}
}

/// <summary>
/// 转换主逻辑
/// </summary>
/// <param name="chars">补齐八位后的字符</param>
/// <returns></returns>
private string Toaowu(char[] chars)
{
string aowu = "";
Expand All @@ -83,7 +95,12 @@ private string Toaowu(char[] chars)
}
return aowu;
}
private string Quaternary(int str)//十进制转换为四进制
/// <summary>
/// 十进制转换为四进制
/// </summary>
/// <param name="str">十进制Int</param>
/// <returns></returns>
private string Quaternary(int str)
{
string num = "";
while(str> 0)
Expand All @@ -108,6 +125,11 @@ public static byte[] GetHash(string inputString)
HashAlgorithm algorithm = SHA256.Create();
return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString));
}
/// <summary>
/// 计算Hash
/// </summary>
/// <param name="inputString">需要计算Hash的字符串</param>
/// <returns></returns>

public static string GetHashString(string inputString)
{
Expand Down Expand Up @@ -168,13 +190,22 @@ private void restore_btn_Click(object sender, EventArgs e)
}
}
#region ToNormalLanguage主逻辑
/// <summary>
/// 嗷呜语转换为地球语
/// </summary>
/// <param name="str">待转换的字符串(8位)</param>
/// <returns></returns>
private string restore(string str)
{

return ((char)AowuTovDecimal(str)).ToString();//翻译为原文并返回

}

/// <summary>
/// 嗷呜语转换为十进制数据
/// </summary>
/// <param name="str">嗷呜语(8位)</param>
/// <returns></returns>
private int AowuTovDecimal(string str)
{
string ret = "";//待转换的四进制
Expand Down

0 comments on commit c14765a

Please sign in to comment.