Esempio n. 1
0
        void ct_NameChanged(object sender, NameChangeArgs e)
        {
            if (_modelComplexTypes.ContainsKey(e.OldName))
            {
                _modelComplexTypes.Remove(e.OldName);
                _modelComplexTypes.Add(e.NewName, (ModelComplexType)sender);
            }

            //update all entity type member properties referencing the complex type...
            foreach (ModelMemberProperty mmp in EntityTypes.SelectMany(et => et.MemberProperties.Where(mp => mp.TypeName == this.Namespace + "." + e.OldName)))
            {
                mmp.TypeName = e.NewName;
            }

            //update all complex type member properties referencing the complex type...
            foreach (ModelMemberProperty mmp in ComplexTypes.SelectMany(ct => ct.MemberProperties.Where(mp => mp.TypeName == this.Namespace + "." + e.OldName)))
            {
                mmp.TypeName = e.NewName;
            }
        }
Esempio n. 2
0
        private int OnExecute(CommandLineApplication app)
        {
            TextWriter output = System.Console.Out;
            bool       outputDirectorySpecified = !String.IsNullOrEmpty(OutputDirectory);

            try {
                if (CreateCompilableProjectFlag)
                {
                    DecompileAsProject(InputAssemblyName, OutputDirectory, ReferencePaths);
                }
                else if (EntityTypes.Any())
                {
                    var values = EntityTypes.SelectMany(v => v.Split(',', ';')).ToArray();
                    HashSet <TypeKind> kinds = TypesParser.ParseSelection(values);
                    if (outputDirectorySpecified)
                    {
                        string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
                        output = File.CreateText(Path.Combine(OutputDirectory, outputName) + ".list.txt");
                    }

                    ListContent(InputAssemblyName, output, kinds, ReferencePaths);
                }
                else if (ShowILCodeFlag)
                {
                    if (outputDirectorySpecified)
                    {
                        string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
                        output = File.CreateText(Path.Combine(OutputDirectory, outputName) + ".il");
                    }

                    ShowIL(InputAssemblyName, output, ReferencePaths);
                }
                else if (CreateDebugInfoFlag)
                {
                    string pdbFileName = null;
                    if (outputDirectorySpecified)
                    {
                        string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
                        pdbFileName = Path.Combine(OutputDirectory, outputName) + ".pdb";
                    }
                    else
                    {
                        pdbFileName = Path.ChangeExtension(InputAssemblyName, ".pdb");
                    }

                    return(GeneratePdbForAssembly(InputAssemblyName, pdbFileName, ReferencePaths, app));
                }
                else if (ShowVersion)
                {
                    string vInfo = "ilspycmd: " + typeof(ILSpyCmdProgram).Assembly.GetName().Version.ToString() +
                                   Environment.NewLine
                                   + "ICSharpCode.Decompiler: " +
                                   typeof(FullTypeName).Assembly.GetName().Version.ToString();
                    output.WriteLine(vInfo);
                }
                else
                {
                    if (outputDirectorySpecified)
                    {
                        string outputName = Path.GetFileNameWithoutExtension(InputAssemblyName);
                        output = File.CreateText(Path.Combine(OutputDirectory,
                                                              (String.IsNullOrEmpty(TypeName) ? outputName : TypeName) + ".decompiled.cs"));
                    }

                    Decompile(InputAssemblyName, output, ReferencePaths, TypeName);
                }
            } catch (Exception ex) {
                app.Error.WriteLine(ex.ToString());
                return(ProgramExitCodes.EX_SOFTWARE);
            } finally {
                output.Close();
            }

            return(0);
        }