Here are the examples of the csharp api System.Convert.ToString(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
267 Examples
19
Source : MainPage.xaml.cs
with MIT License
from Abdesol
with MIT License
from Abdesol
private string equal(string exp)
{
string new_expr = "";
foreach(char i in exp)
{
char ii = i;
if (i == '×')
{
ii = '*';
}
else if (i == '÷')
{
ii = '/';
}
new_expr += ii;
}
try
{
Enreplacedy expr = new_expr;
double output = (double)expr.EvalNumerical();
if((output%1 == 0) == true)
{
int o = Convert.ToInt32(output);
return Convert.ToString(o);
}
else
{
return Convert.ToString(output);
}
}
catch
{
return exp;
}
}
19
Source : DynamoDBItem.cs
with MIT License
from abelperezok
with MIT License
from abelperezok
public void AddNumber(string key, int value)
{
AddKeyAttrValue(key, BaseNumberAttributeValue(Convert.ToString(value)));
}
19
Source : ResourceProperties.cs
with MIT License
from actions
with MIT License
from actions
private static Object ToObject(JToken token)
{
switch (token.Type)
{
case JTokenType.Boolean:
return Convert.ToString((Boolean)token);
case JTokenType.Date:
return Convert.ToString((DateTime)token);
case JTokenType.Float:
return Convert.ToString((Single)token);
case JTokenType.Guid:
return Convert.ToString((Guid)token);
case JTokenType.Integer:
return Convert.ToString((Int32)token);
case JTokenType.TimeSpan:
return Convert.ToString((TimeSpan)token);
case JTokenType.Uri:
return Convert.ToString((Uri)token);
case JTokenType.String:
return (String)token;
case JTokenType.Array:
var array = token as JArray;
return array.Select(x => ToObject(x)).ToList();
case JTokenType.Object:
return ToDictionary(token as JObject);
}
return null;
}
19
Source : AduTimeSelector.cs
with GNU General Public License v3.0
from aduskin
with GNU General Public License v3.0
from aduskin
public void SetButtonSelected()
{
if(!this.SelectedTime.HasValue)
{
return;
}
this.Hour = this.SelectedTime.Value.Hour;
this.Minute = this.SelectedTime.Value.Minute;
this.Second = this.SelectedTime.Value.Second;
if (this.PART_Hour != null)
{
for (int i = 0; i < this.PART_Hour.Items.Count; i++)
{
AduTimeButton timeButton = this.PART_Hour.Items[i] as AduTimeButton;
if (Convert.ToString(timeButton.Content).Equals(Convert.ToString(this.SelectedTime.Value.Hour)))
{
this.PART_Hour.SelectedIndex = i;
this.PART_Hour.AnimateScrollIntoView(timeButton);
break;
}
}
}
if (this.PART_Minute != null)
{
for (int i = 0; i < this.PART_Minute.Items.Count; i++)
{
AduTimeButton timeButton = this.PART_Minute.Items[i] as AduTimeButton;
if (Convert.ToString(timeButton.Content).Equals(Convert.ToString(this.SelectedTime.Value.Minute)))
{
this.PART_Minute.SelectedIndex = i;
this.PART_Minute.AnimateScrollIntoView(timeButton);
break;
}
}
}
if (this.PART_Second != null)
{
for (int i = 0; i < this.PART_Second.Items.Count; i++)
{
AduTimeButton timeButton = this.PART_Second.Items[i] as AduTimeButton;
if (Convert.ToString(timeButton.Content).Equals(Convert.ToString(this.SelectedTime.Value.Second)))
{
this.PART_Second.SelectedIndex = i;
this.PART_Second.AnimateScrollIntoView(timeButton);
break;
}
}
}
}
19
Source : COLOSSAL_TITAN.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
[RPC]
public void labelRPC(int health, int maxHealth)
{
if (health < 0)
{
if (healthLabel != null)
{
Destroy(this.healthLabel);
}
}
else
{
if (healthLabel == null)
{
healthLabel = (GameObject)Instantiate(CacheResources.Load("UI/LabelNameOverHead"));
healthLabel.name = "LabelNameOverHead";
healthLabel.transform.parent = transform;
healthLabel.transform.localPosition = new Vector3(0f, 430f, 0f);
float num = 15f;
if (this.size > 0f && this.size < 1f)
{
num = 15f / this.size;
num = Mathf.Min(num, 100f);
}
this.healthLabel.transform.localScale = new Vector3(num, num, num);
healthLabel.GetComponent<UILabel>().text = string.Empty;
TextMesh txt = healthLabel.GetComponent<TextMesh>();
if (txt == null)
{
txt = healthLabel.AddComponent<TextMesh>();
}
MeshRenderer render = healthLabel.GetComponent<MeshRenderer>();
if (render == null)
{
render = healthLabel.AddComponent<MeshRenderer>();
}
render.material = Optimization.Labels.Font.material;
txt.font = Optimization.Labels.Font;
txt.fontSize = 20;
txt.anchor = TextAnchor.MiddleCenter;
txt.alignment = TextAlignment.Center;
txt.color = Colors.white;
txt.text = healthLabel.GetComponent<UILabel>().text;
txt.richText = true;
txt.gameObject.layer = 5;
}
string str = "[7FFF00]";
float num2 = (float)health / (float)maxHealth;
if (num2 < 0.75f && num2 >= 0.5f)
{
str = "[f2b50f]";
}
else if (num2 < 0.5f && num2 >= 0.25f)
{
str = "[ff8100]";
}
else if (num2 < 0.25f)
{
str = "[ff3333]";
}
this.healthLabel.GetComponent<TextMesh>().text = (str + System.Convert.ToString(health)).ToHTMLFormat();
}
}
19
Source : TitanRPC.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
[RPC]
public void labelRPC(int health, int healthMax)
{
if (health < 0)
{
if (healthLabel != null)
{
Destroy(healthLabel);
}
}
else
{
if (healthLabel == null)
{
healthLabel = (GameObject)Instantiate(CacheResources.Load("UI/LabelNameOverHead"));
healthLabel.name = "LabelNameOverHead";
healthLabel.transform.parent = baseT;
healthLabel.transform.localPosition = new Vector3(0f, 20f + 1f / myLevel, 0f);
var num = 1f;
if (myLevel < 1f)
{
num = 1f / myLevel;
}
healthLabel.transform.localScale = new Vector3(num, num, num);
healthLabel.GetComponent<UILabel>().text = string.Empty;
var txt = healthLabel.GetComponent<TextMesh>();
if (txt == null)
{
txt = healthLabel.AddComponent<TextMesh>();
}
var render = healthLabel.GetComponent<MeshRenderer>();
if (render == null)
{
render = healthLabel.AddComponent<MeshRenderer>();
}
render.material = Labels.Font.material;
txt.font = Labels.Font;
txt.fontSize = 20;
txt.anchor = TextAnchor.MiddleCenter;
txt.alignment = TextAlignment.Center;
txt.color = Colors.white;
txt.text = healthLabel.GetComponent<UILabel>().text;
txt.richText = true;
txt.gameObject.layer = 5;
if (abnormalType == AbnormalType.Crawler)
{
healthLabel.transform.localPosition = new Vector3(0f, 10f + 1f / myLevel, 0f);
}
healthLabelEnabled = true;
}
var str = "[7FFF00]";
var num2 = health / (float)healthMax;
if (num2 < 0.75f && num2 >= 0.5f)
{
str = "[f2b50f]";
}
else if (num2 < 0.5f && num2 >= 0.25f)
{
str = "[ff8100]";
}
else if (num2 < 0.25f)
{
str = "[ff3333]";
}
healthLabel.GetComponent<TextMesh>().text = (str + Convert.ToString(health)).ToHTMLFormat();
}
}
19
Source : TitanRPC.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
[RPC]
public void labelRPC(int health, int healthMax)
{
if (health < 0)
{
if (healthLabel != null) Destroy(healthLabel);
}
else
{
if (healthLabel == null)
{
healthLabel = (GameObject) Instantiate(CacheResources.Load("UI/LabelNameOverHead"));
healthLabel.name = "LabelNameOverHead";
healthLabel.transform.parent = baseT;
healthLabel.transform.localPosition = new Vector3(0f, 20f + 1f / myLevel, 0f);
var num = 1f;
if (myLevel < 1f) num = 1f / myLevel;
healthLabel.transform.localScale = new Vector3(num, num, num);
healthLabel.GetComponent<UILabel>().text = string.Empty;
var txt = healthLabel.GetComponent<TextMesh>();
if (txt == null) txt = healthLabel.AddComponent<TextMesh>();
var render = healthLabel.GetComponent<MeshRenderer>();
if (render == null) render = healthLabel.AddComponent<MeshRenderer>();
render.material = Labels.Font.material;
txt.font = Labels.Font;
txt.fontSize = 20;
txt.anchor = TextAnchor.MiddleCenter;
txt.alignment = TextAlignment.Center;
txt.color = Colors.white;
txt.text = healthLabel.GetComponent<UILabel>().text;
txt.richText = true;
txt.gameObject.layer = 5;
if (abnormalType == AbnormalType.Crawler)
healthLabel.transform.localPosition = new Vector3(0f, 10f + 1f / myLevel, 0f);
healthLabelEnabled = true;
}
var str = "[7FFF00]";
var num2 = health / (float) healthMax;
if (num2 < 0.75f && num2 >= 0.5f)
str = "[f2b50f]";
else if (num2 < 0.5f && num2 >= 0.25f)
str = "[ff8100]";
else if (num2 < 0.25f) str = "[ff3333]";
healthLabel.GetComponent<TextMesh>().text = (str + Convert.ToString(health)).ToHTMLFormat();
}
}
19
Source : TabStripTopBarControl.xaml.cs
with MIT License
from ahoefling
with MIT License
from ahoefling
protected override void OnBindingContextChanged()
{
var context = (TabStripControlModel)BindingContext;
if (context?.Tabs == null) return;
var grid = new Grid();
for (int index = 0; index < context.Tabs.Count; index++)
{
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
var view = new ContentView
{
Content = context.Tabs[index].Header.Item1,
BindingContext = context.Tabs[index].Header.Item2
};
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Command = context.SlideToTab;
tapGestureRecognizer.CommandParameter = Convert.ToString(index);
view.GestureRecognizers.Add(tapGestureRecognizer);
grid.Children.Add(view, index, 0);
}
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2) });
var boxView = new BoxView
{
HeightRequest = 2,
BackgroundColor = new Color(0, 0, 0),
HorizontalOptions = new LayoutOptions(LayoutAlignment.Fill, true)
};
grid.Children.Add(boxView, context.TabPosition, 1);
boxView.SetBinding(Grid.ColumnProperty, new Binding("TabPosition"));
Content = grid;
}
19
Source : FixMessage.cs
with Apache License 2.0
from AlexWan
with Apache License 2.0
from AlexWan
public override string ToString()
{
StringBuilder sb = new StringBuilder();
foreach (var field in _fields)
{
if (field.Tag == 8 || field.Tag == 9)
{
continue;
}
sb.Append(field.Tag + "=" + field.Value + Soh);
}
_fields[1].Value = sb.Length.ToString();
sb.Insert(0, "8=" + _fields[0].Value + Soh + "9=" + _fields[1].Value + Soh);
int sumChar = 0;
for (int i = 0; i < sb.Length; i++)
{
sumChar += sb[i];
}
string trailer = $"10={Convert.ToString(sumChar % 256).PadLeft(3).Replace(" ", "0")}{Soh}";
return sb.Append(trailer).ToString();
}
19
Source : HitbtcServer.cs
with Apache License 2.0
from AlexWan
with Apache License 2.0
from AlexWan
private void _client_MyOrderEvent(Result result)
{
OrderCoupler needCoupler;
needCoupler = _couplers.Find(c => c.OrderNumberMarket == result.clientOrderId);
if (needCoupler == null)
{
return;
}
if (result.status == "partiallyFilled" || result.status == "filled")
{
var partialVolume =
result.quanreplacedy.ToDecimal();
var tradeVolume = partialVolume - needCoupler.CurrentVolume;
needCoupler.CurrentVolume += tradeVolume;
MyTrade myTrade = new MyTrade()
{
NumberOrderParent = result.clientOrderId,
Side = result.side == "sell" ? Side.Sell : Side.Buy,
NumberPosition = Convert.ToString(needCoupler.OsOrderNumberUser),
SecurityNameCode = result.symbol,
Price =
result.price.ToDecimal()
,
Volume = tradeVolume,
NumberTrade = result.id,
Time = result.updatedAt,
};
MyTradeEvent?.Invoke(myTrade);
}
Order order = new Order();
order.NumberUser = needCoupler.OsOrderNumberUser;
order.NumberMarket = result.clientOrderId;
order.PortfolioNumber = result.symbol.Substring(result.symbol.Length-3);
order.Price =
result.price.ToDecimal();
order.Volume =
result.quanreplacedy.ToDecimal();
order.Side = result.side == "sell" ? Side.Sell : Side.Buy;
order.SecurityNameCode = result.symbol;
order.ServerType = ServerType;
order.TimeCallBack = Convert.ToDateTime(result.createdAt);
order.TypeOrder = result.type == "limit" ? OrderPriceType.Limit : OrderPriceType.Market;
if (result.status == "new")
{
order.State = OrderStateType.Activ;
}
else if (result.status == "partiallyFilled")
{
order.State = OrderStateType.Patrial;
}
else if (result.status == "filled")
{
order.State = OrderStateType.Done;
_couplers.Remove(needCoupler);
}
else if (result.status == "canceled")
{
order.State = OrderStateType.Cancel;
_couplers.Remove(needCoupler);
}
else if (result.status == "expired")
{
order.State = OrderStateType.Fail;
}
MyOrderEvent?.Invoke(order);
_incominOrders.Add(order);
_client.GetBalance();
}
19
Source : CrmWorkflowBase.cs
with MIT License
from AndrewButenko
with MIT License
from AndrewButenko
private string CreateFetchXml(string initialFetchXml, string pagingCookie, int pageNumber, int fetchCount)
{
var doc = new XmlDoreplacedent();
doc.LoadXml(initialFetchXml);
if (doc.DoreplacedentElement == null)
throw new InvalidPluginExecutionException("Doreplacedent element of Xml is empty!");
var attrs = doc.DoreplacedentElement.Attributes;
if (!string.IsNullOrEmpty(pagingCookie))
{
var pagingAttr = doc.CreateAttribute("paging-cookie");
pagingAttr.Value = pagingCookie;
attrs.Append(pagingAttr);
}
var pageAttr = doc.CreateAttribute("page");
pageAttr.Value = Convert.ToString(pageNumber);
attrs.Append(pageAttr);
var countAttr = doc.CreateAttribute("count");
countAttr.Value = Convert.ToString(fetchCount);
attrs.Append(countAttr);
return doc.OuterXml;
}
19
Source : ActivityLegend.cs
with MIT License
from AngeloCresta
with MIT License
from AngeloCresta
private void bubbleSortLegend()
{
// Initialize x to the count of the customItems
int x = myLegend.CustomItems.Count;
// Create temporary variables
LegendItem temp;
int indexTemp;
DateTime dateTemp;
// Condition used for second bubble loop
bool secondCondition = false;
// Bubble sort
for (int i = (x - 1); i >= 0; i--)
{
for (int j = 1; j <= i; j++)
{
// The condition is based on whether we're aligning to right or left of the chart
if ((myLegend.Docking == Docking.Right && myChart.ChartAreas[mySeries[mySeriesreplacedignment[j]].ChartArea].AxisX.IsReversed == false) || (myLegend.Docking == Docking.Left && myChart.ChartAreas[mySeries[mySeriesreplacedignment[j]].ChartArea].AxisX.IsReversed == true))
{
// If datearray is not empty, use it for comparison instead of the value
if (myDateArray == null)
secondCondition = (Convert.ToDouble(myLegend.CustomItems[j - 1].Cells[0].Text) > Convert.ToDouble(myLegend.CustomItems[j].Cells[0].Text));
else
secondCondition = (myDateArray[j - 1] > myDateArray[j]);
}
else
{
// If datearray is not empty, use it for comparison instead of the value
if (myDateArray == null)
secondCondition = (Convert.ToDouble(myLegend.CustomItems[j - 1].Cells[0].Text) < Convert.ToDouble(myLegend.CustomItems[j].Cells[0].Text));
else
secondCondition = (myDateArray[j - 1] < myDateArray[j]);
}
if (secondCondition)
{
// Swap the items
temp = myLegend.CustomItems[j - 1];
myLegend.CustomItems.Remove(temp);
myLegend.CustomItems.Insert(j, temp);
// Switch around the indices to reflect a placement change
myLegend.CustomItems[j - 1].Cells[1].Name = "ActivityItem" + Convert.ToString(j - 1);
myLegend.CustomItems[j].Cells[1].Name = "ActivityItem" + j.ToString();
// Move the pointIndex and seriesreplacedignment arrays to reflect the change
indexTemp = myPointIndex[j - 1];
myPointIndex[j - 1] = myPointIndex[j];
myPointIndex[j] = indexTemp;
indexTemp = mySeriesreplacedignment[j - 1];
mySeriesreplacedignment[j - 1] = mySeriesreplacedignment[j];
mySeriesreplacedignment[j] = indexTemp;
// Swap the DateArray if it's being used
if (myDateArray != null)
{
dateTemp = myDateArray[j - 1];
myDateArray[j - 1] = myDateArray[j];
myDateArray[j] = dateTemp;
}
}
}
}
}
19
Source : Keyup.cs
with The Unlicense
from Anirban166
with The Unlicense
from Anirban166
private void button1_KeyUp(object sender, KeyEventArgs e)
{
int sub;
sub = Convert.ToInt32(textBox1.Text) - Convert.ToInt32(textBox2.Text);
textBox3.Text = Convert.ToString(sub);
MessageBox.Show("Subtraction is performed with KeyUp Event");
}
19
Source : Mouseup.cs
with The Unlicense
from Anirban166
with The Unlicense
from Anirban166
private void button1_MouseUp(object sender, MouseEventArgs e)
{
int add;
add = Convert.ToInt32(textBox1.Text) +Convert.ToInt32(textBox2.Text);
textBox3.Text = Convert.ToString(add);
MessageBox.Show("Addition is performed with MouseUp Event");
}
19
Source : ProgressBarEx.cs
with GNU General Public License v3.0
from antikmozib
with GNU General Public License v3.0
from antikmozib
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Point StartPoint = new Point(0, 0);
Point EndPoint = new Point(0, this.Height);
if (_ProgressDirection == ProgressDir.Vertical)
{
EndPoint = new Point(this.Width, 0);
}
using (GraphicsPath gp = new GraphicsPath())
{
Rectangle rec = new Rectangle(0, 0, this.Width, this.Height);
int rad = Convert.ToInt32(rec.Height / 2.5);
if (rec.Width < rec.Height)
rad = Convert.ToInt32(rec.Width / 2.5);
using (LinearGradientBrush _BackColorBrush = new LinearGradientBrush(StartPoint, EndPoint, _BackColor, _GradiantColor))
{
_BackColorBrush.Blend = bBlend;
if (_RoundedCorners)
{
gp.AddArc(rec.X, rec.Y, rad, rad, 180, 90);
gp.AddArc(rec.Right - (rad), rec.Y, rad, rad, 270, 90);
gp.AddArc(rec.Right - (rad), rec.Bottom - (rad), rad, rad, 0, 90);
gp.AddArc(rec.X, rec.Bottom - (rad), rad, rad, 90, 90);
gp.CloseFigure();
e.Graphics.FillPath(_BackColorBrush, gp);
}
else
{
e.Graphics.FillRectangle(_BackColorBrush, rec);
}
}
if (_Value > _Minimum)
{
int lngth = Convert.ToInt32((double)(this.Width / (double)(_Maximum - _Minimum)) * _Value);
if (_ProgressDirection == ProgressDir.Vertical)
{
lngth = Convert.ToInt32((double)(this.Height / (double)(_Maximum - _Minimum)) * _Value);
rec.Y = rec.Height - lngth;
rec.Height = lngth;
}
else
{
rec.Width = lngth;
}
using (LinearGradientBrush _ProgressBrush = new LinearGradientBrush(StartPoint, EndPoint, _ProgressColor, _GradiantColor))
{
_ProgressBrush.Blend = bBlend;
if (_RoundedCorners)
{
if (_ProgressDirection == ProgressDir.Horizontal)
{
rec.Height -= 1;
}
else
{
rec.Width -= 1;
}
using (GraphicsPath gp2 = new GraphicsPath())
{
gp2.AddArc(rec.X, rec.Y, rad, rad, 180, 90);
gp2.AddArc(rec.Right - (rad), rec.Y, rad, rad, 270, 90);
gp2.AddArc(rec.Right - (rad), rec.Bottom - (rad), rad, rad, 0, 90);
gp2.AddArc(rec.X, rec.Bottom - (rad), rad, rad, 90, 90);
gp2.CloseFigure();
using (GraphicsPath gp3 = new GraphicsPath())
{
using (Region rgn = new Region(gp))
{
rgn.Intersect(gp2);
gp3.AddRectangles(rgn.GetRegionScans(new Matrix()));
}
e.Graphics.FillPath(_ProgressBrush, gp3);
}
}
}
else
{
e.Graphics.FillRectangle(_ProgressBrush, rec);
}
}
}
if (_Image != null)
{
if (_ImageLayout == ImageLayoutType.Stretch)
{
e.Graphics.DrawImage(_Image, 0, 0, this.Width, this.Height);
}
else if (_ImageLayout == ImageLayoutType.None)
{
e.Graphics.DrawImage(_Image, 0, 0);
}
else
{
int xx = Convert.ToInt32((this.Width / 2) - (_Image.Width / 2));
int yy = Convert.ToInt32((this.Height / 2) - (_Image.Height / 2));
e.Graphics.DrawImage(_Image, xx, yy);
}
}
if (_ShowPercentage | _ShowText)
{
string perc = "";
if (_ShowText)
perc = this.Text;
if (_ShowPercentage)
perc += Convert.ToString(Convert.ToInt32(((double)100 / (double)(_Maximum - _Minimum)) * _Value)) + "%";
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
{
e.Graphics.DrawString(perc, this.Font, _ForeColorBrush, new Rectangle(0, 0, this.Width, this.Height), sf);
}
}
if (_Border)
{
rec = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
if (_RoundedCorners)
{
gp.Reset();
gp.AddArc(rec.X, rec.Y, rad, rad, 180, 90);
gp.AddArc(rec.Right - (rad), rec.Y, rad, rad, 270, 90);
gp.AddArc(rec.Right - (rad), rec.Bottom - (rad), rad, rad, 0, 90);
gp.AddArc(rec.X, rec.Bottom - (rad), rad, rad, 90, 90);
gp.CloseFigure();
e.Graphics.DrawPath(_BorderPen, gp);
}
else
{
e.Graphics.DrawRectangle(_BorderPen, rec);
}
}
}
}
19
Source : NmsStreamMessageTest.cs
with Apache License 2.0
from apache
with Apache License 2.0
from apache
[Test, Description("Set a string, then retrieve it as all of the legal type combinations to verify it is parsed correctly")]
public void TestWriteStringReadLegal()
{
NmsStreamMessage streamMessage = factory.CreateStreamMessage();
string integralValue = Convert.ToString(byte.MaxValue);
streamMessage.WriteString(integralValue);
streamMessage.Reset();
replacedertGetStreamEntryEquals<string>(streamMessage, true, integralValue);
replacedertGetStreamEntryEquals<bool>(streamMessage, true, false);
replacedertGetStreamEntryEquals<byte>(streamMessage, true, byte.MaxValue);
streamMessage.ClearBody();
integralValue = Convert.ToString(short.MaxValue);
streamMessage.WriteString(integralValue);
streamMessage.Reset();
replacedertGetStreamEntryEquals<short>(streamMessage, true, short.MaxValue);
streamMessage.ClearBody();
integralValue = Convert.ToString(int.MaxValue);
streamMessage.WriteString(integralValue);
streamMessage.Reset();
replacedertGetStreamEntryEquals<int>(streamMessage, true, int.MaxValue);
streamMessage.ClearBody();
integralValue = Convert.ToString(long.MaxValue);
streamMessage.WriteString(integralValue);
streamMessage.Reset();
replacedertGetStreamEntryEquals<long>(streamMessage, true, long.MaxValue);
streamMessage.ClearBody();
string fpValue = Convert.ToString(float.MaxValue, CultureInfo.InvariantCulture);
streamMessage.WriteString(fpValue);
streamMessage.Reset();
replacedertGetStreamEntryEquals<float>(streamMessage, true, float.Parse(fpValue));
// TODO: make following preplaced
//replacedertGetStreamEntryEquals<double>(streamMessage, true, double.Parse(fpValue));
}
19
Source : ConsumerTest.cs
with Apache License 2.0
from apache
with Apache License 2.0
from apache
[Test]
public void TestDoChangeSentMessage(
[Values(AcknowledgementMode.AutoAcknowledge, AcknowledgementMode.ClientAcknowledge,
AcknowledgementMode.DupsOkAcknowledge, AcknowledgementMode.Transactional)]
AcknowledgementMode ackMode,
[Values(true, false)] bool doClear)
{
using (IConnection connection = CreateConnection())
{
connection.Start();
using (ISession session = connection.CreateSession(ackMode))
{
ITemporaryQueue queue = session.CreateTemporaryQueue();
using (IMessageConsumer consumer = session.CreateConsumer(queue))
{
IMessageProducer producer = session.CreateProducer(queue);
ITextMessage message = session.CreateTextMessage();
string prefix = "ConsumerTest - TestDoChangeSentMessage: ";
for (int i = 0; i < COUNT; i++)
{
message.Properties[VALUE_NAME] = i;
message.Text = prefix + Convert.ToString(i);
producer.Send(message);
if (doClear)
{
message.ClearBody();
message.ClearProperties();
}
}
if (ackMode == AcknowledgementMode.Transactional)
{
session.Commit();
}
for (int i = 0; i < COUNT; i++)
{
ITextMessage msg = consumer.Receive(TimeSpan.FromMilliseconds(2000)) as ITextMessage;
replacedert.AreEqual(msg.Text, prefix + Convert.ToString(i));
replacedert.AreEqual(msg.Properties.GetInt(VALUE_NAME), i);
}
if (ackMode == AcknowledgementMode.Transactional)
{
session.Commit();
}
}
}
}
}
19
Source : Version.cs
with MIT License
from architdate
with MIT License
from architdate
public override System.String ToString()
{
return System.Convert.ToString(versionNumber);
}
19
Source : KeyValue.cs
with MIT License
from Astropilot
with MIT License
from Astropilot
private static bool TryReadAsBinaryCore(Stream input, KeyValue current, KeyValue parent)
{
current.Children = new List<KeyValue>();
while (true)
{
var type = (Type)input.ReadByte();
if (type == Type.End)
{
break;
}
current.Name = input.ReadNullTermString(Encoding.UTF8);
switch (type)
{
case Type.None:
{
var child = new KeyValue();
var didReadChild = TryReadAsBinaryCore(input, child, current);
if (!didReadChild)
{
return false;
}
break;
}
case Type.String:
{
current.Value = input.ReadNullTermString(Encoding.UTF8);
break;
}
case Type.WideString:
{
System.Diagnostics.Debug.WriteLine("KeyValue", "Encountered WideString type when parsing binary KeyValue, which is unsupported. Returning false.");
return false;
}
case Type.Int32:
case Type.Color:
case Type.Pointer:
{
current.Value = Convert.ToString(input.ReadInt32());
break;
}
case Type.UInt64:
{
current.Value = Convert.ToString(input.ReadUInt64());
break;
}
case Type.Float32:
{
current.Value = Convert.ToString(input.ReadFloat());
break;
}
default:
{
return false;
}
}
if (parent != null)
{
parent.Children.Add(current);
}
current = new KeyValue();
}
return true;
}
19
Source : WeightedRandomSamplerPropertyData.cs
with MIT License
from atenfyr
with MIT License
from atenfyr
public override string ToString()
{
string oup = "(";
oup += "(";
for (int i = 0; i < Prob.Length; i++)
{
oup += Convert.ToString(Prob[i]) + ", ";
}
oup = oup.Remove(oup.Length - 2) + ")";
oup += "(";
for (int i = 0; i < Alias.Length; i++)
{
oup += Convert.ToString(Alias[i]) + ", ";
}
oup = oup.Remove(oup.Length - 2) + ")";
oup += ", " + TotalWeight + ")";
return oup;
}
19
Source : Form1.cs
with MIT License
from atenfyr
with MIT License
from atenfyr
public void SetParsingVersion(UE4Version ver)
{
if (ver == ParsingVersion) return;
for (int i = 0; i < versionOptionsValues.Length; i++)
{
if (versionOptionsValues[i] == ver)
{
comboSpecifyVersion.SelectedIndex = i;
UpdateComboSpecifyVersion();
return;
}
}
string verStringRepresentation = "(" + Convert.ToString((int)ver) + ")";
comboSpecifyVersion.Items.Add(verStringRepresentation);
Array.Resize(ref versionOptionsKeys, versionOptionsKeys.Length + 1);
versionOptionsKeys[versionOptionsKeys.Length - 1] = verStringRepresentation;
Array.Resize(ref versionOptionsValues, versionOptionsValues.Length + 1);
versionOptionsValues[versionOptionsValues.Length - 1] = ver;
comboSpecifyVersion.SelectedIndex = versionOptionsKeys.Length - 1;
UpdateComboSpecifyVersion();
}
19
Source : ListProxy.cs
with MIT License
from ay2015
with MIT License
from ay2015
public string[] GetPropertyNames(object target)
{
if (target is IList)
{
string[] propertyNames = new string[((IList)target).Count];
for (int i = 0; i < ((IList)target).Count; i++)
propertyNames[i] = System.Convert.ToString(i);
return propertyNames;
}
else
{
return _propertyNames;
}
}
19
Source : CarOperations.cs
with MIT License
from aykutsahin98
with MIT License
from aykutsahin98
private void comboBoxBrand_SelectedIndexChanged(object sender, EventArgs e)
{
id = (comboBoxBrand.SelectedItem as Brand).BrandId;
labelBrand.Text = Convert.ToString(id);
}
19
Source : CarOperations.cs
with MIT License
from aykutsahin98
with MIT License
from aykutsahin98
private void comboBoxColor_SelectedIndexChanged(object sender, EventArgs e)
{
Id = (comboBoxColor.SelectedItem as Enreplacedies.Concrete.Color).ColorId;
labelColor.Text = Convert.ToString(Id);
}
19
Source : CustomerOperations.cs
with MIT License
from aykutsahin98
with MIT License
from aykutsahin98
private void comboBoxUsers_SelectedIndexChanged(object sender, EventArgs e)
{
Id = (comboBoxUsers.SelectedItem as User).UserId;
label4.Text = Convert.ToString(Id);
}
19
Source : DotNaming.cs
with MIT License
from Big-BlueBerry
with MIT License
from Big-BlueBerry
public string GetCurrent()
{
try
{
if (_current < 26) // 'A' ~ 'Z'
{
return I2S(_current + 'A');
}
else
{
return string.Concat(I2S( _current % 26 + 'A'), Convert.ToString(_labelnum + 1));
if (_current % 26 == 0) _labelnum++;
}
}
finally
{
_current++;
}
}
19
Source : RomanNumeralParser.cs
with GNU General Public License v3.0
from bonarr
with GNU General Public License v3.0
from bonarr
private static void GenerateRomanNumerals(int arabicNumeral, out string romanNumeral, out string arabicNumeralreplacedtring)
{
RomanNumeral romanNumeralObject = new RomanNumeral(arabicNumeral);
romanNumeral = romanNumeralObject.ToRomanNumeral();
arabicNumeralreplacedtring = Convert.ToString(arabicNumeral);
}
19
Source : WebSocketClientHandshaker00.cs
with Apache License 2.0
from cdy816
with Apache License 2.0
from cdy816
protected internal override unsafe IFullHttpRequest NewHandshakeRequest()
{
// Make keys
int spaces1 = WebSocketUtil.RandomNumber(1, 12);
int spaces2 = WebSocketUtil.RandomNumber(1, 12);
int max1 = int.MaxValue / spaces1;
int max2 = int.MaxValue / spaces2;
int number1 = WebSocketUtil.RandomNumber(0, max1);
int number2 = WebSocketUtil.RandomNumber(0, max2);
int product1 = number1 * spaces1;
int product2 = number2 * spaces2;
string key1 = Convert.ToString(product1);
string key2 = Convert.ToString(product2);
key1 = InsertRandomCharacters(key1);
key2 = InsertRandomCharacters(key2);
key1 = InsertSpaces(key1, spaces1);
key2 = InsertSpaces(key2, spaces2);
byte[] key3 = WebSocketUtil.RandomBytes(8);
var challenge = new byte[16];
fixed (byte* bytes = challenge)
{
Unsafe.WriteUnaligned(bytes, number1);
Unsafe.WriteUnaligned(bytes + 4, number2);
PlatformDependent.CopyMemory(key3, 0, bytes + 8, 8);
}
this.expectedChallengeResponseBytes = Unpooled.WrappedBuffer(WebSocketUtil.Md5(challenge));
// Get path
Uri wsUrl = this.Uri;
string path = RawPath(wsUrl);
// Format request
var request = new DefaultFullHttpRequest(HttpVersion.Http11, HttpMethod.Get, path);
HttpHeaders headers = request.Headers;
headers.Add(HttpHeaderNames.Upgrade, Websocket)
.Add(HttpHeaderNames.Connection, HttpHeaderValues.Upgrade)
.Add(HttpHeaderNames.Host, WebsocketHostValue(wsUrl))
.Add(HttpHeaderNames.Origin, WebsocketOriginValue(wsUrl))
.Add(HttpHeaderNames.SecWebsocketKey1, key1)
.Add(HttpHeaderNames.SecWebsocketKey2, key2);
string expectedSubprotocol = this.ExpectedSubprotocol;
if (!string.IsNullOrEmpty(expectedSubprotocol))
{
headers.Add(HttpHeaderNames.SecWebsocketProtocol, expectedSubprotocol);
}
if (this.CustomHeaders != null)
{
headers.Add(this.CustomHeaders);
}
// Set Content-Length to workaround some known defect.
// See also: http://www.ietf.org/mail-archive/web/hybi/current/msg02149.html
headers.Set(HttpHeaderNames.ContentLength, key3.Length);
request.Content.WriteBytes(key3);
return request;
}
19
Source : PerMessageDeflateClientExtensionHandshaker.cs
with Apache License 2.0
from cdy816
with Apache License 2.0
from cdy816
public WebSocketExtensionData NewRequestData()
{
var parameters = new Dictionary<string, string>(4);
if (this.requestedServerWindowSize != MaxWindowSize)
{
parameters.Add(ServerNoContext, null);
}
if (this.allowClientNoContext)
{
parameters.Add(ClientNoContext, null);
}
if (this.requestedServerWindowSize != MaxWindowSize)
{
parameters.Add(ServerMaxWindow, Convert.ToString(this.requestedServerWindowSize));
}
if (this.allowClientWindowSize)
{
parameters.Add(ClientMaxWindow, null);
}
return new WebSocketExtensionData(PerMessageDeflateExtension, parameters);
}
19
Source : PerMessageDeflateServerExtensionHandshaker.cs
with Apache License 2.0
from cdy816
with Apache License 2.0
from cdy816
public WebSocketExtensionData NewReponseData()
{
var parameters = new Dictionary<string, string>(4);
if (this.serverNoContext)
{
parameters.Add(ServerNoContext, null);
}
if (this.clientNoContext)
{
parameters.Add(ClientNoContext, null);
}
if (this.serverWindowSize != MaxWindowSize)
{
parameters.Add(ServerMaxWindow, Convert.ToString(this.serverWindowSize));
}
if (this.clientWindowSize != MaxWindowSize)
{
parameters.Add(ClientMaxWindow, Convert.ToString(this.clientWindowSize));
}
return new WebSocketExtensionData(PerMessageDeflateExtension, parameters);
}
19
Source : NetUtil.cs
with Apache License 2.0
from cdy816
with Apache License 2.0
from cdy816
public static string ToSocketAddressString(string host, int port)
{
string portStr = Convert.ToString(port);
return NewSocketAddressStringBuilder(host, portStr,
!IsValidIpV6Address(host)).Append(':').Append(portStr).ToString();
}
19
Source : NetworkUtils.cs
with Apache License 2.0
from CheckPointSW
with Apache License 2.0
from CheckPointSW
public static bool TryParseNetwortWithPrefix(String sNetwork, out String sIp, out String sMaskLength)
{
sIp = "";
sMaskLength = "";
String[] splitedNetwork = sNetwork.Split('/');
IPAddress ipAddr = null;
int maskLengthNum = 0;
if (splitedNetwork.Length == 2 && IPAddress.TryParse(splitedNetwork[0], out ipAddr) && int.TryParse(splitedNetwork[1], out maskLengthNum))
{
sMaskLength = Convert.ToString(maskLengthNum);
sIp = Convert.ToString(ipAddr);
return true;
}
return false;
}
19
Source : CustomProgressBar.cs
with Apache License 2.0
from Chem4Word
with Apache License 2.0
from Chem4Word
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Point StartPoint = new Point(0, 0);
Point EndPoint = new Point(0, this.Height);
if (_progressDirection == ProgressDir.Vertical)
{
EndPoint = new Point(this.Width, 0);
}
using (GraphicsPath gp = new GraphicsPath())
{
Rectangle rec = new Rectangle(0, 0, this.Width, this.Height);
int rad = Convert.ToInt32(rec.Height / 2.5);
if (rec.Width < rec.Height)
rad = Convert.ToInt32(rec.Width / 2.5);
using (LinearGradientBrush _BackColorBrush = new LinearGradientBrush(StartPoint, EndPoint, _backColor, _gradiantColor))
{
_BackColorBrush.Blend = _bBlend;
if (_roundedCorners)
{
gp.AddArc(rec.X, rec.Y, rad, rad, 180, 90);
gp.AddArc(rec.Right - (rad), rec.Y, rad, rad, 270, 90);
gp.AddArc(rec.Right - (rad), rec.Bottom - (rad), rad, rad, 0, 90);
gp.AddArc(rec.X, rec.Bottom - (rad), rad, rad, 90, 90);
gp.CloseFigure();
e.Graphics.FillPath(_BackColorBrush, gp);
}
else
{
e.Graphics.FillRectangle(_BackColorBrush, rec);
}
}
if (_value > _minimum)
{
int lngth = Convert.ToInt32((double)(this.Width / (double)(_maximum - _minimum)) * _value);
if (_progressDirection == ProgressDir.Vertical)
{
lngth = Convert.ToInt32((double)(this.Height / (double)(_maximum - _minimum)) * _value);
rec.Y = rec.Height - lngth;
rec.Height = lngth;
}
else
{
rec.Width = lngth;
}
using (LinearGradientBrush _ProgressBrush = new LinearGradientBrush(StartPoint, EndPoint, _progressColor, _gradiantColor))
{
_ProgressBrush.Blend = _bBlend;
if (_roundedCorners)
{
if (_progressDirection == ProgressDir.Horizontal)
{
rec.Height -= 1;
}
else
{
rec.Width -= 1;
}
using (GraphicsPath gp2 = new GraphicsPath())
{
gp2.AddArc(rec.X, rec.Y, rad, rad, 180, 90);
gp2.AddArc(rec.Right - (rad), rec.Y, rad, rad, 270, 90);
gp2.AddArc(rec.Right - (rad), rec.Bottom - (rad), rad, rad, 0, 90);
gp2.AddArc(rec.X, rec.Bottom - (rad), rad, rad, 90, 90);
gp2.CloseFigure();
using (GraphicsPath gp3 = new GraphicsPath())
{
using (Region rgn = new Region(gp))
{
rgn.Intersect(gp2);
gp3.AddRectangles(rgn.GetRegionScans(new Matrix()));
}
e.Graphics.FillPath(_ProgressBrush, gp3);
}
}
}
else
{
e.Graphics.FillRectangle(_ProgressBrush, rec);
}
}
}
if (_image != null)
{
if (_imageLayout == ImageLayoutType.Stretch)
{
e.Graphics.DrawImage(_image, 0, 0, this.Width, this.Height);
}
else if (_imageLayout == ImageLayoutType.None)
{
e.Graphics.DrawImage(_image, 0, 0);
}
else
{
int xx = Convert.ToInt32((this.Width / 2) - (_image.Width / 2));
int yy = Convert.ToInt32((this.Height / 2) - (_image.Height / 2));
e.Graphics.DrawImage(_image, xx, yy);
}
}
if (_showPercentage | _showText)
{
string perc = "";
if (_showText)
perc = this.Text;
if (_showPercentage)
perc += Convert.ToString(Convert.ToInt32(((double)100 / (double)(_maximum - _minimum)) * _value)) + "%";
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
{
e.Graphics.DrawString(perc, this.Font, _foreColorBrush, new Rectangle(0, 0, this.Width, this.Height), sf);
}
}
if (_border)
{
rec = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
if (_roundedCorners)
{
gp.Reset();
gp.AddArc(rec.X, rec.Y, rad, rad, 180, 90);
gp.AddArc(rec.Right - (rad), rec.Y, rad, rad, 270, 90);
gp.AddArc(rec.Right - (rad), rec.Bottom - (rad), rad, rad, 0, 90);
gp.AddArc(rec.X, rec.Bottom - (rad), rad, rad, 90, 90);
gp.CloseFigure();
e.Graphics.DrawPath(_borderPen, gp);
}
else
{
e.Graphics.DrawRectangle(_borderPen, rec);
}
}
}
}
19
Source : OrclPower.cs
with GNU General Public License v3.0
from ClayLipscomb
with GNU General Public License v3.0
from ClayLipscomb
public static string GetreplacedocArrayAsCommaDelimited(OracleParameter param) {
if (param.CollectionType != OracleCollectionType.PLSQLreplacedociativeArray) return null;
string commaDelimitedVals = "";
List<string> vals = new List<string>();
switch (param.OracleDbType) {
case OracleDbType.Varchar2:
for (int i = 0; i < (param.Value as Array).Length; i++) {
if (param.Direction.ToString().EndsWith(ParameterDirection.Output.ToString())) {
//a = GetStructArray<OracleString>(param.Value);
vals.Add((param.Value as OracleString[])[i].IsNull
? "NULL"
: "'" + (param.Value as OracleString[])[i].Value + "'"); // use single quotes to designate string
} else {
vals.Add((param.Value as String[])[i] == null
? "NULL"
: "'" + (param.Value as String[])[i] + "'"); // use single quotes to designate string
}
}
commaDelimitedVals += String.Join(",", vals.ToArray());
break;
case OracleDbType.Decimal:
case OracleDbType.Int16:
case OracleDbType.Int32:
case OracleDbType.Int64:
for (int i = 0; i < (param.Value as Array).Length; i++) {
if (param.Direction.ToString().EndsWith(ParameterDirection.Output.ToString())) {
vals.Add((param.Value as OracleDecimal[])[i].IsNull
? "NULL"
: (param.Value as OracleDecimal[])[i].Value.ToString());
} else {
//Type arrayType = param.Value.GetType().GetElementType();
//decimal?[] a = GetStructArray<decimal?>(param.Value);
//Nullable.GetUnderlyingType(field.FieldType) ?? field.FieldType
if (param.OracleDbType.Equals(OracleDbType.Int64)) {
vals.Add(!(param.Value as Int64?[])[i].HasValue
? "NULL"
: Convert.ToString((param.Value as Int64?[])[i].Value));
} else if (param.OracleDbType.Equals(OracleDbType.Int32)) {
vals.Add(!(param.Value as Int32?[])[i].HasValue
? "NULL"
: Convert.ToString((param.Value as Int32?[])[i].Value));
} else if (param.OracleDbType.Equals(OracleDbType.Int16)) {
vals.Add(!(param.Value as Int16?[])[i].HasValue
? "NULL"
: Convert.ToString((param.Value as Int16?[])[i].Value));
} else if (param.OracleDbType.Equals(OracleDbType.Decimal)) {
vals.Add(!(param.Value as Decimal?[])[i].HasValue
? "NULL"
: Convert.ToString((param.Value as Decimal?[])[i].Value));
} else {
commaDelimitedVals = NOT_AVAILABLE;
break;
}
}
}
commaDelimitedVals += String.Join(",", vals.ToArray());
break;
case OracleDbType.Date:
for (int i = 0; i < (param.Value as Array).Length; i++) {
if (param.Direction.ToString().EndsWith(ParameterDirection.Output.ToString())) {
vals.Add((param.Value as OracleDate[])[i].IsNull
? "NULL"
: (param.Value as OracleDate[])[i].Value.ToString());
} else {
vals.Add((param.Value as DateTime[])[i] == null
? "NULL"
: (param.Value as DateTime[])[i].ToString());
}
}
commaDelimitedVals += String.Join(",", vals.ToArray());
break;
}
return commaDelimitedVals;
}
19
Source : Brute.cs
with GNU General Public License v3.0
from cobbr
with GNU General Public License v3.0
from cobbr
public static void Execute(string CovenantURI, string CovenantCertHash, string GUID, Aes SessionKey)
{
try
{
int Delay = Convert.ToInt32(@"{{REPLACE_DELAY}}");
int Jitter = Convert.ToInt32(@"{{REPLACE_JITTER_PERCENT}}");
int ConnectAttempts = Convert.ToInt32(@"{{REPLACE_CONNECT_ATTEMPTS}}");
DateTime KillDate = DateTime.FromBinary(long.Parse(@"{{REPLACE_KILL_DATE}}"));
List<string> ProfileHttpHeaderNames = @"{{REPLACE_PROFILE_HTTP_HEADER_NAMES}}".Split(',').ToList().Select(H => System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(H))).ToList();
List<string> ProfileHttpHeaderValues = @"{{REPLACE_PROFILE_HTTP_HEADER_VALUES}}".Split(',').ToList().Select(H => System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(H))).ToList();
List<string> ProfileHttpUrls = @"{{REPLACE_PROFILE_HTTP_URLS}}".Split(',').ToList().Select(U => System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(U))).ToList();
string ProfileHttpGetResponse = @"{{REPLACE_PROFILE_HTTP_GET_RESPONSE}}".Replace(Environment.NewLine, "\n");
string ProfileHttpPostRequest = @"{{REPLACE_PROFILE_HTTP_POST_REQUEST}}".Replace(Environment.NewLine, "\n");
string ProfileHttpPostResponse = @"{{REPLACE_PROFILE_HTTP_POST_RESPONSE}}".Replace(Environment.NewLine, "\n");
bool ValidateCert = bool.Parse(@"{{REPLACE_VALIDATE_CERT}}");
bool UseCertPinning = bool.Parse(@"{{REPLACE_USE_CERT_PINNING}}");
string Hostname = Dns.GetHostName();
string IPAddress = Dns.GetHostAddresses(Hostname)[0].ToString();
foreach (IPAddress a in Dns.GetHostAddresses(Dns.GetHostName()))
{
if (a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
IPAddress = a.ToString();
break;
}
}
string OperatingSystem = Environment.OSVersion.ToString();
string Process = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
int Integrity = 2;
string UserDomainName = Environment.UserDomainName;
string UserName = Environment.UserName;
string RegisterBody = @"{ ""integrity"": " + Integrity + @", ""process"": """ + Process + @""", ""userDomainName"": """ + UserDomainName + @""", ""userName"": """ + UserName + @""", ""delay"": " + Convert.ToString(Delay) + @", ""jitter"": " + Convert.ToString(Jitter) + @", ""connectAttempts"": " + Convert.ToString(ConnectAttempts) + @", ""status"": 0, ""ipAddress"": """ + IPAddress + @""", ""hostname"": """ + Hostname + @""", ""operatingSystem"": """ + OperatingSystem + @""" }";
IMessenger baseMessenger = null;
baseMessenger = new HttpMessenger(CovenantURI, CovenantCertHash, UseCertPinning, ValidateCert, ProfileHttpHeaderNames, ProfileHttpHeaderValues, ProfileHttpUrls);
baseMessenger.Read();
baseMessenger.Identifier = GUID;
TaskingMessenger messenger = new TaskingMessenger
(
new MessageCrafter(GUID, SessionKey),
baseMessenger,
new Profile(ProfileHttpGetResponse, ProfileHttpPostRequest, ProfileHttpPostResponse)
);
messenger.QueueTaskingMessage(RegisterBody);
messenger.WriteTaskingMessage();
messenger.SetAuthenticator(messenger.ReadTaskingMessage().Message);
try
{
// A blank upward write, this helps in some cases with an HTTP Proxy
messenger.QueueTaskingMessage("");
messenger.WriteTaskingMessage();
}
catch (Exception) { }
List<KeyValuePair<string, Thread>> Tasks = new List<KeyValuePair<string, Thread>>();
Random rnd = new Random();
int ConnectAttemptCount = 0;
bool alive = true;
while (alive)
{
int change = rnd.Next((int)Math.Round(Delay * (Jitter / 100.00)));
if (rnd.Next(2) == 0) { change = -change; }
Thread.Sleep((Delay + change) * 1000);
try
{
GruntTaskingMessage message = messenger.ReadTaskingMessage();
if (message != null)
{
ConnectAttemptCount = 0;
string output = "";
if (message.Type == GruntTaskingType.SetDelay || message.Type == GruntTaskingType.SetJitter || message.Type == GruntTaskingType.SetConnectAttempts)
{
if (int.TryParse(message.Message, out int val))
{
if (message.Type == GruntTaskingType.SetDelay)
{
Delay = val;
output += "Set Delay: " + Delay;
}
else if (message.Type == GruntTaskingType.SetJitter)
{
Jitter = val;
output += "Set Jitter: " + Jitter;
}
else if (message.Type == GruntTaskingType.SetConnectAttempts)
{
ConnectAttempts = val;
output += "Set ConnectAttempts: " + ConnectAttempts;
}
}
else
{
output += "Error parsing: " + message.Message;
}
messenger.QueueTaskingMessage(new GruntTaskingMessageResponse(GruntTaskingStatus.Completed, output).ToJson(), message.Name);
}
else if (message.Type == GruntTaskingType.SetKillDate)
{
if (DateTime.TryParse(message.Message, out DateTime date))
{
KillDate = date;
output += "Set KillDate: " + KillDate.ToString();
}
else
{
output += "Error parsing: " + message.Message;
}
messenger.QueueTaskingMessage(new GruntTaskingMessageResponse(GruntTaskingStatus.Completed, output).ToJson(), message.Name);
}
else if (message.Type == GruntTaskingType.Exit)
{
output += "Exited";
messenger.QueueTaskingMessage(new GruntTaskingMessageResponse(GruntTaskingStatus.Completed, output).ToJson(), message.Name);
messenger.WriteTaskingMessage();
return;
}
else if(message.Type == GruntTaskingType.Tasks)
{
if (!Tasks.Where(T => T.Value.ThreadState == ThreadState.Running).Any()) { output += "No active tasks!"; }
else
{
output += "Task Status" + Environment.NewLine;
output += "---- ------" + Environment.NewLine;
output += String.Join(Environment.NewLine, Tasks.Where(T => T.Value.ThreadState == ThreadState.Running).Select(T => T.Key + " Active").ToArray());
}
messenger.QueueTaskingMessage(new GruntTaskingMessageResponse(GruntTaskingStatus.Completed, output).ToJson(), message.Name);
}
else if(message.Type == GruntTaskingType.TaskKill)
{
var matched = Tasks.Where(T => T.Value.ThreadState == ThreadState.Running && T.Key.ToLower() == message.Message.ToLower());
if (!matched.Any())
{
output += "No active task with name: " + message.Message;
}
else
{
KeyValuePair<string, Thread> t = matched.First();
t.Value.Abort();
Thread.Sleep(3000);
if (t.Value.IsAlive)
{
t.Value.Suspend();
}
output += "Task: " + t.Key + " killed!";
}
messenger.QueueTaskingMessage(new GruntTaskingMessageResponse(GruntTaskingStatus.Completed, output).ToJson(), message.Name);
}
else if (message.Token)
{
Thread t = new Thread(() => TaskExecute(messenger, message, Delay));
t.Start();
Tasks.Add(new KeyValuePair<string, Thread>(message.Name, t));
bool completed = t.Join(5000);
}
else
{
Thread t = new Thread(() => TaskExecute(messenger, message, Delay));
t.Start();
Tasks.Add(new KeyValuePair<string, Thread>(message.Name, t));
}
}
messenger.WriteTaskingMessage();
}
catch (ObjectDisposedException)
{
ConnectAttemptCount++;
messenger.QueueTaskingMessage(new GruntTaskingMessageResponse(GruntTaskingStatus.Completed, "").ToJson());
messenger.WriteTaskingMessage();
}
catch (Exception e)
{
ConnectAttemptCount++;
Console.Error.WriteLine("Loop Exception: " + e.GetType().ToString() + " " + e.Message + Environment.NewLine + e.StackTrace);
}
if (ConnectAttemptCount >= ConnectAttempts) { return; }
if (KillDate.CompareTo(DateTime.Now) < 0) { return; }
}
}
catch (Exception e)
{
Console.Error.WriteLine("Outer Exception: " + e.Message + Environment.NewLine + e.StackTrace);
}
}
19
Source : ParseContext.cs
with MIT License
from codewitch-honey-crisis
with MIT License
from codewitch-honey-crisis
[DebuggerHidden()]
public void Expecting(params int[] expecting)
{
ExpectingException ex = null;
switch (expecting.Length)
{
case 0:
if (-1 == Current)
ex = new ExpectingException(_GetExpectingMessage(expecting));
break;
case 1:
if (expecting[0] != Current)
ex = new ExpectingException(_GetExpectingMessage(expecting));
break;
default:
if (0 > Array.IndexOf(expecting, Current))
ex = new ExpectingException(_GetExpectingMessage(expecting));
break;
}
if (null != ex)
{
ex.Position = Position;
ex.Line = Line;
ex.Column = Column;
ex.Expecting = new string[expecting.Length];
for (int i = 0; i < ex.Expecting.Length; i++)
ex.Expecting[i] = Convert.ToString(expecting[i]);
throw ex;
}
}
19
Source : MainForm.cs
with Apache License 2.0
from coodyer
with Apache License 2.0
from coodyer
[STAThread]
private void checkThread(Object obj)
{
int index = 0;
while (index < DataListView.Items.Count)
{
lock (base_lock)
{
index = data_view_index;
data_view_index++;
}
if (index >= DataListView.Items.Count)
{
return;
}
String url = DataListView.Items[index].SubItems[1].Text;
DataListView.Items[index].SubItems[4].Text = "检测中";
DataListView.Items[index].ForeColor = Color.Violet;
DateTime dateStart = DateTime.Now;
int code = GetCode(url);
DateTime dateEnd = DateTime.Now;
DataListView.Items[index].SubItems[3].Text = Convert.ToString(code);
TimeSpan span = (TimeSpan)(dateEnd - dateStart);
DataListView.Items[index].SubItems[4].Text = Convert.ToString(span.Milliseconds);
if (code != 200)
{
DataListView.Items[index].ForeColor = Color.Red;
continue;
}
DataListView.Items[index].ForeColor = Color.Green;
}
}
19
Source : MainForm.cs
with Apache License 2.0
from coodyer
with Apache License 2.0
from coodyer
private void resetListViewIndex(ListView listView)
{
for (int i = 0; i < listView.Items.Count; i++)
{
if (Convert.ToInt32(listView.Items[i].SubItems[0].Text) == i + 1)
{
continue;
}
listView.Items[i].SubItems[0].Text = Convert.ToString(i + 1);
}
}
19
Source : SignatureHelper.cs
with Apache License 2.0
from cosmos-open
with Apache License 2.0
from cosmos-open
public static (string nonce, string timestamp, string signature) GenerateSignature(string appSecret)
{
var rd = new Random((int)DateTime.Now.Ticks);
var rd_i = rd.Next();
var nonce = Convert.ToString(rd_i);
var timestamp = Convert.ToString(ConvertDateTimeInt(DateTime.UtcNow));
var signature = SHA1HashingProvider.Signature(appSecret + nonce + timestamp);
return (nonce, timestamp, signature);
}
19
Source : ViewReport.cshtml.cs
with MIT License
from ctrager
with MIT License
from ctrager
private static Bitmap CreateBarChart(string replacedle, DataTable dataTable, int scale)
{
var chartWidth = 640 / scale;
var chartHeight = 300 / scale;
var chartTopMargin = 10 / scale; // gap between highest bar and border of chart
var xAxisTextOffset = 8 / scale; // gap between edge and start of x axis text
var pageTopMargin = 40 / scale; // gape between chart and top of page
var maxGridLines = 20 / scale;
var fontreplacedle = new Font("Arial", 12, FontStyle.Bold);
var fontLegend = new Font("Arial", 8);
var pageBottomMargin = 3 * fontLegend.Height;
var pageLeftMargin = 4 * fontLegend.Height + xAxisTextOffset; // where the y axis text goes
// find the max of the y axis so we know how to scale the data
var max = 0.0F;
float tmp;
int i;
for (i = 0; i < dataTable.Rows.Count; i++)
{
tmp = Convert.ToSingle(dataTable.Rows[i][1]);
if (tmp > max) max = tmp;
}
var verticalScaleFactor = (chartHeight - chartTopMargin) / max;
// determine how the horizontal grid lines should be
var gridLineInterval = 1;
if (max > 1)
while (max / gridLineInterval > maxGridLines)
gridLineInterval *= 10 / scale;
// Corey's quick and dirty fix for Budoco
int extra_x = 50;
// Create a Bitmap instance
var objBitmap = new Bitmap(
pageLeftMargin + chartWidth + extra_x, // total width
pageTopMargin + fontreplacedle.Height + chartHeight + pageBottomMargin); // total height
using var objGraphics = Graphics.FromImage(objBitmap);
using var blackBrush = new SolidBrush(Color.Black);
using var whiteBrush = new SolidBrush(Color.White);
// white overall background
objGraphics.FillRectangle(
whiteBrush, // yellow
0, 0,
pageLeftMargin + chartWidth + extra_x, // far left
pageTopMargin + fontreplacedle.Height + chartHeight + pageBottomMargin); // bottom
// gray chart background
objGraphics.FillRectangle(
new SolidBrush(Color.FromArgb(204, 204, 204)), // gray
pageLeftMargin, pageTopMargin + fontreplacedle.Height,
pageLeftMargin + chartWidth - extra_x,
chartHeight);
// draw replacedle
objGraphics.DrawString(
replacedle,
fontreplacedle,
blackBrush,
xAxisTextOffset,
fontreplacedle.Height / 2);
int y;
var chartBottom = pageTopMargin + fontreplacedle.Height + chartHeight;
var blackPen = new Pen(Color.Black, 1);
for (i = 0; i < max; i += gridLineInterval)
{
y = (int)(i * verticalScaleFactor);
// y axis label
objGraphics.DrawString(
Convert.ToString(i),
fontLegend,
blackBrush,
xAxisTextOffset, chartBottom - y - fontLegend.Height / 2);
// grid line
objGraphics.DrawLine(
blackPen,
pageLeftMargin,
chartBottom - y,
pageLeftMargin + chartWidth,
chartBottom - y);
}
// draw bars
var barSpace = chartWidth / dataTable.Rows.Count;
var barWidth = (int)(.70F * barSpace);
var x = (int)(.30F * barSpace);
x += pageLeftMargin;
var xAxisTextY = chartBottom + pageBottomMargin / 2 - fontLegend.Height / 2;
Brush blueBrush = new SolidBrush(Color.FromArgb(0, 0, 204));
for (i = 0; i < dataTable.Rows.Count; i++)
{
var data = Convert.ToSingle(dataTable.Rows[i][1]);
var barHeight = (int)(data * verticalScaleFactor);
objGraphics.FillRectangle(
blueBrush,
x, chartBottom - barHeight,
barWidth,
barHeight);
objGraphics.DrawString(
Convert.ToString(dataTable.Rows[i][0]),
fontLegend,
blackBrush,
x, xAxisTextY);
x += barWidth;
x += (int)(.30F * barSpace);
}
return objBitmap;
}
19
Source : ViewReport.cshtml.cs
with MIT License
from ctrager
with MIT License
from ctrager
private static Bitmap CreateLineChart(string replacedle, DataTable dataTable, int scale)
{
var chartWidth = 640 / scale;
var chartHeight = 300 / scale;
var chartTopMargin = 10 / scale; // gap between highest bar and border of chart
var xAxisTextOffset = 8 / scale; // gap between edge and start of x axis text
var pageTopMargin = 40 / scale; // gape between chart and top of page
var maxGridLines = 20 / scale;
var fontreplacedle = new Font("Arial", 12, FontStyle.Bold);
var fontLegend = new Font("Arial", 8);
var pageBottomMargin = 3 * fontLegend.Height;
var pageLeftMargin = 4 * fontLegend.Height + xAxisTextOffset; // where the y axis text goes
// find the max of the y axis so we know how to scale the data
var max = 0.0F;
float tmp;
int i;
for (i = 0; i < dataTable.Rows.Count; i++)
{
tmp = Convert.ToSingle(dataTable.Rows[i][1]);
if (tmp > max) max = tmp;
}
var verticalScaleFactor = (chartHeight - chartTopMargin) / max;
// determine how the horizontal grid lines should be
var gridLineInterval = 1;
if (max > 1)
while (max / gridLineInterval > maxGridLines)
gridLineInterval *= 10 / scale;
// Corey's quick and dirty fix for Budoco
int extra_x = 50;
// Create a Bitmap instance
var objBitmap = new Bitmap(
pageLeftMargin + chartWidth + extra_x, // total width
pageTopMargin + fontreplacedle.Height + chartHeight + pageBottomMargin); // total height
using var objGraphics = Graphics.FromImage(objBitmap);
using var blackBrush = new SolidBrush(Color.Black);
using var whiteBrush = new SolidBrush(Color.White);
// white overall background
objGraphics.FillRectangle(
whiteBrush,
0, 0,
pageLeftMargin + chartWidth + extra_x, // far left
pageTopMargin + fontreplacedle.Height + chartHeight + pageBottomMargin); // bottom
// gray chart background
objGraphics.FillRectangle(
new SolidBrush(Color.FromArgb(204, 204, 204)), // gray
pageLeftMargin, pageTopMargin + fontreplacedle.Height,
pageLeftMargin + chartWidth - extra_x,
chartHeight);
// draw replacedle
objGraphics.DrawString(
replacedle,
fontreplacedle,
blackBrush,
xAxisTextOffset,
fontreplacedle.Height / 2);
int y;
var chartBottom = pageTopMargin + fontreplacedle.Height + chartHeight;
var blackPen = new Pen(Color.Black, 1);
for (i = 0; i < max; i += gridLineInterval)
{
y = (int)(i * verticalScaleFactor);
// y axis label
objGraphics.DrawString(
Convert.ToString(i),
fontLegend,
blackBrush,
xAxisTextOffset, chartBottom - y - fontLegend.Height / 2);
// grid line
objGraphics.DrawLine(
blackPen,
pageLeftMargin,
chartBottom - y,
pageLeftMargin + chartWidth,
chartBottom - y);
}
// draw lines
var lineLength = chartWidth / (dataTable.Rows.Count - 1);
var x = pageLeftMargin;
var xAxisTextY = chartBottom + pageBottomMargin / 2 - fontLegend.Height / 2;
var bluePen = new Pen(Color.FromArgb(0, 0, 204), 2);
var blueBrush = new SolidBrush(Color.FromArgb(0, 0, 204));
var prevXAxisLabel = -99999;
for (i = 1; i < dataTable.Rows.Count; i++)
{
var data1 = Convert.ToSingle(dataTable.Rows[i - 1][1]);
var data2 = Convert.ToSingle(dataTable.Rows[i][1]);
var valueY1 = (int)(data1 * verticalScaleFactor);
var valueY2 = (int)(data2 * verticalScaleFactor);
objGraphics.DrawLine(
bluePen,
x, chartBottom - valueY1,
x + lineLength, chartBottom - valueY2);
objGraphics.FillEllipse(
blueBrush,
x + lineLength - 3, chartBottom - valueY2 - 3,
6, 6);
// draw x axis labels
var xVal = string.Empty;
try
{
xVal = Convert.ToString((int)dataTable.Rows[i][0]);
}
catch (Exception)
{
xVal = Convert.ToString(dataTable.Rows[i][0]);
}
if (x - prevXAxisLabel > 50) // space them apart, so they don't bump into each other
{
// the little line so that the label points to the the data point
objGraphics.DrawLine(
blackPen,
x, chartBottom,
x, chartBottom + 14);
objGraphics.DrawString(
xVal,
fontLegend,
blackBrush,
x, xAxisTextY);
prevXAxisLabel = x;
}
x += lineLength;
}
return objBitmap;
}
19
Source : PerMessageDeflateClientExtensionHandshaker.cs
with MIT License
from cuteant
with MIT License
from cuteant
public WebSocketExtensionData NewRequestData()
{
var parameters = new Dictionary<string, string>(4, StringComparer.Ordinal);
if (_requestedServerWindowSize != MaxWindowSize)
{
parameters.Add(ServerNoContext, null);
}
if (_allowClientNoContext)
{
parameters.Add(ClientNoContext, null);
}
if (_requestedServerWindowSize != MaxWindowSize)
{
parameters.Add(ServerMaxWindow, Convert.ToString(_requestedServerWindowSize));
}
if (_allowClientWindowSize)
{
parameters.Add(ClientMaxWindow, null);
}
return new WebSocketExtensionData(PerMessageDeflateExtension, parameters);
}
19
Source : PerMessageDeflateServerExtensionHandshaker.cs
with MIT License
from cuteant
with MIT License
from cuteant
public WebSocketExtensionData NewReponseData()
{
var parameters = new Dictionary<string, string>(4, StringComparer.Ordinal);
if (_serverNoContext)
{
parameters.Add(ServerNoContext, null);
}
if (_clientNoContext)
{
parameters.Add(ClientNoContext, null);
}
if (_serverWindowSize != MaxWindowSize)
{
parameters.Add(ServerMaxWindow, Convert.ToString(_serverWindowSize));
}
if (_clientWindowSize != MaxWindowSize)
{
parameters.Add(ClientMaxWindow, Convert.ToString(_clientWindowSize));
}
return new WebSocketExtensionData(PerMessageDeflateExtension, parameters);
}
19
Source : HttpContentEncoderTest.cs
with MIT License
from cuteant
with MIT License
from cuteant
protected override void Encode(IChannelHandlerContext context, IByteBuffer message, IByteBuffer output)
{
output.WriteBytes(Encoding.ASCII.GetBytes(Convert.ToString(message.ReadableBytes)));
message.SkipBytes(message.ReadableBytes);
}
19
Source : RedisDecoderTest.cs
with MIT License
from cuteant
with MIT License
from cuteant
[Fact]
public void DecodeNullBulkString()
{
replacedert.False(this.channel.WriteInbound(ByteBufOf("$")));
replacedert.False(this.channel.WriteInbound(ByteBufOf(Convert.ToString(-1))));
replacedert.True(this.channel.WriteInbound(ByteBufOf("\r\n")));
replacedert.True(this.channel.WriteInbound(ByteBufOf("$")));
replacedert.True(this.channel.WriteInbound(ByteBufOf(Convert.ToString(-1))));
replacedert.True(this.channel.WriteInbound(ByteBufOf("\r\n")));
var msg1 = this.channel.ReadInbound<IFullBulkStringRedisMessage>();
replacedert.True(msg1.IsNull);
ReferenceCountUtil.Release(msg1);
var msg2 = this.channel.ReadInbound<IFullBulkStringRedisMessage>();
replacedert.True(msg2.IsNull);
ReferenceCountUtil.Release(msg2);
var msg3 = this.channel.ReadInbound<IFullBulkStringRedisMessage>();
replacedert.Null(msg3);
}
19
Source : RedisDecoderTest.cs
with MIT License
from cuteant
with MIT License
from cuteant
[Fact]
public void DecodeBulkString()
{
const string Buf1 = "bulk\nst";
const string Buf2 = "ring\ntest\n1234";
byte[] content = BytesOf(Buf1 + Buf2);
replacedert.False(this.channel.WriteInbound(ByteBufOf("$")));
replacedert.False(this.channel.WriteInbound(ByteBufOf(Convert.ToString(content.Length))));
replacedert.False(this.channel.WriteInbound(ByteBufOf("\r\n")));
replacedert.False(this.channel.WriteInbound(ByteBufOf(Buf1)));
replacedert.False(this.channel.WriteInbound(ByteBufOf(Buf2)));
replacedert.True(this.channel.WriteInbound(ByteBufOf("\r\n")));
var msg = this.channel.ReadInbound<FullBulkStringRedisMessage>();
replacedert.Equal(content, BytesOf(msg.Content));
ReferenceCountUtil.Release(msg);
}
19
Source : RedisDecoderTest.cs
with MIT License
from cuteant
with MIT License
from cuteant
[Fact]
public void DecodeEmptyBulkString()
{
byte[] content = BytesOf("");
replacedert.False(this.channel.WriteInbound(ByteBufOf("$")));
replacedert.False(this.channel.WriteInbound(ByteBufOf(Convert.ToString(content.Length))));
replacedert.False(this.channel.WriteInbound(ByteBufOf("\r\n")));
replacedert.False(this.channel.WriteInbound(ByteBufOf(content)));
replacedert.True(this.channel.WriteInbound(ByteBufOf("\r\n")));
var msg = this.channel.ReadInbound<IFullBulkStringRedisMessage>();
replacedert.Equal(content, BytesOf(msg.Content));
ReferenceCountUtil.Release(msg);
}
19
Source : ColourSelection.cs
with MIT License
from cwensley
with MIT License
from cwensley
void ParseValue(ref string val, KeyEventArgs e)
{
if (e.KeyData == Keys.Backspace)
{
if (val.Length > 0)
{
val = val.Remove(val.Length - 1);
e.Handled = true;
}
}
else if (e.KeyData >= Keys.D0 && e.KeyData <= Keys.D9)
{
string newval = val + Convert.ToString((int)(e.KeyData - Keys.D0));
int num = Convert.ToInt32(newval);
if (num >= 0 && num < pal.Count)
{
val = newval;
e.Handled = true;
}
}
}
19
Source : CharacterDocumentInfo.cs
with MIT License
from cwensley
with MIT License
from cwensley
public override void ReadXml(XmlElement element)
{
base.ReadXml(element);
use9x = element.GetBoolAttribute("use9x") ?? use9x;
dosAspect = element.GetBoolAttribute("dosAspect") ?? dosAspect;
insertMode = element.GetBoolAttribute("insertMode") ?? insertMode;
shiftSelect = element.GetBoolAttribute("shiftSelect") ?? shiftSelect;
iceColours = element.GetBoolAttribute("iceColours") ?? true;
AttributeDialogSize = element.ReadChildSizeXml("attribute-dialog");
if (AttributeDialogSize != null && AttributeDialogSize.Value == Size.Empty)
AttributeDialogSize = null;
AttributeDialogBounds = element.ReadChildRectangleXml("attribute-dialog-bounds");
element.ReadChildListXml(brushes, "brush", "brushes");
XmlNodeList charElements = element.SelectNodes("characterSets/characterSet");
if (charElements != null)
{
if (charElements.Count > 0)
CreateCharacterSets();
foreach (XmlElement charElement in charElements)
{
int set = Convert.ToInt32(charElement.GetAttribute("set"));
if (set >= 0 && set < characterSets.GetLength(0))
{
for (int i = 0; i < characterSets.GetLength(1); i++)
{
characterSets[set, i] = charElement.GetIntAttribute("f" + Convert.ToString(i + 1)) ?? 32;
}
}
}
}
}
19
Source : CharacterDocumentInfo.cs
with MIT License
from cwensley
with MIT License
from cwensley
public override void WriteXml(XmlElement element)
{
base.WriteXml(element);
element.SetAttribute("use9x", use9x);
element.SetAttribute("dosAspect", dosAspect);
element.SetAttribute("iceColours", iceColours);
element.SetAttribute("insertMode", insertMode);
element.SetAttribute("shiftSelect", shiftSelect);
element.WriteChildSizeXml("attribute-dialog", AttributeDialogSize);
element.WriteChildRectangleXml("attribute-dialog-bounds", AttributeDialogBounds);
element.WriteChildListXml(brushes, "brush", "brushes");
XmlElement charElement = element.OwnerDoreplacedent.CreateElement("characterSets");
for (int set = 0; set < characterSets.GetLength(0); set++)
{
XmlElement charSet = charElement.OwnerDoreplacedent.CreateElement("characterSet");
charSet.SetAttribute("set", set.ToString());
for (int i = 0; i < characterSets.GetLength(1); i++)
{
charSet.SetAttribute("f" + Convert.ToString(i + 1), characterSets[set, i].ToString());
}
charElement.AppendChild(charSet);
}
element.AppendChild(charElement);
}
See More Examples