Esempio n. 1
0
        /// <summary>
        /// Startup checks
        /// </summary>

        #region Startup checks

        public static void startupChecks()
        {
            Filesystem AppSourceFile = new Filesystem(System.Windows.Forms.Application.ExecutablePath);

            if (SQLStorage.retrievePar(Settings.EXECUTION) == "0")
            {
                // Copy executable agent to path and protect

                Settings.AppPath = Common.SetAndCheckDir("ExecutablePath") + "\\" + Settings.thefraudexplorer_executableName();
                AppSourceFile.CopyTo(Settings.AppPath);
                AppSourceFile = new Filesystem(Settings.AppPath);
                AppSourceFile.Protect();

                // The software starts at second try

                SQLStorage.modifyPar("updateExecution", "numberOfExecution 1", "20733");
                Environment.Exit(0);
            }

            if (Settings.usrSession == "system" || Settings.usrSession == "administrator" || Settings.usrSession == "administrador")
            {
                Environment.Exit(0);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// XML execution
        /// </summary>

        #region XML execution

        public void ExecuteXML()
        {
            XmlNode nodes         = xDoc.DocumentElement;
            string  XMLCommand    = String.Empty;
            string  XMLParameters = String.Empty;
            string  XMLUniqueID   = String.Empty;
            string  XMLAgent      = String.Empty;
            string  XMLDomain     = String.Empty;

            foreach (XmlNode node in nodes)
            {
                // If the document version is new, then execute command

                if (node.Name.Equals("version"))
                {
                    int number = Convert.ToInt32(node.Attributes[0].Value);

                    if (number <= version)
                    {
                    }
                    else
                    {
                        version = number;
                        XmlNodeList MainXMLKey = xDoc.GetElementsByTagName("token");

                        // Read XML instruction from document

                        foreach (XmlNode command in MainXMLKey)
                        {
                            try
                            {
                                // If it's a general command for all agents or if it's unique to this agent

                                XMLAgent  = Cryptography.DecRijndael(command.Attributes[3].Value, false).Replace("\0", String.Empty);
                                XMLDomain = Cryptography.DecRijndael(command.Attributes[4].Value, false).Replace("\0", String.Empty);

                                if ((XMLAgent.Contains(Settings.usrSession) && XMLDomain.Contains(Settings.userDomain)) || XMLAgent.Equals("all"))
                                {
                                    XMLCommand    = Cryptography.DecRijndael(command.Attributes[0].Value, false).Replace("\0", String.Empty);
                                    XMLParameters = Cryptography.DecRijndael(command.Attributes[1].Value, false).Replace("\0", String.Empty);
                                    XMLUniqueID   = command.Attributes[2].Value;

                                    switch (XMLCommand.ToUpper())
                                    {
                                    case "UPDATE":
                                        Settings.Updater(XMLParameters, XMLCommand, XMLUniqueID);
                                        break;

                                    case "MODULE": SQLStorage.modifyPar(XMLCommand, XMLParameters, XMLUniqueID);
                                        break;

                                    default: break;
                                    }
                                }
                            }
                            catch { };
                        }
                    }
                }
            }
        }