예제 #1
0
파일: Form1.cs 프로젝트: LyonSnt/APPCOHISA2
        private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter = "[LFP]|*.txt";
            string texto = "";
            string fila  = "";

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                string       ruta1        = openFile.FileName;
                StreamReader streamReader = new StreamReader(ruta1, System.Text.Encoding.UTF8);
                string       nombreC      = Path.GetFileNameWithoutExtension(openFile.FileName);
                while ((fila = streamReader.ReadLine()) != null)
                {
                    texto += fila + System.Environment.NewLine;
                }
                richTextBox1.Text = texto;
                streamReader.Close();
                //MessageBox.Show(nombreC, "nombreC");
                //MessageBox.Show(ruta1, "ruta1");

                rutas.Clear();
                Rutas path = new Rutas(ruta1, nombreC);
                rutas.Add(path);

                //MessageBox.Show(rutas.Count.ToString() , "rutas.Count");
                Path_actual  = ruta1;
                nombre_acual = nombreC;
                this.Text    = nombre_acual;
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: LyonSnt/APPCOHISA2
        private void guardarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Boolean existe = false;
            string  path   = "";

            for (int i = 0; i < rutas.Count; i++)
            {
                Rutas ru = rutas.ElementAt(i);
                if (Path_actual == ru.getPath())
                {
                    path   = Path_actual;
                    existe = true;
                }
            }
            if (existe == false)
            {
                guardarComo();
            }
            else
            {
                guardar(path);
            }
        }
예제 #3
0
        public void CargarMovimiento()
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter = "[UTN]|*.utn";
            string texto = "";
            string fila  = "";

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                string       ruta1        = openFile.FileName;
                StreamReader streamReader = new StreamReader(ruta1, System.Text.Encoding.UTF8);
                string       nombreC      = Path.GetFileNameWithoutExtension(openFile.FileName);
                while ((fila = streamReader.ReadLine()) != null)
                {
                    texto += fila + System.Environment.NewLine;
                }

                //  Frm_Movimientos mo = new Frm_Movimientos();
                movimiento.richTextBox1.Text = texto;


                streamReader.Close();
                //MessageBox.Show(nombreC, "nombreC");
                //MessageBox.Show(ruta1, "ruta1");

                rutas.Clear();
                Rutas path = new Rutas(ruta1, nombreC);
                rutas.Add(path);

                //MessageBox.Show(rutas.Count.ToString() , "rutas.Count");
                Path_actual  = ruta1;
                nombre_acual = nombreC;
                this.Text    = nombre_acual;
            }
        }
예제 #4
0
파일: Form1.cs 프로젝트: LyonSnt/APPCOHISA2
        private void guardarComo()
        {
            SaveFileDialog saveFile = new SaveFileDialog();

            saveFile.Filter = "[LFP]|*.txt";
            saveFile.Title  = "Guardar archivo";

            if (saveFile.ShowDialog() == DialogResult.OK)
            {
                FileStream fs = (FileStream)saveFile.OpenFile();
                fs.Close();
                string path = saveFile.FileName;
                guardar(path);
                string nombre = Path.GetFileNameWithoutExtension(path);
                Rutas  path_r = new Rutas(path, nombre);
                rutas.Add(path_r);

                //MessageBox.Show(path, "path");
                //MessageBox.Show(rutas.Count.ToString(), "rutas.Count");
                Path_actual  = path;
                nombre_acual = nombre;
                this.Text    = nombre_acual;
            }
        }