Exemplo n.º 1
0
        public static void LeerDatoServidoryPath()
        {
            string DATO;
            string pathprograma = Application.StartupPath;
            string sNombreEquipo;

            //if (ConectaA == null)
            //{
            //string archivo = Application.StartupPath + @"\datoserv.txt";
            string archivo = pathprograma + @"\datoserv.txt";

            System.IO.StreamReader file =
                new System.IO.StreamReader(archivo);
            if ((DATO = file.ReadLine()) != " ")
            {
                sNombreEquipo = @"\\" + DATO.Trim() + @"\";
                DATO          = file.ReadLine();
                if (DATO != " ")
                {
                    //gsServidor = "";
                    if (!string.IsNullOrWhiteSpace(DATO))
                    {
                        GsPathData = sNombreEquipo + DATO.Trim() + @"\";
                    }
                }
                DATO = file.ReadLine();
                if (DATO != " ")
                {
                    //gsServidor = "";
                    if (!string.IsNullOrWhiteSpace(DATO))
                    {
                        gsServidor = DATO.Trim();
                    }
                }
            }
            else
            {
                if (DATO == " ")
                {
                    //MessageBox.Show( Application.CommonAppDataPath);
                    sNombreEquipo = pathprograma.Substring(0, 3);
                    GsPath        = sNombreEquipo + pathprograma.Substring(3, pathprograma.Length - 3) + @"\";
                    gsServidor    = "localhost";
                }
            }
            file.Close();
            //}
        }
Exemplo n.º 2
0
        public void DatosServidoryPath(string pathprograma)
        {
            string DATO;

            if (ConectaA == null)
            {
                //string archivo = Application.StartupPath + @"\datoserv.txt";
                string archivo = pathprograma + @"\datoserv.txt";

                System.IO.StreamReader file =
                    new System.IO.StreamReader(archivo);
                if ((DATO = file.ReadLine()) != " ")
                {
                    gsServidor = @"\\" + DATO.Trim() + @"\";
                    DATO       = file.ReadLine();
                    if (DATO != " ")
                    {
                        //gsServidor = "";
                        if (!string.IsNullOrWhiteSpace(DATO))
                        {
                            GsPath = gsServidor + DATO.Trim() + @"\";
                        }
                    }
                }
                else
                {
                    if (DATO == " ")
                    {
                        //MessageBox.Show( Application.CommonAppDataPath);
                        gsServidor = pathprograma.Substring(0, 3);
                        GsPath     = gsServidor + pathprograma.Substring(3, pathprograma.Length - 3) + @"\";
                    }
                }
                file.Close();
            }
        }