private void LOAD_APPS_LIST()
        {
            try
            {
                Classes.MySQL A = new Classes.MySQL();
                A.stored_procedure("Get_AppNames");

                AppNames = new List <AppName>();
                while (A.rdr.Read())
                {
                    AppNames.Add(new AppName
                    {
                        _App                   = A.rdr.IsDBNull(0) ? "" : A.rdr.GetString("appname"),
                        _PathEXE               = A.rdr.IsDBNull(1) ? "" : A.rdr.GetString("path_executable"),
                        _LatestVersion         = A.rdr.IsDBNull(2) ? "" : A.rdr.GetString("latest_version"),
                        _Path_Latest_Installer = A.rdr.IsDBNull(3) ? "" : A.rdr.GetString("path_latest_installer"),
                        _MSI_Installer         = A.rdr.IsDBNull(4) ? "" : A.rdr.GetString("msi"),
                        _EXE_Installer         = A.rdr.IsDBNull(5) ? "" : A.rdr.GetString("exe"),
                        _PublishTo             = A.rdr.IsDBNull(6) ? "" : A.rdr.GetString("company")
                    });
                }
                A.conn.Close(); A.conn.Dispose();

                DGridAppNames.SelectionChanged -= DGridAppNames_SelectionChanged;
                DGridAppNames.ItemsSource       = null;
                DGridAppNames.ItemsSource       = AppNames;
                DGridAppNames.SelectionChanged += DGridAppNames_SelectionChanged;
            }
            catch (Exception)
            {
                throw;
            }
        }
 private void GET_NETWORK_RESOURCE_CREDS()
 {
     try
     {
         /// GET CREDENTIAL FOR SHARED FOLDER
         Classes.MySQL B = new Classes.MySQL();
         B.stored_procedure("Get_NetShared_Creds");
         if (B.rdr.Read())
         {
             NETWORK_RESOURCE_USER_LOGIN = Classes.Pub.Decrypt(B.rdr.GetString("Domain"), Classes.Pub.passphraselesky) + "\\" + Classes.Pub.Decrypt(B.rdr.GetString("UN"), Classes.Pub.passphraselesky);
             NETWORK_RESOURCE_USER_PASS  = Classes.Pub.Decrypt(B.rdr.GetString("PW"), Classes.Pub.passphraselesky);
         }
         B.conn.Close(); B.conn.Dispose();
     }
     catch (Exception)
     {
         throw;
     }
 }
        private bool CHECK_CREATE_DESTINATION_DIRECTORY()
        {
            try
            {
                Classes.MySQL A = new Classes.MySQL();
                A.stored_procedure("GetTempPath");
                if (A.rdr.Read())
                {
                    DESTINATION_FOLDER = System.IO.Path.Combine(A.rdr.GetString("my_local_path"), APP_NAME.ToUpper().Replace("*", ""));
                }
                A.conn.Close(); A.conn.Dispose();

                System.IO.Directory.CreateDirectory(DESTINATION_FOLDER);

                return(System.IO.Directory.Exists(DESTINATION_FOLDER));
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #4
0
        private void LoadApps()
        {
            try
            {
                //// LOAD APP NAMES TO COMBOBOX
                Apps = new List <App>();
                CboApps.Items.Clear();

                Classes.MySQL A = new Classes.MySQL();
                A.stored_procedure("Get_AppNames");
                while (A.rdr.Read())
                {
                    Apps.Add(new App
                    {
                        _AppName              = A.rdr.GetString("appname"),
                        _PathExe              = A.rdr.GetString("path_executable"),
                        _PathInstaller_EXE    = !A.rdr.IsDBNull(5) ? A.rdr.GetString("exe") : null,
                        _PathInstaller_MSI    = !A.rdr.IsDBNull(4) ? A.rdr.GetString("MSI") : null,
                        _PathInstaller_Folder = A.rdr.GetString("path_latest_installer"),
                        _LatestVersion        = A.rdr.GetString("latest_version"),
                        _Company              = A.rdr.GetString("company")
                    });
                }
                A.conn.Close(); A.conn.Dispose();

                foreach (App X in Apps.Where(a => a._Company.Equals(_CompanyName, StringComparison.OrdinalIgnoreCase) || a._Company.Equals("", StringComparison.OrdinalIgnoreCase)).ToList())
                {
                    CboApps.Items.Add(new ComboBoxItem()
                    {
                        Content = X._AppName.ToUpper()
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, "CSF APP CENTER", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
        }
Beispiel #5
0
        private bool CopyInstaller_ToTEMPFolder()
        {
            try
            {
                Classes.MySQL A = new Classes.MySQL();
                A.stored_procedure("GetTempPath");
                if (A.rdr.Read())
                {
                    rcp_dest_folder = System.IO.Path.Combine(A.rdr.GetString("my_local_path"), CboApps.Text.Replace("*", ""));
                }
                A.conn.Close(); A.conn.Dispose();

                System.IO.Directory.CreateDirectory(rcp_dest_folder);

                A = new Classes.MySQL();
                A.stored_procedure("GetTempPath");

                if (A.rdr.Read())
                {
                    if (temp.Count == 1)
                    {
                        /// CHECK IF LATEST INSTALLER IS A FILE OR FOLDER
                        /// IF IT IS A FILE, THEN COPY ITS PARENT FOLDER
                        /// IF IT IS A FOLDER, THEN COPY IT TO LOCAL PATH

                        /// GET CREDENTIAL FOR SHARED FOLDER
                        Classes.MySQL B = new Classes.MySQL();
                        B.stored_procedure("Get_NetShared_Creds");
                        if (B.rdr.Read())
                        {
                            /// ACCESS SHARED FOLDER OF INSTALLER USING A DIFF CREDENTIAL
                            using (System.Diagnostics.Process Proc = new System.Diagnostics.Process())
                            {
                                string _SharedFolder = System.IO.Path.GetDirectoryName(_Application_LatestInstaller);
                                Proc.StartInfo.FileName  = @"C:\windows\system32\net.exe";
                                Proc.StartInfo.Arguments = "use \"" + _SharedFolder + "\" /user:"******"\"" +
                                                           Classes.Pub.Decrypt(B.rdr.GetString("Domain"), Classes.Pub.passphraselesky) + "\\" +
                                                           Classes.Pub.Decrypt(B.rdr.GetString("UN"), Classes.Pub.passphraselesky) + "\"" + " \"" +
                                                           Classes.Pub.Decrypt(B.rdr.GetString("PW"), Classes.Pub.passphraselesky) + "\"";
                                Proc.StartInfo.UseShellExecute       = false;
                                Proc.StartInfo.RedirectStandardError = true;

                                Proc.Start();
                                Proc.WaitForExit();
                            }
                        }
                        B.conn.Close(); B.conn.Dispose();

                        if (!string.IsNullOrEmpty(rcp_source_folder) && !string.IsNullOrEmpty(rcp_dest_folder))
                        {
                            /// robocopy installer
                            using (System.Diagnostics.Process P = new System.Diagnostics.Process())
                            {
                                /// robocopy source dest /mir
                                P.StartInfo.FileName       = @"C:\windows\system32\robocopy.exe";
                                P.StartInfo.Arguments      = "\"" + rcp_source_folder + "\" " + "\"" + rcp_dest_folder + "\" /mir";
                                P.StartInfo.CreateNoWindow = true;
                                P.Start();
                                P.WaitForExit();
                            }

                            using (System.Diagnostics.Process P = new System.Diagnostics.Process())
                            {
                                /// robocopy source dest /mir
                                P.StartInfo.FileName       = @"C:\windows\system32\net.exe";
                                P.StartInfo.Arguments      = "use \"" + rcp_source_folder + "\" /d";
                                P.StartInfo.CreateNoWindow = true;
                                P.Start();
                                P.WaitForExit();
                            }
                        }
                    }
                }
                A.conn.Close(); A.conn.Dispose();


                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR : " + ex.Message, "CSFP Apps Center", MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }
        }