本文整理汇总了C#中IEngineContext类的典型用法代码示例。如果您正苦于以下问题:C# IEngineContext类的具体用法?C# IEngineContext怎么用?C# IEngineContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEngineContext类属于命名空间,在下文中一共展示了IEngineContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoadEngineContext
public void LoadEngineContext(IEngineContext context)
{
this.context = context;
this.soundpath = context.Configuration[EngineConfigurationName.SoundsRoot];
this.isloaded = true;
}
开发者ID:NullSoldier,项目名称:Valkyrie,代码行数:7,代码来源:ValkyrieSoundContentManager.cs
示例2: SetAuthCookie
public static void SetAuthCookie(IEngineContext context, User user)
{
var username = user.GetType().FullName + "_" + user.Id;
FormsAuthentication.SetAuthCookie(username, true);
context.CurrentUser = user;
Thread.CurrentPrincipal = user;
}
开发者ID:rlucassen,项目名称:RobtaPayment,代码行数:7,代码来源:AuthenticationHelper.cs
示例3: Init
public void Init()
{
mocks = new MockRepository();
factory = new SparkViewFactory();
engineContext = mocks.CreateMock<IEngineContext>();
server = new MockServerUtility();
request = mocks.CreateMock<IRequest>();
response = mocks.CreateMock<IResponse>();
controller = mocks.CreateMock<IController>();
controllerContext = mocks.CreateMock<IControllerContext>();
routingEngine = mocks.CreateMock<IRoutingEngine>();
output = new StringWriter();
helpers = new HelperDictionary();
propertyBag = new Dictionary<string, object>();
flash = new Flash();
session = new Dictionary<string, object>();
requestParams = new NameValueCollection();
contextItems = new Dictionary<string, object>();
SetupResult.For(engineContext.Server).Return(server);
SetupResult.For(engineContext.Request).Return(request);
SetupResult.For(engineContext.Response).Return(response);
SetupResult.For(engineContext.CurrentController).Return(controller);
SetupResult.For(engineContext.CurrentControllerContext).Return(controllerContext);
SetupResult.For(engineContext.Flash).Return(flash);
SetupResult.For(engineContext.Session).Return(session);
SetupResult.For(engineContext.Items).Return(contextItems);
SetupResult.For(request.Params).Return(requestParams);
SetupResult.For(controllerContext.LayoutNames).Return(new[] { "default" });
SetupResult.For(controllerContext.Helpers).Return(helpers);
SetupResult.For(controllerContext.PropertyBag).Return(propertyBag);
SetupResult.For(routingEngine.IsEmpty).Return(true);
var urlBuilder = new DefaultUrlBuilder(server, routingEngine);
var serviceProvider = mocks.CreateMock<IServiceProvider>();
var viewSourceLoader = new FileAssemblyViewSourceLoader("Views");
SetupResult.For(serviceProvider.GetService(typeof(IViewSourceLoader))).Return(viewSourceLoader);
SetupResult.For(serviceProvider.GetService(typeof(ILoggerFactory))).Return(new NullLogFactory());
SetupResult.For(serviceProvider.GetService(typeof(ISparkViewEngine))).Return(null);
SetupResult.For(serviceProvider.GetService(typeof(IUrlBuilder))).Return(urlBuilder);
SetupResult.For(serviceProvider.GetService(typeof(IViewComponentFactory))).Return(null);
mocks.Replay(serviceProvider);
SetupResult.For(engineContext.GetService(null)).IgnoreArguments().Do(
new Func<Type, object>(serviceProvider.GetService));
factory.Service(serviceProvider);
manager = new DefaultViewEngineManager();
manager.RegisterEngineForExtesionLookup(factory);
manager.RegisterEngineForView(factory);
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:60,代码来源:SparkViewFactoryTests.cs
示例4: Contextualize
/// <summary>
/// Sets the context for the controller
/// </summary>
/// <param name="engineContext">The engine context.</param>
/// <param name="context">The controller context.</param>
public virtual void Contextualize(IEngineContext engineContext, IControllerContext context)
{
this.context = context;
SetEngineContext(engineContext);
renderingSupport = new RenderingSupport(context, engineContext);
isContextualized = true;
}
开发者ID:ralescano,项目名称:castle,代码行数:12,代码来源:Controller.cs
示例5: RedirectToLoginAction
/// <summary>
///
/// </summary>
/// <param name="context"></param>
public static void RedirectToLoginAction(IEngineContext context)
{
// redirect to login or automatically relogin using cookie.
NameValueCollection queryStringParameters = new NameValueCollection();
queryStringParameters.Add("returnUrl", context.Request.Url);
context.Response.Redirect("authentication", "login", queryStringParameters);
}
开发者ID:nshah55,项目名称:storm-the-castle,代码行数:11,代码来源:SecurityUtil.cs
示例6: CreateJSCodeGeneratorInfo
/// <summary>
/// Creates the JS code generator info. Temporarily on IViewEngineManager
/// </summary>
/// <param name="engineContext">The engine context.</param>
/// <param name="controller">The controller.</param>
/// <param name="controllerContext">The controller context.</param>
/// <returns></returns>
public JSCodeGeneratorInfo CreateJSCodeGeneratorInfo(IEngineContext engineContext, IController controller,
IControllerContext controllerContext)
{
var codeGen = new JSCodeGenerator();
return new JSCodeGeneratorInfo(codeGen, new PrototypeGenerator(codeGen), new object[0], new object[0]);
}
开发者ID:Eilon,项目名称:spark,代码行数:14,代码来源:InjectableStubViewEngineManager.cs
示例7: Undo
public void Undo(IEngineContext context)
{
var world = context.WorldManager.GetWorlds().Values.FirstOrDefault();
var map = world.Maps.Values.FirstOrDefault();
map.Map.SetLayerValue(x, y, layer, lastvalue);
}
开发者ID:NullSoldier,项目名称:Griffin,代码行数:7,代码来源:PlaceTileAction.cs
示例8: OnAfterRendering
protected override void OnAfterRendering(IEngineContext context, IController controller,
IControllerContext controllerContext){
if (writeAfterAction){
return;
}
doLog(context);
}
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:7,代码来源:OperationLogFilter.cs
示例9: LoadEngineContext
public void LoadEngineContext(IEngineContext context)
{
if(context != null)
this.worldmanager = context.WorldManager;
this.isloaded = true;
}
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:7,代码来源:ServerCollisionManager.cs
示例10: Perform
public bool Perform(ExecuteWhen exec, IEngineContext context, IController controller, IControllerContext controllerContext)
{
/*
ArrayList admins = new ArrayList();
admins.Add("jpino");
admins.Add("logas");
admins.Add("lmolina");
if (admins.Contains (context.CurrentUser.Identity.Name.ToLower()))
return true;
else {
context.Flash["TypeMsg"] = "alert alert-error";
context.Flash["Msg"] = "Error : No eres admin";
context.Response.RedirectToUrl ("/");
return false;
}
*/
if (context.CurrentUser.IsInRole ("admin"))
return true;
else {
context.Flash["TypeMsg"] = "alert alert-error";
context.Flash["Msg"] = "Error : No eres admin";
context.Response.RedirectToUrl ("/");
return false;
}
}
开发者ID:joil,项目名称:Compras,代码行数:28,代码来源:AdminFilter.cs
示例11: LoadContent
public void LoadContent(GraphicsDevice graphicsDevice, IEngineContext context)
{
this.context = context;
this.startpoint = GetNegativeOne();
this.endpoint = GetNegativeOne();
}
开发者ID:NullSoldier,项目名称:Griffin,代码行数:7,代码来源:RectangleComponent.cs
示例12: OnAfterRendering
protected override void OnAfterRendering(IEngineContext context, IController controller,
IControllerContext controllerContext){
var mvc = MvcContext.Create((Controller) controller);
var logname = acl.token(mvc).Replace("/", ".").Substring(1);
var log = logger.get(logname);
log.info(() => myapp.usrName + "\t\tAFTER_RENDER:\t" + acl.token(mvc));
}
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:7,代码来源:LogFilter.cs
示例13: CalculateParamPoints
/// <summary>
/// Calculates the param points. Implementers should return value equals or greater than
/// zero indicating whether the parameter can be bound successfully. The greater the value (points)
/// the more successful the implementation indicates to the framework
/// </summary>
/// <param name="context">The context.</param>
/// <param name="controller">The controller.</param>
/// <param name="controllerContext">The controller context.</param>
/// <param name="parameterInfo">The parameter info.</param>
/// <returns>
/// </returns>
public int CalculateParamPoints(IEngineContext context, IController controller, IControllerContext controllerContext, ParameterInfo parameterInfo)
{
var token = context.Request[parameterName];
if (CanConvert(parameterInfo.ParameterType, token))
return 10;
return 0;
}
开发者ID:kenegozi,项目名称:openuni,代码行数:18,代码来源:BindFromAttribute.cs
示例14: ActionManager
public ActionManager(IEngineContext context)
{
undo = new Stack<IUserAction>();
redo = new Stack<IUserAction>();
this.context = context;
}
开发者ID:NullSoldier,项目名称:Griffin,代码行数:7,代码来源:ActionManager.cs
示例15: Trigger
public void Trigger(BaseCharacter character, IEngineContext context)
{
String worldname = this.Parameters["World"];
String pos = this.Parameters["EntryPointName"];
IMapEvent tmpevent = null;
MapHeader tmpheader = null;
foreach(MapHeader header in context.WorldManager.GetWorld(worldname).Maps.Values)
{
tmpevent = context.EventProvider.GetMapsEvents(header.Map).Where( m => m.GetStringType() == "EntryPoint" && m.Parameters["Name"] == pos).FirstOrDefault();
if(tmpevent != null)
{
tmpheader = header;
break;
}
}
if(tmpevent == null || tmpheader == null)
return;
context.MovementProvider.EndMove (character, false, true);
character.WorldName = worldname;
character.Location = new MapPoint (tmpevent.Rectangle.X + tmpheader.MapLocation.X,
tmpevent.Rectangle.Y + tmpheader.MapLocation.Y).ToScreenPoint ();
character.CurrentMap = null;
context.SceneProvider.Cameras["camera1"].CenterOnCharacter (character);
}
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:30,代码来源:LoadEvent.cs
示例16: GetNav
public NavData GetNav(IEngineContext context, string section)
{
Logger.Debug("Getting nav for {0}", section);
if (section == "navigation")
{
return new NavData
{
Items = new[]
{
Item(context, "Home", "home", "index"),
Item(context, "About", "home", "about"),
Item(context, "Login", "account", "login")
}
};
}
if (section == "contents")
{
return new NavData
{
Items = new[]
{
Item(context, "Products", "products", "index"),
Item(context, "About", "home", "about"),
Item(context, "Contact Us", "home", "contact"),
Item(context, "Register", "account", "register")
}
};
}
throw new ApplicationException("Unknown nav section " + section);
}
开发者ID:Eilon,项目名称:spark,代码行数:33,代码来源:NavProvider.cs
示例17: AddComment
public AddComment(NewsPost post, Comment comment, IEngineContext context)
{
this.post = post;
this.comment = comment;
this.context = context;
this.context = context;
}
开发者ID:Tigraine,项目名称:ic-website,代码行数:7,代码来源:AddComment.cs
示例18: doLog
private void doLog(IEngineContext context){
if (waserror){
return;
}
try{
var conversation = myapp.conversation.Current;
var stopwatch = conversation.Data[_stopwatch] as DateRange;
stopwatch.Finish = DateTime.Now;
conversation.Data.Remove(_stopwatch);
var log = storage.New();
log.Range = stopwatch;
log.Elapsed = (int) (stopwatch.Finish - stopwatch.Start).TotalMilliseconds;
log.Usr = myapp.usrName;
log.System = context.Request.Uri.GetLeftPart(UriPartial.Path).find(@"^\w+://[^/]+?/\w+");
log.Url = context.Request.Url;
prepareLogEntry(log, context);
using (var s = new TemporaryTransactionSession()){
storage.Save(log);
s.Commit();
}
}
catch (Exception ex){
logger.get("comdiv.sys").Error("operation log error", ex);
waserror = true;
}
}
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:27,代码来源:OperationLogFilter.cs
示例19: Authenticate
public static User Authenticate(IEngineContext context)
{
var cookieText = context.Request.ReadCookie(FormsAuthentication.FormsCookieName);
if (string.IsNullOrEmpty(cookieText))
{
return null;
}
if (context.CurrentUser.Identity.IsAuthenticated == false)
throw new SecurityException("Er is geen gebruiker ingelogd");
int userId;
var name = context.CurrentUser.Identity.Name;
name = name.Replace(typeof(User).FullName + "_", string.Empty);
var result = int.TryParse(name, out userId);
if (result == false)
{
throw new SecurityException("De gebruikersidentificatie is niet geldig");
}
var user = User.Find(userId);
if (user == null)
{
throw new SecurityException("Deze gebruiker staat niet in de database");
}
context.CurrentUser = user;
Thread.CurrentPrincipal = user;
return user;
}
开发者ID:rlucassen,项目名称:RobtaPayment,代码行数:34,代码来源:AuthenticationHelper.cs
示例20: InvokeNext
/// <summary>
/// Invokes the next handler.
/// </summary>
/// <param name="context">The context.</param>
protected void InvokeNext(IEngineContext context)
{
if (nextHandler != null)
{
nextHandler.Process(context);
}
}
开发者ID:ralescano,项目名称:castle,代码行数:11,代码来源:AbstractExceptionHandler.cs
注:本文中的IEngineContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论