//throws IOException public JadeParser(String filename, TemplateLoader templateLoader) { this.filename = filename; this.templateLoader = templateLoader; _jadeLexer = new JadeLexer(filename, templateLoader); getContexts().AddLast(this); }
public static void Main(string[] args) { var options = GetOptions(args); if(!options.RequiredOptionIsMissing) { try { using (var destFs = new FileStream(options.DestinationsFile, FileMode.Open)) { using(var taxFs = new FileStream(options.TaxonomyFile, FileMode.Open)) { var destinationParser = new DestinationParser(destFs); var templateLoader = new TemplateLoader(); var taxonomyParser = new TaxonomyParser(taxFs); var htmlFileWriter = new HTMLFileWriter(templateLoader, taxonomyParser); WriteFiles(destinationParser, htmlFileWriter, options); Console.WriteLine("HTML Generation finished. Wrote files to {0}", options.OutputFolder); } } } catch (Exception e) { Console.WriteLine("ERROR: {0}", e.Message); } } Console.WriteLine("Press any key to exit..."); Console.Read(); }
public JadeException(String message, String filename, int lineNumber, TemplateLoader templateLoader, Exception e) : base(message, e) { ; this.filename = filename; this.lineNumber = lineNumber; this.templateLoader = templateLoader; }
private void button5_Click(object sender, EventArgs e) { var sft = TemplateLoader.LoadTemplateFromJsonFile <SubmitFormTemplate <ShapeColumnTemplate> >("./Templates/LightKeySettings.json"); var sf = new SubmitForm(); sf.ApplyTemplate(sft); sf.ShowDialog(this); }
private static JadeTemplate createTemplate(String filename, TemplateLoader loader) // throws IOException { JadeParser jadeParser = new JadeParser(filename, loader); Node root = jadeParser.parse(); JadeTemplate template = new JadeTemplate(); template.setTemplateLoader(loader); template.setRootNode(root); return(template); }
public ProjectHandler(NodeProviderBroker broker, ITemplateDirectory template_manager, List<Tag> tags, List<Filter> filters, string project_directory) { this.broker = broker; TemplateManager = template_manager; this.tags = tags; this.filters = filters; this.project_directory = project_directory; template_loader = new TemplateLoader(project_directory); parser = InitializeParser(); }
public Spell(int id, MapUnit unit = null) { SpellID = (Spells)id; Template = TemplateLoader.GetSpellById(id - 1); if (Template == null) { Debug.LogFormat("Invalid spell created (id={0})", id); } User = unit; }
public void SetUp() { this.dialogFactory = Substitute.For <IDialogFactory>(); this.messageManager = Substitute.For <MessageManager>(); templateLoader = new TemplateLoader(); this.projectConfiguration = Substitute.For <IProjectConfiguraiton>(); this.projectConfiguration.LastSelectedSearchTypeInOpenFromPackage.Returns("MethodContent"); openFromPackageViewModel = new OpenFromPackageViewModel(this.dialogFactory, templateLoader, this.messageManager, "C#", this.projectConfiguration); }
public CodeInfo CreateCodeItemInfo(MethodInfo methodInformation, string fileName, CodeType codeType, CodeElementType codeElementType, bool useVSFormatting) { string serverMethodFolderPath = projectManager.ServerMethodFolderPath; string selectedFolderPath = projectManager.SelectedFolderPath; string methodName = projectManager.MethodName; string codeItemPath = selectedFolderPath.Substring(serverMethodFolderPath.IndexOf(serverMethodFolderPath) + serverMethodFolderPath.Length); codeItemPath = Path.Combine(codeItemPath, fileName); string codeItemAttributePath = codeItemPath.Substring(codeItemPath.IndexOf(methodName) + methodName.Length + 1); codeItemAttributePath = codeItemAttributePath.Replace("\\", "/"); var templateLoader = new TemplateLoader(this.dialogFactory); templateLoader.Load(projectManager.MethodConfigPath); TemplateInfo template = null; template = templateLoader.Templates.Where(t => t.TemplateLanguage == methodInformation.MethodLanguage && t.TemplateName == methodInformation.TemplateName).FirstOrDefault(); if (template == null) { template = templateLoader.Templates.Where(t => t.TemplateLanguage == methodInformation.MethodLanguage && t.IsSupported).FirstOrDefault(); } if (template == null) { throw new Exception("Template not found."); } EventSpecificDataType eventData = CommonData.EventSpecificDataTypeList.First(x => x.EventSpecificData == methodInformation.EventData); GeneratedCodeInfo codeInfo = this.CreateWrapper(template, eventData, methodName, useVSFormatting); string methodCode = File.ReadAllText(projectManager.MethodPath, new UTF8Encoding(true)); var tree = CSharpSyntaxTree.ParseText(methodCode); var root = tree.GetRoot(); var referenceUsings = string.Empty; var mainUsingDirectiveSyntaxes = root.DescendantNodes().OfType <UsingDirectiveSyntax>(); referenceUsings = string.Join("\r\n", mainUsingDirectiveSyntaxes); if (!string.IsNullOrEmpty(referenceUsings)) { referenceUsings += "\r\n"; } string codeItemTemplate = this.codeItemProvider.GetCodeElementTypeTemplate(codeType, codeElementType); string code = string.Format(codeItemTemplate, referenceUsings, codeInfo.MethodCodeParentClassName, codeItemAttributePath, codeInfo.Namespace, fileName); var codeItemInfo = new CodeInfo() { Path = codeItemPath, Code = useVSFormatting ? FormattingCode(code) : code }; return(codeItemInfo); }
public void Setup() { this.innovatorUser = new InnovatorUser(); this.serverConnection = Substitute.For <IServerConnection>(); this.innovatorInstance = new Innovator(this.serverConnection); this.iOMWrapper = Substitute.For <IIOMWrapper>(); this.authManager = new AuthenticationManagerProxy(serverConnection, innovatorInstance, innovatorUser, iOMWrapper); this.dialogFactory = Substitute.For <IDialogFactory>(); this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>(); this.projectConfiguration = Substitute.For <IProjectConfiguraiton>(); this.packageManager = new PackageManager(authManager); this.arasDataProvider = Substitute.For <IArasDataProvider>(); this.methodInformation = new MethodInfo(); this.templateLoader = new TemplateLoader(dialogFactory); this.projectManager = Substitute.For <IProjectManager>(); this.codeProvider = Substitute.For <ICodeProvider>(); this.globalConfiguration = Substitute.For <IGlobalConfiguration>(); this.globalConfiguration.GetUserCodeTemplatesPaths().Returns(new List <string>()); this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is <XmlDocument>(doc => doc.DocumentElement.Attributes["type"].Value == "Value"), Arg.Any <XmlDocument>())) .Do(x => { (x[2] as XmlDocument).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\ActionLocationsListValue.xml")); }); this.serverConnection.When(x => x.CallAction("ApplyItem", Arg.Is <XmlDocument>(doc => doc.DocumentElement.Attributes["type"].Value == "Filter Value"), Arg.Any <XmlDocument>())) .Do(x => { (x[2] as XmlDocument).Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodTypesListFilterValue.xml")); }); this.projectConfiguration.LastSavedSearch.Returns(new Dictionary <string, List <ItemSearch.PropertyInfo> >()); XmlDocument methodItemTypeAML = new XmlDocument(); methodItemTypeAML.Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodItemType.xml")); Item methodItemType = this.innovatorInstance.newItem(); methodItemType.loadAML(methodItemTypeAML.OuterXml); this.arasDataProvider.GetMethodItemTypeInfo().Returns(new MethodItemTypeInfo(methodItemType)); this.createMethodViewModel = new CreateMethodViewModel(authManager, dialogFactory, projectConfiguration, templateLoader, packageManager, projectManager, arasDataProvider, codeProvider, globalConfiguration); }
public void InitialiseHotKeyManager(IGlobalHotKeyManager manager) { HKM = manager; log.Debug("Initialising MSSQLPlugin."); TemplateFolder = TemplateLoader.GetDefaultTemplateFolder(Assembly.GetExecutingAssembly()); AutoTemplates = new List <TextTemplate>(); LoadAutoTemplates(); LoadCustomTemplates(); HKM.Register(Modifiers.Ctrl | Modifiers.Shift, Keys.P, ShowMainForm); }
private void tbJSID_Click(object sender, EventArgs e) { AddCodeDialogTemplate codeDialog = new AddCodeDialogTemplate(); codeDialog.lblDescription.Text = MainForm.rm.GetString("getElementIDDescription"); if (codeDialog.ShowDialog() == DialogResult.OK) { TemplateLoader.InsertString("document.getElementById(\"" + codeDialog.tbxEntry.Text + "\")${cursor}", editor); } codeDialog.Dispose(); }
private void DesktopColor_Deactivate(object sender, EventArgs e) { if (this.Owner is MainForm) { if ((Owner as MainForm).ActiveDocumentTab is EditorTab) { TemplateLoader.InsertString(label1.Text.ToString(), ((Owner as MainForm).ActiveDocumentTab as EditorTab).editor); } } this.Close(); }
void LoadAutoTemplate(string filename) { string templateFilePath = Path.Combine(TemplateFolder, filename); var template = TemplateLoader.LoadTemplate(templateFilePath); if (template != null) { AutoTemplates.Add(template); HKM.Register(template); } }
private void button7_Click(object sender, EventArgs e) { var sft = TemplateLoader.LoadTemplateFromJsonFile <TunableShapeTemplate <ShapeColumnTemplate> >("./Templates/RequestNumberSettingsForm.json"); var requestNumberSettingsForm = new RequestNumberSettingsForm(); requestNumberSettingsForm.ApplyTemplate(sft); requestNumberSettingsForm.ShowDialog(this); }
private void CreateLaunchConfiguration(string currentWorkingDirectory) { string vsCodeDirectory = Path.Combine(currentWorkingDirectory, ".vscode"); if (!Directory.Exists(vsCodeDirectory)) { Directory.CreateDirectory(vsCodeDirectory); } // on windows we use this as opportunity to make the file association for .csx -> dotnet-script // (If/when dotnet install command provides us an install time hook this code should move there) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // check to see if .csx is mapped to dotnet-script if (_commandRunner.Execute("reg", "query HKCU\\Software\\classes\\.csx") != 0) { // register dotnet-script as the tool to process .csx files _commandRunner.Execute("reg", $"add HKCU\\Software\\classes\\.csx /f /ve /t REG_SZ -d dotnetscript"); } if (_commandRunner.Execute("reg", "query HKCU\\Software\\classes\\dotnetscript") != 0) { _commandRunner.Execute("reg", $"add HKCU\\Software\\Classes\\dotnetscript\\Shell\\Open\\Command /f /ve /t REG_EXPAND_SZ /d \"\"%ProgramFiles%\\dotnet\\dotnet.exe\" exec {_scriptEnvironment.InstallLocation}\\dotnet-script.dll %1 -- %*\""); } } _scriptConsole.WriteNormal("Creating VS Code launch configuration file"); string pathToLaunchFile = Path.Combine(vsCodeDirectory, "launch.json"); string installLocation = _scriptEnvironment.InstallLocation; string dotnetScriptPath = Path.Combine(installLocation, "dotnet-script.dll").Replace(@"\", "/"); if (!File.Exists(pathToLaunchFile)) { string launchFileTemplate = TemplateLoader.ReadTemplate("launch.json.template"); string launchFileContent = launchFileTemplate.Replace("PATH_TO_DOTNET-SCRIPT", dotnetScriptPath); File.WriteAllText(pathToLaunchFile, launchFileContent); _scriptConsole.WriteSuccess($"...'{pathToLaunchFile}' [Created]"); } else { _scriptConsole.WriteHighlighted($"...'{pathToLaunchFile}' already exists' [Skipping]"); var launchFileContent = File.ReadAllText(pathToLaunchFile); string pattern = @"^(\s*"")(.*dotnet-script.dll)("").*$"; if (Regex.IsMatch(launchFileContent, pattern, RegexOptions.Multiline)) { var newLaunchFileContent = Regex.Replace(launchFileContent, pattern, $"$1{dotnetScriptPath}$3", RegexOptions.Multiline); if (launchFileContent != newLaunchFileContent) { _scriptConsole.WriteHighlighted($"...Fixed path to dotnet-script: '{dotnetScriptPath}' [Updated]"); File.WriteAllText(pathToLaunchFile, newLaunchFileContent); } } } }
public override void ExecuteCommandImpl(object sender, EventArgs args) { var project = projectManager.SelectedProject; string projectConfigPath = projectManager.ProjectConfigPath; string selectedMethodPath = projectManager.MethodPath; string selectedMethodName = Path.GetFileNameWithoutExtension(selectedMethodPath); MethodInfo methodInformation = projectConfigurationManager.CurrentProjectConfiguraiton.MethodInfos.FirstOrDefault(m => m.MethodName == selectedMethodName); if (methodInformation == null) { throw new Exception(); } TemplateLoader templateLoader = new TemplateLoader(); templateLoader.Load(projectManager.MethodConfigPath); var packageManager = new PackageManager(authManager, this.messageManager); var updateView = dialogFactory.GetUpdateFromArasView(projectConfigurationManager, templateLoader, packageManager, methodInformation, projectConfigPath, project.Name, project.FullName); var updateViewResult = updateView.ShowDialog(); if (updateViewResult?.DialogOperationResult != true) { return; } var eventData = CommonData.EventSpecificDataTypeList.First(x => x.EventSpecificData == updateViewResult.EventSpecificData); ICodeProvider codeProvider = codeProviderFactory.GetCodeProvider(projectManager.Language); GeneratedCodeInfo codeInfo = codeProvider.GenerateCodeInfo(updateViewResult.SelectedTemplate, eventData, updateViewResult.MethodName, updateViewResult.MethodCode, updateViewResult.IsUseVSFormattingCode); projectManager.CreateMethodTree(codeInfo, updateViewResult.Package); var methodInfo = new MethodInfo() { InnovatorMethodConfigId = updateViewResult.MethodConfigId, InnovatorMethodId = updateViewResult.MethodId, MethodLanguage = updateViewResult.MethodLanguage, MethodName = updateViewResult.MethodName, MethodType = updateViewResult.MethodType, Package = updateViewResult.Package, TemplateName = updateViewResult.SelectedTemplate.TemplateName, EventData = updateViewResult.EventSpecificData, ExecutionAllowedToId = updateViewResult.ExecutionIdentityId, ExecutionAllowedToKeyedName = updateViewResult.ExecutionIdentityKeyedName, MethodComment = updateViewResult.MethodComment }; projectConfigurationManager.CurrentProjectConfiguraiton.AddMethodInfo(methodInfo); projectConfigurationManager.CurrentProjectConfiguraiton.UseVSFormatting = updateViewResult.IsUseVSFormattingCode; projectConfigurationManager.Save(projectConfigPath); }
public ProjectList(IShell shell, CreateProject createProject, IDialog <object> parent) { _shell = shell; var recentProjectItems = RecentProjects.All .SelectPerElement(project => new ProjectListItem( menuItemName: "Open", title: project.Name, descriptionTitle: "Last opened:", description: ProjectLastOpenedString(project), locationTitle: "Location:", location: project.ProjectPath.NativePath, command: Command.Enabled(async() => { await Application.OpenDocument(project.ProjectPath, showWindow: true); parent.Close(); }), thumbnail: Layout.Dock() .Fill( Icons.ProjectIcon() .WithOverlay(Shapes.Rectangle( stroke: Stroke.Create(0.5, Theme.DescriptorText), cornerRadius: Observable.Return(new CornerRadius(2)) )) ), projectFile: project.ProjectPath)); var newProjectItems = TemplateLoader .LoadTemplatesFrom(UnoConfig.Current.GetTemplatesDir() / "Projects", _shell) .Select(template => new ProjectListItem( menuItemName: "Create", title: "New " + template.Name, descriptionTitle: "Description:", description: template.Description, locationTitle: String.Empty, location: String.Empty, command: Command.Enabled(async() => { if (await createProject.ShowDialog(template, parent)) { parent.Close(); } }), thumbnail: Icon(Color.Transparent, fg => MainWindowIcons.AddIcon(Stroke.Create(1, fg))))) .ToImmutableList(); _selectedItem = new BehaviorSubject <ProjectListItem>(newProjectItems.First()); _allProjectItems = recentProjectItems .Select(newProjectItems.AddRange) .Replay(1).RefCount(); }
public MainWindow() { InitializeComponent(); dataGridHeader.ItemsSource = headerData; dataGridParams.ItemsSource = paramsData; var template = new TemplateLoader(); ApplySavedData(template.New()); }
public void CreateNewScriptFile(string file) { string currentDirectory = Directory.GetCurrentDirectory(); var pathToScriptFile = Path.Combine(currentDirectory, file); if (!File.Exists(pathToScriptFile)) { var scriptFileTemplate = TemplateLoader.ReadTemplate("helloworld.csx.template"); WriteFile(pathToScriptFile, scriptFileTemplate); } }
public MapUnit(string name) : this() { Template = TemplateLoader.GetMonsterByName(name); if (Template == null) { Debug.LogFormat("Invalid unit created (name={0})", name); } else { InitUnit(); } }
public void Setup() { this.projectManager = Substitute.For <IProjectManager>(); this.dialogFactory = Substitute.For <IDialogFactory>(); this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>(); this.codeProviderFactory = Substitute.For <ICodeProviderFactory>(); this.messageManager = Substitute.For <MessageManager>(); this.templateLoader = new TemplateLoader(); CreateCodeItemCmd.Initialize(this.projectManager, this.dialogFactory, this.projectConfigurationManager, this.codeProviderFactory, this.messageManager); createCodeItemCmd = CreateCodeItemCmd.Instance; }
public MapUnit(int serverId) : this() { Template = TemplateLoader.GetMonsterById(serverId); if (Template == null) { Debug.LogFormat("Invalid unit created (serverId={0})", serverId); } else { InitUnit(); } }
private void button6_Click(object sender, EventArgs e) { var sft = TemplateLoader.LoadTemplateFromJsonFile <SubmitFormTemplate <ShapeColumnTemplate> >("./Templates/PasswordSettingsForm.json"); sft.Steps[0].TunableShape.Columns[0].Controls[0].Visible = false; var sf = new SubmitForm(); sf.ApplyTemplate(sft); sf.ShowDialog(this); }
public JadeLexer(String filename, TemplateLoader templateLoader)// throws IOException { this.filename = ensureJadeExtension(filename); this.templateLoader = templateLoader; reader = templateLoader.getReader(this.filename); options = new LinkedList <String>(); _jadeScanner = new JadeScanner(reader); deferredTokens = new LinkedList <Token>(); stash = new LinkedList <Token>(); indentStack = new LinkedList <int>(); lastIndents = 0; lineno = 1; }
public void BlankConfigLoadsOk() { string body = @"[Config];;AZ;;body"; TextTemplate t = TemplateLoader.LoadTemplateFromString(body); Assert.IsNull(t.Name); Assert.IsNull(t.ModifiedKey); Assert.IsNull(t.Description); Assert.IsNull(t.Filename); Assert.IsNull(t.FilePath); Assert.AreEqual("body", t.OriginalText); }
public ProjectHandler(NodeProviderBroker broker, IVsHierarchy hier, string project_directory) { this.broker = broker; template_loader = new TemplateLoader(project_directory); type_resolver = new TypeResolver(hier); TemplateDirectory = new TemplateDirectory(project_directory); parser = new TemplateManagerProvider() .WithTags(type_resolver.Tags) .WithFilters(type_resolver.Filters) .WithSetting(NDjango.Constants.EXCEPTION_IF_ERROR, false) .WithLoader(template_loader) .GetNewManager(); }
public MapHuman(int serverId, bool hero = false) { IsHero = hero; Template = TemplateLoader.GetHumanById(serverId); if (Template == null) { Debug.LogFormat("Invalid human created (serverId={0})", serverId); } else { InitHuman(); } }
public MapHuman(string name, bool hero = false) { IsHero = hero; Template = TemplateLoader.GetHumanByName(name); if (Template == null) { Debug.LogFormat("Invalid human created (name={0})", name); } else { InitHuman(); } }
private void loadNodeTemplate() { if (Request.QueryString["nodeID"] != null) { int nodeID = int.Parse(Request.QueryString["nodeID"]); Node currentNode = NodeFactory.RootNode.Find(nodeID); nodeTemplateHolder.Controls.Add(TemplateLoader.GetAdminTemplate(currentNode)); } else { nodeTemplateHolder.Controls.Add(new LiteralControl("Please select a page from the menu to the left")); } }
public static CreateCommand CreateCreateCommand() { var shell = new Shell(); var coloredConsole = ColoredTextWriter.Out; var fuse = FuseApi.Initialize("Fuse", new List <string>()); return(new CreateCommand( shell, () => TemplateLoader.LoadTemplatesFrom(UnoConfig.Current.GetTemplatesDir() / "Projects", shell), () => TemplateLoader.LoadTemplatesFrom(UnoConfig.Current.GetTemplatesDir() / "Files", shell), coloredConsole, fuse)); }
// calculate price. calculate effects based on native effects + magic effects. public void UpdateItem() { if (Class == null || Class.IsMoney) { return; } // concat native and magic effects Effects.Clear(); Effects.AddRange(NativeEffects); Effects.AddRange(MagicEffects); // base price. Price = Class.Price; /* * if (!Class.IsSpecial) * { * Price = (int)(Price * Class.Class.Price); * Price = (int)(Price * Class.Material.Price); * } */ int manaUsage = 0; for (int i = 0; i < Effects.Count; i++) { Templates.TplModifier modifier = TemplateLoader.GetModifierById((int)Effects[i].Type1); if (modifier == null) { continue; // wtf was that lol. } manaUsage += modifier.ManaCost; } Price = Math.Max(Price, (int)(Price * ((float)manaUsage / 10))); // search for override price effect for (int i = 0; i < Effects.Count; i++) { if (Effects[i].Type1 == ItemEffect.Effects.Price) { Price = Effects[i].Value1; } } if (Price < 2) { Price = 2; // min price } }
private ITemplateManager InitializeParser() { TemplateLoader template_loader = new TemplateLoader(projectDir); List <Tag> tags = new List <Tag>(); List <Filter> filters = new List <Filter>(); TemplateManagerProvider provider = new TemplateManagerProvider(); return(provider .WithTags(tags) .WithFilters(filters) .WithSetting(NDjango.Constants.EXCEPTION_IF_ERROR, false) .WithLoader(template_loader) .GetNewManager()); }
/// <summary> /// start up. get globals, load object mappings, init DAL, etc... /// </summary> public static void Start() { System.Web.HttpContext context = System.Web.HttpContext.Current; // set globals NodeTemplateLocation = System.Configuration.ConfigurationSettings.AppSettings["nodeTemplateDirectory"]; ResourceFileLocation = System.Configuration.ConfigurationSettings.AppSettings["resourceDirectory"]; VirtualDirectory = System.Configuration.ConfigurationSettings.AppSettings["virtualDirName"]; SiteRoot = "/" + System.Configuration.ConfigurationSettings.AppSettings["virtualDirName"]; VirutalFileExtention = System.Configuration.ConfigurationSettings.AppSettings["virtualFileExtension"]; DefaultLanguage = System.Configuration.ConfigurationSettings.AppSettings["defaultLanguage"]; ShowLangInUrl = bool.Parse(System.Configuration.ConfigurationSettings.AppSettings["showLangInUrl"]); BaseDirectory = System.AppDomain.CurrentDomain.BaseDirectory; EncryptionKey = System.Configuration.ConfigurationSettings.AppSettings["encryptionKey"]; EncryptionMethod = System.Configuration.ConfigurationSettings.AppSettings["encryptionMethod"]; EncryptionSalt = Convert.FromBase64CharArray(EncryptionKey.ToCharArray(), 0, EncryptionKey.Length); AdminstratorRoleName = System.Configuration.ConfigurationSettings.AppSettings["AdminstratorRoleName"]; PublisherRoleName = System.Configuration.ConfigurationSettings.AppSettings["PublisherRoleName"]; EditorRoleName = System.Configuration.ConfigurationSettings.AppSettings["EditorRoleName"]; ContributorRoleName = System.Configuration.ConfigurationSettings.AppSettings["ContributorRoleName"]; ContentMenuDisplay = System.Configuration.ConfigurationSettings.AppSettings["contentMenuDisplay"]; appDirectory = AppDomain.CurrentDomain.BaseDirectory.Replace("/bin", ""); //context.Application.Add("currentUsers",0); UserCount = 0; // start Object-Relational Mappings string connection = System.Configuration.ConfigurationSettings.AppSettings["connectionString"]; string mappings = appDirectory + System.Configuration.ConfigurationSettings.AppSettings["objectMappingsFile"]; ObjectManager = new Wilson.ORMapper.ObjectSpace(mappings, connection, Wilson.ORMapper.Provider.MsSql); mappings = appDirectory + System.Configuration.ConfigurationSettings.AppSettings["objectMappingsPublicFile"]; ObjectManagerPublic = new Wilson.ORMapper.ObjectSpace(mappings, connection, Wilson.ORMapper.Provider.MsSql); // SQL Data Abstraction Layer DAL = new DAL(); // read templates into memory TemplateLoader.Load(System.Configuration.ConfigurationSettings.AppSettings["nodeTemplateDefinitions"]); // set FSW on config files fsw = new System.IO.FileSystemWatcher(appDirectory, "*.config"); fsw.EnableRaisingEvents = true; fsw.NotifyFilter = System.IO.NotifyFilters.LastWrite; fsw.Changed += new System.IO.FileSystemEventHandler(fsw_Changed); UpdateNodes(); }
public void Init() { serverConnection = Substitute.For <IServerConnection>(); Innovator innovatorIns = new Innovator(serverConnection); this.authManager = new AuthenticationManagerProxy(this.serverConnection, innovatorIns, new InnovatorUser(), Substitute.For <IIOMWrapper>()); this.dialogFactory = Substitute.For <IDialogFactory>(); this.projectConfigurationManager = Substitute.For <IProjectConfigurationManager>(); this.projectConfiguration = Substitute.For <IProjectConfiguraiton>(); this.messageManager = Substitute.For <MessageManager>(); this.packageManager = new PackageManager(this.authManager, this.messageManager); this.templateLoader = new TemplateLoader(); this.codeProvider = Substitute.For <ICodeProvider>(); this.projectManager = Substitute.For <IProjectManager>(); this.arasDataProvider = Substitute.For <IArasDataProvider>(); this.iOWrapper = Substitute.For <IIOWrapper>(); this.methodInformation = new MethodInfo() { MethodName = string.Empty, Package = new PackageInfo(string.Empty) }; this.projectConfiguration.LastSavedSearch.Returns(new Dictionary <string, List <PropertyInfo> >()); XmlDocument methodItemTypeDoc = new XmlDocument(); methodItemTypeDoc.Load(Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodItemType.xml")); Item methodItemType = innovatorIns.newItem(); methodItemType.loadAML(methodItemTypeDoc.OuterXml); MethodItemTypeInfo methodItemTypeInfo = new MethodItemTypeInfo(methodItemType, messageManager); this.arasDataProvider.GetMethodItemTypeInfo().Returns(methodItemTypeInfo); string pathToFileForSave = Path.Combine(currentPath, @"Dialogs\ViewModels\TestData\MethodAml\ReturnNullMethodAml.xml"); this.saveToPackageViewModel = new SaveToPackageViewModel(authManager, dialogFactory, projectConfiguration, templateLoader, packageManager, codeProvider, projectManager, arasDataProvider, iOWrapper, messageManager, methodInformation, pathToFileForSave); }
private void cmdImportTemplateUrl_Click(object sender, EventArgs e) { Cursor saveCursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; TemplateLoader TemplateLoader = new TemplateLoader(); TemplateLoader.ImportTemplateViaUrl(txtTemplateFileUrl.Text); TemplateLoader.SaveAndReloadTemplates(); System.Windows.Forms.MessageBox.Show("Templates Imported"); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } finally { Cursor.Current = saveCursor; } }
private void cmdImportPackageRaw_Click(object sender, EventArgs e) { TemplateLoader TemplateLoader = new TemplateLoader(); TemplateLoader.ImportTemplatePackageRaw(txtPackageFileUrl.Text); TemplateLoader.SaveAndReloadTemplates(); }
private ITemplateManager InitializeParser() { TemplateLoader template_loader = new TemplateLoader(projectDir); List<Tag> tags = new List<Tag>(); List<Filter> filters = new List<Filter>(); TemplateManagerProvider provider = new TemplateManagerProvider(); return provider .WithTags(tags) .WithFilters(filters) .WithSetting(NDjango.Constants.EXCEPTION_IF_ERROR, false) .WithLoader(template_loader) .GetNewManager(); }
private void cmdImportTemplateUrl_Click(object sender, EventArgs e) { TemplateLoader TemplateLoader = new TemplateLoader(); TemplateLoader.ImportTemplateViaUrl(txtTemplateFileUrl.Text); TemplateLoader.SaveAndReloadTemplates(); }
//private static readonly long serialVersionUID = -126617495230190225L; public JadeCompilerException(Node node, TemplateLoader templateLoader, Exception e) : base(e.Message, node.getFileName(), node.getLineNumber(), templateLoader, e) { ; }
public void setTemplateLoader(TemplateLoader templateLoader) { this.templateLoader = templateLoader; }
// throws IOException private static JadeTemplate createTemplate(String filename, TemplateLoader loader) { JadeParser jadeParser = new JadeParser(filename, loader); Node root = jadeParser.parse(); JadeTemplate template = new JadeTemplate(); template.setTemplateLoader(loader); template.setRootNode(root); return template; }
//private static readonly long serialVersionUID = 2022663314591205451L; public JadeParserException(String filename, int lineNumber, TemplateLoader templateLoader, Type expected, Type got) : base("expected " + expected + " but got " + got, filename, lineNumber, templateLoader, null) { ; }
private void ScanForTemplates(string filename) { // We only do one pass of a file, but this means that it's difficult for a game // file to override any templates specified in libraries. To allow for this, we // do a preliminary pass of the base .aslx file to scan for any template definitions, // then we add those and mark them as non-overwritable. XmlReader reader; if (Config.ReadGameFileFromAzureBlob) { using (var client = new WebClient()) { client.Encoding = System.Text.Encoding.UTF8; var data = client.DownloadString(filename); reader = new XmlTextReader(new StringReader(data)); } } else { var stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); reader = new XmlTextReader(stream); } TemplateLoader templateLoader = new TemplateLoader(); templateLoader.GameLoader = this; templateLoader.IsBaseTemplateLoader = true; Element e = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "template") { templateLoader.Load(reader, ref e); } } }
public JadeParserException(String filename, int lineNumber, TemplateLoader templateLoader, Token token) : base("unknown token " + token, filename, lineNumber, templateLoader, null) { ; }
//private static readonly long serialVersionUID = -4390591022593362563L; public JadeLexerException(String message, String filename, int lineNumber, TemplateLoader templateLoader) : base(message, filename, lineNumber, templateLoader, null) { ; }
private void ScanForTemplates(string filename) { // We only do one pass of a file, but this means that it's difficult for a game // file to override any templates specified in libraries. To allow for this, we // do a preliminary pass of the base .aslx file to scan for any template definitions, // then we add those and mark them as non-overwritable. System.IO.FileStream stream = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); XmlReader reader = new XmlTextReader(stream); TemplateLoader templateLoader = new TemplateLoader(); templateLoader.GameLoader = this; templateLoader.IsBaseTemplateLoader = true; Element e = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "template") { templateLoader.Load(reader, ref e); } } }
/// <summary>Downloads the set of required templates that were added via the 'AddRequiredTemplate' method.</summary> /// <param name="onComplete">Action which is invoked when the templates have completed downloading.</param> protected void DownloadTemplates(Action onComplete) { if (templateLoader == null) { Helper.Invoke(onComplete); return; } templateLoader.LoadComplete += delegate { Helper.Invoke(onComplete); templateLoader = null; }; templateLoader.Start(); }
/// <summary>Adds a template to the list of resoures to download (if it's not already available in the page).</summary> /// <param name="selector">The CSS selector for the template.</param> /// <param name="url">The URL to download the template(s) from.</param> /// <remarks>Aftering adding one or more Templates Url's call the 'DownloadTemplates' method.</remarks> protected void AddRequiredTemplate(string selector, string url) { if (Helper.Template.IsAvailable(selector)) return; if (templateLoader == null) templateLoader = new TemplateLoader(); templateLoader.AddUrl(url); }
public JadeCompilerException(Node node, TemplateLoader templateLoader, String message) : base(message, node.getFileName(), node.getLineNumber(), templateLoader, null) { ; }