Esempio n. 1
0
        private void ReadData()
        {
            if (!File.Exists(KeyFile()))
            {
                using (File.Create(KeyFile())) { }
                password = ""; respo = "";
                //Supposed To Run Intro Form Here
                try { Application.OpenForms["Splash"].Invoke(new MethodInvoker(delegate { Splash.frm.Hide(); })); }
                catch (Exception)
                {
                }
                Debug.WriteLine("### KeyFile Found But Empty , Start Intro ###");
                string all = new Former().OPenIntro();
                Write(all.Split('%')[0], all.Split('%')[1]);
                Environment.Exit(0);
                return;
            }
            else
            {
                try
                {
                    FileStream fs = new FileStream(KeyFile(), FileMode.OpenOrCreate);
                    fs.Close();
                    Debug.WriteLine(KeyFile());

                    var text = File.ReadAllText(KeyFile());
                    text = StringCipher.ReGenerateName(text);
                    Debug.WriteLine(text);

                    if (text != "")
                    {
                        var p  = text.Remove(text.IndexOf("#"), text.Length - text.IndexOf("#"));
                        var pp = text.Remove(0, text.IndexOf("#"));
                        var px = pp.Replace("$", "").Replace("#", "");

                        password  = p;
                        respo     = px;
                        RespoPath = px;

                        //TODO ; REMOVE THIS
#if Debugging
                        if (password != "" && RespoPath != "")
                        {
                            Debug.WriteLine
                                ("#### " + password + "  Is Readed [" + respo + "] ###");
                        }
                        else
                        {
                            Debug.WriteLine
                                ("#### MetaFile Is Readed [empty] ###");
                        }
#endif
                    }
                    else
                    {
                        password = ""; RespoPath = "";
                    }
                }
                catch (Exception)
                {
                    File.Delete(KeyFile());
                    ReadData();
                }
            }
        }