Exemple #1
0
        private bool InstallDotNetPackage()
        {
            bool ok = true;

            string processFilePath = System.IO.Path.Combine(AppHomeFolder.Trim(), "DOTNET", "dotNetFx40_Full_setup.exe");

            if (File.Exists(processFilePath.Trim()))
            {
                try
                {
                    // Use ProcessStartInfo class
                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                    startInfo.CreateNoWindow  = false;
                    startInfo.UseShellExecute = false;
                    startInfo.FileName        = processFilePath;
                    startInfo.WindowStyle     = System.Diagnostics.ProcessWindowStyle.Hidden;
                    //startInfo.Arguments = "-f j -o \"" + ex1 + "\" -z 1.0 -s y " + ex2;
                    //using (System.Diagnostics.Process exeProcess = System.Diagnostics.Process.Start(startInfo))
                    using (System.Diagnostics.Process exeProcess = System.Diagnostics.Process.Start(processFilePath))
                    {
                        exeProcess.WaitForExit();
                    }
                }
                catch (Exception ex)
                {
                    ok = false;
                }
            }

            return(ok);
        }
Exemple #2
0
        private bool CopyPTSInstallationFiles()
        {
            bool ok = true;

            string sourceFolder      = AppHomeFolder.Trim();
            string destinationFolder = System.IO.Path.Combine(WindowsHomeFolder, "Rigaku", "PTS");

            if (Directory.Exists(destinationFolder))
            {
                // PTS files
                string[] filePaths = Directory.GetFiles(System.IO.Path.Combine(sourceFolder, "PTS"));
                foreach (string file in filePaths)
                {
                    FileInfo info = new FileInfo(file);
                    if (File.Exists(info.FullName))
                    {
                        string fileName = Path.GetFileName(info.FullName);
                        if (!string.IsNullOrEmpty(fileName))
                        {
                            try
                            {
                                File.Copy(info.FullName, System.IO.Path.Combine(destinationFolder, fileName), true);
                            }
                            catch (Exception ex)
                            {
                                string strMsg = string.Format("{0}", ex.Message.ToString());
                                MessageBox.Show(strMsg, "Important Message");
                                return(false);
                            }
                        }
                    }
                }

                // copy DLL
                filePaths = Directory.GetFiles(System.IO.Path.Combine(sourceFolder, "DLL"));
                foreach (string file in filePaths)
                {
                    FileInfo info = new FileInfo(file);
                    if (File.Exists(info.FullName))
                    {
                        string fileName = Path.GetFileName(info.FullName);
                        if (!string.IsNullOrEmpty(fileName))
                        {
                            try
                            {
                                File.Copy(info.FullName, System.IO.Path.Combine(destinationFolder, fileName), true);
                            }
                            catch (Exception ex)
                            {
                                string strMsg = string.Format("{0}", ex.Message.ToString());
                                MessageBox.Show(strMsg, "Important Message");
                                return(false);
                            }
                        }
                    }
                }

                // copy ICON
                filePaths = Directory.GetFiles(System.IO.Path.Combine(sourceFolder, "ICON"));
                foreach (string file in filePaths)
                {
                    FileInfo info = new FileInfo(file);
                    if (File.Exists(info.FullName))
                    {
                        string fileName = Path.GetFileName(info.FullName);
                        if (!string.IsNullOrEmpty(fileName))
                        {
                            try
                            {
                                File.Copy(info.FullName, System.IO.Path.Combine(destinationFolder, fileName), true);
                            }
                            catch (Exception ex)
                            {
                                string strMsg = string.Format("{0}", ex.Message.ToString());
                                MessageBox.Show(strMsg, "Important Message");
                                return(false);
                            }
                        }
                    }
                }

                // copy IMAGE
                filePaths = Directory.GetFiles(System.IO.Path.Combine(sourceFolder, "IMAGE"));
                foreach (string file in filePaths)
                {
                    FileInfo info = new FileInfo(file);
                    if (File.Exists(info.FullName))
                    {
                        string fileName = Path.GetFileName(info.FullName);
                        if (!string.IsNullOrEmpty(fileName))
                        {
                            try
                            {
                                File.Copy(info.FullName, System.IO.Path.Combine(destinationFolder, fileName), true);
                            }
                            catch (Exception ex)
                            {
                                string strMsg = string.Format("{0}", ex.Message.ToString());
                                MessageBox.Show(strMsg, "Important Message");
                                return(false);
                            }
                        }
                    }
                }


                // copy RUN trigger files
                filePaths = Directory.GetFiles(System.IO.Path.Combine(sourceFolder, "RUN", "shm", "comm"));
                string CopyToFolder = System.IO.Path.Combine(destinationFolder, "run", "shm", "comm");
                foreach (string file in filePaths)
                {
                    FileInfo info = new FileInfo(file);
                    if (File.Exists(info.FullName))
                    {
                        string fileName = Path.GetFileName(info.FullName);
                        if (!string.IsNullOrEmpty(fileName))
                        {
                            try
                            {
                                File.Copy(info.FullName, System.IO.Path.Combine(CopyToFolder, fileName), true);
                            }
                            catch (Exception ex)
                            {
                                string strMsg = string.Format("{0}", ex.Message.ToString());
                                MessageBox.Show(strMsg, "Important Message");
                                return(false);
                            }
                        }
                    }
                }

                // copy RUN trigger files
                filePaths    = Directory.GetFiles(System.IO.Path.Combine(sourceFolder, "RUN", "shm", "comm_archives"));
                CopyToFolder = System.IO.Path.Combine(destinationFolder, "run", "shm", "comm_archives");
                foreach (string file in filePaths)
                {
                    FileInfo info = new FileInfo(file);
                    if (File.Exists(info.FullName))
                    {
                        string fileName = Path.GetFileName(info.FullName);
                        if (!string.IsNullOrEmpty(fileName))
                        {
                            try
                            {
                                File.Copy(info.FullName, System.IO.Path.Combine(CopyToFolder, fileName), true);
                            }
                            catch (Exception ex)
                            {
                                string strMsg = string.Format("{0}", ex.Message.ToString());
                                MessageBox.Show(strMsg, "Important Message");
                                return(false);
                            }
                        }
                    }
                }

                // create PTS desktop shurtcut
                appShortcutToDesktop("PTS");
            }

            return(ok);
        }