本文整理汇总了C#中Config.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Config.GetValue方法的具体用法?C# Config.GetValue怎么用?C# Config.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnLogin_Click
private void btnLogin_Click(object sender, EventArgs e)
{
var config = new Config { GroupName = null };
string orderip = config.GetValue("appSettings", "NNFConIp", null);
string tbPort= config.GetValue("appSettings", "NNFConSUBPort", null);
TcpClient tcpSocket = null;
try
{
tcpSocket = new TcpClient(orderip, Convert.ToInt32(tbPort));
}
catch (SocketException SE)
{
MessageBox.Show("Message~~> " + SE.Message, "Server is Stopped", MessageBoxButtons.OK, MessageBoxIcon.Information);
if(tcpSocket!=null)
tcpSocket.Close();
return;
}
Global.Instance.Relogin = true;
Global.Instance.NNFPassword = textBox1.Text;
// if (NNFHandler.flag == false)
NNFHandler.Instance._socketfun();
NNFInOut.Instance.SIGN_ON_REQUEST_IN();
Thread.Sleep(2000);
// tasks.Add(Task.Factory.StartNew(() =>
// {
// Task.Factory.StartNew(() => NNFHandler.Instance.Subscriber());
// }
//));
//Task.WaitAll(tasks.ToArray());
Global.Instance.ReloginFarmloader = true;
this.Close();
///
}
示例2: ParseText
/// <summary>
/// Parses the text.
/// </summary>
/// <param name="text">The text.</param>
/// <returns>HoconValue.</returns>
/// <exception cref="System.Exception">Unresolved substitution: + sub.Path</exception>
private HoconRoot ParseText(string text)
{
root = new HoconValue();
reader = new HoconTokenizer(text);
reader.PullWhitespaceAndComments();
ParseObject(root, true);
var c = new Config(new HoconRoot(root,Enumerable.Empty<HoconSubstitution>()));
foreach (HoconSubstitution sub in substitutions)
{
HoconValue res = c.GetValue(sub.Path);
if (res == null)
throw new Exception("Unresolved substitution:" + sub.Path);
sub.ResolvedValue = res;
}
return new HoconRoot(root, substitutions);
}
示例3: ParseText
private HoconRoot ParseText(string text,Func<string,HoconRoot> includeCallback)
{
_includeCallback = includeCallback;
_root = new HoconValue();
_reader = new HoconTokenizer(text);
_reader.PullWhitespaceAndComments();
ParseObject(_root, true,"");
var c = new Config(new HoconRoot(_root, Enumerable.Empty<HoconSubstitution>()));
foreach (HoconSubstitution sub in _substitutions)
{
HoconValue res = c.GetValue(sub.Path);
if (res == null)
throw new FormatException("Unresolved substitution:" + sub.Path);
sub.ResolvedValue = res;
}
return new HoconRoot(_root, _substitutions);
}
示例4: Global
private Global()
{
OrdetTable = new DataTable();
OrdetTable = ReadyOrderBook();
TradeTracker = new DataTable();
TradeTracker = ReadyDatatable();
Child_Index = new DataTable();
Child_Index = child_index_Datatable();
var config = new Config { GroupName = null };
DataConIp = config.GetValue("appSettings", "DataConIp", null);
DataConSUBPort = config.GetValue("appSettings", "DataConSUBPort", null);
NNFConIp = config.GetValue("appSettings", "NNFConIp", null);
NNFConPUBPort = config.GetValue("appSettings", "NNFConPUBPort", null);
NNFConSUBPort = config.GetValue("appSettings", "NNFConSUBPort", null);
LanIp = config.GetValue("appSettings", "LanIp", null);
ClientId =Convert.ToInt32(config.GetValue("appSettings", "ClientId", null));
LZOIP = config.GetValue("appSettings", "LZOIP", null);
LZOPORT = config.GetValue("appSettings", "LZOPORT", null);
INDEXIP = config.GetValue("appSettings", "INDEXIP", null);
INDEXPORT = config.GetValue("appSettings", "INDEXPORT", null);
APPTYPE = config.GetValue("appSettings", "APPTYPE", null);
interval = Convert.ToInt32(config.GetValue("appSettings", "Interval", null));
cashDataSection = new LzoCashData();
CashSock.DataArrival += cashDataSection.OnDataArrival;
//pData = new Primary();
// FoSock.DataArrival += pData.OnDataArrival;
// thDataFilter = new Thread(new ThreadStart(StartMyThread));
// thDataFilter.Start();
// NNFPassword=config.GetValue("Profile","NNFPassword",null);
//Console.WriteLine("DataConIp :" + DataConIp);
//Console.WriteLine("DataConSUBPort :" + DataConSUBPort);
//Console.WriteLine("NNFConIp :" + NNFConIp);
//Console.WriteLine("NNFConPUBPort :" + NNFConPUBPort);
//Console.WriteLine("NNFConSUBPort :" + NNFConSUBPort);
//Console.WriteLine("ClientId :" + ClientId);
}
示例5: frmLogin_Load
/*
private void frmLogin_Load(object sender, EventArgs e)
{
// EditorFontData configData = new EditorFontData();
EditorFontData configData = (EditorFontData)ConfigurationManager.GetSection("EditorSettings");
var v = configData.Style;
configData.Name = "Arial";
configData.Size = 20;
configData.Style = 2;
Configuration config =ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None);
// You need to remove the old settings object before you can replace it
config.Sections.Remove("EditorSettings");
// with an updated one
config.Sections.Add("EditorSettings", configData);
// Write the new configuration data to the XML file
config.Save();
var v2 = configData.Style;
// Get the application configuration file.
// System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Get the collection of the section groups.
// ConfigurationSectionGroupCollection sectionGroups = config.SectionGroups;
// Show the configuration values
// ShowSectionGroupCollectionInfo(sectionGroups);
foreach (string key in ConfigurationManager.AppSettings)
{
string value = ConfigurationManager.AppSettings[key];
Console.WriteLine("Key: {0}, Value: {1}", key, value);
}
string fval = System.Configuration.ConfigurationManager.AppSettings["DataConIp"].ToString();
}
static void ShowSectionGroupCollectionInfo( ConfigurationSectionGroupCollection sectionGroups)
{
ClientSettingsSection clientSection;
SettingValueElement value;
foreach (ConfigurationSectionGroup group in sectionGroups)
// Loop over all groups
{
if (!group.IsDeclared)
// Only the ones which are actually defined in app.config
continue;
Console.WriteLine("Group {0}", group.Name);
// get all sections inside group
foreach (ConfigurationSection section in group.Sections)
{
clientSection = section as ClientSettingsSection;
Console.WriteLine("\tSection: {0}", section);
if (clientSection == null)
continue;
foreach (SettingElement set in clientSection.Settings)
{
value = set.Value as SettingValueElement;
// print out value of each section
Console.WriteLine("\t\t{0}: {1}",
set.Name, value.ValueXml.InnerText);
}
}
}
}
*/
private void frmLogin_Load(object sender, EventArgs e)
{
var config = new Config { GroupName = null };
tbServerIP.Text = config.GetValue("appSettings", "DataConIp", null);
tbdataport.Text = config.GetValue("appSettings", "DataConSUBPort", null);
tbOrderIp.Text = config.GetValue("appSettings", "NNFConIp", null);
tbPort.Text = config.GetValue("appSettings", "NNFConSUBPort", null);
txtUserId.Text = config.GetValue("appSettings", "ClientId", null);
// txtPassword.Text = config.GetValue("Profile", "NNFPassword", null);
Global.Instance.NNFPassword = txtPassword.Text;
txtPassword.Focus();
// if avoid check soket telnet yhen please assign _bval == false
bool _bval = true;
if (_bval == true)
return;
TcpClient tcpSocket = null;
try
{
tcpSocket = new TcpClient(tbOrderIp.Text, Convert.ToInt32(tbPort.Text));
//.........这里部分代码省略.........
示例6: defaultLoadfun
//SpreadTable.Clear();
// DataSet ds_set = new DataSet();
// ds_set.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Lastvalue.xml");
// SpreadTable.ReadXml(opn.FileName);
private void defaultLoadfun()
{
try
{
var config = new Config { GroupName = null };
string iforms = Convert.ToString(config.GetValue("PF_Profile", Convert.ToString(0)));
//if (File.Exists(Application.StartupPath + Path.DirectorySeparatorChar + System.DateTime.Now.Date.ToString("dddd, MMMM d, yyyy") + "FOFODefault.xml"))
if (File.Exists(iforms))
{
SpreadTable.Clear();
DataSet ds_set = new DataSet();
ds_set.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Lastvalue.xml");
//SpreadTable.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + System.DateTime.Now.Date.ToString("dddd, MMMM d, yyyy") + "FOFODefault.xml");
SpreadTable.ReadXml(iforms);
for (int i = 0; i < ds_set.Tables[0].Rows.Count; i++)
{
DGV1.Rows[i].Cells["BNSFDIFF"].Value = ds_set.Tables[0].Rows[i]["BNSFDIFF"];
DGV1.Rows[i].Cells["BFSNDIFF"].Value = ds_set.Tables[0].Rows[i]["BFSNDIFF"];
DGV1.Rows[i].Cells["BNSFMNQ"].Value = ds_set.Tables[0].Rows[i]["BNSFMNQ"];
DGV1.Rows[i].Cells["BFSNMNQ"].Value = ds_set.Tables[0].Rows[i]["BFSNMNQ"];
DGV1.Rows[i].Cells["BNSFMXQ"].Value = ds_set.Tables[0].Rows[i]["BNSFMXQ"];
DGV1.Rows[i].Cells["BFSNMXQ"].Value = ds_set.Tables[0].Rows[i]["BFSNMXQ"];
DGV1.Rows[i].Cells["TICKS"].Value = ds_set.Tables[0].Rows[i]["TICKS"];
}
for (int i = 0; i < SpreadTable.Rows.Count; i++)
{
UDP_Reciever.Instance.Subscribe = Convert.ToInt32(SpreadTable.Rows[i]["Token1"].ToString());
UDP_Reciever.Instance.Subscribe = Convert.ToInt32(SpreadTable.Rows[i]["Token2"].ToString());
portFolioCounter++;
}
if (DGV1.Rows.Count == 0)
{ return; }
portFolioCounter = Convert.ToInt32(SpreadTable.Compute("MAX(PF)", "")) + 1;
}
}
catch(Exception ex)
{
}
}
示例7: Fo_Fo_mktwatch_Load
//.........这里部分代码省略.........
});
this.DGV1.Columns.Add(new DataGridViewTextBoxColumn()
{
Name = "_sell_WTC",
HeaderText = "_sell_WTC",
});
this.DGV1.Columns.Add(new DataGridViewTextBoxColumn()
{
Name = "_sell_con_WTC",
HeaderText = "_sell_con_WTC",
});
DGV1.Columns["WTC"].DefaultCellStyle.NullValue = 0;
DGV1.Columns["_con_WTC"].DefaultCellStyle.NullValue = 0;
DGV1.Columns["_sell_WTC"].DefaultCellStyle.NullValue = 0;
DGV1.Columns["_sell_con_WTC"].DefaultCellStyle.NullValue = 0;
DGV1.Columns["WTC"].ReadOnly = true;
DGV1.Columns["_con_WTC"].ReadOnly = true;
DGV1.Columns["_sell_WTC"].ReadOnly = true;
DGV1.Columns["_sell_con_WTC"].ReadOnly = true;
DGV1.Columns["BNSFDIFF"].DefaultCellStyle.NullValue = 0.00;
DGV1.Columns["BFSNDIFF"].DefaultCellStyle.NullValue = 0.00;
DGV1.Columns["BNSFMNQ"].DefaultCellStyle.NullValue = 0.00;
DGV1.Columns["BFSNMNQ"].DefaultCellStyle.NullValue = 0.00;
DGV1.Columns["BNSFMXQ"].DefaultCellStyle.NullValue = 0.00;
DGV1.Columns["BFSNMXQ"].DefaultCellStyle.NullValue = 0.000;
DGV1.Columns["TICKS"].DefaultCellStyle.NullValue = 0;
this.DGV1.Columns["BNSFTD"].DefaultCellStyle.Format = "0.##";
this.DGV1.Columns["BFSNTD"].DefaultCellStyle.Format = "0.##";
this.DGV1.Columns["Buy_Avg"].DefaultCellStyle.Format = "0.##";
this.DGV1.Columns["Sell_Avg"].DefaultCellStyle.Format = "0.##";
_makeItRed = new DataGridViewCellStyle();
_makeItBlue = new DataGridViewCellStyle();
_makeItBlack = new DataGridViewCellStyle();
_makeItRed.BackColor = Color.Red;
_makeItBlue.BackColor = Color.Blue;
_makeItBlack.BackColor = Color.Black;
SpreadTable.TableNewRow += new DataTableNewRowEventHandler(SpreadTable_NewRow);
// NNFHandler.eOrderTRADE_ERROR += Fillqty_ingrd;
btnStopAll.Enabled = true;
btnStartAll.Enabled = true;
DGV1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Type controlType = DGV1.GetType();
PropertyInfo pi = controlType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
pi.SetValue(DGV1, true, null);
try
{
foreach (DataGridViewColumn dc in DGV1.Columns)
{
this.DGV1.Columns[dc.HeaderText.Replace(" ", "")].Visible = true;
}
DataSet ds = new DataSet();
//config.SetValue("Fo_FO_Profile", Convert.ToString(0), GetProfileName);
var config = new Config { GroupName = null };
var iforms = config.GetValue("Fo_FO_Profile", Convert.ToString(0));
if (File.Exists(Application.StartupPath + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + iforms+".xml"))
{
ds.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + iforms + ".xml");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string st = ds.Tables[0].Rows[i]["Input"].ToString();
this.DGV1.Columns[ds.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].Visible = false;
}
}
}
catch
{
MessageBox.Show("Defauft Profile Not Create" , "Error");
}
Task.Factory.StartNew(() =>
{
//Thread.Sleep(100);
if (this.InvokeRequired)
{
this.BeginInvoke((ThreadStart)delegate() { defaultLoadfun(); });
return;
}
else
{
this.BeginInvoke((ThreadStart)delegate() { defaultLoadfun(); });
}
});
}
示例8: frmmktdefaultfun
private void frmmktdefaultfun()
{
try
{
foreach (DataGridViewColumn dc in DGV.Columns)
{
this.DGV.Columns[dc.HeaderText.Replace(" ", "")].Visible = true;
}
DataSet ds = new DataSet();
//config.SetValue("Fo_FO_Profile", Convert.ToString(0), GetProfileName);
var config = new Config { GroupName = null };
var iforms = config.GetValue("MKT_Profile", Convert.ToString(0));
if (File.Exists(Application.StartupPath + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + iforms + ".xml"))
{
ds.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + iforms + ".xml");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string st = ds.Tables[0].Rows[i]["Input"].ToString();
this.DGV.Columns[ds.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].Visible = false;
}
DataSet dst = new DataSet();
dst.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Defaultfrmwatch.xml");
for (int i = 0; i < dst.Tables[0].Rows.Count; i++)
{
int RowIndex = DGV.Rows.Add();
DGV.Rows[RowIndex].Cells["UniqueIdentifier"].Value = dst.Tables[0].Rows[i]["UniqueIdentifier"].ToString();
DGV.Rows[RowIndex].Cells["InstrumentName"].Value = dst.Tables[0].Rows[i]["InstrumentName"].ToString();
DGV.Rows[RowIndex].Cells["Description"].Value = dst.Tables[0].Rows[i]["Description"].ToString();
DGV.Rows[RowIndex].Cells["ExpiryDate"].Value = dst.Tables[0].Rows[i]["ExpiryDate"].ToString();
DGV.Rows[RowIndex].Cells["OptionType"].Value = dst.Tables[0].Rows[i]["OptionType"].ToString();
DGV.Rows[RowIndex].Cells["StrikePrice"].Value = dst.Tables[0].Rows[i]["StrikePrice"].ToString();
DGV.Rows[RowIndex].Cells["Symbol"].Value = dst.Tables[0].Rows[i]["Symbol"].ToString();
DGV.Rows[RowIndex].Cells["Bid"].Value = dst.Tables[0].Rows[i]["Bid"].ToString();
DGV.Rows[RowIndex].Cells["BidQ"].Value = dst.Tables[0].Rows[i]["BidQ"].ToString();
DGV.Rows[RowIndex].Cells["Ask"].Value = dst.Tables[0].Rows[i]["Ask"].ToString();
DGV.Rows[RowIndex].Cells["AskQ"].Value = dst.Tables[0].Rows[i]["AskQ"].ToString();
DGV.Rows[RowIndex].Cells["LTP"].Value = dst.Tables[0].Rows[i]["LTP"].ToString();
DGV.Rows[RowIndex].Cells["LTQ"].Value = dst.Tables[0].Rows[i]["LTQ"].ToString();
DGV.Rows[RowIndex].Cells["LTT"].Value = dst.Tables[0].Rows[i]["LTT"].ToString();
DGV.Rows[RowIndex].Cells["Open"].Value = dst.Tables[0].Rows[i]["Open"].ToString();
DGV.Rows[RowIndex].Cells["High"].Value = dst.Tables[0].Rows[i]["High"].ToString();
DGV.Rows[RowIndex].Cells["Low"].Value = dst.Tables[0].Rows[i]["Low"].ToString();
DGV.Rows[RowIndex].Cells["Close"].Value = dst.Tables[0].Rows[i]["Close"].ToString();
DGV.Rows[RowIndex].Cells["Volume"].Value = dst.Tables[0].Rows[i]["Volume"].ToString();
DGV.Rows[RowIndex].Cells["OI"].Value = dst.Tables[0].Rows[i]["OI"].ToString();
DGV.Rows[RowIndex].Cells["ATP"].Value = dst.Tables[0].Rows[i]["ATP"].ToString();
DGV.Rows[RowIndex].Cells["TBQ"].Value = dst.Tables[0].Rows[i]["TBQ"].ToString();
DGV.Rows[RowIndex].Cells["TSQ"].Value = dst.Tables[0].Rows[i]["TSQ"].ToString();
DGV.Rows[RowIndex].Cells["TotalTrades"].Value = dst.Tables[0].Rows[i]["TotalTrades"].ToString();
DGV.Rows[RowIndex].Cells["TotalQtyTraded"].Value = dst.Tables[0].Rows[i]["TotalQtyTraded"].ToString();
DGV.Rows[RowIndex].Cells["TotalTradedValue"].Value = dst.Tables[0].Rows[i]["TotalTradedValue"].ToString();
DGV.Rows[RowIndex].Cells["HighestPriceEver"].Value = dst.Tables[0].Rows[i]["HighestPriceEver"].ToString();
DGV.Rows[RowIndex].Cells["LowestPriceever"].Value = dst.Tables[0].Rows[i]["LowestPriceever"].ToString();
DGV.Rows[RowIndex].Cells["DecimalLocator"].Value = dst.Tables[0].Rows[i]["DecimalLocator"].ToString();
DGV.Rows[RowIndex].Cells["Lotsize"].Value = dst.Tables[0].Rows[i]["Lotsize"].ToString();
DGV.Rows[RowIndex].Cells["Exchange"].Value = dst.Tables[0].Rows[i]["Exchange"].ToString();
_mwatchDict.Add(Convert.ToInt32(dst.Tables[0].Rows[i]["UniqueIdentifier"].ToString()), DGV.Rows[RowIndex]);
//UDP_Reciever.Instance.Subscribe = Convert.ToInt32(dst.Tables[0].Rows[i]["UniqueIdentifier"].ToString());
//Global.Instance.pData.Subscribe = Convert.ToInt32(dst.Tables[0].Rows[i]["UniqueIdentifier"].ToString());
LZO_NanoData.LzoNanoData.Instance.Subscribe = Convert.ToInt32(dst.Tables[0].Rows[i]["UniqueIdentifier"].ToString());
Global.Instance.Data_With_Nano.AddOrUpdate(Convert.ToInt32(dst.Tables[0].Rows[i]["UniqueIdentifier"].ToString()), ClassType.MARKETWTCH, (k, v) => ClassType.MARKETWTCH);
Holder._DictLotSize.TryAdd(Convert.ToInt32(dst.Tables[0].Rows[i]["UniqueIdentifier"]), new Csv_Struct()
{
lotsize = CSV_Class.cimlist.Where(q => q.Token == Convert.ToInt32(dst.Tables[0].Rows[i]["UniqueIdentifier"])).Select(a => a.BoardLotQuantity).First()
}
);
}
}
}
catch
{
// MessageBox.Show("Defauft Profile Not Create", "Error");
}
//DGV.Rows.Clear();
//DataSet dst = new DataSet();
//if (File.Exists(Application.StartupPath + Path.DirectorySeparatorChar + System.DateTime.Now.Date.ToString("dddd, MMMM d, yyyy") + "Defaultfrmwatch.xml"))
//{
// dst.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + System.DateTime.Now.Date.ToString("dddd, MMMM d, yyyy") + "Defaultfrmwatch.xml");
// for (int i = 0; i < dst.Tables[0].Rows.Count; i++)
// {
// int RowIndex = DGV.Rows.Add();
// DGV.Rows[RowIndex].Cells["UniqueIdentifier"].Value = dst.Tables[0].Rows[i]["UniqueIdentifier"].ToString();
// DGV.Rows[RowIndex].Cells["InstrumentName"].Value = dst.Tables[0].Rows[i]["InstrumentName"].ToString();
// DGV.Rows[RowIndex].Cells["Description"].Value = dst.Tables[0].Rows[i]["Description"].ToString();
// DGV.Rows[RowIndex].Cells["ExpiryDate"].Value = dst.Tables[0].Rows[i]["ExpiryDate"].ToString();
// DGV.Rows[RowIndex].Cells["OptionType"].Value = dst.Tables[0].Rows[i]["OptionType"].ToString();
// DGV.Rows[RowIndex].Cells["StrikePrice"].Value = dst.Tables[0].Rows[i]["StrikePrice"].ToString();
// DGV.Rows[RowIndex].Cells["Symbol"].Value = dst.Tables[0].Rows[i]["Symbol"].ToString();
// DGV.Rows[RowIndex].Cells["Bid"].Value = dst.Tables[0].Rows[i]["Bid"].ToString();
// DGV.Rows[RowIndex].Cells["BidQ"].Value = dst.Tables[0].Rows[i]["BidQ"].ToString();
// DGV.Rows[RowIndex].Cells["Ask"].Value = dst.Tables[0].Rows[i]["Ask"].ToString();
//.........这里部分代码省略.........
示例9: CompletedInitialize
public void CompletedInitialize(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error == null)
{
switch (Processing)
{
case Algorithm.Initialize:
if (Directory.Exists(TempFiles))
{
foreach (String filename in Directory.GetFiles(TempFiles))
{
Config DumpList = new Config("", filename);
NewItems = new ListViewItem(new ListViewItem.ListViewSubItem[] {
new ListViewItem.ListViewSubItem(null, (ListHentai.Items.Count+1).ToString()), // ID
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Name")), // Name
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Sizes")), // Size
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Pages")), // Page
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Rating"), Color.Maroon, Color.White, new Font("Segoe UI", 8.25F,FontStyle.Bold)), // Rating
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("Status"), Color.Brown, Color.White, new Font("Tahoma", 8.25F)), // Status
new ListViewItem.ListViewSubItem(null, ""), // Speed
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("ID")),
new ListViewItem.ListViewSubItem(null, DumpList.GetValue("URL"))}, DumpList.GetValue("Key")); // Index Images
ListHentai.Items.Add(NewItems);
ListHentai.Items[ListHentai.Items.Count - 1].UseItemStyleForSubItems = false;
DumpList.Close();
}
}
if (ListHentai.Items.Count != 0) toolbtnStart.Enabled = true;
toolEnabled(true);
Processing = Algorithm.Verfify;
break;
case Algorithm.Verfify:
RequestURL.Clear();
if (ListHentai.Items.Count != 0)
{
toolbtnStart.Visible = true;
toolbtnStart.Enabled = true;
}
break;
}
panelLoading.Visible = false;
}
else
{
// Error Threading
}
}
示例10: Loadchildform
void Loadchildform()
{
var config = new Config { GroupName = null };
int iforms = Convert.ToInt32(config.GetValue("FORMS", "MAX"));
for (int iOpen = 0; iOpen < iforms; iOpen++)
{
string sFormTitle = (string)config.GetValue("FORMS", iOpen.ToString());
if (sFormTitle == "ORDER BOOK")
{
toolStripStatusLabel3_Click(new object(), new EventArgs());
}
else if (sFormTitle == "TRADE BOOK")
{
TradeBook_Click(new object(), new EventArgs());
}
else if (sFormTitle == "NET BOOK")
{
NetBook_Click(new object(), new EventArgs());
}
else if (sFormTitle == "Market Watch")
{
marketWatchToolStripMenuItem_Click(new object(), new EventArgs());
}
else if (sFormTitle == "FO FO Market Watch")
{
foFoMarketWatchToolStripMenuItem_Click(new object(), new EventArgs());
}
else if (sFormTitle == "Spread Market Watch")
{
spreadWatchCtrlF1ToolStripMenuItem_Click(new object(), new EventArgs());
}
else if (sFormTitle == "Spread Order Book")
{
spreadOrderBookToolStripMenuItem_Click(new object(), new EventArgs());
}
else if (sFormTitle == "Index")
{
indexToolStripMenuItem1_Click(new object(), new EventArgs());
}
}
}
示例11: profile_load
//public void T()
// {
// while (true)
// {
// random_Method();
// Thread.Sleep(100);
// }
// }
public void profile_load()
{
try
{
// DGV.Columns["FullName"].Visible = true;
// DGV2.Columns["FullName"].Visible = true;
DataSet ds1 = new DataSet();
var config = new Config { GroupName = null };
var iforms = config.GetValue("GenOrderBook", Convert.ToString(0));
if (File.Exists(Application.StartupPath + Path.DirectorySeparatorChar + "Order_Profiles" + Path.DirectorySeparatorChar + iforms + ".xml"))
{
ds1.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Order_Profiles" + Path.DirectorySeparatorChar + iforms + ".xml");
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
if (ds1.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "") == "FullName")
{ continue; }
DGV.Columns[ds1.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].Visible = false;
// DGV.Columns[ds1.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].DisplayIndex = i+1;
DGV2.Columns[ds1.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].Visible = false;
}
}
}
catch (Exception ex)
{
// MessageBox.Show( ex.Message);
}
// ds1.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")
}
示例12: CheckConfig
static void CheckConfig(string fName)
{
Config m_serverConf = new Config(fName);
m_serverConf.Load();
int oInt;
bool oBool;
string oStr;
Console.ForegroundColor = ConsoleColor.Yellow;
if (!m_serverConf.GetValue("passwordlen", out oInt))
{
Console.WriteLine("Setting default config value passwordlen=8");
m_serverConf.Add("general", "passwordlen", 8);
}
if (!m_serverConf.GetValue("passwordenc", out oBool))
{
Console.WriteLine("Setting default config value passwordenc=true");
m_serverConf.Add("general", "passwordenc", true);
}
if (!m_serverConf.GetValue("loggedinusers", out oInt))
{
Console.WriteLine("Setting default config value loggedinusers=50");
m_serverConf.Add("general", "loggedinusers", 50);
}
if(!m_serverConf.GetValue(ConfigConst.CONF_SERVER, ConfigConst.CONF_SERVER_DUAL, out oBool))
{
Console.WriteLine("Setting default config value dualmode=false");
m_serverConf.Add(ConfigConst.CONF_SERVER, ConfigConst.CONF_SERVER_DUAL, false);
}
if (!m_serverConf.GetValue("server", "bindaddress", out oStr))
{
Console.WriteLine("Setting default config value bindaddress=0.0.0.0");
m_serverConf.Add("server", "bindaddress", "0.0.0.0");
}
if (!m_serverConf.GetValue("server", "port", out oInt))
{
Console.WriteLine("Setting default config value port=8085");
m_serverConf.Add("server", "port", 8085);
}
if(!m_serverConf.GetValue(ConfigConst.CONF_GAME, ConfigConst.CONF_GAME_START_MAP, out oInt))
{
Console.WriteLine("Setting default config value startmap=0");
m_serverConf.Add(ConfigConst.CONF_GAME, ConfigConst.CONF_GAME_START_MAP, 0);
}
if (!m_serverConf.GetValue(ConfigConst.CONF_GAME, ConfigConst.CONF_GAME_START_X, out oInt))
{
Console.WriteLine("Setting default config value startx=29");
m_serverConf.Add(ConfigConst.CONF_GAME, ConfigConst.CONF_GAME_START_X, 29);
}
if (!m_serverConf.GetValue(ConfigConst.CONF_GAME, ConfigConst.CONF_GAME_START_Y, out oInt))
{
Console.WriteLine("Setting default config value starty=79");
m_serverConf.Add(ConfigConst.CONF_GAME, ConfigConst.CONF_GAME_START_Y, 79);
}
if (!m_serverConf.GetValue("database", "dbuser", out oStr))
{
Console.ResetColor();
Console.WriteLine("Enter a username for the database connection: ");
string user = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Setting config value dbuser=" + user);
m_serverConf.Add("database", "dbuser", user);
}
if (!m_serverConf.GetValue("database", "dbpass", out oStr))
{
Console.ResetColor();
Console.WriteLine("Enter the password for the specified user: ");
string pass = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Setting config value dbpass=" + pass);
m_serverConf.Add("database", "dbpass", pass);
}
if (!m_serverConf.GetValue("database", "dbaddr", out oStr))
{
Console.ResetColor();
Console.WriteLine("Enter the server address for the database connection: ");
string addr = Console.ReadLine();
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Setting config value dbaddr=" + addr);
m_serverConf.Add("database", "dbaddr", addr);
}
m_serverConf.SaveChanges();
Console.ResetColor();
}
示例13: toolbtnDelete_Click
private void toolbtnDelete_Click(object sender, EventArgs e)
{
if (ListHentai.Items[ItemIndexed].ImageIndex == -1 || ListHentai.Items[ItemIndexed].ImageIndex == 2 || ListHentai.Items[ItemIndexed].ImageIndex == 0)
{
Boolean IndexFound = false;
Int32 IndexItemsID = 0;
foreach (String filename in Directory.GetFiles(TempFiles))
{
Config DumpList = new Config("", filename);
if (IndexFound)
{
DumpList.Close();
File.Delete(filename);
String id_name = IndexItemsID.ToString();
while (id_name.Length < IDMax) id_name = "0" + id_name;
Config ReIndexed = new Config(DumpList.GetValue("Name") + " Dump Files ", TempFiles + id_name + "-" + DumpList.GetValue("Name") + ".txt");
ReIndexed.Save("URL", DumpList.GetList("URL").ToArray());
ReIndexed.Save("Key", DumpList.GetList("Key").ToArray());
ReIndexed.Save("Name", DumpList.GetList("Name").ToArray());
ReIndexed.Save("Sizes", DumpList.GetList("Sizes").ToArray());
ReIndexed.Save("Pages", DumpList.GetList("Pages").ToArray());
ReIndexed.Save("Rating", DumpList.GetList("Rating").ToArray());
ReIndexed.Save("Status", DumpList.GetList("Status").ToArray());
ReIndexed.Save("ID", DumpList.GetList("ID").ToArray());
ReIndexed.Save("Links", DumpList.GetList("Links").ToArray());
ReIndexed.Write();
ReIndexed.Close();
ListHentai.Items[IndexItemsID].SubItems[0].Text = (IndexItemsID + 1).ToString();
}
else
{
if (DumpList.GetValue("ID") == ListHentai.Items[ItemIndexed].SubItems[7].Text)
{
DumpList.Delete();
ListHentai.Items[ItemIndexed].Remove();
IndexFound = true;
IndexItemsID--;
if ((ListHentai.Items.Count - 1) < ItemIndexed) ItemIndexed--;
ListHentai.Items[ItemIndexed].Selected = true;
}
}
IndexItemsID++;
}
}
}
示例14: DoWorkDownloade
public void DoWorkDownloade(object sender, DoWorkEventArgs e)
{
ImagesCurrent = 0;
Int32 FileCurrent = 0;
String[] ListFiles = Directory.GetFiles(TempFiles);
do
{
if (DownloadWorker.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
String FileName = ListFiles[FileCurrent];
Config Items = new Config("", FileName);
Items.Close();
String ImageFolder = Settings.Configs.GetValue("Folder") + Items.GetValue("Name") + "\\";
if (Items.GetValue("Key") != "2")
{
DownloadWorker.ReportProgress(-1);
CurrentItem = Items.GetValue("ID");
TotalImages = Items.GetList("Links").Count;
foreach (String url in Items.GetList("Links"))
{
Console.WriteLine("----------------------------------------------------------------");
if (DownloadWorker.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
Boolean ImageFailsLoading;
String RetryImage = "";
String URLImage = "";
Int32 ImageError = 0;
do
{
ImageFailsLoading = true;
Items = new Config(Items.HeaderTitle, FileName);
Thread.Sleep(100);
if (DownloadWorker.CancellationPending == true)
{
e.Cancel = true;
break;
}
else
{
Int32 ContentLenght = 0;
Int32 NowLenght = 0;
Int32 ImageLenght = 0;
String ImageName = "";
String ResponseHTML = "";
Boolean ReceiveLink = true;
Boolean ReceiveImage = true;
Dictionary<String, String> Response;
List<String> Images = Items.GetList("Images");
Console.WriteLine("Images: " + Images.Count + " Current: " + (ImagesCurrent + 1));
if (Images.Count > ImagesCurrent)
{
String[] data = Regex.Split(Images[ImagesCurrent].Trim(), "#");
ImageName = data[0];
if (data[1] != "") ImageLenght = Int32.Parse(data[1]);
}
if (ImageLenght != 0 && File.Exists(ImageFolder + ImageName))
{ // Check Image File
Console.WriteLine("Exists Image: " + ImageName);
FileStream ImageStream = new FileStream(ImageFolder + ImageName, FileMode.Open, FileAccess.Read);
if (ImageStream.Length != ImageLenght)
{
ImageStream.Close();
File.Delete(ImageFolder + ImageName);
Console.WriteLine(" <<===== Exists: false");
}
else
{
ImagesCurrent++;
ReceiveLink = false;
ReceiveImage = false;
ImageFailsLoading = false;
Console.WriteLine(" <<===== Exists: true");
}
if (ImageStream.CanRead) ImageStream.Close();
}
if (ReceiveLink)
{ // Get Images From URL
Console.WriteLine("Geting URL...");
SyncNet DnsGetingURL = new SyncNet(url);
if (DnsGetingURL.Connected)
{
Response = DnsGetingURL.ResponseHeader(RetryImage);
// foreach (KeyValuePair<String, String> head in Response) Console.WriteLine(head.Key + ": " + head.Value);
if (Response.ContainsKey("Content-Length")) ContentLenght = Int32.Parse(Response["Content-Length"]);
if (Response["HTTP"] == "200 OK" && ContentLenght != 0)
//.........这里部分代码省略.........
示例15: Global
private Global()
{
OrdetTable = new DataTable();
OrdetTable = ReadyOrderBook();
OrdetTable.DefaultView.Sort = "TokenNo";
//OrdetTable.DefaultView.Sort = "LogTime";
NetBookTable = new DataTable();
NetBookTable = NetBookOrderBook();
TradeTracker = new DataTable();
TradeTracker = ReadyDatatable();
var config = new Config { GroupName = null };
DataConIp = config.GetValue("appSettings", "DataConIp", null);
DataConSUBPort = config.GetValue("appSettings", "DataConSUBPort", null);
NNFConIp = config.GetValue("appSettings", "NNFConIp", null);
NNFConPUBPort = config.GetValue("appSettings", "NNFConPUBPort", null);
NNFConSUBPort = config.GetValue("appSettings", "NNFConSUBPort", null);
LanIp = config.GetValue("appSettings", "LanIp", null);
ClientId = Convert.ToInt64(config.GetValue("appSettings", "ClientId", null));
McastIp = config.GetValue("appSettings", "McastIp", null);
Mcastport = config.GetValue("appSettings", "Mcastport", null);
McastIp = config.GetValue("appSettings", "McastIp", null);
INDEXIP = config.GetValue("appSettings", "INDEXIP", null);
// MessageBox.Show("step1");
INDEXPORT = config.GetValue("appSettings", "INDEXPORT", null);
// MessageBox.Show("step2");
APPTYPE = config.GetValue("appSettings", "APPTYPE", null);
interval = Convert.ToInt32(config.GetValue("appSettings", "Interval", null));
cashDataSection = new LzoCashData();
CashSock.DataArrival += cashDataSection.OnDataArrival;
// MessageBox.Show("step1");
// NNFPassword=config.GetValue("Profile","NNFPassword",null);
//Console.WriteLine("DataConIp :" + DataConIp);
//Console.WriteLine("DataConSUBPort :" + DataConSUBPort);
//Console.WriteLine("NNFConIp :" + NNFConIp);
//Console.WriteLine("NNFConPUBPort :" + NNFConPUBPort);
//Console.WriteLine("NNFConSUBPort :" + NNFConSUBPort);
//Console.WriteLine("ClientId :" + ClientId);
}