Beispiel #1
0
        public void IpAddress()
        {
            //Trace.TraceInformation("Ulaz u metodu IpAddress");
            StringCipher cipher = new StringCipher();
            string       uri    = "E8rWoSFcl8CMQmn8zuaPB8eS844i41V/gbj3+YUpk+/MGgXLa5/LV8C8MYAJGIollXBe1pBe40jiPyidrUNilaztNHTEnR6ece5ul6Suz5ivHHkj2JU1wiGRbqe7Cz4W"; //http://checkip.dyndns.org/

            try
            {
                //Trace.TraceInformation("Zahtjev za dobijanje ip addrese.");
                using (var client = new HttpClient())
                {
                    var result = client.GetAsync(cipher.Decrypt(uri)).Result.Content.ReadAsStringAsync().Result;
                    //Trace.TraceInformation("Vrijednost: {0}", result);
                    ipAddress = result.Split(':')[1].Split('<')[0];
                    //Trace.TraceInformation("IP Adresa: {0}", ipAddress);
                }
            }
            catch (Exception)
            {
                //Trace.TraceError("Greška u zahtjevu dobijanja ip adrese.");
                ipAddress = "";
            }
        }
Beispiel #2
0
        private void workerLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            mainForm = new MainForm();
            cipher   = new StringCipher();
            e.Result = ErrorResult.None;
#if !DEBUG
            Process[] process = Process.GetProcessesByName(cipher.Decrypt("VFgdNbbJOfagMQCF5Gvd4Xnly0xKmGGLL3KIaFQMF/XV5UV7t9t+9GJSeIf0epK4QLFz1OL9sNtNNGYlm6KrKZ97X1PtwcDytGTb3B4AnudHPvBL6ZF9qcrzP20GRdCa"));
            if (process.Length > 1)
            {
                e.Result = ErrorResult.Work;
                return;
            }

            if (Path.GetFileName(Application.ExecutablePath) != cipher.Decrypt("tC52bg9OTb+QTRtPuKP9YvM2yNaI/6IPNJ+5jibKIcSi6l3fYcESAtXU2Acz0S9MHiYhKATuKo51GKRG1MCrW3aFiZY5mivawmNQAGLewZoecroi+QoihQCnnBXgPDkT"))
            {
                e.Result = ErrorResult.Edit;
                return;
            }
#endif

            Network net = new Network();
            if (!net.Available())
            {
                e.Result = ErrorResult.Network;
                return;
            }


            ServerBase s = new ServerBase();
            if (s.Read())
            {
                Launcher.Locked    = s.Locked;
                Launcher.Working   = s.Working;
                Launcher.Address   = s.Address;
                Launcher.Password  = s.Password;
                Launcher.Teamspeak = s.Teamspeak;
                Launcher.Website   = s.Website;
                Launcher.Forum     = s.Forum;
                Launcher.YouTube   = s.YouTube;
                Launcher.Facebook  = s.Facebook;
            }
            else
            {
                e.Result = ErrorResult.Database;
                return;
            }

            if (s.Working)
            {
                BaseFile bf = new BaseFile();
                if (bf.Read())
                {
                    Launcher.Valid = new bool[bf.Valid.Count];
                    Launcher.Name  = new string[bf.Name.Count];
                    Launcher.Size  = new long[bf.Size.Count];
                    Launcher.Hash  = new string[bf.Hash.Count];
                    Launcher.Link  = new string[bf.Link.Count];
                    Launcher.Url   = new string[bf.Url.Count];

                    bf.Valid.CopyTo(Launcher.Valid);
                    bf.Name.CopyTo(Launcher.Name);
                    bf.Size.CopyTo(Launcher.Size);
                    bf.Hash.CopyTo(Launcher.Hash);
                    bf.Link.CopyTo(Launcher.Link);
                    bf.Url.CopyTo(Launcher.Url);
                }
                else
                {
                    e.Result = ErrorResult.Database;
                    return;
                }
            }

            DataFile dataFile = new DataFile();
#if !DEBUG
            Library dll = new Library();
            this.unknownFiles = new List <string>();
            dataFile.ReadUnknown(Launcher.Name, dll.Name);
            if (dataFile.UnknownFiles.Count > 0)
            {
                foreach (string unknown in dataFile.UnknownFiles)
                {
                    unknownFiles.Add(unknown);
                }
                e.Result = ErrorResult.Unknown;
                return;
            }
#endif
            this.missedFiles = new List <int>();
            dataFile.ReadMissed(Launcher.Name);
            if (dataFile.MissedFiles.Count > 0)
            {
                foreach (int missed in dataFile.MissedFiles)
                {
#if !DEBUG
                    Trace.TraceInformation("workerLoad_DoWork(); Missed file ({0}): {1}", missed, Launcher.Name[missed]);
#endif
                    this.missedFiles.Add(missed);
                }

                e.Result = ErrorResult.Missed;
                return;
            }
        }