예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GACManagerViewModel"/> class.
        /// </summary>
        public GACManagerViewModel()
        {
            InitCommands();

            //  Update Gac Util Status info.
            GacUtilStatusInfo = GacUtil.CanFindExecutable() ? Resources.Msg_GacUtilFound :
                                Resources.Msg_GacUtilNotFound;
        }
예제 #2
0
 protected GacUtil GetGac()
 {
     if (m_gac == null)
     {
         m_gac = new GacUtil();
     }
     return(m_gac);
 }
예제 #3
0
        public override bool Execute()
        {
            using (GacUtil util = new GacUtil())
            {
                util.InstallAssemblyFile(m_path);
            }

            return(true);
        }
예제 #4
0
        public void Uninstall()
        {
            GacUtil task = new GacUtil();
            task.BuildEngine = new MockBuild();
            task.Command = "Uninstall";
            task.Assemblies = new string[] { @"MSBuild.Community.Tasks, Version=1.4.0.0, Culture=neutral, PublicKeyToken=e8bf2261941c3948" };
            bool result = task.Execute();

            Assert.IsTrue(result);
        }
예제 #5
0
        public void Install()
        {
            GacUtil task = new GacUtil();
            task.BuildEngine = new MockBuild();
            task.Command = "Install";
            task.IncludeRelatedFiles = true;
            task.Assemblies = new string[] { @"..\..\..\MSBuild.Community.Tasks\bin\Debug\MSBuild.Community.Tasks.dll" };
            bool result = task.Execute();

            Assert.IsTrue(result);
        }
예제 #6
0
        public void Uninstall()
        {
            GacUtil task = new GacUtil();

            task.BuildEngine = new MockBuild();
            task.Command     = "Uninstall";
            task.Assemblies  = new string[] { @"MSBuild.Community.Tasks, Version=1.4.0.0, Culture=neutral, PublicKeyToken=e8bf2261941c3948" };
            bool result = task.Execute();

            Assert.IsTrue(result);
        }
예제 #7
0
        public override void Execute()
        {
            var assemblyName = Options["n"].Values[0];

            using (GacUtil gac = new GacUtil())
            {
                if (gac.UninstallAssembly(assemblyName))
                {
                    Console.WriteLine("Uninstalled '" + assemblyName + "' from the GAC.");
                }
            }
        }
예제 #8
0
        public void Install()
        {
            GacUtil task = new GacUtil();

            task.BuildEngine         = new MockBuild();
            task.Command             = "Install";
            task.IncludeRelatedFiles = true;
            task.Assemblies          = new string[] { @"..\..\..\MSBuild.Community.Tasks\bin\Debug\MSBuild.Community.Tasks.dll" };
            bool result = task.Execute();

            Assert.IsTrue(result);
        }
예제 #9
0
        async public void GetExtensions()
        {
            if (GACForm.E != null)
            {
                // asm = asms;
            }
            else
            {
                E = await GacUtil.GetExtensions("");
            }

            LoadAssemblies(E);
        }
예제 #10
0
        public override void Execute()
        {
            var assembly = Options["i"].Values[0];

            // Iterate across all assemblies.

            using (GacUtil gac = new GacUtil())
            {
                if (gac.UninstallAssemblyFile(assembly))
                {
                    Console.WriteLine("Uninstalled '" + assembly + "' from the GAC.");
                }
            }
        }
예제 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GACManagerViewModel"/> class.
        /// </summary>
        public GACManagerViewModel()
        {
            //  Create the refresh assemblies command.
            RefreshAssembliesCommand    = new AsynchronousCommand(DoRefreshAssembliesCommand, true);
            CopyDisplayNameCommand      = new Command(DoCopyDisplayNameCommand, false);
            ShowFilePropertiesCommand   = new Command(DoShowFilePropertiesCommand, false);
            UninstallAssemblyCommand    = new Command(() => { }, false);
            OpenAssemblyLocationCommand = new Command(() => {}, false);
            InstallAssemblyCommand      = new Command(() => {});
            HelpCommand = new Command(() => {});
            ShowAssemblyDetailsCommand = new Command(DoShowAssemblyDetailsCommand, false);

            //  Update Gac Util Status info.
            GacUtilStatusInfo = GacUtil.CanFindExecutable() ? "GacUtil is installed" :
                                "Cannot find GacUtil";
        }
예제 #12
0
        /// <summary>
        /// 输出多行_主函数_内部.
        /// </summary>
        /// <param name="isfull">显示全部信息.</param>
        /// <param name="iw">带缩进输出者.</param>
        /// <param name="obj">object. Can be null.</param>
        /// <param name="context">State Object. Can be null.</param>
        /// <returns>返回是否成功输出.</returns>
        private static bool outl_main_core(bool isfull, IIndentedWriter iw, object obj, IndentedWriterContext context)
        {
            if (null == iw)
            {
                return(false);
            }
            ASM_DISPLAY_FLAGS flags = isfull ? ASM_DISPLAY_FLAGS.ASM_DISPLAYF_FULL : ASM_DISPLAY_FLAGS.ASM_DISPLAYF_RETARGET;

            //flags = ASM_DISPLAY_FLAGS.ASM_DISPLAYF_FULL;
            iw.WriteLine("# zinfoassemblylist");
            foreach (string str in GacUtil.GacGetAssemblyNameList(flags, GacGetListOptions.AutoSort | GacGetListOptions.Fallback))
            {
                iw.WriteLine(str);
            }
            return(true);
        }
