Ejemplo n.º 1
0
 private static void InstallAssembly(Kernel kernel)
 {
     Publish publish = new Publish();
     string file = kernel.CommandLine["install"];
     //Console.WriteLine(".."+file+"..");
     publish.GacInstall(file);
 }
Ejemplo n.º 2
0
        static void Install()
        {
            // Make sure file exists
            Console.WriteLine("\r\n> Checking files...");
            if (!File.Exists(mainDllPath) || !File.Exists(jsonDllPath))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\r\n>> Unable to find all the required files. Please extract all files from the archive then try again.");
                return;
            }
            Console.WriteLine("File check success!");

            // Is 64 bit .NET installed?
            bool is64BitInstalled = File.Exists(regAsm64Path);
            if (is64BitInstalled) Console.WriteLine("64-Bit check success");

            // Publish to GAC
            var pub = new Publish();
            pub.GacInstall(mainDllPath);
            pub.GacInstall(jsonDllPath);

            // Register with RegAsm
            RunProcess(regAsm32Path, mainDllPath);
            if (is64BitInstalled)
                RunProcess(regAsm64Path, mainDllPath);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\r\n>> Successfully installed Scriptmonkey!");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Make sure you enable the addon when you start Internet Explorer (bar at the bottom).");
        }
Ejemplo n.º 3
0
        public static void GacRegisterHost()
        {
            Publish pub = new Publish();

            pub.GacInstall(AppDomain.CurrentDomain.BaseDirectory + @"\Mono.Security.dll");
            pub.GacInstall(AppDomain.CurrentDomain.BaseDirectory + @"\Mono.Security.Win32.dll");
            pub.GacInstall(AppDomain.CurrentDomain.BaseDirectory + @"\Mono.WebServer2.dll");
        }
Ejemplo n.º 4
0
        public override bool Execute()
        {
            var publish = new Publish();
            foreach (var item in Assemblies)
            {
                ExecutePublish(publish, item.ItemSpec);
            }

            return true;
        }
Ejemplo n.º 5
0
 public static void Uninstall()
 {
     var pub = new Publish();
     pub.GacRemoveC("InTheHand.Net.Personal");
     pub.GacRemoveC("Vlc.DotNet.Core");
     pub.GacRemoveC("Vlc.DotNet.Forms");
     pub.GacRemoveC("ZomB");
     var p = NGenu("ViZ, Version=0.9.1.0, Culture=neutral, PublicKeyToken=c7d9dbcb0b13713a");
     p.WaitForExit();
     var q = NGenu("ZomB, Version=0.9.1.0, Culture=neutral, PublicKeyToken=5880636763ded5de");
     q.WaitForExit();
 }
Ejemplo n.º 6
0
 static void Main(string[] args)
 {
     Publish p = new Publish();
     if(args[0] == "install")
     {
         p.GacInstall(args[1]);
     }
     else if (args[0] == "uninstall")
     {
         p.GacRemove(args[1]);
     }
 }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            //System.Console.Out.WriteLine("arguments: "+args.Length);

            try
            {
                if (args.Length == 2)
                {
                    Publish p = new Publish();
                    if (args[0] == "install")
                    {
                        System.Console.Out.WriteLine("Registering {0} into GAC", args[1]);
                        p.GacInstall(args[1]);
                    }
                    else if (args[0] == "remove")
                    {
                        System.Console.Out.WriteLine("Removing {0} from GAC", args[1]);
                        p.GacRemove(args[1]);
                    }
                    else if (args[0] == "installasm")
                    {
                        System.Console.Out.WriteLine("Registering Assembly {0}", args[1]);
                        RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();
                        Assembly ass = Assembly.LoadFrom(args[1]);
                        regsrv.RegisterAssembly( ass,
                            System.Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase);
                        //p.RegisterAssembly(args[1]);
                    }
                    else if (args[0] == "removeasm")
                    {
                        System.Console.Out.WriteLine("Removing Assembly {0}", args[1]);
                        RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();
                        Assembly ass = Assembly.LoadFrom(args[1]);
                        regsrv.UnregisterAssembly( ass );
                        //p.UnRegisterAssembly(args[1]);
                    }
                    else
                    {
                        displayUsage();
                    }
                }
                else
                {
                    displayUsage();
                }
            }
            catch (Exception E) {
                String s = "Error "+E.Source+" while "+args[0]+" "+args[1]+": "+E.Message;
                s = DateTime.Now.ToString()+" "+s;
                System.Console.Out.WriteLine(s);
            }
        }
 public static void Install(bool async)
 {
     ExtractAll();
     //HACK CONF: update when assemblies change
     var p = NGen("ZomB, Version=" + System451.Communication.Dashboard.ZVersionMgr.ShortNumber + ", Culture=neutral, PublicKeyToken=5880636763ded5de");
     p.WaitForExit();
     var pub = new Publish();
     pub.GacInstall("InTheHand.Net.Personal.dll");
     pub.GacInstall("Vlc.DotNet.Core.dll");
     pub.GacInstall("Vlc.DotNet.Forms.dll");
     pub.GacInstall("ZomB.dll");
     p = NGen("ZomB, Version=" + System451.Communication.Dashboard.ZVersionMgr.ShortNumber + ", Culture=neutral, PublicKeyToken=5880636763ded5de");
     if (!async)
         p.WaitForExit();
     var q = NGen();
     if (!async)
         q.WaitForExit();
 }
