Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                /* Create a new instance of SEInstallData object. */
                SEInstallDataLib.SEInstallData installData = new SEInstallDataLib.SEInstallData();

                /* Beware: installData.GetVersion() appends 'x64' to end of string if x64 installation! */
                /* This comes from HKEY_LOCAL_MACHINE\SOFTWARE\Unigraphics Solutions\Solid Edge\Version XXX\CurrentVersion\Build */

                /* Solid Edge version */
                Version version = new Version(
                    installData.GetMajorVersion(),
                    installData.GetMinorVersion(),
                    installData.GetServicePackVersion(),
                    installData.GetBuildNumber());

                /* Parasolid version */
                Version parasolidVersion = new Version(
                    installData.GetParasolidMajorVersion(),
                    installData.GetParasolidMinorVersion());

                /* Solid Edge language.  i.e. 'English', 'German', etc. */
                CultureInfo cultureInfo = new CultureInfo(installData.GetLanguageID());

                /* Get path to Solid Edge program directory.  Typically, 'C:\Program Files\Solid Edge XXX\Program'. */
                DirectoryInfo programDirectory = new DirectoryInfo(installData.GetInstalledPath());

                /* Get path to Solid Edge installation directory.  Typically, 'C:\Program Files\Solid Edge XXX'. */
                DirectoryInfo installationDirectory = programDirectory.Parent;

                /* Get path to Solid Edge template directory.  Typically, 'C:\Program Files\Solid Edge XXX\Template'. */
                DirectoryInfo templateDirectory = new DirectoryInfo(Path.Combine(programDirectory.Parent.FullName, "Template"));

                /* Get path to Solid Edge training directory.  Typically, 'C:\Program Files\Solid Edge XXX\Training'. */
                DirectoryInfo trainingDirectory = new DirectoryInfo(Path.Combine(programDirectory.Parent.FullName, "Training"));

                // Output info to screen.
                Console.WriteLine("Language: '{0}'", cultureInfo);
                Console.WriteLine("Version: '{0}'", version);
                Console.WriteLine("VersionString: '{0}'", installData.GetVersion());
                Console.WriteLine("ParasolidVersion: '{0}'", parasolidVersion);
                Console.WriteLine("InstallFolderPath: '{0}'", installationDirectory.FullName);
                Console.WriteLine("ProgramFolderPath: '{0}'", programDirectory.FullName);
                Console.WriteLine("TemplateFolderPath: '{0}'", templateDirectory.FullName);
                Console.WriteLine("TrainingFolderPath: '{0}'", trainingDirectory.FullName);
            }
            catch (System.Exception ex)
            {
#if DEBUG
                System.Diagnostics.Debugger.Break();
#endif
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            try
            {
                /* Create a new instance of SEInstallData object. */
                SEInstallDataLib.SEInstallData installData = new SEInstallDataLib.SEInstallData();

                /* Beware: installData.GetVersion() appends 'x64' to end of string if x64 installation! */
                /* This comes from HKEY_LOCAL_MACHINE\SOFTWARE\Unigraphics Solutions\Solid Edge\Version XXX\CurrentVersion\Build */

                /* Solid Edge version */
                Version version = new Version(
                    installData.GetMajorVersion(),
                    installData.GetMinorVersion(),
                    installData.GetServicePackVersion(),
                    installData.GetBuildNumber());

                /* Parasolid version */
                Version parasolidVersion = new Version(
                    installData.GetParasolidMajorVersion(),
                    installData.GetParasolidMinorVersion());

                /* Solid Edge language.  i.e. 'English', 'German', etc. */
                var cultureInfo = new CultureInfo(installData.GetLanguageID());

                /* Get path to Solid Edge program directory.  Typically, 'C:\Program Files\Solid Edge XXX\Program'. */
                var programDirectory = new DirectoryInfo(installData.GetInstalledPath());

                /* Get path to Solid Edge installation directory.  Typically, 'C:\Program Files\Solid Edge XXX'. */
                var installationDirectory = programDirectory.Parent;

                /* Get path to Solid Edge template directory.  Typically, 'C:\Program Files\Solid Edge XXX\Template'. */
                var templateDirectory = new DirectoryInfo(Path.Combine(programDirectory.Parent.FullName, "Template"));

                /* Get path to Solid Edge training directory.  Typically, 'C:\Program Files\Solid Edge XXX\Training'. */
                var trainingDirectory = new DirectoryInfo(Path.Combine(programDirectory.Parent.FullName, "Training"));

                // Output info to screen.
                Console.WriteLine("Language: '{0}'", cultureInfo);
                Console.WriteLine("Version: '{0}'", version);
                Console.WriteLine("VersionString: '{0}'", installData.GetVersion());
                Console.WriteLine("ParasolidVersion: '{0}'", parasolidVersion);
                Console.WriteLine("InstallFolderPath: '{0}'", installationDirectory.FullName);
                Console.WriteLine("ProgramFolderPath: '{0}'", programDirectory.FullName);
                Console.WriteLine("TemplateFolderPath: '{0}'", templateDirectory.FullName);
                Console.WriteLine("TrainingFolderPath: '{0}'", trainingDirectory.FullName);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        /// <summary>
        /// Returns a Version object representing the installed version of Solid Edge.
        /// </summary>
        /// <returns></returns>
        public static Version GetVersion()
        {
            var installData = new SEInstallDataLib.SEInstallData();

            return(new Version(installData.GetMajorVersion(), installData.GetMinorVersion(), installData.GetServicePackVersion(), installData.GetBuildNumber()));
        }
Exemplo n.º 4
0
 // Restituisce string con i dati della versione
 public string VersioneSolidEdgeEInstallata()
 {
     string versione = "";
     try
         {
         installData = new SEInstallDataLib.SEInstallData();
         builderNumber = installData.GetBuildNumber();
         installFolder = new DirectoryInfo(installData.GetInstalledPath());
         cultureInfo = new CultureInfo(installData.GetLanguageID());
         majorVersion = installData.GetMajorVersion();
         minorVersion = installData.GetMinorVersion();
         parasolidMajorVersion = installData.GetParasolidMajorVersion();
         parasolidMinorVersion = installData.GetParasolidMinorVersion();
         parasolidVersion = new Version(installData.GetParasolidVersion());
         servicePackVersion = installData.GetServicePackVersion();
         version = new Version(installData.GetVersion());
         versione = string.Format("Versione di Solid Edge :  {1}\nVersione parasolid :  {0}\nCartella di installazione :  {2}", parasolidVersion.ToString(), version.ToString(), installFolder.FullName);
         }
     catch (System.Exception ex)
         {
         Console.WriteLine(ex.Message);
         }
     finally
         {
         if (installData != null)
             {
             Marshal.ReleaseComObject(installData);
             installData = null;
             }
         }
     return versione;
 }