public void ImportPowerModule(string name, bool noCache) { string moduleScript = PowerWebPartHelper.LoadPowerModule(name, noCache); if (moduleScript == null) { throw new PowerControlException("ImportPowerModule", new FileNotFoundException("Module could not be found!")); } try { Pipeline tmpPipe = CreatePipeline(); tmpPipe.Commands.AddScript(moduleScript.Trim()); InvokePipeline(tmpPipe, false); tmpPipe = CreatePipeline(); tmpPipe.Commands.AddScript("get-childitem function:\\"); Collection <PSObject> result = InvokePipeline(tmpPipe, false); foreach (PSObject obj in result) { FunctionInfo func = (FunctionInfo)obj.BaseObject; if (functions.ContainsKey(func.Name.ToLower()) == false) { functions.Add(func.Name.ToLower(), func); } } } catch (Exception ex) { powerWebPartException = new PowerControlException("ImportPowerModule", ex); } }
public void LoadAssembly(string name, bool noCache) { byte[] bin = PowerWebPartHelper.GetFileFromPowerLibraryAsBytes(name + ".dll", noCache); if (bin == null) { throw new FileNotFoundException("Assembly " + name + " not found!"); } Assembly.Load(bin); }
public void VerifySignature() { PowerWebPartHelper.VerifySignature(Script + DebugUrl, Signing); }
public void VerifyEditorSignature() { PowerWebPartHelper.VerifySignature(EditorScript, EditorSigning); }
public void SignEditor() { EditorSigning = PowerWebPartHelper.CreateSignature(EditorScript); }
public void Sign() { Signing = PowerWebPartHelper.CreateSignature(Script + DebugUrl); }