Ejemplo n.º 9
0
 // Methods
 static void Main(string[] args) {
     string pattern = "";
     if (args.Length > 0) {
         pattern = args[0];
     }
     
     bool flag = true;
     if (args.Length == 2) {
         flag = args[1] == "i";
     }
     var publish = new Publish();
     bool error=false;
     foreach (var file in GetFiles()) {
         try {
             if (Regex.IsMatch(file, pattern)) {
                 if (flag) {
                     publish.GacInstall(file);
                     Console.WriteLine("Installed: " + file);
                 }
                 else {
                     var windowsPath = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
                     var path = windowsPath + @"\Microsoft.NET\assembly\GAC_MSIL\" + Path.GetFileNameWithoutExtension(file);
                     if (Directory.Exists(path)) {
                         Directory.Delete(path,true);
                         Console.WriteLine("Uninstalled: " + Path.GetFileNameWithoutExtension(file) );
                     }
                     else {
                         Console.WriteLine("Already uninstalled: " + Path.GetFileNameWithoutExtension(file));
                     }
                 }
             }
         }
         catch (Exception exception) {
             error = true;
             var foregroundColor = Console.ForegroundColor;
             Console.ForegroundColor=ConsoleColor.Red;
             Console.WriteLine(new Exception("ERROR in " + Path.GetFileNameWithoutExtension(file), exception));
             Console.ForegroundColor=foregroundColor;
         }
     }
     if (error)
         Console.ReadKey();
 }
Ejemplo n.º 10
0
        public void AddAssemblyToCache(string[] assemblies)
        {
            Publish GACPublisher = new Publish();

            foreach (var a in assemblies)
            {
                if (IsValidPath(a))
                {
                    try
                    {
                        GACPublisher.GacInstall(a);
                        OnLog("Assembly {0} registered in the GAC", a);
                    }
                    catch (Exception e)
                    {
                        OnLog(new LogEventArgs(e));
                    }
                }
                else
                    OnLog(new LogEventArgs(string.Format("Invalid file path: {0}", a), true));
            }
        }
