Ejemplo n.º 1
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.º 2
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);
            }
        }
Ejemplo n.º 3
0
		private static void RemoveAssembly(Kernel kernel)
		{
			Publish publish = new Publish();
			string file = kernel.CommandLine["remove"];
			publish.GacRemove(file);
		}
Ejemplo n.º 4
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.º 5
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);
 }
Ejemplo n.º 6
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.º 7
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));
                }
            }
        }
Ejemplo n.º 8
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");
            }
        }