/// <summary>Escreve informações sobre a Cache</summary> private void writeCacheInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_cache_title") + "</b></div>"); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Cache.Count + "</b><br />"); writer.WriteLine("<b>" + info.getContent("stats_cache_content") + "</b><br />"); writer.WriteLine("<table class='stats_cache_items' >"); foreach (DictionaryEntry item in Page.Cache) { if (item.Key.ToString().StartsWith("@@")) { continue; } writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item.Key.ToString()); writer.WriteLine("<td>{0}</td>", item.Value.ToString()); writer.WriteLine("<td><a href='javascript:{1}'><img src='{0}' /></a></td>", OrionGlobals.getCommonImagePath("remove.gif"), "deleteCache(\"" + item.Key.ToString() + "\")" ); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
public Scenario(ILanguageInfo info, string name, string description, BlockSteps scenarioSteps, Examples examples, IList <IGherkinComment> comments) : base(info, GherkinKeyword.ScenarioOutline, name, description) { this.Steps = scenarioSteps ?? new BlockSteps(); this.Examples = examples ?? new Examples(); this.Comments = comments; }
public ModelType(ModelAssembly assembly, Type runtimeType, ILanguageInfo languageInfo) { this.assembly = assembly; this.runtimeType = runtimeType; this.languageInfo = languageInfo; this.methods = new List<ModelMethod>(); this.assembly.Types.Add(this); }
public ModelMethod(ModelType type, MethodBase methodBase, ILanguageInfo languageInfo) { this.callsMethods = new MethodCallsList(this); this.type = type; this.languageInfo = languageInfo; this.methodBase = methodBase; this.type.Methods.Add(this); }
public static string GetLanguageEnglishName(this ILanguageInfo languageInfo) { if (languageInfo is EawModinfo.Model.LanguageInfo lang) { return(lang.Culture.EnglishName); } return(new CultureInfo(languageInfo.Code).EnglishName); }
/// <summary> /// Initializes a new instance of the <see cref="GherkinLexer"/> class. /// </summary> /// <param name="sourceFilePath">The source file path.</param> /// <param name="featureFileReader">The feature file reader.</param> public GherkinLexer(string sourceFilePath, TextReader featureFileReader) { this.sourceFilePath = sourceFilePath; var contents = featureFileReader.ReadToEnd(); this.language = Internationalization.SetDefault().TryParse(contents); this.featureFileReader = new StringReader(contents); }
public ModelType(ModelAssembly assembly, Type runtimeType, ILanguageInfo languageInfo) { this.assembly = assembly; this.runtimeType = runtimeType; this.languageInfo = languageInfo; this.methods = new List <ModelMethod>(); this.assembly.Types.Add(this); }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { ILanguageInfo info = CultureModule.getLanguage(); Hashtable questions = info.getTargetHash("faq"); writeIndex(writer, questions); writeContent(writer, questions); }
protected override object Convert(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { ImageSource source = value as ImageSource; if (source == null) return Visibility.Collapsed; else { return Visibility.Visible; } }
protected override object Convert(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { double percent = 100; if (parameter != null && value is bool && double.TryParse(parameter as string, out percent)) return (bool)value ? percent / 100.0 : 1.0; return value; }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); mailValidator.ErrorMessage = LoginControl.getError("validators_invalidMailFormat"); resetButton.Text = info.getContent("reset_button"); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_resetpassword")); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("login"); passValidator.ErrorMessage = getError("provide-password"); userValidator.ErrorMessage = getError("provide-mail"); mailValidator.ErrorMessage = getError("bad-mail-format"); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); mailValidator.ErrorMessage = LoginControl.getError("validators_invalidMailFormat"); resetButton.Text = info.getContent("reset_button"); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_resetpassword")); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("login"); passValidator.ErrorMessage = getError("provide-password"); userValidator.ErrorMessage = getError("provide-mail"); mailValidator.ErrorMessage = getError("bad-mail-format"); }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { EnableViewState = false; Universe universe = Universe.instance; ILanguageInfo info = CultureModule.getLanguage(); ChronosStats stats = (ChronosStats)Page.Application["ChronosStats"]; writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_title") + "</b></div>"); writer.WriteLine(info.getContent("stats_alliances") + "<b>: " + (universe.allianceCount - 1) + "</b><br />"); writer.WriteLine(info.getContent("stats_rulers") + ": <b>" + universe.rulerCount + "</b><br />"); int maxP = Coordinate.MaximumGalaxies * Coordinate.MaximumSystems * Coordinate.MaximumSectors * Coordinate.MaximumPlanets; writer.WriteLine(info.getContent("stats_planets") + ": <b>" + universe.planetCount + "/" + maxP + "</b><br />"); writer.WriteLine(info.getContent("stats_nextCoordinate") + ": <b>" + universe.CurrentCoordinate + "</b><br />"); writer.WriteLine("<div>--</div>"); writer.WriteLine(info.getContent("stats_timeFromLastReboot") + ": <b>" + stats.StartTime + "</b><br />"); writer.WriteLine("Dress Up: <b>" + stats.DressUp + "</b><br />"); writer.WriteLine(info.getContent("stats_lastTurnTime") + ": <b>" + stats.LastTurnTime + "</b><br />"); writer.WriteLine(info.getContent("stats_turnSinceReboot") + ": <b>" + stats.TurnCount + "</b><br />"); writer.WriteLine(info.getContent("stats_totalTurns") + ": <b>" + universe.TurnCount + "</b><br />"); writer.WriteLine(info.getContent("stats_turnTime") + ": <b>" + universe.TurnTime + "</b><br />"); writer.WriteLine(info.getContent("stats_lastTurn") + ": <b>" + stats.LastTurn.ToLongTimeString() + "</b><br />"); writer.WriteLine(info.getContent("stats_nextTurn") + ": <b>" + stats.LastTurn.AddMilliseconds(universe.TurnTime).ToLongTimeString() + "</b><br />"); if (Universe.instance.Persistence is UniverseSerializer) { writer.WriteLine("Stream Size: <b>" + (((UniverseSerializer)Universe.instance.Persistence).StreamSize / 1024) + " Kb</b><br />"); } writer.WriteLine("<div>--</div>"); writer.WriteLine(info.getContent("stats_persistence") + ": <b>" + Chronos.Persistence.UniverseSerializer.Instance.GetType().Name + "</b><br />"); writer.WriteLine("<div>--</div>"); writer.WriteLine("<b>Alnitak: </b><br/>{0}<p/>", OrionGlobals.AlnitakInfo.Replace(";", "<br/>")); writer.WriteLine("<b>Chronos: </b><br/>{0}", Chronos.Utils.Platform.ChronosInfo.Replace(";", "<br/>")); writer.WriteLine("</div>"); registerScripts(); writer.WriteLine("<p />"); writeCacheInfo(writer, info); writer.WriteLine("<p />"); writeApplicationInfo(writer, info); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_admin")); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("send"); passValidator.ErrorMessage = LoginControl.getError("provide-password"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); userValidator.ErrorMessage = LoginControl.getError("provide-mail"); mailValidator.ErrorMessage = LoginControl.getError("bad-mail-format"); nickValidator.ErrorMessage = LoginControl.getError("provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); passRangeValidator.ErrorMessage = LoginControl.getError("validators_big-pass"); }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); loginButton.Text = info.getContent("send"); passValidator.ErrorMessage = LoginControl.getError("provide-password"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); userValidator.ErrorMessage = LoginControl.getError("provide-mail"); mailValidator.ErrorMessage = LoginControl.getError("bad-mail-format"); nickValidator.ErrorMessage = LoginControl.getError("provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); passRangeValidator.ErrorMessage = LoginControl.getError("validators_big-pass"); }
/// <summary> /// MethodBodyReader constructor /// </summary> /// <param name="method">The method to read the body from.</param> /// <param name="language">Code language to use for text representations of code.</param> public MethodBodyReader(MethodBase method, ILanguageInfo language) { try { this.method = method; this.language = language ?? new DefaultLanguageInfo(); MethodBody body = method.GetMethodBody(); if (body != null) { il = body.GetILAsByteArray(); ConstructInstructions(method.Module); } } catch (Exception ex) { throw new InvalidOperationException(String.Format("Failed to read the body of {0}'s {1}.", method.DeclaringType, method), ex); } }
protected override void OnLoad(EventArgs e) { Ruler ruler = getRuler(); Planet planet = getPlanet(); ILanguageInfo info = CultureModule.getLanguage(); OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Battle, string.Format("{0} - {1}", planet.Name, info.getContent("section_fleet"))); resources.Manager = queue.Manager = planet; resources.Category = queue.Category = "Unit"; resources.QueueError = queueError; resources.AskBuildQuantity = true; resources.ShowQuantity = false; resources.ShowDemolish = false; resources.Tooltip = "attributes"; resources.ShowImagePreview = true; resources.Cost = Cost; resources.ShowRareResourceCost = true; resources.ShowDocumentation = true; resources.IncludeOnMouseOver = false; resources.CategoryDescription = "general"; resources.AllowKeywords = false; resourcesHelp.Title = info.getContent("planetResources"); resourcesHelp.Manager = planet; resourcesHelp.ShowImages = true; resourcesHelp.Category = "Intrinsic"; resourcesHelp.ShowDocumentation = false; resourcesHelp.ShowDocumentation = false; resourcesHelp.ResourcesToShow = Cost; queue.Title = info.getContent("inProduction"); queue.EmptyMessage = info.getContent("buildingsQueueEmpty"); queue.ShowImagePreview = true; resources.Title = info.getContent("fleet_buildShip"); planetNavigation.Player = ruler; planetNavigation.Current = planet; planetNavigation.Section = "Fleet"; }
/// <summary>Escreve informações sobre o ApplicationState</summary> private void writeApplicationInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_application_title") + "</b></div>"); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Application.Count + "</b><br />"); writer.WriteLine("<b>" + info.getContent("stats_cache_content") + "</b><br />"); writer.WriteLine("<table class='stats_cache_items'>"); string[] keys = Page.Application.AllKeys; foreach (string item in keys) { writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item); writer.WriteLine("<td>{0}</td>", Page.Application[item].ToString()); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
/// <summary>Constrói todo o conteúdo do controlo</summary> private void buildControlTree() { ILanguageInfo info = CultureModule.getLanguage(); User user = (User)Page.User; if (user.IsInRole("ruler")) { Information.AddError(info.getContent("addruler_already-ruler")); hide(); return; } int count = int.Parse(OrionGlobals.getConfigurationValue("alnitak", "userCount")); if (Universe.instance.canAddRuler() && Universe.instance.rulers.Count < count) { string status = info.getContent("addruler_status-goodnews"); string m = string.Format(info.getContent("addruler_intro"), status); Information.AddInformation(m); } else { string status = info.getContent("addruler_status-badnews"); string m = string.Format(info.getContent("addruler_intro"), status); Information.AddInformation(m); hide(); return; } EventHandler click = new EventHandler(this.onClick); insertPlanetName.Text = info.getContent("addruler_home-planet"); planet.TextChanged += click; registerRuler.Text = info.getContent("register"); registerRuler.Click += click; onlyTextValidator.ErrorMessage = info.getContent("addruler_planet-only-text") + "<p/>"; requiredFieldValidator.ErrorMessage = info.getContent("addruler_planet-required") + "<p/>"; charCountValidator.ErrorMessage = info.getContent("addruler_planet-tolong"); }
public Feature( ILanguageInfo info, string name, string description, string ns, IGherkinBlock background, IEnumerable <IGherkinScenario> scenarios, IList <IGherkinComment> comments, IList <IGherkinTag> tags, string sourceFile) : base(info, GherkinKeyword.Feature, name, description) { this.Background = background; this.Scenarios = new GherkinCollection <IGherkinScenario>(scenarios); this.Comments = new GherkinCollection <IGherkinComment>(comments); this.Tags = new GherkinCollection <IGherkinTag>(tags); this.SourceFile = sourceFile; this.Language = info.Code; this.Namespace = ns; }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, CultureModule.getContent("section_index")); NewsList news = NewsUtility.Persistence.GetNews(); if (news != null && news.List.Count > 0) { writeNews(writer, news); } else { ILanguageInfo info = CultureModule.getLanguage(); /*writer.WriteLine("<div><b>{0}</b></div>", * info.getContent("no_news_title") * );*/ writer.WriteLine("<div>{0}</div>", info.getContent("no_news_message")); } }
/// <summary>Prepara os controlos</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); info = CultureModule.getLanguage(); userUpdated.Visible = false; userMail.EnableViewState = true; OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_profile")); updateButton.Text = info.getContent("update"); nickValidator.ErrorMessage = LoginControl.getError("profile_provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); avatarUrlValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-avatarUrl"); avatarRangeValidator.ErrorMessage = LoginControl.getError("validators_big-avatarUrl"); urlTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-url"); urlRangeValidator.ErrorMessage = LoginControl.getError("validators_big-url"); imagesDirValidator.ErrorMessage = LoginControl.getError("validators_invalidDir"); msnValidator.ErrorMessage = LoginControl.getError("validators_invalid-msn"); icqValidator.ErrorMessage = LoginControl.getError("validators_invalid-icq"); jabberValidator.ErrorMessage = LoginControl.getError("validators_invalid-jabber"); aimValidator.ErrorMessage = LoginControl.getError("validators_invalid-aim"); yahooValidator.ErrorMessage = LoginControl.getError("validators_invalid-yahoo"); signatureValidator.ErrorMessage = LoginControl.getError("validators_invalid-signature"); signatureRangeValidator.ErrorMessage = LoginControl.getError("validators_big-signature"); if (!IsPostBack) { povoateLang(); povoateSkin(); setFields(); } }
/// <summary>Prepara os controlos</summary> protected override void OnLoad( EventArgs args ) { base.OnLoad(args); info = CultureModule.getLanguage(); userUpdated.Visible = false; userMail.EnableViewState = true; OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Generic, info.getContent("section_profile")); updateButton.Text = info.getContent("update"); nickValidator.ErrorMessage = LoginControl.getError("profile_provide-nick"); nickTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-nick"); nickRangeValidator.ErrorMessage = LoginControl.getError("validators_big-nick"); //passValidator2.ErrorMessage = LoginControl.getError("diferent-passwords"); avatarUrlValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-avatarUrl"); avatarRangeValidator.ErrorMessage = LoginControl.getError("validators_big-avatarUrl"); urlTextValidator.ErrorMessage = LoginControl.getError("validators_bad-formed-url"); urlRangeValidator.ErrorMessage = LoginControl.getError("validators_big-url"); imagesDirValidator.ErrorMessage = LoginControl.getError("validators_invalidDir"); msnValidator.ErrorMessage = LoginControl.getError("validators_invalid-msn"); icqValidator.ErrorMessage = LoginControl.getError("validators_invalid-icq"); jabberValidator.ErrorMessage = LoginControl.getError("validators_invalid-jabber"); aimValidator.ErrorMessage = LoginControl.getError("validators_invalid-aim"); yahooValidator.ErrorMessage = LoginControl.getError("validators_invalid-yahoo"); signatureValidator.ErrorMessage = LoginControl.getError("validators_invalid-signature"); signatureRangeValidator.ErrorMessage = LoginControl.getError("validators_big-signature"); if( !IsPostBack ) { povoateLang(); povoateSkin(); setFields(); } }
protected GherkinKeywordBase(ILanguageInfo info, GherkinKeyword keyword, string name, string description) { #if PREFER_GEHERKIN_PLUS switch (keyword) { case GherkinKeyword.ScenarioOutline: this.Keyword = info.Get(GherkinKeyword.Scenarios); break; case GherkinKeyword.Examples: this.Keyword = info.Get(GherkinKeyword.Where); break; default: this.Keyword = info.Get(keyword); break; } #else Keyword = info.Get(keyword); #endif this.Name = name ?? string.Empty; this.Description = description ?? string.Empty; }
/// <summary> /// Validates an <see cref="ILanguageInfo"/> data. Throws an <see cref="ModinfoException"/> when validation failed. /// </summary> /// <remarks> /// Validates whether the <see cref="ILanguageInfo.Code"/> has only two letters. /// <br></br> /// Validates whether the <see cref="ILanguageInfo.Code"/> can be parsed into a <see cref="CultureInfo"/>. /// <br></br> /// Validation fails on the <see cref="CultureInfo.InvariantCulture"/>. /// </remarks> /// <param name="languageInfo">The data to check</param> /// <exception cref="ModinfoException">When validation failed.</exception> public static void Validate(this ILanguageInfo languageInfo) { if (string.IsNullOrEmpty(languageInfo.Code)) { throw new ModinfoException("Language-Info data is invalid: Language Code is missing."); } if (languageInfo.Code.Length != 2) { throw new ModinfoException("Language-Info data is invalid: Code must be an ISO 639-1 two letter code."); } if (languageInfo.Code.Equals("iv", StringComparison.InvariantCultureIgnoreCase)) { throw new ModinfoException($"Language-Info data is invalid: Code must not be an invariant culture '{languageInfo.Code}'"); } try { var _ = new CultureInfo(languageInfo.Code); } catch (CultureNotFoundException) { throw new ModinfoException($"Language-Info data is invalid: {languageInfo.Code} is not a valid language code."); } }
protected override object Convert(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { return !(value is bool && (bool)value); }
/// <summary> /// Initializes a new instance of the <see cref="ScenarioOutlineBuilder"/> class. /// </summary> /// <param name="info">The information.</param> /// <param name="title">The title.</param> public ScenarioOutlineBuilder(ILanguageInfo info, string title) : base(info, title, GherkinKeyword.ScenarioOutline) { }
/// <summary> /// Process the given session and return a codemodel containing /// the in-memory method call network. /// </summary> public CodeModel Process(StaticCodeAnalyzerSession session) { List <ModelAssembly> massemblies = new List <ModelAssembly>(); List <ModelType> mtypes = new List <ModelType>(); Dictionary <string, ModelMethod> mmethods = new Dictionary <string, ModelMethod>(); ILanguageInfo languageInfo = session.LanguageInfo; IAnalyzerFilter analyzerFilter = session.AnalyzerFilter; // Retrieve all methods and constructors: foreach (Assembly asm in session.Assemblies) { try { if ((analyzerFilter != null) && (!analyzerFilter.ProcessAssembly(asm))) { continue; } ModelAssembly masm = new ModelAssembly(asm, languageInfo); massemblies.Add(masm); foreach (Type type in asm.GetTypes()) { try { if ((analyzerFilter != null) && (!analyzerFilter.ProcessType(type))) { continue; } ModelType mtype = new ModelType(masm, type, languageInfo); mtypes.Add(mtype); foreach (MethodBase mb in type.GetConstructors(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { if ((analyzerFilter != null) && (!analyzerFilter.ProcessMethod(mb))) { continue; } mmethods[GetMethodKey(mb)] = new ModelMethod(mtype, mb, languageInfo); } foreach (MethodBase mb in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)) { if ((analyzerFilter != null) && (!analyzerFilter.ProcessMethod(mb))) { continue; } mmethods[GetMethodKey(mb)] = new ModelMethod(mtype, mb, languageInfo); } } catch (Exception ex) { // Rethrow with mode info: throw new TargetInvocationException( String.Format("Error reading type {0}: {1} (See innerException.)", type.FullName, ex.Message), ex ); } } } catch (ReflectionTypeLoadException ex) { // Rethrow with mode info: throw new TargetInvocationException( String.Format("Error reading assembly {0}: {1} (See innerException.)", asm.FullName, ex.Message), ex.LoaderExceptions.FirstOrDefault() ?? ex ); } catch (Exception ex) { // Rethrow with mode info: throw new TargetInvocationException( String.Format("Error reading assembly {0}: {1} (See innerException.)", asm.FullName, ex.Message), ex ); } } // Build network of method calls: foreach (ModelMethod m in mmethods.Values) { try { MethodBodyReader reader = new MethodBodyReader(m.MethodBase); foreach (MethodBase calledmb in reader.GetCalledMethods(true, true)) { ModelMethod calledm = FindMethod(mmethods, calledmb); if (calledm != null) { m.CallsMethods.Add(calledm); } } } catch (InvalidOperationException ex) { Debug.WriteLine(ex.Message); } } // Construct a code model: CodeModel codeModel = new CodeModel( massemblies, mtypes, mmethods.Values); // Apply processors: foreach (IProcessor processor in session.Processors) { processor.Process(codeModel); } // Construct & return a code model: return(codeModel); }
public ModelAssembly(Assembly assembly, ILanguageInfo languageInfo) { this.assembly = assembly; this.languageInfo = languageInfo; this.types = new List <ModelType>(); }
public ModelAssembly(Assembly assembly, ILanguageInfo languageInfo) { this.assembly = assembly; this.languageInfo = languageInfo; this.types = new List<ModelType>(); }
/// <summary> /// Initializes a new instance of the <see cref="SupportedLanguage"/> class. /// </summary> /// <param name="info">The information.</param> public SupportedLanguage(ILanguageInfo info) { this.LanguageInfo = info; }
public FeatureBuilder(ILanguageInfo info, string sourceFile) : base(info, GherkinKeyword.Feature, sourceFile, info.Code) { this.SourceFile = sourceFile; this.suffix = GetSuffix(sourceFile); }
public AlnitakValidator() { info = CultureModule.getLanguage(); }
public Background(ILanguageInfo info, string name, string description, BlockSteps scenarioSteps, IList <IGherkinComment> comments) : base(info, GherkinKeyword.Background, name, description) { this.Steps = scenarioSteps ?? new BlockSteps(); this.Comments = comments; }
/// <summary>Escreve informações sobre o ApplicationState</summary> private void writeApplicationInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_application_title") + "</b></div>" ); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Application.Count + "</b><br />" ); writer.WriteLine("<b>" + info.getContent("stats_cache_content")+ "</b><br />"); writer.WriteLine("<table class='stats_cache_items'>"); string[] keys = Page.Application.AllKeys; foreach( string item in keys ) { writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item); writer.WriteLine("<td>{0}</td>", Page.Application[item].ToString()); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
private void Load(XmlDocument sessionDefinition) { // Load assemblies: foreach (XmlNode path in sessionDefinition.DocumentElement.SelectNodes(@"/analyzer/assemblies/assembly")) { string file = path.Attributes["file"].Value; //Console.WriteLine("Loading: {0}", file); this.assemblies.Add(Assembly.Load(file)); } foreach (XmlNode path in sessionDefinition.DocumentElement.SelectNodes(@"/analyzer/assemblies/filepatterns")) { //Console.WriteLine(">> {0}", path.Attributes["path"].Value); DirectoryInfo dir = new DirectoryInfo(path.Attributes["path"].Value); foreach (XmlNode filepattern in path.SelectNodes(@"add")) { string pattern = filepattern.Attributes["value"].Value; foreach (FileInfo file in dir.GetFiles(pattern)) { //Console.WriteLine("Loading: {0}", file.FullName); this.assemblies.Add(Assembly.LoadFrom(file.FullName)); } } } // Load language: XmlNode languageNode = sessionDefinition.DocumentElement.SelectSingleNode(@"/analyzer/language"); if (languageNode != null) { // Retrieve language: if (languageNode.Attributes["code"] != null) { switch (languageNode.Attributes["code"].Value.ToUpper()) { case "CS": case "C#": this.languageInfo = new CsLanguageInfo(); break; case "VB": case "VB.NET": case "VISUALBASIC": case "VISUALBASIC.NET": this.languageInfo = new VbLanguageInfo(); break; default: this.languageInfo = new DefaultLanguageInfo(); break; } } // Retrieve imports: foreach (XmlNode importNode in languageNode.SelectNodes("import")) { if (importNode.Attributes["alias"] == null) { this.languageInfo.RegisterNamespace( importNode.Attributes["namespace"].Value); } else { this.languageInfo.RegisterNamespace( importNode.Attributes["namespace"].Value, importNode.Attributes["alias"].Value); } } } // Load processors: foreach (XmlNode processorDef in sessionDefinition.DocumentElement.SelectNodes(@"/analyzer/processors/*[count(@handler) = 1]")) { // Instantiate and initialize processor: Type processorType = Type.GetType(processorDef.Attributes["handler"].Value); IProcessor processor = (IProcessor)Activator.CreateInstance(processorType); processor.Initialize(processorDef); // Register processor: this.processors.Add(processor); } }
/// <summary>Ctor</summary> public MessageDecorator() { info = null; }
/// <summary>Ctor</summary> public MessageDecorator(ILanguageInfo _info) { info = _info; }
protected abstract object ConvertBack(object value, Type targetType, object parameter, ILanguageInfo languageInfo);
/// <summary>Escreve informações sobre a Cache</summary> private void writeCacheInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_cache_title") + "</b></div>" ); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Cache.Count + "</b><br />" ); writer.WriteLine("<b>" + info.getContent("stats_cache_content")+ "</b><br />"); writer.WriteLine("<table class='stats_cache_items' >"); foreach( DictionaryEntry item in Page.Cache ) { if( item.Key.ToString().StartsWith("@@") ) { continue; } writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item.Key.ToString()); writer.WriteLine("<td>{0}</td>", item.Value.ToString()); writer.WriteLine("<td><a href='javascript:{1}'><img src='{0}' /></a></td>", OrionGlobals.getCommonImagePath("remove.gif"), "deleteCache(\"" + item.Key.ToString() + "\")" ); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
/// <summary>Pinta o controlo</summary> protected override void Render(HtmlTextWriter _writer) { try { writer = _writer; string locale = Request.QueryString["locale"]; if (locale == null || locale == string.Empty) { locale = "en"; } string url = OrionGlobals.AlnitakUrl; ILanguageInfo info = CultureModule.getLanguage(locale); int rulerId = int.Parse(Request.QueryString["id"]); User user = UserUtility.bd.getUser(rulerId); Ruler ruler = null; if (user != null) { ruler = Universe.instance.getRuler(user.RulerId); } Write("<div class=\"orionsbelt_title\">"); Write("<a href=\"{0}\" class=\"orionsbelt_link\">Orion`s Belt</a></div>", url); if (ruler == null || user.RulerId == -1) { Write(info.getContent("ruler_not_playing")); return; } Write("<table class=\"orionsbelt_table\">"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("name")); Write("<td class=\"orionsbelt_td\">{0}</td>", OrionGlobals.getCompleteLink(ruler).Replace("'", "\"")); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("stats_alliances")); string allianceText = null; if (Universe.instance.isDefaultAlliance(ruler)) { allianceText = "<i>" + info.getContent("no_alliance") + "</i>"; } else { allianceText = ruler.Alliance.Name; } Write("<td class=\"orionsbelt_td\">{0}</td>", allianceText); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("planetas")); Write("<td class=\"orionsbelt_td\">{0}</td>", ruler.Planets.Length); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("batalhas")); Write("<td class=\"orionsbelt_td\"><span class=\"green\">{0}</span>/<span class=\"orange\">{1}</span>/<span class=\"red\">{2}</span></td>", ruler.Victories, ruler.Draws, ruler.Defeats); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("score")); Write("<td class=\"orionsbelt_td\">{0}</td>", ruler.getResourceCount("score")); Write("</tr>"); Write("<tr>"); Write("<td class=\"orionsbelt_td\">{0}</td>", info.getContent("battle_rank")); Write("<td class=\"orionsbelt_td\"><b>{0}</b></td>", (ruler.Rank == -1?"~":ruler.Rank.ToString())); Write("</tr>"); Write("</table>"); } catch (Exception) { Write("<div class=\"orionsbelt_title\">Error processing the URL</div>"); } }
protected override object Convert(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed; }
protected override object ConvertBack(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { return value is Visibility && (Visibility)value == Visibility.Visible; }
protected override object ConvertBack(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { throw new NotImplementedException(); }
public Example(ILanguageInfo info, string name, string description, ITestCases testCases) : base(info, GherkinKeyword.Examples, name, description) { this.TestCases = testCases; }
/// <summary>Ctor</summary> public MessageDecorator( ILanguageInfo _info ) { info = _info; }
protected override void initializeSkin(Control skin) { info = CultureModule.getLanguage(); string c = OrionGlobals.getCulture(); login = (Panel)getControl(skin,"login"); logout = (Panel)getControl(skin,"logout"); becomeRulerPanel = (Panel)getControl(skin,"becomeRulerPanel"); loginButton = (ImageButton)getControl(skin,"loginButton"); loginButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/login_"+ c +".gif" ); registerButton = (ImageButton)getControl(skin,"registerButton"); registerButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/register_"+ c +".gif" ); logoutButton = (ImageButton)getControl(skin,"logoutButton"); logoutButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/logout_"+ c +".gif" ); profileButton = (ImageButton)getControl(skin,"profileButton"); profileButton.ImageUrl = OrionGlobals.getSkinImagePath("buttons/profile_"+ c +".gif" ); userMail = (TextBox)getControl(skin,"userMail"); if( ! Page.IsPostBack ) { userMail.Text = string.Empty; } password = (TextBox)getControl(skin,"password"); autoLogin = (CheckBox)getControl(skin,"autoLogin"); loginButton.ToolTip = info.getContent("login_login"); registerButton.ToolTip = info.getContent("login_register"); logoutButton.ToolTip = info.getContent("login_logout"); profileButton.ToolTip = info.getContent("login_profile"); //eventos loginButton.Click += new ImageClickEventHandler( onLoginClick ); registerButton.Click += new ImageClickEventHandler(onRegisterClick); logoutButton.Click += new ImageClickEventHandler(onLogoutClick); profileButton.Click += new ImageClickEventHandler(onProfileClick); if( HttpContext.Current.User.IsInRole("guest") ) { logout.Visible = false; login.Visible = true; }else{ logout.Visible = true; login.Visible = false; if( !HttpContext.Current.User.IsInRole("ruler") ) { becomeRulerPanel.Controls.Clear(); if( becomeRulerPanel.Controls.Count == 0 ) { ImageButton becomeRuler; object o = HttpContext.Current.Cache["ImageButton_BecomeRulers"]; if( o == null ) { becomeRuler = new ImageButton(); becomeRuler.ToolTip = info.getContent("login_becomeRuler"); becomeRuler.Click += new ImageClickEventHandler(onBecomeRuler); becomeRuler.ImageUrl = OrionGlobals.getSkinImagePath("buttons/becomeRuler_"+ c +".gif" ); becomeRuler.CausesValidation = false; becomeRuler.CssClass = "imageButton"; becomeRulerPanel.Visible = true; HttpContext.Current.Cache["ImageButton_BecomeRulers"] = becomeRuler; }else{ becomeRuler = (ImageButton)o; } becomeRulerPanel.Controls.Add( becomeRuler ); } }else { if( becomeRulerPanel.Controls.Count > 0 ) becomeRulerPanel.Controls.Clear(); } } }
public ILInstruction(ILanguageInfo languageInfo) { this.languageInfo = languageInfo ?? new DefaultLanguageInfo(); }
protected override object Convert(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { return (value is string && string.IsNullOrEmpty((string)value)) ? Visibility.Collapsed : Visibility.Visible; }
protected override object Convert(object value, Type targetType, object parameter, ILanguageInfo languageInfo) { return value.ToString().ToLower(); }