示例#1
0
		internal static void RefreshList()
		{
			list.Clear();

            IOTAProjectGroup _ProjectGroup = OtaUtils.GetCurrentProjectGroup();

            if (_ProjectGroup != null) {
                for (int j= 0; j < _ProjectGroup.ProjectCount; j++) {
                    IOTAProject _Project = _ProjectGroup[j];

                    for (int k = 0; k < _Project.ModuleCount; k++) {
                        IOTAModuleInfo _ModuleInfo = _Project.GetModuleInfo(k);
                        // TODO: what if the file is required by a certain project? not only the first project including it.
                        if (!IsValidModuleInfo(_ModuleInfo)) {
                            continue;
                        }
                        string key = _ModuleInfo.FileName.ToUpperInvariant();
                        if (list.ContainsKey(key))
                        {
                            list[key].ProjectFileName += ";" + _Project.FileName;
                        }
                        else
                        {
                            ModuleFileInfo _ModuleFileInfo = new ModuleFileInfo();
                            _ModuleFileInfo.ProjectFileName = _Project.FileName;
                            //_ModuleFileInfo.IsPartOfActiveProject = _Project == _ProjectGroup.ActiveProject;
                            _ModuleFileInfo.Tag = _ModuleInfo;
                            list.Add(_ModuleInfo.FileName.ToUpperInvariant(), _ModuleFileInfo);
                        }
                    }
                }
            }
		}
示例#2
0
		internal override bool IsSatisfiedBy(ModuleFileInfo file) {
			if (String.IsNullOrEmpty(name))
			{
				return true;
			} else {
				return Path.GetFileName(file.FileName).IndexOf(name, StringComparison.OrdinalIgnoreCase) > -1;
            }
        }
示例#3
0
		internal override bool IsSatisfiedBy(ModuleFileInfo file) {
			if (project == AnyProject) {
				return true;
			} else if (project == ActiveProject) {
				return file.IsPartOfActiveProject;
            } else {
				return file.ProjectFileName.Contains(project);
            }
		}
示例#4
0
        private static bool IsForm(ModuleFileInfo file) {
        	#region Approach One: fails because of an OTA bug.
			// this approach cannot show all files. Some forms and user controls give null, too.
//			IOTAModuleInfo info = (IOTAModuleInfo)file.Tag;
//			LoggingService.Info(file.FileName + " gives " +
//				info.DesignClassName);
//			if (String.IsNullOrEmpty(info.DesignClassName))
//			{
//				return false;
//			} else {
//				return true;
//			}
			#endregion
			#region Approach Two: too slow.
			/* if (IsAssembly(file))
			{
				// prevent them from opening.
				return false;
			}
			// method 1 will open the module:
			// IOTAModule module = info.OpenModule();
			// method 2 will open the file and make it invisible.
			IOTAModule module = OTAUtils.GetModuleServices().OpenModule(file.FileName);
			if (module == null)
			{
				return false;
			}
			IOTADotNetModule dotNet = module.GetService(typeof(IOTADotNetModule))
									  as IOTADotNetModule;
			if (dotNet == null) {
				return false;  // not .NET module.
			}
			if (dotNet.HasDesignableType) {
				return true;
			}
			return false;
			//*/
			#endregion
			// if .resx exists and a source file with the same name, it may be a Form or User Controls.
			// There might be few exceptions.
			string ext = Path.GetExtension(file.FileName);
			if (String.IsNullOrEmpty(ext)
                || ext.ToUpperInvariant() == ".RESX")
			{
				return false;
			}
            string resxFileName = Path.ChangeExtension(file.FileName, ".resx");
            string nfmFileName = Path.ChangeExtension(file.FileName, ".nfm");
            string dfmFileName = Path.ChangeExtension(file.FileName, ".dfm");
			if (File.Exists(resxFileName) || File.Exists(nfmFileName) || File.Exists(dfmFileName)) {
				return true;
			} else {
                return false;
            }
		}
示例#5
0
        internal override bool IsSatisfiedBy(ModuleFileInfo file) {
			if (!File.Exists(file.FileName))
			{
                return false;
            }
			switch (type) {
            case ModuleType.All:
                return true;
            case ModuleType.Assemblies:
                return IsAssembly(file);
            case ModuleType.Forms:
                return IsForm(file);
            case ModuleType.Sources:
                return IsSource(file);
            default:
                return false;
            }
        }
示例#6
0
		private static bool IsAssembly(ModuleFileInfo file) {
            return Path.GetExtension(file.FileName).ToUpperInvariant() == ".DLL";
        }
示例#7
0
 private static bool IsSource(ModuleFileInfo file) {
 	return OtaUtils.IsSourceFile(file.FileName);
 }
示例#8
0
		internal abstract bool IsSatisfiedBy(ModuleFileInfo file);
示例#9
0
		internal override bool IsSatisfiedBy(ModuleFileInfo file) {
			return spec1.IsSatisfiedBy(file) && spec2.IsSatisfiedBy(file);
		}
示例#10
0
		private static ListViewItem CreateListViewItem(ModuleFileInfo item) {
			ModuleFileInfo _ModuleFileInfo = item;
            IOTAModuleInfo _ModuleInfo = (IOTAModuleInfo) _ModuleFileInfo.Tag;

            ListViewItem _ListViewItem = new ListViewItem();

            _ListViewItem.Text = Path.GetExtension(_ModuleInfo.FileName);
            _ListViewItem.SubItems.Add(Path.GetFileName(_ModuleInfo.FileName));
            _ListViewItem.SubItems.Add(Path.GetDirectoryName(_ModuleInfo.FileName));
            _ListViewItem.ImageIndex = _ModuleFileInfo.ImageIndex;
            _ListViewItem.Tag = item;

            return _ListViewItem;
		}
示例#11
0
		private static void NavigateTo(ModuleFileInfo item) {
			IOTAModuleInfo _ModuleInfo = (IOTAModuleInfo)item.Tag;
            IOTAModule _Module = _ModuleInfo.OpenModule();

            if (_Module != null) {
                _Module.ShowFileName(_ModuleInfo.FileName);
			}
        }