Ejemplo n.º 11
0
        static void Remove()
        {
            // Make sure file exists
            Console.WriteLine("\r\n> Checking files...");
            if (!File.Exists(mainDllPath) || !File.Exists(jsonDllPath))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\r\n>> Unable to find all the required files. Please extract all files from the archive then try again.");
                return;
            }
            Console.WriteLine("File check success!");

            // Is 64 bit .NET installed?
            bool is64BitInstalled = File.Exists(regAsm64Path);
            if (is64BitInstalled) Console.WriteLine("64-Bit check success");

            // Unregister with RegAsm
            RunProcess(regAsm32Path, "/unregister " + mainDllPath);
            if (is64BitInstalled)
                RunProcess(regAsm64Path, "/unregister " + mainDllPath);

            // Remove from GAC
            var pub = new Publish();
            pub.GacRemove(mainDllPath);
            pub.GacRemove(jsonDllPath);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\r\n>> Successfully removed Scriptmonkey!");
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            Publish p = new Publish();

            if (args.Length > 0)
            {
                if (args[0] == "gac" || args[0] == "install")
                {
                    p.GacInstall(args[1]);
                }
                else if (args[0] == "ungac" || args[0] == "uninstall")
                {
                    p.GacRemove(args[1]);
                }
                else if (args[0] == "registerime")
                {
                    ImmInstallIMEA(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\OVIME.IME", "OpenVanilla 0.9b");
                    Console.WriteLine(" OVIME registered ");
                }
                else if (args[0] == "unregisterime")
                {
                    RegistryKey HKLM = Registry.LocalMachine;
                    RegistryKey HKUSER = Registry.CurrentUser;

                    RegistryKey IMEKey = HKLM.OpenSubKey(
                        "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts", true);
                    RegistryKey IMEUserKey = HKUSER.OpenSubKey(
                        "Keyboard Layout\\Preload", true);

                    string[] subKeys = IMEKey.GetSubKeyNames();
                    string OVIMEKey = "";

                    foreach (string curKey in subKeys)
                    {
                        RegistryKey rk = IMEKey.OpenSubKey(curKey, false);
                        if (rk != null)
                        {
                            String imeName = (String)rk.GetValue("IME File");
                            if (imeName == null)
                                imeName = "";
                            //else
                            //    Console.WriteLine(curKey + ":IME Name: " + imeName);

                            if (imeName.Equals("OVIME.IME"))
                            {
                                OVIMEKey = curKey;
                                Console.WriteLine(" OVIME Regiester as " + OVIMEKey);
                                IMEKey.DeleteSubKeyTree(curKey);
                                Console.WriteLine(" OVIME unregistered ");
                            }
                        }
                    }
                    String[] valueNames = IMEUserKey.GetValueNames();
                    foreach (string curValueName in valueNames)
                    {
                        String keyLayout = (String)IMEUserKey.GetValue(curValueName);
                        if (keyLayout.ToUpper().Equals(OVIMEKey.ToUpper()))
                        {
                            Console.WriteLine(" OVIME Preload found at " + curValueName);
                            IMEUserKey.DeleteValue(curValueName);
                            Console.WriteLine(" OVIME user preload settings removed");
                        }

                    }

                }
                else if (args[0] == "testuiserver")
                {
                    OVUIServer.IMEStatusForm  imeStatus = new OVUIServer.IMEStatusForm();
                    imeStatus.ShowNoActive();
                        Console.WriteLine(" Testing OVUIServer, StatusBar showed. ");
                    Console.ReadLine();
                }
                else if (args[0] == "getlanguage")
                {
                    foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
                    {
                        Console.WriteLine("imename = " + lang.LayoutName);
                    }
                }
                else if (args[0] == "switchOV")
                {
                    foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)
                    {
                        string imename = lang.LayoutName;
                        Console.WriteLine("imename = " + imename);
                        if(imename.StartsWith("OpenVanilla"))
                        {
                            Console.WriteLine("OV found");
                            InputLanguage.CurrentInputLanguage = lang;
                            Console.ReadLine();
                            break;

                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("Available command gac, ungac, registerime, unregisterime");
            }
        }
Ejemplo n.º 13
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Updates all files that require an update.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void UpdateFiles()
        {
            bool fAskedUserToExit = false; // will be set to true as soon as we have asked user
            using (ProgressDialog dlg = new ProgressDialog())
            {
                dlg.ProgressBar.Maximum = m_FilesToUpdate.Length;
                dlg.Show();
                for (int i = 0; i < m_FilesToUpdate.Length && !dlg.ShouldCancel; i++)
                {
                    UpdateFile file = m_FilesToUpdate[i];
                    Trace.WriteLine(DateTime.Now + ": Installing " + file.Name);
                    dlg.InstallText = "Installing " + file.Name;

                    if (file.ExitVs && !fAskedUserToExit)
                    {
                        fAskedUserToExit = true;
                        CloseVs();
                    }

                    try
                    {
                        string extension = Path.GetExtension(file.Name).ToLower();
                        if (extension == ".msi" || extension == ".vsi" || extension == ".vsix")
                        {
                            // Install this file
                            Process process = new Process();
                            process.StartInfo.FileName = Path.Combine(m_UpdatePath, file.Name);
                            process.StartInfo.CreateNoWindow = true;
                            process.StartInfo.Arguments = "/quiet";
                            process.Start();
                            process.WaitForExit();
                            Trace.WriteLine(DateTime.Now + ": Exit code: " + process.ExitCode);
                        }
                        else if (extension == ".dll")
                        {
                            // Install in the GAC
                            string fileName = Path.Combine(m_UpdatePath, file.Name);
                            Publish publish = new Publish();
                            publish.GacInstall(fileName);
                            Trace.WriteLine(DateTime.Now + ": Installed in GAC");
                        }
                    }
                    catch (Exception e)
                    {
                        Trace.WriteLine(DateTime.Now + ": Got exception installing " +
                            file.Name + ": " + e.Message);
                        // remove from list of updated files so that we try again
                        m_FileHash.Remove(file.Name);
                    }
                    dlg.ProgressBar.Increment(1);
                }

                RestartVisualStudio(dlg);
                dlg.Close();
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Removes the given assembly from the Global Assembly Cache
 /// </summary>
 /// <param name="assembly"></param>
 public static void UninstallFromGAC(Assembly assembly)
 {
     //Remove the assembly from the global assembly cache
     Publish p = new Publish();
     p.GacRemove(Assembly.GetExecutingAssembly().Location);
 }
 /// <summary>
 ///     Inject our assembly to the Global Assembly Cache so all scripts have access to it
 /// </summary>
 private void InjectToGAC()
 {
     //Allows other scripts to access us
     var pub = new Publish();
     pub.GacInstall(typeof (DeveloperConsole).Assembly.Location);
 }
Ejemplo n.º 16
0
 protected abstract void ExecutePublish(Publish publish, string path);
Ejemplo n.º 17
0
		private static void RemoveAssembly(Kernel kernel)
		{
			Publish publish = new Publish();
			string file = kernel.CommandLine["remove"];
			publish.GacRemove(file);
		}
Ejemplo n.º 18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Updates all files that require an update.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void UpdateFiles()
		{
			bool fAskedUserToExit = false; // will be set to true as soon as we have asked user
			using (ProgressDialog dlg = new ProgressDialog())
			{
				dlg.ProgressBar.Maximum = m_FilesToUpdate.Length;
				dlg.Show();
				for (int i = 0; i < m_FilesToUpdate.Length && !dlg.ShouldCancel; i++)
				{
					UpdateFile file = m_FilesToUpdate[i];
					Trace.WriteLine(DateTime.Now.ToString() + ": Installing " + file.Name);
					dlg.InstallText = "Installing " + file.Name;

					if (file.ExitVs && !fAskedUserToExit)
					{
						fAskedUserToExit = true;
						Process[] processes = Process.GetProcessesByName("devenv");
						if (processes.Length > 0)
						{
							if (MessageBox.Show("Visual Studio needs to close before update can proceed",
							"Updates available", MessageBoxButtons.OKCancel) == DialogResult.OK)
							{
								ExitVs();
							}
							else
							{
								Trace.WriteLine(DateTime.Now.ToString() + ": Skipped closing Visual Studio by user's request");
							}
						}
					}

					try
					{
						string extension = Path.GetExtension(file.Name).ToLower();
						if (extension == ".msi" || extension == ".vsi")
						{
							// Install this file
							Process process = new Process();
							process.StartInfo.FileName = Path.Combine(m_UpdatePath, file.Name);
							process.StartInfo.CreateNoWindow = true;
							process.StartInfo.Arguments = "/quiet";
							process.Start();
							process.WaitForExit();
							Trace.WriteLine(DateTime.Now.ToString() + ": Exit code: " + process.ExitCode);
						}
						else if (extension == ".dll")
						{
							// Install in the GAC
							string fileName = Path.Combine(m_UpdatePath, file.Name);
							Publish publish = new Publish();
							publish.GacInstall(fileName);
							Trace.WriteLine(DateTime.Now.ToString() + ": Installed in GAC");
						}
					}
					catch (Exception e)
					{
						Trace.WriteLine(DateTime.Now.ToString() + ": Got exception installing " +
							file.Name + ": " + e.Message);
						// remove from list of updated files so that we try again
						m_FileHash.Remove(file.Name);
					}
					dlg.ProgressBar.Increment(1);
				}

				RestartVisualStudio(dlg);
				dlg.Close();
			}
		}
Ejemplo n.º 19
0
        public void RemoveAssemblyFromCache(string[] assemblies)
        {
            Publish GACPublisher = new Publish();

            foreach (var a in assemblies)
            {
                try
                {
                    GACPublisher.GacRemove(a);
                    OnLog("Assembly {0} un-registered from the GAC", a);
                }
                catch (Exception e)
                {
                    OnLog(new LogEventArgs(e));
                }
            }
        }
        private void db_DoWork(object sender, DoWorkEventArgs e)
        {
            errStrBuilder.Clear();

            //mysql connector 설치
            invokeMessage("> MySql Connector 설치중\n");
            Thread.Sleep(100);
            Publish publish = null;
            try
            {
                publish = new Publish();
                publish.GacInstall(Path.Combine(Application.StartupPath, "MySql.Data.dll"));
            }
            catch (Exception ee)
            {
                errStrBuilder.AppendLine(String.Format("> {0} : {1}", "어셈블리 설치 에러", ee.Message));
                Debug.WriteLine("어셈블리 설치 에러 " + ee.Message);
                Debug.WriteLine(ee.Message);
                return;
            }
            invokeMessage("> MySql Connector를 설치했습니다\n");
            Thread.Sleep(200);

            try
            {
                //DB Connection check
                if (!isDbConnected)
                {
                    invokeMessage(String.Format("> 데이타 베이스[{0}][{1}][{2}]에 연결중\n", dbHost, dbId, dbPass));
                    Thread.Sleep(100);
                    MySqlConnection con5 = null;
                    string connectionString = String.Format(
                        "Data Source={0};User Id={1};Password={2};charset={3}",
                        dbHost, dbId, dbPass, "utf8");
                    con5 = new MySqlConnection();
                    con5.ConnectionString = connectionString;
                    con5.Open();
                    invokeMessage(String.Format("> 데이타 베이스[{0}][{1}][{2}]에 연결할 수 있습니다\n", dbHost, dbId, dbPass));
                }
            }
            catch (Exception e1)
            {
                errStrBuilder.AppendLine(String.Format(String.Format("> 데이타 베이스[{0}][{1}][{2}]에 연결할 수 없습니다\n", dbHost, dbId, dbPass)));
                return;
            }

            //write config
            invokeMessage(String.Format("> 설정 파일(config.ini)을 작성중\n"));
            Thread.Sleep(100);

            try
            {
                //SERVICE section
                ApplicationConfig.Instance();
                ApplicationConfig.Instance().ServiceName = this.serviceName;
                ApplicationConfig.Instance().ServiceDisplayName = this.serviceDisplayName;
                ApplicationConfig.Instance().ServiceFilePath = this.serviceFile;
                ApplicationConfig.Instance().MaxSessionCount = this.maxSessionCount;
                ApplicationConfig.Instance().ServicePort = this.servicePort;

                //PROTOCOL section
                ApplicationConfig.Instance().UsingProtocol = this.protocol;
                ApplicationConfig.Instance().NMSSupport = true;
                ApplicationConfig.Instance().SNMPSupport = false;

                //CLIENT section
                ApplicationConfig.Instance().LogFilename = this.logFile;
                ApplicationConfig.Instance().RemotePort = this.remotePort;
                ApplicationConfig.Instance().UpdatePeriod = this.updatePeriod;
                ApplicationConfig.Instance().LowBatteryLimit = this.lowBatteryLimit;

                ApplicationConfig.Instance().ConcurrentDownloadCount = this.concurrentDownloadCount;
                ApplicationConfig.Instance().Latitude = this.lat;
                ApplicationConfig.Instance().Longitude = this.lng;
                //ApplicationConfig.Instance().ProtocolDes = des;

                //DATABASE section
                ApplicationConfig.Instance().DatabaseHost = dbHost;
                ApplicationConfig.Instance().DatabaseName = "celot_db";
                ApplicationConfig.Instance().DatabaseId = dbId;
                ApplicationConfig.Instance().DatabasePassword = dbPass;
                ApplicationConfig.Instance().DatabaseCharset = "utf8";

            }
            catch (Exception eee)
            {
                errStrBuilder.AppendLine(String.Format("> 설정 파일(config.ini)을 작성 중에 에러가 발생했습니다 : {0}\n", eee.Message));
                Debug.WriteLine(eee.StackTrace);
                return;
            }
            invokeMessage(String.Format("> 설정 파일(config.ini)을 작성했습니다\n"));
            Thread.Sleep(100);

            //DB 스키마 생성
            Thread.Sleep(100);
            MySqlConnection con = null;
            MySqlCommand command = null;
            try
            {
                //Create Database and table
                invokeMessage(String.Format("> 데이타 베이스 Schema[celot_db]와 테이블을  생성중\n"));
                Thread.Sleep(200);

                string connectionString = String.Format(
                    "Data Source={0};User Id={1};Password={2}",
                    dbHost, dbId, dbPass);
                con = new MySqlConnection();
                string script = File.ReadAllText("new_celot_schema.sql");
                con.ConnectionString = connectionString;
                con.Open();

                command = new MySqlCommand(script, con);
                command.ExecuteNonQuery();

                string adminGroupCreateScript = @"INSERT INTO celot_db.admin_group(Code, Name,Des) VALUES";
                adminGroupCreateScript += String.Format(@"('{0}','{1}','{2}'),", "SA", "Super Admin", "Super Admin");
                adminGroupCreateScript += String.Format(@"('{0}','{1}','{2}'),", "MA", "Manager", "Manager");
                adminGroupCreateScript += String.Format(@"('{0}','{1}','{2}')", "CO", "Common", "Common");
                command = new MySqlCommand(adminGroupCreateScript, con);
                command.ExecuteNonQuery();

                invokeMessage(String.Format("> 데이타 베이스 Schema[celot_db]와 테이블을  생성했습니다\n"));
                Thread.Sleep(100);
            }
            catch (Exception ex2)
            {
                errStrBuilder.AppendLine(String.Format("> Schema 생성 에러 : {0}\n", ex2.Message));
                return;
            }
            finally
            {
                if (con != null) con.Close();
            }
            Thread.Sleep(100);

            invokeMessage(String.Format("> C-Cloud 서비스를 설치중\n"));
            Thread.Sleep(100);
            if (!ServiceManager.Instance().InstallService(
                this.serviceName,
                this.serviceDisplayName,
                this.serviceFile,
                this.mySqlSeviceName))
            {
                errStrBuilder.AppendLine(String.Format("> {0} : {1}", "C-Cloud 서비스 설치 에러", ServiceManager.Instance().Message));
                return;
            }

            CelotWinApi.EnableWow64DisableWow64FsRedirection();
            try
            {
                if (File.Exists(Path.Combine(Environment.SystemDirectory, "config.ini")))
                {
                    File.Delete(Path.Combine(Environment.SystemDirectory, "config.ini"));
                }

                if (File.Exists(Path.Combine(Environment.SystemDirectory, "CELOT_SERVICE_LOG.log")))
                {
                    File.Delete(Path.Combine(Environment.SystemDirectory, "CELOT_SERVICE_LOG.log"));
                }
            }
            catch (Exception ee)
            {
                errStrBuilder.AppendLine(String.Format("> 기존의 onfig.ini 제거 실패 {0}\n", ee.Message));
                return;
            }

            try
            {
                File.Copy(IniUtil.INI_FILENAME, Path.Combine(Environment.SystemDirectory, "config.ini"), true);

            }
            catch (Exception ee)
            {
                errStrBuilder.AppendLine(String.Format("> config.ini 파일 생성 실패 {0}\n", ee.Message));
                return;
            }

            CelotWinApi.DisableWow64DisableWow64FsRedirection();

            invokeMessage(String.Format("> C-Cloud 서비스를 설치했습니다\n"));
            Thread.Sleep(100);

            invokeMessage(String.Format("> C-Cloud 서비스를 시작하는 중\n"));
            Thread.Sleep(100);

            try
            {
                if (!ServiceManager.Instance().StartService())
                {
                    errStrBuilder.AppendLine(String.Format("> {0} : {1}", "C-Cloud 서비스 시작 에러", ServiceManager.Instance().Message));
                    return;
                }
                invokeMessage(String.Format("> C-Cloud 서비스를 시작했습니다\n"));
                Thread.Sleep(100);
                ApplicationConfig.Instance().Install = 1;
            }
            catch (Exception ex)
            {
                errStrBuilder.AppendLine(String.Format("> {0} : {1}", " C-Cloud 서비스 설치 에러", ex.Message));
                Debug.WriteLine("서비스 설치 에러");
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
Ejemplo n.º 21
0
        private static void Main(string[] args)
        {
            try
            {
                bool uninstallMode = false;
                string[] searchPatterns;

                if (args.Length == 0)
                {
                    Console.WriteLine("Usage: " + AppDomain.CurrentDomain.FriendlyName + "<DLL_PATH>  [/u] [Comma separated patterns including extensions]");
                    Console.WriteLine("Example: " + AppDomain.CurrentDomain.FriendlyName + " c:\\gac");
                    Console.WriteLine("Example: " + AppDomain.CurrentDomain.FriendlyName + " c:\\gac /u Sequel*.dll,Sequel*.exe");
                    Console.WriteLine("By default it will install all the *.exe and *.dll files from the specified folder.");

                }
                else if (!Program.IsUserAdministrator())
                {
                    Console.WriteLine("This application must be run as an Administrator.");
                }
                else
                {
                    if (args.Length > 1)
                    {
                        uninstallMode = "/u".Equals(args[1], StringComparison.CurrentCultureIgnoreCase);
                    }

                    Publish publish = new Publish();
                    DirectoryInfo directoryInfo = new DirectoryInfo(args[0]);
                    Console.WriteLine("Working folder " + directoryInfo.FullName);
                    if (args.Length > 2)
                    {
                        searchPatterns = args[2].Split(',');
                    }
                    else
                    {
                        searchPatterns = new string[] { "*.dll", "*.exe" };
                    }
                    var fileList = MyDirectory.GetFiles(directoryInfo.FullName, searchPatterns, System.IO.SearchOption.TopDirectoryOnly);
                    foreach (string fileName in fileList)
                    {
                        FileInfo fileInfo = new FileInfo(fileName);

                        if (uninstallMode)
                        {
                            Console.WriteLine("Removing " + (object)fileInfo + " from the GAC.");
                            publish.GacRemove(fileInfo.FullName);
                        }
                        else
                        {
                            bool flag = false;
                            List<FileInfo> list = Program.SearchForFileInGAC(fileInfo);
                            foreach (FileInfo fileInfo2 in list)
                            {
                                if (Comparisons.FilesContentsAreEqual(fileInfo, fileInfo2))
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag && Enumerable.Count<FileInfo>((IEnumerable<FileInfo>)list) > 0)
                            {
                                Console.WriteLine("Removing " + (object)fileInfo + " from the GAC.");
                                publish.GacRemove(fileInfo.FullName);
                            }
                            if (!flag)
                            {
                                Console.WriteLine("Adding " + (object)fileInfo + " to the GAC.");
                                publish.GacInstall(fileInfo.FullName);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Ouch!... " + ex.Message);
                Console.WriteLine(ex.StackTrace.ToString());
            }
        }
Ejemplo n.º 22
0
 static void Main(string[] args)
 {
     Publish p = new Publish();
     p.GacInstall(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/lib/OSAE.API.dll");
     p.GacInstall(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "/lib/MySql.Data.dll");
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Installs the assembly into the .Net Global Assembly Cache.  Note: If you want this assembly to be visible to other developers be sure to also call RegisterWithVisualStudio.
 /// </summary>
 /// <param name="assembly"></param>
 public static void InstallIntoGAC(Assembly assembly)
 {
     //Publish the assembly to the global assembly cache
     Publish p = new Publish();
     p.GacInstall(assembly.Location);
 }