本文整理汇总了C#中ModuleInfo类的典型用法代码示例。如果您正苦于以下问题:C# ModuleInfo类的具体用法?C# ModuleInfo怎么用?C# ModuleInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleInfo类属于命名空间,在下文中一共展示了ModuleInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadModule
/// <summary>Inherited</summary>
public void LoadModule(ModuleInfo moduleInfo)
{
var assembly = LoadAssembly(moduleInfo);
var bootstraper = CreateBootstraper(assembly);
ExecuteOnLoad(bootstraper);
RegisterModule(moduleInfo, bootstraper);
}
示例2: BeginLoadModuleType
/// <summary>
/// Starts retrieving the <paramref name="moduleInfo"/> and calls the <paramref name="callback"/> when it is done.
/// </summary>
/// <param name="moduleInfo">Module that should have it's type loaded.</param>
/// <param name="callback">Delegate to be called when typeloading process completes or fails.</param>
public void BeginLoadModuleType(ModuleInfo moduleInfo, ModuleTypeLoadedCallback callback)
{
Uri uriRef = new Uri(moduleInfo.Ref, UriKind.RelativeOrAbsolute);
lock (this.typeLoadingCallbacks)
{
ModuleTypeLoaderCallbackMetadata callbackMetadata = new ModuleTypeLoaderCallbackMetadata { Callback = callback, ModuleInfo = moduleInfo };
List<ModuleTypeLoaderCallbackMetadata> callbacks;
if (this.typeLoadingCallbacks.TryGetValue(uriRef, out callbacks))
{
callbacks.Add(callbackMetadata);
return;
}
this.typeLoadingCallbacks[uriRef] = new List<ModuleTypeLoaderCallbackMetadata> { callbackMetadata };
}
IFileDownloader downloader = this.CreateDownloader();
downloader.DownloadCompleted += this.OnDownloadCompleted;
try
{
downloader.DownloadAsync(uriRef, uriRef);
}
catch (Exception ex)
{
throw new Exception(string.Format("Module download from failed : {0}", uriRef), ex);
}
}
示例3: ContextSecurity
public ContextSecurity(ModuleInfo objModule)
{
UserId = UserController.Instance.GetCurrentUserInfo().UserID;
CanView = ModulePermissionController.CanViewModule(objModule);
CanEdit = ModulePermissionController.HasModulePermission(objModule.ModulePermissions, "EDIT");
IsAdmin = PortalSecurity.IsInRole(PortalSettings.Current.AdministratorRoleName);
}
示例4: CanAddContentToPage
private static bool CanAddContentToPage(ModuleInfo objModule)
{
bool canManage = Null.NullBoolean;
TabInfo objTab = new TabController().GetTab(objModule.TabID, objModule.PortalID, false);
canManage = TabPermissionController.CanAddContentToPage(objTab);
return canManage;
}
示例5: DeviceInfo
//helper for simple devices
public DeviceInfo(
int id,
string deviceName,
string spriteName,
string promoterName,
float productionMax,
float terminatorFactor,
string formula,
string product,
float rbs)
{
ModuleInfo moduleInfo = new ModuleInfo(
"pLac",
10.0f,
1.0f,
"![0.8,2]LacI",
"GFP",
1.0f
);
List<ModuleInfo> modules = new List<ModuleInfo>();
modules.Add(moduleInfo);
_id = id;
_name = deviceName;
_spriteName = spriteName;
_modules = modules;
}
示例6: Add
public bool Add(ModuleInfo entity)
{
T_PF_MODULEINFO model = entity.CloneObject<T_PF_MODULEINFO>(new T_PF_MODULEINFO());
model = Utility.CreateCommonProperty().CloneObject<T_PF_MODULEINFO>(model);
return _commonDAL.Add(model);
}
示例7: AddContent
private static void AddContent(XmlNode nodeModule, ModuleInfo objModule)
{
XmlAttribute xmlattr;
if (!String.IsNullOrEmpty(objModule.DesktopModule.BusinessControllerClass) && objModule.DesktopModule.IsPortable)
{
try
{
object objObject = Framework.Reflection.CreateObject(objModule.DesktopModule.BusinessControllerClass, objModule.DesktopModule.BusinessControllerClass);
if (objObject is IPortable)
{
string Content = Convert.ToString(((IPortable)objObject).ExportModule(objModule.ModuleID));
if (!String.IsNullOrEmpty(Content))
{
XmlNode newnode = nodeModule.OwnerDocument.CreateElement("content");
xmlattr = nodeModule.OwnerDocument.CreateAttribute("type");
xmlattr.Value = Globals.CleanName(objModule.DesktopModule.ModuleName);
newnode.Attributes.Append(xmlattr);
xmlattr = nodeModule.OwnerDocument.CreateAttribute("version");
xmlattr.Value = objModule.DesktopModule.Version;
newnode.Attributes.Append(xmlattr);
Content = HttpContext.Current.Server.HtmlEncode(Content);
newnode.InnerXml = XmlUtils.XMLEncode(Content);
nodeModule.AppendChild(newnode);
}
}
}
catch
{
}
}
}
示例8: load_modules_only_loads_modules_that_pass_filter
public void load_modules_only_loads_modules_that_pass_filter()
{
var a = new ModuleInfo("a", _moduleManifestMock.Object);
var b = new ModuleInfo("b", _moduleManifestMock.Object);
var expectedModuleInfos = new[]
{
a, b
};
var discoveryMock = new Mock<IModuleDiscovery>(MockBehavior.Loose);
discoveryMock.Setup(discovery => discovery.GetModules())
.Returns(expectedModuleInfos);
var filterMock = new Mock<IModuleFilter>(MockBehavior.Loose);
filterMock.Setup(filter => filter.Matches(a))
.Returns(true);
filterMock.Setup(filter => filter.Matches(b))
.Returns(false);
var loaderMock = new Mock<IModuleLoader>(MockBehavior.Strict);
loaderMock.Setup(x => x.GetLoadedModules()).Returns(new List<ModuleInfo>());
loaderMock.Setup(loader => loader.LoadModule(a));
var moduleManager = new ModuleManager(loaderMock.Object, filterMock.Object,
_dependencyMock.Object);
moduleManager.LoadModules(discoveryMock.Object);
loaderMock.Verify(x => x.LoadModule(a));
loaderMock.Verify(x => x.LoadModule(It.IsAny<ModuleInfo>()), Times.Exactly(1));
}
示例9: ExtractAll
public static void ExtractAll(string path, string projectName)
{
if (!Directory.Exists(Path.Combine(path, "Projects")))
Directory.CreateDirectory(Path.Combine(path, "Projects"));
var module = new ModuleInfo { Name = projectName };
module.Save(Path.Combine(path, "Module.xml"));
}
示例10: BeginLoadModuleType
/// <summary>
/// Starts retrieving the <paramref name="moduleInfo"/> and calls the <paramref name="callback"/> when it is done.
/// </summary>
/// <param name="moduleInfo">Module that should have it's type loaded.</param>
/// <param name="callback">Delegate to be called when typeloading process completes or fails.</param>
public void BeginLoadModuleType(ModuleInfo moduleInfo, ModuleTypeLoadedCallback callback)
{
Uri uriRef = new Uri(moduleInfo.Ref, UriKind.RelativeOrAbsolute);
lock (this.typeLoadingCallbacks)
{
ModuleTypeLoaderCallbackMetadata callbackMetadata = new ModuleTypeLoaderCallbackMetadata()
{
Callback = callback,
ModuleInfo = moduleInfo
};
List<ModuleTypeLoaderCallbackMetadata> callbacks;
if (this.typeLoadingCallbacks.TryGetValue(uriRef, out callbacks))
{
callbacks.Add(callbackMetadata);
return;
}
this.typeLoadingCallbacks[uriRef] = new List<ModuleTypeLoaderCallbackMetadata> { callbackMetadata };
}
IFileDownloader downloader = this.CreateDownloader();
downloader.DownloadCompleted += this.OnDownloadCompleted;
downloader.DownloadAsync(uriRef, uriRef);
}
示例11: Open
public static void Open(ModuleInfo root, object obj, Action update)
{
var definitionInfo = obj as DefinitionInfo;
var moduleInfo = obj as ModuleInfo;
if (definitionInfo != null)
{
// Open XML in editor.
Process.Start("monodevelop", definitionInfo.DefinitionPath);
}
if (moduleInfo != null)
{
// Start the module's Protobuild unless it's also our
// module (for the root node).
if (moduleInfo.Path != root.Path)
{
var info = new ProcessStartInfo
{
FileName = System.IO.Path.Combine(moduleInfo.Path, "Protobuild.exe"),
WorkingDirectory = moduleInfo.Path
};
var p = Process.Start(info);
p.EnableRaisingEvents = true;
p.Exited += (object sender, EventArgs e) => update();
}
}
}
示例12: update_list_closes_the_cycle_with_additional_module
public void update_list_closes_the_cycle_with_additional_module()
{
/*
* Local:
* A(v1) v1-> B(v1) v1 -> C(v1)
*
* Remote:
* C(v2) v2-> D(v2) v0-> A(v1) from local
*
* Result: failure
*/
ModuleInfo c1;
ModuleInfo a1;
ModuleInfo b1;
PrepareChainWithVersion(_v1, out a1, out b1, out c1);
ModuleInfo c2 = SetUpModuleInfoWithVersion("C", _v2,
new KeyValuePair<string, Version>("D", _v2));
ModuleInfo d2 = SetUpModuleInfoWithVersion("D", _v2,
new KeyValuePair<string, Version>("A", _v0));
Modules = new[] {a1, b1, c1};
_updateModules = new[] {c2, d2};
// FIXME: should it be empty list ? or we should put what ?
ExpectedModules = new ModuleInfo[] {};
PerformTest();
Assert.IsFalse(_resultBool);
Assert.AreEqual(ExpectedModules, _resultNonValidModules);
}
示例13: Parse
public ModuleInfo Parse(string script)
{
var alreadyModuleDef = Regex.Match(script, "^require.define\\(", RegexOptions.Singleline);
var directiveHeader = Regex.Match(script, "^[\"'](.*)[\"'];\r?\n", RegexOptions.Singleline);
if (alreadyModuleDef.Success || !directiveHeader.Success) return new ModuleInfo() { Content = script, Dependencies = new List<string>(), Packaged = true };
var directives = directiveHeader.Groups[1].Value.Split(';');
var moduleInfo = new ModuleInfo();
foreach (var directive in directives)
{
var parts = directive.Split(':');
var name = parts[0].Trim();
var value = parts[1].Trim();
if (name == "depends")
{
if (value.Length > 0)
moduleInfo.Dependencies.AddRange(value.Split(new char[] { ',' }).Select(v => v.Trim()));
}
if (name == "provides")
{
moduleInfo.Name = value;
}
}
moduleInfo.Content = script.Substring(directiveHeader.Index + directiveHeader.Value.Length, script.Length - directiveHeader.Value.Length);
return moduleInfo;
}
示例14: RhModule
public RhModule(RhRuntime runtime, ModuleInfo module)
{
m_runtime = runtime;
m_name = string.IsNullOrEmpty(module.FileName) ? "" : Path.GetFileNameWithoutExtension(module.FileName);
m_filename = module.FileName;
m_imageBase = module.ImageBase;
m_size = module.FileSize;
}
示例15: GetManifest
/// <summary>
/// Inherited.
/// </summary>
public ModuleManifest GetManifest(ModuleInfo moduleInfo)
{
var manifestPath = string.Format("{0}{1}", moduleInfo.AssemblyPath,
ModuleManifest.ManifestFileNameSuffix);
var manifest = File.ReadAllBytes(manifestPath);
return
XmlSerializerHelper.Deserialize<ModuleManifest>(manifest);
}