예제 #13
0
        static OracleBulkCopy()
        {
            AppDomain.CurrentDomain.AssemblyResolve += (_AppDomain, e) =>
            {
                if (e.Name.Contains(".resources"))
                {
                    return(null);
                }

                if (e.Name.StartsWith("Oracle.DataAccess"))
                {
                    string filePath = GacUtil.GetAssemblyPath("Oracle.DataAccess");
                    return(filePath == null ? null : Assembly.LoadFile(filePath));
                }
                return(null);
            };
        }
예제 #14
0
        public static bool IKVMDirectoryAndAssembliesExistOnPath()
        {
            string[] assemblyList =
            {
                @"IKVM.Runtime",
                @"IKVM.Runtime.JNI",
                @"IKVM.OpenJDK.Beans",
                @"IKVM.OpenJDK.Charsets",
                @"IKVM.OpenJDK.Cldrdata",
                @"IKVM.OpenJDK.Corba",
                @"IKVM.OpenJDK.Core",
                @"IKVM.OpenJDK.Jdbc",
                @"IKVM.OpenJDK.Localedata",
                @"IKVM.OpenJDK.Management",
                @"IKVM.OpenJDK.Media",
                @"IKVM.OpenJDK.Misc",
                @"IKVM.OpenJDK.Naming",
                @"IKVM.OpenJDK.Nashorn",
                @"IKVM.OpenJDK.Remoting",
                @"IKVM.OpenJDK.Security",
                @"IKVM.OpenJDK.SwingAWT",
                @"IKVM.OpenJDK.Text",
                @"IKVM.OpenJDK.Tools",
                @"IKVM.OpenJDK.Util",
                @"IKVM.OpenJDK.XML.API",
                @"IKVM.OpenJDK.XML.Bind",
                @"IKVM.OpenJDK.XML.Crypto",
                @"IKVM.OpenJDK.XML.Parse",
                @"IKVM.OpenJDK.XML.Transform",
                @"IKVM.OpenJDK.XML.WebServices",
                @"IKVM.OpenJDK.XML.XPath"
            };

            foreach (string assemblyName in assemblyList)
            {
                if (!GacUtil.IsAssemblyInGAC(assemblyName))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #15
0
        async static public Task <ArrayList> GetAssembliesList(string s)
        {
            frameworks = GacUtil.GetFrameworks();

            asms = await GacUtil.GetFramework(s);

            asmd = new Dictionary <string, AssemblyDescription>();

            foreach (AssemblyDescription d in asms)
            {
                if (d.Name != null)
                {
                    asmd.Add(d.Name, d);
                }
            }

            dicts = GetAsmDict(asms);

            return(asms);
        }
예제 #16
0
        public override bool Execute()
        {
            using (GacUtil gacutil = new GacUtil())
            {
                foreach (string assembly in gacutil.GetAllAssemblies())
                {
                    // Pull apart the name and the version.

                    int pos = assembly.IndexOf(',');
                    if (pos != -1)
                    {
                        string name = assembly.Substring(0, pos);
                        if (name.StartsWith(_assemblyPrefix, StringComparison.InvariantCultureIgnoreCase))
                        {
                            string rest = assembly.Substring(pos + 1);

                            if (rest.StartsWith(" Version="))
                            {
                                string version = rest.Substring(" Version=".Length);
                                if (version == _productVersion)
                                {
                                    gacutil.UninstallAssembly(assembly);
                                }
                            }
                        }
                        else if (Contains(_others, name))
                        {
                            // Ignore the version.

                            gacutil.UninstallAssembly(assembly);
                        }
                    }
                }
            }

            return(true);
        }
예제 #17
0
        public static void GacAll(string folder)
        {
            // Iterate across all assemblies.

            using (GacUtil gac = new GacUtil())
            {
                foreach (string file in Directory.GetFiles(folder))
                {
                    string fileName = Path.GetFileName(file);
                    if (!string.Equals(fileName, EntryAssemblyFileName, StringComparison.OrdinalIgnoreCase))
                    {
                        // Don't attempt to put Sdk or VisualStudio assemblies in the GAC.

                        if (!fileName.Contains("wix") && !fileName.Contains(".Sdk.") && !fileName.Contains(".VisualStudio."))
                        {
                            if (gac.InstallAssemblyFile(file))
                            {
                                Console.WriteLine("Installed '" + file + "' into the GAC.");
                            }
                        }
                    }
                }
            }
        }
예제 #18
0
 public void GetGacUtilPathTest()
 {
     //  We are running in Visual Studio, therefore we should be able to find
     //  the GacUtil.
     Assert.IsNotNull(GacUtil.GetGacUtilPath(), "Unable to successfully find the gacutil executable.");
 }
예제 #19
0
 public void CanFindExecutableTest()
 {
     //  We are running in Visual Studio, therefore we should be able to find
     //  the GacUtil.
     Assert.AreEqual(GacUtil.CanFindExecutable(), true, "Unable to successfully find the gacutil executable.");
 }
예제 #20
0
 public DllAssembler(Artifact artifact, string sourceFullPath, string destinationFullPath, AssembleOptions options, TaskLoggingHelper log, GacUtil gac)
     :   base(artifact, sourceFullPath, destinationFullPath, options, log)
 {
     m_gac = gac;
 }