public static DadosGlobais GetConfs()
        {
            string CAMINHO = System.Reflection.Assembly.GetExecutingAssembly().Location;
            var path = Path.Combine(Path.GetDirectoryName(CAMINHO), "CONFIGURACOES.txt");

            if (confs == null)
            {
                confs = new DadosGlobais();
                if (!File.Exists(path))
                {
                    var json = new JavaScriptSerializer().Serialize(confs);
                    File.WriteAllText(path, json);
                }
                else
                {
                    var json = File.ReadAllText(path);
                    confs = new JavaScriptSerializer().Deserialize<DadosGlobais>(json);
                }
            }

            return confs;
        }
Exemple #2
0
        public static DadosGlobais GetConfs()
        {
            string CAMINHO = System.Reflection.Assembly.GetExecutingAssembly().Location;
            var    path    = Path.Combine(Path.GetDirectoryName(CAMINHO), "CONFIGURACOES.txt");

            if (confs == null)
            {
                confs = new DadosGlobais();
                if (!File.Exists(path))
                {
                    var json = new JavaScriptSerializer().Serialize(confs);
                    File.WriteAllText(path, json);
                }
                else
                {
                    var json = File.ReadAllText(path);
                    confs = new JavaScriptSerializer().Deserialize <DadosGlobais>(json);
                }
            }

            return(confs);
        }