當前位置: 首頁>>代碼示例>>C#>>正文


C# TextBox.Replace方法代碼示例

本文整理匯總了C#中System.Windows.Forms.TextBox.Replace方法的典型用法代碼示例。如果您正苦於以下問題:C# TextBox.Replace方法的具體用法?C# TextBox.Replace怎麽用?C# TextBox.Replace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.TextBox的用法示例。


在下文中一共展示了TextBox.Replace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: doPush

        private void doPush(int how,string fname)
        {
            string results="";
            string[] resAr;
            bool isMe = true;
            string theFileName = pushFileName;
            string extraPath = "";
            debugMessage("-Entering doPush");
            if (how == 1)
            {
                theFileName = fname;
                extraPath = "\\messages";
            }
            try
            {
                //System.IO.FileStream myFile = System.IO.File.Open(filePath + extraPath + "\\" + theFileName,System.IO.FileMode.Open,System.IO.FileAccess.Read,System.IO.FileShare.Read);
                //for (int i=0;i<myFile.Length;i++)
                results += systemInventory.readTextFile(filePath + extraPath + "\\" + theFileName);
                //myFile.Close();
            }
            catch (Exception e)
            {
                debugMessage("There was a problem receiving the package. The package file was opened by an application that won't share.");
            }
               // MessageBox.Show(theFileName);
            //MessageBox.Show(results);
            resAr = results.Split("\n".ToCharArray());
            string[] temp;
            string[] temp2;
            string file = "";
            string args = "";
            string notice = "";
            string es="";
            string message = "";
            string title = System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString();
            string dnsName = System.Net.Dns.GetHostName().ToLower()	;
            string cu = getCurrentUser().ToUpper().Replace("VeraciTek\\","").ToLower();
            string[] cua = getCurrentUser().ToUpper().ToLower().Split('\\');
            if (cua.Length > 1)
                cu = cua[1];
            bool foundMe = false;
            bool isMeViaMachineName = false;
            for (int i=0;i<resAr.Length && isMe;i++)
            {
                //MessageBox.Show(resAr[i]);
                temp = resAr[i].Split("=".ToCharArray());
                //MessageBox.Show(temp.Length + "");
                if (temp.Length > 1)
                {
                    if (temp[0].ToLower().Trim() == "users")
                        if (temp[1].ToLower().Trim() != "all" && temp[1].ToLower().Trim() != "allservers")
                        {
                            //MessageBox.Show(temp[0] +"-"+ temp[1]);
                            temp2 = temp[1].Split(",".ToCharArray());
                            for (int b=0;b<temp2.Length && !foundMe;b++)
                                if (temp2[b].ToLower().Trim() == dnsName || temp2[b].ToLower().Trim() == cu)
                                {
                                    if (temp2[b].ToLower().Trim() == dnsName)
                                        isMeViaMachineName = true;
                                    foundMe = true;
                                }
                            if (!foundMe)
                                isMe = false;
                        }
                        else
                        {
                            //MessageBox.Show("gotit");
                            isMe = false;
                            if (temp[1].ToLower().Trim() == "all")
                                if (!isserver(System.Environment.MachineName))
                                {
                                    isMe = true;
                                    isMeViaMachineName = true;
                                }
                            if (temp[1].ToLower().Trim() == "allservers")
                                if (isserver(System.Environment.MachineName))
                                {
                                    isMe = true;
                                    isMeViaMachineName = true;
                                }

                        }
                    if (temp[0].ToLower().Trim() == "file")
                    {
                        file = temp[1].Trim();
                        for (int c=2;c < temp.Length; c++)
                            file += "=" + temp[c];
                    }
                    if (temp[0].ToLower().Trim() == "arguments")
                        args = temp[1].Trim();

                    if (temp[0].ToLower().Trim() == "notice")
                        notice = temp[1].Trim();

                    if (temp[0].ToLower().Trim() == "kill")
                        if (temp[1].Trim().ToLower() == "true")
                            kill = true;

                    if (temp[0].ToLower().Trim() == "message")
                    {
//.........這裏部分代碼省略.........
開發者ID:reticon,項目名稱:CCMClient,代碼行數:101,代碼來源:Form1.cs


注:本文中的System.Windows.Forms.TextBox.Replace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。