short money = 0;
using (BinaryReader br = new BinaryReader(File.OpenRead("Player.chr")))
{
br.BaseStream.Position = 0x6F0; //если позиция не меняется, то очень легко
money = br.ReadInt16();
}
using (BinaryWriter bw = new BinaryWriter(File.OpenWrite("Player.chr")))
{
bw.Seek(0x6F0, SeekOrigin.Begin); //прыгаем в позицию денег
bw.Write(money + 150); //добавим 150 монет, например
}
public string Lg {get; set;}
Login login = new Login();
login.ShowDialog();
string log = login.Lg;
public class Section
{
public string type { get; set; }
public string group { get; set; }
public int count { get; set; }
public string name { get; set; }
public string displaytype { get; set; }
public List<object> data { get; set; }
}
public class RootObject
{
public string xmlns { get; set; }
public string status { get; set; }
public string version { get; set; }
public int webplayer { get; set; }
public string responsetype { get; set; }
public List<Section> sections { get; set; }
}
class Program
{
static void Main(string[] args)
{
string rawJson = File.ReadAllText("data.json"); // for example
OrderCollection orders = JsonConvert.DeserializeObject<OrderCollection>(rawJson);
foreach (var item in orders.Orders.GroupBy(x => x.Id))
{
Console.WriteLine($"Order id: {item.Key}, sum: {item.Sum(x => x.Sum)}");
}
}
}
class OrderCollection
{
public List<Order> Orders { get; set; }
}
class Order
{
public int Id { get; set; }
public string Sku { get; set; }
public int Sum { get; set; }
}
Console.WriteLine((100000000).ToString("N0")); // output: 100 000 000
Console.WriteLine(string.Format("{0:### ### ###}", 100000000)); // output: 100 000 000