示例#1
0
        private static TypeDefinition FindBaseTypeDefinition(TypeReference type, string name)
        {
            if (type == null || type.Module == null) return null;
            TypeDefinition typeDefinition = null;

            string fileName = new FileInfo(type.Module.FullyQualifiedName).DirectoryName + "\\" + type.Scope.Name;
            if (!fileName.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase))
            {
                fileName += ".dll";
            }
            var md = ModuleDefinition.ReadModule(fileName);
            if (md != null && md.Assembly != null)
            {
                AssemblyDefinition ad = md.Assembly;
                typeDefinition = ad.MainModule.GetType(type.Namespace, type.Name);
            }
            if (typeDefinition != null)
            {
                typeDefinition = typeDefinition.Resolve();
                if (string.Equals(typeDefinition.Name, name, StringComparison.CurrentCultureIgnoreCase))
                {
                    return typeDefinition;
                }
                if (typeDefinition.BaseType != null)
                {
                    return FindBaseTypeDefinition(typeDefinition.BaseType, name);
                }
            }
            return typeDefinition;
        }
示例#2
0
        public ProjectForm()
        {
            InitializeComponent();
			string lastFile = Options.GetInstance().LastProject;
            if(lastFile != null)
            {
                string dir = new FileInfo(lastFile).Directory.FullName;
                txtPath.Text = dir + (dir.EndsWith("\\") ? "" : "\\") + "NewProject1.jsb";
            }
            else
            {
                string dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal).ToString();
                txtPath.Text = dir + (dir.EndsWith("\\") ? "" : "\\") + "NewProject1.jsb";
            }
            txtName.Text = "New Project 1";
        }
示例#3
0
        public void WriteLineToSubLog(String iRelativePath, MessageType iType, String iLine, params Object[] iArgs)
        {
            if (cSWrOutput != null)
            {
                if (cMTeTypes.HasFlag(iType))
                {
                    Mutex pMutMutex = new Mutex(false, iRelativePath.EncodeHex());
                    try
                    {
                        pMutMutex.WaitOne();
                        if (iArgs != null && iArgs.Length > 0)
                            iLine = String.Format(iLine, iArgs);
                        cSWrOutput.WriteLine(DateTime.UtcNow.ToString() + " :: " + iType.ToString().ToUpper() + " :: " + iLine);
                        String pStrMessage = DateTime.UtcNow.ToString() + " :: " + iType.ToString().ToUpper() + " :: " + iLine;

                        String pStrPath = new FileInfo(FullPath).Directory.FullName;
                        if (!pStrPath.EndsWith("\\"))
                            pStrPath += "\\";
                        iRelativePath = iRelativePath.TrimStart(new Char[] { '\\' });
                        pStrPath += iRelativePath;
                        new FileInfo(pStrPath).Directory.Create();
                        File.AppendAllText(pStrPath, pStrMessage + "\r\n");
                    }
                    finally
                    {
                        pMutMutex.ReleaseMutex();
                        pMutMutex.Dispose();
                    }
                }
            }
        }