示例#1
0
        private void FileProcess_Click(object sender, EventArgs e)
        {
            string path = @"" + FilePath.Text;
            //Instances of lines of the file, and the class that will get the data

            ProcessFile   processFile;
            FileRW        lines = new FileRW();
            StringBuilder sb    = new StringBuilder();
            string        targetPath;

            try
            {
                //Read
                processFile = new ProcessFile(lines.ReadFile(path));
                sb.AppendLine("Arquivo Lido com suscesso!");
                TextLog.AppendText(sb.ToString());
                //Process
                processFile.CreateConciliation(processFile.Spf);
                sb.AppendLine("Arquivo processado com sucesso!");
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
                //Write
                targetPath = lines.WriteFile(path, processFile.Conciliations);
                sb.AppendLine("Arquivo gravado com sucesso!");
                sb.AppendLine("Processo Finalizado!");
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
                //OpenFolder
                Process prc = new Process();
                prc.StartInfo.FileName = targetPath;
                prc.Start();
                path = Path.GetDirectoryName(targetPath);
                prc.StartInfo.WorkingDirectory = path;
                prc.StartInfo.FileName         = path;
                prc.Start();
            }
            catch (IOException ex)
            {
                sb.AppendLine("An error occurred!!");
                sb.AppendLine(ex.Message);
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
            }
        }
示例#2
0
 public void Init()
 {
     DontDestroyOnLoad(gameObject);
     clients        = new List <ServerClient>();
     disconnectList = new List <ServerClient>();
     accounts       = new List <Account>();
     string[] accountData = FileRW.ReadFile("Assets/Resources/AccountData.txt", '\n');
     string[] nextAccount = new string[0];
     for (int i = 0; i < accountData.Length; i++)
     {
         nextAccount = accountData[i].Split(' ');
         accounts.Add(new Account(nextAccount[0], nextAccount[1], nextAccount[2]));
     }
     try {
         server = new TcpListener(IPAddress.Any, port);
         server.Start();
         StartListening();
         serverStarted = true;
     } catch (Exception e) {
         Debug.Log("Socket error: " + e.Message);
     }
 }
示例#3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Este sistema irá converter o extrato agrupado em parcelas!");
            Console.WriteLine("=============================================");
            Console.WriteLine("Por favor informe o caminho do arquivo abaixo");
            Console.WriteLine("Caminho e o arquivo não podem conter espaços ");
            Console.WriteLine("ou caracteres especiais recomendamos que seja");
            Console.WriteLine(@"colocado na pasta c:\temp\extrato.csv!");
            Console.WriteLine("=============================================");
            Console.Write("Caminho: ");
            string path = @"" + Console.ReadLine();

            //Instances of lines of the file, and the class that will get the data

            ProcessFile processFile;
            FileRW      lines = new FileRW();

            try
            {
                //Read
                processFile = new ProcessFile(lines.ReadFile(path));
                Console.WriteLine("Arquivo Lido com suscesso!");
                Console.WriteLine();
                //Process
                processFile.CreateConciliation(processFile.Spf);
                Console.WriteLine("Arquivo processado com sucesso!");
                Console.WriteLine();
                //Write
                lines.WriteFile(path, processFile.Conciliations);
                Console.WriteLine("Arquivo convertido com sucesso!");
            }
            catch (IOException e)
            {
                Console.WriteLine("An error occurred");
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
        }