当前位置: 首页>>代码示例>>C#>>正文


C# UserInfo.showMessage方法代码示例

本文整理汇总了C#中UserInfo.showMessage方法的典型用法代码示例。如果您正苦于以下问题:C# UserInfo.showMessage方法的具体用法?C# UserInfo.showMessage怎么用?C# UserInfo.showMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserInfo的用法示例。


在下文中一共展示了UserInfo.showMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: add

		public override void add(String host, byte[] key, UserInfo userinfo)
		{
			HostKey hk;
			int type=getType(key);
			for(int i=0; i<pool.Count; i++)
			{
				hk=(HostKey)(pool[i]);
				if(isIncluded(hk.host, host) && hk.type==type)
				{
					/*
							if(Util.array_equals(hk.key, key)){ return; }
							if(hk.host.equals(host)){
							hk.key=key;
							return;
						}
						else{
							hk.host=deleteSubString(hk.host, host);
						break;
						}
					*/
				}
			}
			hk=new HostKey(host, type, key);
			pool.Add(hk);

			String bar=getKnownHostsRepositoryID();
			if(userinfo!=null && 
				bar!=null)
			{
				bool foo=true;
				FileInfo goo=new FileInfo(bar);
				if(!goo.Exists)
				{
					foo=false;
					if(userinfo!=null)
					{
						foo=userinfo.promptYesNo(
							bar+" does not exist.\n"+
							"Are you sure you want to create it?"
							);
						DirectoryInfo dir =goo.Directory;
						if(foo && dir!=null && !dir.Exists)
						{
							foo=userinfo.promptYesNo(
								"The parent directory "+dir.Name+" does not exist.\n"+
								"Are you sure you want to create it?"
								);
							if(foo)
							{
								try{dir.Create(); userinfo.showMessage(dir.Name+" has been succesfully created.\nPlease check its access permission.");}
								catch
								{
									userinfo.showMessage(dir.Name+" has not been created.");
									foo=false;
								}
							}
						}
						if(goo==null)foo=false;
					}
				}
				if(foo)
				{
					try
					{ 
						sync(bar); 
					}
					catch(Exception e){ Console.WriteLine("sync known_hosts: "+e); }
				}
			}
		}
开发者ID:MatanDavidCohen,项目名称:StockAnalyzerWin,代码行数:70,代码来源:KnownHosts.cs

示例2: add

        public override void add(HostKey hostkey, UserInfo userinfo)
        {
            int type = hostkey.type;
            string host = hostkey.getHost();
            byte[] key = hostkey.key;

            HostKey hk = null;
            lock (pool)
            {
                for (int i = 0; i < pool.Count; i++)
                {
                    hk = pool[i];
                    if (hk.isMatched(host) && hk.type == type)
                    {
                        /*
                              if(Util.array_equals(hk.key, key)){ return; }
                              if(hk.host.Equals(host)){
                                hk.key=key;
                                return;
                              }
                              else{
                                hk.host=deleteSubString(hk.host, host);
                                break;
                              }
                        */
                    }
                }
            }

            hk = hostkey;

            pool.Add(hk);

            string bar = getKnownHostsRepositoryID();
            if (bar != null)
            {
                bool foo = true;
                FileInfo goo = new FileInfo(bar);
                if (!goo.Exists)
                {
                    foo = false;
                    if (userinfo != null)
                    {
                        foo = userinfo.promptYesNo(bar + " does not exist.\n" +
                                                 "Are you sure you want to create it?"
                                                 );
                        DirectoryInfo dgoo = Directory.GetParent(bar);
                        if (foo && dgoo != null && !dgoo.Exists)
                        {
                            foo = userinfo.promptYesNo("The parent directory " + goo + " does not exist.\n" +
                                                     "Are you sure you want to create it?"
                                                     );
                            if (foo)
                            {
                                if (!dgoo.mkdirs())
                                {
                                    userinfo.showMessage(goo + " has not been created.");
                                    foo = false;
                                }
                                else
                                {
                                    userinfo.showMessage(goo + " has been succesfully created.\nPlease check its access permission.");
                                }
                            }
                        }
                        if (dgoo == null) foo = false;
                    }
                }
                if (foo)
                {
                    try
                    {
                        Sync(bar);
                    }
                    catch (Exception e) { Console.Error.WriteLine("sync known_hosts: " + e); }
                }
            }
        }
开发者ID:JamesHagerman,项目名称:sftprelay,代码行数:78,代码来源:KnownHosts.cs


注:本文中的UserInfo.showMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。