本文整理汇总了C#中System.Collections.Hashtable.Add方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Hashtable.Add方法的具体用法?C# System.Collections.Hashtable.Add怎么用?C# System.Collections.Hashtable.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Hashtable
的用法示例。
在下文中一共展示了System.Collections.Hashtable.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunExample
public static void RunExample(String[] arg)
{
try
{
//Create a new JSch instance
JSch jsch=new JSch();
//Prompt for username and server host
Console.WriteLine("Please enter the user and host info at the popup window...");
String host = InputForm.GetUserInput
("Enter [email protected]",
Environment.UserName+"@localhost");
String user=host.Substring(0, host.IndexOf('@'));
host=host.Substring(host.IndexOf('@')+1);
//Create a new SSH session
Session session=jsch.getSession(user, host, 22);
// username and password will be given via UserInfo interface.
UserInfo ui=new MyUserInfo();
session.setUserInfo(ui);
//Add AES128 as default cipher in the session config store
System.Collections.Hashtable config=new System.Collections.Hashtable();
config.Add("cipher.s2c", "aes128-cbc,3des-cbc");
config.Add("cipher.c2s", "aes128-cbc,3des-cbc");
session.setConfig(config);
//Connect to remote SSH server
session.connect();
//Open a new Shell channel on the SSH session
Channel channel=session.openChannel("shell");
//Redirect standard I/O to the SSH channel
channel.setInputStream(Console.OpenStandardInput());
channel.setOutputStream(Console.OpenStandardOutput());
//Connect the channel
channel.connect();
Console.WriteLine("-- Shell channel is connected using the {0} cipher",
session.getCipher());
//Wait till channel is closed
while(!channel.isClosed())
{
System.Threading.Thread.Sleep(500);
}
//Disconnect from remote server
channel.disconnect();
session.disconnect();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
示例2: Add
/// <summary>
/// 增加一条数据
/// </summary>
public bool Add(Model.Regional model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into regional(");
strSql.Append("RegionalID,RegionalName,RegionalCode,SubRegionalID,RegionalLevel,Orders,LastModifyTime,IsValid,Memo)");
strSql.Append(" values (");
strSql.Append("@RegionalID,@RegionalName,@RegionalCode,@SubRegionalID,@RegionalLevel,@Orders,@LastModifyTime,@IsValid,@Memo)");
MySqlParameter[] parameters = {
new MySqlParameter("@RegionalID", MySqlDbType.VarChar,50),
new MySqlParameter("@RegionalName", MySqlDbType.VarChar,50),
new MySqlParameter("@RegionalCode", MySqlDbType.VarChar,50),
new MySqlParameter("@SubRegionalID", MySqlDbType.VarChar,50),
new MySqlParameter("@RegionalLevel", MySqlDbType.VarChar,50),
new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
new MySqlParameter("@IsValid", MySqlDbType.Bit),
new MySqlParameter("@Memo", MySqlDbType.VarChar,50),
new MySqlParameter("@Orders", MySqlDbType.Int32)};
parameters[0].Value = model.RegionalID;
parameters[1].Value = model.RegionalName;
parameters[2].Value = model.RegionalCode;
parameters[3].Value = model.SubRegionalID;
parameters[4].Value = model.RegionalLevel;
parameters[5].Value = model.LastModifyTime;
parameters[6].Value = model.IsValid;
parameters[7].Value = model.Memo;
parameters[8].Value = model.Orders;
StringBuilder strSql1 = new StringBuilder();
strSql1.Append("insert into T_SYSCODEDETIAL(");
strSql1.Append("SYSCodeID,SYSCodeDetialID,SYSCodeDetialContext,LastModifyTime,IsValid,Memo)");
strSql1.Append(" values (");
strSql1.Append("@SYSCodeID,@SYSCodeDetialID,@SYSCodeDetialContext,@LastModifyTime,@IsValid,@Memo)");
MySqlParameter[] parameters1 = {
new MySqlParameter("@SYSCodeID", MySqlDbType.VarChar,50),
new MySqlParameter("@SYSCodeDetialID", MySqlDbType.VarChar,50),
new MySqlParameter("@SYSCodeDetialContext", MySqlDbType.VarChar,50),
new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
new MySqlParameter("@IsValid", MySqlDbType.Bit,1),
new MySqlParameter("@Memo", MySqlDbType.VarChar,50)};
parameters1[0].Value = "Region";
parameters1[1].Value = model.RegionalID;
parameters1[2].Value = model.RegionalName;
parameters1[3].Value = DateTime.Now;
parameters1[4].Value = model.IsValid;
parameters1[5].Value = model.Memo;
System.Collections.Hashtable sqlStringList = new System.Collections.Hashtable();
sqlStringList.Add(strSql, parameters);
sqlStringList.Add(strSql1, parameters1);
try
{
DbHelperMySQL.ExecuteSqlTran(sqlStringList);
return true;
}
catch
{
return false;
}
}
示例3: btnSearch_click
protected void btnSearch_click(object sender, EventArgs e)
{
string strLeaseType = string.Empty;
if (rbdBuy.Checked)
{
strLeaseType = "S";
}
else
{
strLeaseType = "R";
}
if (Session["SearchParams"] != null)
Session.Remove("SearchParams");
System.Collections.Hashtable objSearchParams = new System.Collections.Hashtable();
objSearchParams.Add("Property", (ddlPropertType.SelectedValue.ToString()).Contains("-1") ? "-1" : ddlPropertType.SelectedValue.ToString());
objSearchParams.Add("Location", ddlLocation.SelectedValue.ToString());
objSearchParams.Add("City", ddlCity.SelectedValue.ToString());
objSearchParams.Add("Bedroom", txtBedroooms.Text);
objSearchParams.Add("LeaseType", strLeaseType.ToString());
objSearchParams.Add("Budget", txtBudgetfrom.Text);
//objSearchParams.Add("BudgetTo", txtBudgetTo.Text);
objSearchParams.Add("Individual", (chkIndividual.Checked ? "I" : string.Empty));
objSearchParams.Add("Dealers", (chkDealers.Checked ? "D" : string.Empty));
objSearchParams.Add("Builders", (chkBuilders.Checked ? "B" : string.Empty));
objSearchParams.Add("User", "0");
SiteHelper.SearchParams = objSearchParams;
CurrentSession.SearchType = "SReq";
Response.Redirect("/SearchResults.aspx?Search=Req");
}
示例4: TestStopList
public virtual void TestStopList()
{
System.Collections.Hashtable stopWordsSet = new System.Collections.Hashtable();
stopWordsSet.Add("good", "good");
stopWordsSet.Add("test", "test");
stopWordsSet.Add("analyzer", "analyzer");
// {{Aroush how can we copy 'stopWordsSet' to 'System.String[]'?
System.String[] arrStopWordsSet = new System.String[3];
arrStopWordsSet[0] = "good";
arrStopWordsSet[1] = "test";
arrStopWordsSet[2] = "analyzer";
// Aroush}}
StopAnalyzer newStop = new StopAnalyzer(arrStopWordsSet);
System.IO.StringReader reader = new System.IO.StringReader("This is a good test of the english stop analyzer");
TokenStream stream = newStop.TokenStream("test", reader);
Assert.IsTrue(stream != null);
Token token = null;
try
{
while ((token = stream.Next()) != null)
{
System.String text = token.TermText();
Assert.IsTrue(stopWordsSet.Contains(text) == false);
}
}
catch (System.IO.IOException e)
{
Assert.IsTrue(false);
}
}
示例5: EngineWrapperTest
public EngineWrapperTest()
{
//testDataPath = @"..\..\..\TestData\";
arguments = new System.Collections.Hashtable();
inputFilename = "EngineWrapperTestHydroNetInputFile.xml";
arguments.Add("InputFilename", inputFilename);
arguments.Add("TimestepLength", "2"); //2 seconds
}
示例6: btnSearch_Click
protected void btnSearch_Click(object sender, EventArgs e)
{
//dgAgent.Visible = true;
if (Session["SearchParams"] != null)
Session.Remove("SearchParams");
System.Collections.Hashtable objSearchParams = new System.Collections.Hashtable();
objSearchParams.Add("CityID", Convert.ToByte(ddlCity.SelectedValue));
objSearchParams.Add("Location", Convert.ToByte(ddlLocation.SelectedValue));
SiteHelper.SearchParams = objSearchParams;
CurrentSession.SearchType = "SAg";
Response.Redirect("/SearchResults.aspx");
}
示例7: PerformWhois
public static string PerformWhois(string WhoisServerHost, int WhoisServerPort, string Host)
{
string result="";
try {
String strDomain = Host;
char[] chSplit = {'.'};
string[] arrDomain = strDomain.Split(chSplit);
// There may only be exactly one domain name and one suffix
if (arrDomain.Length != 2) {
return "";
}
// The suffix may only be 2 or 3 characters long
int nLength = arrDomain[1].Length;
if (nLength != 2 && nLength != 3) {
return "";
}
System.Collections.Hashtable table = new System.Collections.Hashtable();
table.Add("de", "whois.denic.de");
table.Add("be", "whois.dns.be");
table.Add("gov", "whois.nic.gov");
table.Add("mil", "whois.nic.mil");
String strServer = WhoisServerHost;
if (table.ContainsKey(arrDomain[1])) {
strServer = table[arrDomain[1]].ToString();
}
else if (nLength == 2) {
// 2-letter TLD's always default to RIPE in Europe
strServer = "whois.ripe.net";
}
System.Net.Sockets.TcpClient tcpc = new System.Net.Sockets.TcpClient ();
tcpc.Connect(strServer, WhoisServerPort);
String strDomain1 = Host+"\r\n";
Byte[] arrDomain1 = System.Text.Encoding.ASCII.GetBytes(strDomain1.ToCharArray());
System.IO.Stream s = tcpc.GetStream();
s.Write(arrDomain1, 0, strDomain1.Length);
System.IO.StreamReader sr = new System.IO.StreamReader(tcpc.GetStream(), System.Text.Encoding.ASCII);
System.Text.StringBuilder strBuilder = new System.Text.StringBuilder();
string strLine = null;
while (null != (strLine = sr.ReadLine())) {
strBuilder.Append(strLine+"\r\n");
}
result = strBuilder.ToString();
tcpc.Close();
}catch(Exception exc) {
result="Could not connect to WHOIS server!\r\n"+exc.ToString();
}
return result;
}
示例8: Get
//
// GET: /Login/
/**
* Upon login returns json string:
*
* {type:0} - non valid login parameters
* {type:1} - admin logged in
* {type:2} - comercial I logged in
* {type:3} - cliente logged in
*/
public System.Collections.Hashtable Get(string username, string password)
{
if (FirstREST.Lib_Primavera.PriEngine.InitializeCompany("BELAFLOR", username, password))
{
StdBSAdministrador list = FirstREST.Lib_Primavera.PriEngine.Platform.Administrador;
StdBSUtilizador user = FirstREST.Lib_Primavera.PriEngine.Platform.Contexto.Utilizador;
String s; // = Microsoft.VisualBasic.Information.TypeName(user.get_objUtilizador());
System.Collections.Hashtable table = new System.Collections.Hashtable();
dynamic d = user.get_objUtilizador();
s = d.PerfilSugerido();
switch (s) {
case "Comercial I":
//sales manager detected
table.Add("type", "2");
return table;
case "":
//admin detected
table.Add("type","1");
return table;
case "Guest":
//client detected
table.Add("type","3");
return table;
default:
//no identifiable profile
table.Add("type","0");
return table;
}
}
else
{
//Attempt to verify DB for clients orders with this id on
//first log as guest (the guest password is still required)
System.Collections.Hashtable table = new System.Collections.Hashtable();
if (FirstREST.Lib_Primavera.PriEngine.InitializeCompany("BELAFLOR", "guest", password))
{
String query = "SELECT * FROM PRIBELAFLOR.dbo.CabecDoc where entidade='" + username + "'";
StdBELista objList = FirstREST.Lib_Primavera.PriEngine.Engine.Consulta(query);
//if query returns non empty table then it is a client id
if (!objList.Vazia())
{
query = "SELECT NOME FROM [PRIBELAFLOR].[dbo].[Clientes] WHERE cliente="+username;
string name = FirstREST.Lib_Primavera.PriEngine.Engine.Consulta(query).Valor("Nome");
table.Add("type", "3");
table.Add("name", name);
return table;
}
}
table.Add("type", "0");
return table;
}
}
示例9: Add
/// <summary>
/// 增加一条数据
/// </summary>
public bool Add(SmartLaw.Model.SysUser model)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("insert into SysUser(");
strSql.Append("UserID,Password,EmployeeID,UserName,IsValid)");
strSql.Append(" values (");
strSql.Append("@UserID,@Password,@EmployeeID,@UserName,@IsValid)");
MySqlParameter[] parameters = {
new MySqlParameter("@UserID", MySqlDbType.VarChar,50),
new MySqlParameter("@Password", MySqlDbType.VarChar,50),
new MySqlParameter("@EmployeeID", MySqlDbType.VarChar,50),
new MySqlParameter("@UserName", MySqlDbType.VarChar,50),
new MySqlParameter("@IsValid", MySqlDbType.Bit,1)};
parameters[0].Value = model.UserID;
parameters[1].Value = model.Password;
parameters[2].Value = model.EmployeeID;
parameters[3].Value = model.UserName;
parameters[4].Value = model.IsValid;
StringBuilder strSql1 = new StringBuilder();
strSql1.Append("insert into T_SYSCODEDETIAL(");
strSql1.Append("SYSCodeID,SYSCodeDetialID,SYSCodeDetialContext,LastModifyTime,IsValid,Memo)");
strSql1.Append(" values (");
strSql1.Append("@SYSCodeID,@SYSCodeDetialID,@SYSCodeDetialContext,@LastModifyTime,@IsValid,@Memo)");
MySqlParameter[] parameters1 = {
new MySqlParameter("@SYSCodeID", MySqlDbType.VarChar,50),
new MySqlParameter("@SYSCodeDetialID", MySqlDbType.VarChar,50),
new MySqlParameter("@SYSCodeDetialContext", MySqlDbType.VarChar,50),
new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
new MySqlParameter("@IsValid", MySqlDbType.Bit,1),
new MySqlParameter("@Memo", MySqlDbType.VarChar,50)};
parameters1[0].Value = "SysUser";
parameters1[1].Value = model.UserID;
parameters1[2].Value = model.UserName;
parameters1[3].Value = DateTime.Now;
parameters1[4].Value = model.IsValid;
parameters1[5].Value = "操作员";
System.Collections.Hashtable sqlStringList=new System.Collections.Hashtable();
sqlStringList.Add(strSql,parameters);
sqlStringList.Add(strSql1,parameters1);
try
{
DbHelperMySQL.ExecuteSqlTran(sqlStringList);
return true;
}
catch
{
return false;
}
}
示例10: Init
public static void Init()
{
config=new System.Collections.Hashtable();
// config.Add("kex", "diffie-hellman-group-exchange-sha1");
config.Add("kex", "diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1");
config.Add("server_host_key", "ssh-rsa,ssh-dss");
//config.Add("server_host_key", "ssh-dss,ssh-rsa");
// config.Add("cipher.s2c", "3des-cbc,blowfish-cbc");
// config.Add("cipher.c2s", "3des-cbc,blowfish-cbc");
config.Add("cipher.s2c", "3des-cbc");
config.Add("cipher.c2s", "3des-cbc");
// config.Add("mac.s2c", "hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96");
// config.Add("mac.c2s", "hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96");
config.Add("mac.s2c", "hmac-md5");
config.Add("mac.c2s", "hmac-md5");
config.Add("compression.s2c", "none");
config.Add("compression.c2s", "none");
config.Add("lang.s2c", "");
config.Add("lang.c2s", "");
config.Add("diffie-hellman-group-exchange-sha1",
"Tamir.SharpSsh.jsch.DHGEX");
config.Add("diffie-hellman-group1-sha1",
"Tamir.SharpSsh.jsch.DHG1");
config.Add("dh", "Tamir.SharpSsh.jsch.jce.DH");
config.Add("3des-cbc", "Tamir.SharpSsh.jsch.jce.TripleDESCBC");
//config.Add("blowfish-cbc", "Tamir.SharpSsh.jsch.jce.BlowfishCBC");
config.Add("hmac-sha1", "Tamir.SharpSsh.jsch.jce.HMACSHA1");
config.Add("hmac-sha1-96", "Tamir.SharpSsh.jsch.jce.HMACSHA196");
config.Add("hmac-md5", "Tamir.SharpSsh.jsch.jce.HMACMD5");
config.Add("hmac-md5-96", "Tamir.SharpSsh.jsch.jce.HMACMD596");
config.Add("sha-1", "Tamir.SharpSsh.jsch.jce.SHA1");
config.Add("md5", "Tamir.SharpSsh.jsch.jce.MD5");
config.Add("signature.dss", "Tamir.SharpSsh.jsch.jce.SignatureDSA");
config.Add("signature.rsa", "Tamir.SharpSsh.jsch.jce.SignatureRSA");
config.Add("keypairgen.dsa", "Tamir.SharpSsh.jsch.jce.KeyPairGenDSA");
config.Add("keypairgen.rsa", "Tamir.SharpSsh.jsch.jce.KeyPairGenRSA");
config.Add("random", "Tamir.SharpSsh.jsch.jce.Random");
//config.Add("aes128-cbc", "Tamir.SharpSsh.jsch.jce.AES128CBC");
//config.Add("zlib", "com.jcraft.jsch.jcraft.Compression");
config.Add("StrictHostKeyChecking", "ask");
}
示例11: SaveDocument
public override string SaveDocument(string filename, string contentType, byte[] documentContents)
{
#if _NO_KDMS
return "9999999999999999";
#else
if (string.IsNullOrEmpty(_rootPath))
throw new Exception("DocumentumDocumentStorage RootPath property has not been set.");
if (!ValidDocumentType(contentType))
throw new ArgumentException(string.Format("{0} '{1}'.", Names._EM_UnrecognizedExtension, contentType));
KDMS.ImportConfiguration ic = new Kindred.Knect.ITAT.Utility.KDMS.ImportConfiguration();
ic.DocuType = Names.KDMS_DocType;
System.Collections.Hashtable ht = new System.Collections.Hashtable();
ht.Add(Names.KDMS_Property_DocumentName, filename);
ic.PropertyList = Utility.WebServiceHelper.ToJaggedArray(ht);
ic.LifeCyclePolicyName = "ITAT Scanned Document Lifecycle";
ic.DocuFolderPath = _rootPath;
try
{
KDMS.Service svc = new KDMS.Service();
svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
svc.Url = ConfigurationManager.AppSettings[string.Format("{0}.{1}", Utility.EnvironmentHelper.GetEnvironment(EnvironmentDetectionMode.Machine), svc.GetType())];
return svc.ImportDocumentContent(documentContents, contentType, ic);
}
catch (Exception e)
{
string error = string.Format("Error uploading file '{0}' to KDMS : {1}",filename,e.ToString());
ILog log = LogManager.GetLogger(this.GetType());
log.Error(error);
throw new Exception(error, e);
}
#endif
}
示例12: TabbedSkin
public TabbedSkin(BasilProject project, ITaskBuilder taskBuilder)
{
_project = project;
_tabsToTools = new System.Collections.Hashtable();
window = new Gtk.Window ("WeSay");
window.SetDefaultSize (600, 400);
window.DeleteEvent += new DeleteEventHandler (WindowDelete);
HBox hbox = new HBox (false, 0);
window.Add (hbox);
Notebook notebook = new Notebook ();
notebook.SwitchPage += new SwitchPageHandler(OnNotebookSwitchPage);
hbox.PackStart(notebook, true, true, 0);
foreach (ITask t in taskBuilder.Tasks)
{
VBox container = new VBox();
t.Container = container;
int i = notebook.AppendPage(container, new Label(t.Label));
_tabsToTools.Add(i, t);
}
window.ShowAll ();
}
示例13: setDisplay
/// <summary>
/// �]�wCMS���
/// </summary>
/// <param name="devNames"></param>
/// <returns></returns>
protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
{
System.Collections.Hashtable displayht = new System.Collections.Hashtable();
List<object> outputs = new List<object>();
if (devNames == null || devNames.Length == 0) return displayht;
foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
{
int distance = getDeviceDistance(devName.SegId, maxSegId);
DevStartMile = devName.Mileage;
DevLineID = devName.LineId;
CMSDevName = devName.DevName;
outputs = (List<object>)com.select(DBConnect.DataType.CmsCategory, Command.GetSelectCmd.getCMSCategory(Convert.ToInt32(DevRange["RULEID"]), (int)secType, devType.ToString(), distance, devName.DevName, megType.ToString(), ht["INC_LINEID"].ToString().Trim(),devName.Location,devName.LineId));
foreach (object obj in outputs)
{
List<object> output=new List<object>();
output.AddRange(new object[] { getPriority(), obj });
if (!displayht.Contains(devName.DevName))
displayht.Add(devName.DevName, output);
else if (devName.Location == "L")
{
displayht[devName.DevName] = output;
}
}
}
return displayht;
}
示例14: ImportarVariables
public void ImportarVariables(DataGridView Grid)
{
foreach (DataGridViewRow row in Grid.Rows)
{
System.Collections.Hashtable lin = new System.Collections.Hashtable();
foreach (DataGridViewCell cell in row.Cells)
{
string valor;
if (cell != null && cell.Value != null)
{
valor = cell.Value.ToString() ?? "";
}
else
{
valor = "";
}
lin.Add(NumToLetra(cell.ColumnIndex), valor);
}
ST.SetAttribute("grid", lin);
}
}
示例15: setWEADisplay
protected override System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId)
{
System.Collections.Hashtable outputs = new System.Collections.Hashtable();
byte display = 1;
switch (secType)
{
case 45: //�@��
display = 1;
break;
case 46: //�j��
display = 2;
break;
case 47: //���B
display = 3;
break;
default: //��L
display = 0;
break;
}
if (devNames == null) return null;
foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
{
RemoteInterface.HC.FSOutputData output = new RemoteInterface.HC.FSOutputData(display);
outputs.Add(devName.DevName, output);
}
return outputs;
}