Initial commit

This commit is contained in:
2018-06-07 19:19:01 +02:00
commit 9be5e9a301
7 changed files with 493 additions and 0 deletions

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<ApplicationIcon />
<OutputTypeEx>exe</OutputTypeEx>
<StartupObject />
</PropertyGroup>
</Project>

62
ConsoleApp1/Program.cs Normal file
View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
namespace ConsoleApp1 {
class Program {
static List<int> list1 = new List<int>();
static List<int> listTemp = new List<int>();
static List<int> list2 = new List<int>();
static int num = 1;
static String folder = @"C:\tmp\";
static void Main(string[] args) {
list2.Add(1);
System.IO.File.WriteAllText(folder + num + ".txt", 1 + "");
Console.Write("Working...");
run();
}
/*
* Cut list1 into multiple parts(each 10 elemnts)
*/
static void run() {
int b = 0; //nombre précédent
int r = 1; //nombre de répétition
foreach(char n in System.IO.File.ReadAllText(folder + num++ + ".txt").ToCharArray()) {
int t = int.Parse(n.ToString());
if(b == t) r++;
else {
if(b != 0) add(b, r);
b = t;
r = 1;
}
}
/*while(list1.Count > 0) {
int n = list1[0];
if(b == n) r++;
else {
if(b != 0) add(b, r);
b = n;
r = 1;
}
list1.Remove(n);
}*/
add(b, r);
Console.WriteLine("Numbers : " + num);
//System.IO.File.WriteAllText(@"F:\tmp\" + num + ".txt", string.Join("", list2.ToArray()));
run();
}
static void add(int b, int r) {
if(r != 0) System.IO.File.AppendAllText(folder + num + ".txt", r+""); //list2.Add(r);
System.IO.File.AppendAllText(folder + num + ".txt", r+""); //list2.Add(b);
}
}
}