Example #1
0
        public void ScriviMicroProgramma(string nome, int id, string[] data)
        {
            var toCompress = string.Join("\n", data);
            var toWrite    = new List <string>
            {
                "----",
                "####",
                "Nome MicroProgramma: " + nome,
                "####",
                "ID MicroProgramma: " + id,
                "####",
                "Codice MicroProgramma:",
                CompressioneDati.CompressString(toCompress),
                "----"
            };


            //data = ToCompress.Split('\n');
            //ToWrite.AddRange(data);


            TextWriter tw = new StreamWriter(Directory.GetCurrentDirectory() + @"\microprograms.programlist", true);

            foreach (var s in toWrite)
            {
                tw.WriteLine(s);
            }
            tw.Close();

            //Debug.WriteLine(DecompressString("rAAAAB+LCAAAAAAABABzMDSy4DIgAPAqMAQCLgecagyRDTHEJgFjYppgaAiSM4QoMTQAAO3JcjCsAAAA"));
        }
Example #2
0
        public void RiscriviMicroProgramma(int vecchioId, int nuovoId, string nuovoNome, string[] data)
        {
            var    readData = File.ReadAllLines(Directory.GetCurrentDirectory() + @"\microprograms.programlist");
            var    lineId   = 0;
            string line;
            var    found = false;
            var    file  = new StreamReader(Directory.GetCurrentDirectory() + @"\microprograms.programlist");

            while ((line = file.ReadLine()) != null)
            {
                if (line.Contains("ID MicroProgramma: " + vecchioId))
                {
                    found = true;
                    break;
                }

                lineId++;
            }

            file.Close();

            if (!found)
            {
                return;
            }
            readData[lineId - 2] = "Nome MicroProgramma: " + nuovoNome;
            readData[lineId]     = "ID MicroProgramma: " + nuovoId;

            var toCompress = string.Join("\n", data);

            readData[lineId + 3] = CompressioneDati.CompressString(toCompress);
            // Debug.WriteLine(DecompressString("/0kAAB+LCAAAAAAABADtyjERADAIALG9aqh/c3AIAATk78dEzP36LaaDIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCIAiCLigBLHYK4f9JAAA="));

            File.WriteAllLines(Directory.GetCurrentDirectory() + @"\microprograms.programlist", readData);
        }
Example #3
0
        public void ScriviProgramma(string nome, int id, string[] data)
        {
            var toCompress = string.Join("\n", data);
            var toWrite    = new List <string>
            {
                "----",
                "####",
                "Nome Programma: " + nome,
                "####",
                "ID Programma: " + id,
                "####",
                "Codice Programma:",
                CompressioneDati.CompressString(toCompress),
                "----"
            };

            //ToWrite.AddRange(data);


            TextWriter tw = new StreamWriter(Directory.GetCurrentDirectory() + @"\programs.programlist", true);

            foreach (var s in toWrite)
            {
                tw.WriteLine(s);
            }
            tw.Close();
        }
Example #4
0
        public void RiscriviProgramma(int vecchioId, int nuovoId, string nuovoNome, string[] data)
        {
            var    readData = File.ReadAllLines(Directory.GetCurrentDirectory() + @"\programs.programlist");
            var    lineId   = 0;
            string line;
            var    found = false;
            var    file  = new StreamReader(Directory.GetCurrentDirectory() + @"\programs.programlist");

            while ((line = file.ReadLine()) != null)
            {
                if (line.Contains("ID Programma: " + vecchioId))
                {
                    found = true;
                    break;
                }

                lineId++;
            }

            file.Close();

            if (!found)
            {
                return;
            }
            readData[lineId - 2] = "Nome Programma: " + nuovoNome;
            readData[lineId]     = "ID Programma: " + nuovoId;

            var toCompress = string.Join("\n", data);

            readData[lineId + 3] = CompressioneDati.CompressString(toCompress);

            File.WriteAllLines(Directory.GetCurrentDirectory() + @"\programs.programlist", readData);
        }