using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; using System.IO; using Teamcenter.Hello; using Teamcenter.ClientX; namespace HelloTeamcenter.form { public partial class Login : Form { public Login() { InitializeComponent(); } public string m_WebAddress = "http://localhost:7001/tc"; public string username = ""; public string password = ""; public string usergroup = ""; public string userrole = ""; public Document appodc; private void Login_Load(object sender, EventArgs e) { string tempdir = System.Environment.GetEnvironmentVariable("TEMP").ToString(); Editor ed = appodc.Editor; ed.WriteMessage("login文件路径:" + tempdir + "\n"); string loginfile = tempdir + "\\login.ini"; if (File.Exists(loginfile)) { StreamReader sr = new StreamReader(loginfile); string line; if ((line = sr.ReadLine()) != null) { string[] ans = line.Split('|'); for (int i = 0; i < ans.Length; i++) { if (i == 0) m_WebAddress = ans[i].ToString(); if (i == 1) username = ans[i].ToString(); if (i == 3) usergroup = ans[i].ToString(); if (i == 4) userrole = ans[i].ToString(); } } sr.Close(); } textBox1.Text = m_WebAddress; textBox2.Text = username; textBox3.Text = password; textBox4.Text = usergroup; textBox4.Text = userrole; } } }