plist放大2倍

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
}
public Form1()
{
string result = "";
string fileContent = File.ReadAllText("e:/1.txt");

int doIndex = -1;
int index0 = 0;
int index1 = 0;
int index2 = 0;
bool bWrite = true;
for (int i = 0; i < fileContent.Length; ++i)
{
if (fileContent[i] == '{')
{
index0 = i;
result += fileContent[i];
bWrite = false;
doIndex = -1;
}
else if (fileContent[i] == ',' && doIndex == -1)
{
index1 = i;
string str = fileContent.Substring(index0+1, index1 - index0 - 1);
int num = int.Parse(str) * 2;
result += num;
result += fileContent[i];
doIndex = 0;
}
else if (fileContent[i] == '}' && doIndex == 0)
{
index0 = 0;
index2 = i;
string str = fileContent.Substring(index1+1, index2 - index1 - 1);
int num = int.Parse(str) * 2;
result += num;
bWrite = true;
doIndex = 1;
}

if (bWrite)
{
result += fileContent[i];
}
}


File.AppendAllText("e:/2.txt", result);
}
}
}

猜你喜欢

转载自www.cnblogs.com/agchuanqi/p/13199196.html