편집창 100 700 900 에서 쩜(.) 이 제거되지 않도록 함

This commit is contained in:
2026-01-24 11:47:13 +09:00
parent c44f40a651
commit 568868602f
5 changed files with 56 additions and 22 deletions

View File

@@ -25,7 +25,7 @@ namespace WindowsFormsApp1
private void login_Load(object sender, EventArgs e)
{
lbl_IP.Text = String.Format("{0}", ip.GetIP);
lbl_IP.Text = String.Format("{0}", ip.GetIP());
lbl_Version.Text = string.Format("Ver.{0}", ip.VersionInfo());
this.ActiveControl = ID_text;

View File

@@ -3005,21 +3005,49 @@ namespace WindowsFormsApp1
public class IP
{
/// <summary>
/// 현 PC의 외부아이피를 가져옴
/// 프로그램에서 가져올 방법이 딱히 없어 꼼수로 웹사이트 크롤링을 통해 가져옴
/// </summary>
public string GetIP
public string GetIP()
{
get
{
string externalIp = new WebClient().DownloadString("http://ipinfo.io/ip").Trim(); // http://icanhazip.com
// 최신 사이트 접속을 위한 TLS 1.2 활성화 (강제 지정)
// Windows 7 / .NET 4.0에서는 이 설정이 없으면 HTTPS 접속이 실패할 수 있습니다.
try { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; } catch { }
if (string.IsNullOrWhiteSpace(externalIp))
externalIp = GetIP;
return externalIp;
string[] urls = {
"http://checkip.amazonaws.com",
"http://ipinfo.io/ip",
"https://api.ipify.org"
};
foreach (var url in urls)
{
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Timeout = 2000;
// 브라우저처럼 보이게 하기 위해 User-Agent 추가 (많은 사이트가 이를 요구함)
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
string ip = reader.ReadToEnd().Trim();
// IP 형식인지 검증
IPAddress address;
if (IPAddress.TryParse(ip, out address))
{
// IPv4인 경우에만 반환 (필요시 IPv6 허용 가능)
if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
return ip;
}
}
}
catch { continue; } // 다음 URL 시도
}
return "IP 확인 실패";
}
public string VersionInfo()
{
string version = "0";

View File

@@ -28,7 +28,7 @@ namespace WindowsFormsApp1
button1.ForeColor = Color.Red;
IP ip = new IP();
string[] IPList = { "ALL", ip.GetIP };
string[] IPList = { "ALL", ip.GetIP() };
cb_IPList.Items.AddRange(IPList);
cb_IPList.SelectedIndex = 0;
}

View File

@@ -2211,7 +2211,7 @@ namespace ExcelTest
/// <summary>
/// 문자와 문자사이의 값 가져오기
/// </summary>
/// <param name="str">대상 문자열</param>
/// <param name="str">대상 문자열</param>Text100
/// <param name="begin">시작 문자열</param>
/// <param name="end">마지막 문자열</param>
/// <param name="TagNum">불러올 태그 번호</param>

View File

@@ -60,7 +60,7 @@ namespace ExcelTest
{
btNext.Enabled = enable;
btNext.ForeColor = enable ? Color.Black : Color.DimGray;
}
}
public MarcEditorControl()
{
@@ -295,7 +295,7 @@ namespace ExcelTest
mp.richTextBox1.Text = richTextBox1.Text;
mp.ButtonSave += (s, ev) =>
{
SetMarcString(ev);
SetMarcString(ev);
btn_Reflesh008_Click(this, null);
};
mp.Show();
@@ -304,7 +304,7 @@ namespace ExcelTest
{
public string SaveDate { get; set; }
public string DBMarc { get; set; }
public MacEditorParameter griddata { get; set; }
}
@@ -312,7 +312,7 @@ namespace ExcelTest
private void Btn_Save_Click(object sender, EventArgs e)
{
if (Param.NewMake ==false && string.IsNullOrEmpty(Param.ISBN13))
if (Param.NewMake == false && string.IsNullOrEmpty(Param.ISBN13))
{
MessageBox.Show("마크가 선택되지않았습니다.");
return;
@@ -1255,9 +1255,9 @@ namespace ExcelTest
if (TagNum == "586") InputOneTextBox(text586a, GetMiddelString(Marc, "▼a", "▼"));
if (TagNum == "650") InputOneTextBox(text650a, GetMiddelString(Marc, "▼a", "▼"));
if (TagNum == "653") InputOneTextBox(text653a, GetMiddelString(Marc, "▼a", "▼"));
if (TagNum == "700") InputOneTextBox(text700a, GetMiddelString(Marc, "▼a", "▼"));
if (TagNum == "700") InputOneTextBox(text700a, GetMiddelString(Marc, "▼a", "▼", TagNum));
if (TagNum == "710") Text710And910(Marc, TagNum);
if (TagNum == "900") InputOneTextBox(text900a, GetMiddelString(Marc, "▼a", "▼"));
if (TagNum == "900") InputOneTextBox(text900a, GetMiddelString(Marc, "▼a", "▼", TagNum));
if (TagNum == "910") Text710And910(Marc, TagNum);
if (TagNum == "940") InputOneTextBox(text940a, GetMiddelString(Marc, "▼a", "▼"));
}
@@ -1505,7 +1505,7 @@ namespace ExcelTest
if (TagNum == "111")
rbtn[2].Checked = true;
string a = GetMiddelString(SplitTag, "▼a", "▼");
string a = GetMiddelString(SplitTag, "▼a", "▼", TagNum);
InputOneTextBox(Text, a);
}
@@ -1801,9 +1801,15 @@ namespace ExcelTest
if (TagNum == "710" || TagNum == "910")
return str;
if (TagNum == "245") gu = new char[] { '.', ':', ';', '/', ' ' };
if (TagNum == "245a") gu = new char[] { '.', ',', '=', ':', ';', '/', ' ' };
//. 은 제외한다 260124
if (TagNum.StartsWith("100") || TagNum.StartsWith("700") || TagNum.StartsWith("900"))
{
gu = new char[] { ',', ':', ';', '/', ' ' };
}
for (int i = 0; i < gu.Length; i++)
{
str = str.TrimEnd(gu[i]);