public ArrayImpl GetConstructors() { ArrayImpl result = new ArrayImpl(); var constructors = AsmType.GetConstructors(); foreach (var itm in constructors) { ArrayImpl miparams = new ArrayImpl(); foreach (var prm in itm.GetParameters()) { StructureImpl strct = new StructureImpl(); strct.Insert("Имя", ValueFactory.Create(prm.Name)); strct.Insert("ЗначениеПоУмолчанию", ValueFactory.Create(prm.DefaultValue.ToString())); strct.Insert("ЭтоНеобязательный", ValueFactory.Create(prm.IsOptional)); strct.Insert("Тип", ValueFactory.Create(prm.ParameterType.Name)); miparams.Add(strct); } AssemblyMethod mi = new AssemblyMethod(); mi.Name = itm.Name; mi.IsFunction = false; mi.Params = miparams; result.Add(ValueFactory.Create(mi)); } return(result); }
private LexerParser?GetLexerParser(AsmType asmType) { switch (asmType) { case AsmType.RadAsm: return(new LexerParser() { Lexer = new AsmLexer(), Parser = new Asm1Parser(this) }); case AsmType.RadAsm2: return(new LexerParser() { Lexer = new Asm2Lexer(), Parser = new Asm2Parser(this) }); case AsmType.RadAsmDoc: return(new LexerParser() { Lexer = new AsmDocLexer(), Parser = new AsmDocParser() }); default: return(null); } }
/// <summary> /// This routine loads a CLR script assembly from disk and creates an /// initial script object from it. /// </summary> /// <param name="ScriptFileName">Supplies the file name of the script /// assembly to load.</param> /// <param name="CallerScript">Supplies the script object owned by the /// caller.</param> /// <returns>The script object for the newly loaded script. On failure /// an exception is raised.</returns> public static IGeneratedScriptProgram LoadScriptFromDisk(string ScriptFileName, CLRScriptBase CallerScript) { AppDomain CurrentDomain = AppDomain.CurrentDomain; Assembly ScriptAsm; Type ScriptObjectType; IGeneratedScriptProgram ScriptObject; // // Load the target assembly up from disk in preparation for // instantiation. // byte[] FileContents = File.ReadAllBytes(ScriptFileName); // // Establish a temporary assembly resolve handler to handle the // reference to the interface assembly. // CurrentDomain.AssemblyResolve += new ResolveEventHandler(LoadScriptFromDisk_AssemblyResolve); try { ScriptAsm = CurrentDomain.Load(FileContents); // // Locate the script object type and create an instance of the // script object. // ScriptObjectType = (from AsmType in ScriptAsm.GetTypes() where AsmType.IsVisible && AsmType.GetInterface("IGeneratedScriptProgram") != null select AsmType).FirstOrDefault(); if (ScriptObjectType == null) { throw new ApplicationException("Unable to resolve script object type for assembly " + ScriptFileName); } ScriptObject = (IGeneratedScriptProgram)ScriptAsm.CreateInstance( ScriptObjectType.FullName, false, BindingFlags.CreateInstance, null, new object[] { CallerScript.ScriptHost.Intrinsics, CallerScript.ScriptHost.Host }, null, null); } finally { CurrentDomain.AssemblyResolve -= new ResolveEventHandler(LoadScriptFromDisk_AssemblyResolve); } return(ScriptObject); }
public static void UpdateInstructions(IInstructionListManager sender, AsmType asmType) { const AsmType currentAsmType = AsmType.RadAsm2; if ((asmType & currentAsmType) != currentAsmType) { return; } UpdateInstructions(sender, currentAsmType, ref Instructions, ref OtherInstructions); }
public static SignatureConfig GetSignature(AsmType asmType) { switch (asmType) { case AsmType.RadAsm: return(Asm1Instance); case AsmType.RadAsm2: return(Asm2Instance); default: return(null); } }
public IEnumerable <Instruction> GetSelectedSetInstructions(AsmType asmType) { switch (asmType) { case AsmType.RadAsm: return(_radAsm1SelectedSet ?? (IEnumerable <Instruction>)_radAsm1Instructions); case AsmType.RadAsm2: return(_radAsm2SelectedSet ?? (IEnumerable <Instruction>)_radAsm2Instructions); default: return(Enumerable.Empty <Instruction>()); } }
private void ActiveDocumentChanged(IDocument activeDocument) { var newActiveDocumentAsm = activeDocument?.CurrentSnapshot.GetAsmType() ?? AsmType.Unknown; if (newActiveDocumentAsm == _activeDocumentType) { return; } _activeDocumentType = newActiveDocumentAsm; AsmTypeChanged?.Invoke(); }
public Window1() { InitializeComponent(); show_log_window(); debug("FFXIAI"); debug(" author: framerate"); debug(" version: 0.0.0.1"); debug(" Starting..."); ArrayList a = Processes.get_ffxi_processes(); process_list_cb.Items.Clear(); foreach (Process obj in a) { process_list_cb.Items.Add(obj.MainWindowTitle + " - " + obj.Id); debug("found PID: " + obj.MainWindowTitle + " - " + obj.Id); } if (process_list_cb.Items.Count == 1) { debug("Only one FFXI process found!"); string polID = process_list_cb.Text; debug("Word: " + polID); int polIDPosition = polID.IndexOf(" - "); polID = polID.Remove(0, polIDPosition + 3); int pid = (int)Convert.ToUInt32(polID); debug("Attached to Process"); //Processes.attach_process(pid); } debug(System.AppDomain.CurrentDomain.BaseDirectory); //System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), @"settings/nav"); //system.reflection.assembly.getexecutingassembly().location foreach (string Filename in Directory.GetFiles(Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Plugins"), "*.dll")) { Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("IPluginInterface") != null) { IPluginInterface Plugin = (IPluginInterface)Activator.CreateInstance(AsmType); Plugins.Add(Plugin); debug("Plugin Loaded!"); } } } if (Plugins.Count == 0) { debug("No plugins found!"); } }
public InstructionListManager(IInstructionListLoader instructionListLoader, IDocumentFactory documentFactory) { instructionListLoader.InstructionsUpdated += InstructionsLoaded; documentFactory.ActiveDocumentChanged += ActiveDocumentChanged; _radAsm1InstructionSets = new List <IInstructionSet>(); _radAsm2InstructionSets = new List <IInstructionSet>(); _radAsm1Instructions = new List <Instruction>(); _radAsm2Instructions = new List <Instruction>(); _activeDocumentType = AsmType.Unknown; InstructionsLoaded(instructionListLoader.InstructionSets); Instance = this; }
public ArrayImpl GetFields() { ArrayImpl result = new ArrayImpl(); var list = AsmType.GetFields(); foreach (var itm in list) { StructureImpl strct = new StructureImpl(); strct.Insert("Имя", ValueFactory.Create(itm.Name)); strct.Insert("Тип", ValueFactory.Create(itm.FieldType.Name)); strct.Insert("ЭтоЗакрытое", ValueFactory.Create(itm.IsPrivate)); strct.Insert("ЭтоОткрытое", ValueFactory.Create(itm.IsPublic)); result.Add(strct); } return(result); }
void buttonBarItem_Click(object sender, Janus.Windows.ButtonBar.ItemEventArgs e) { INewsPaperControl item = (INewsPaperControl)((Janus.Windows.ButtonBar.ButtonBarItem)(sender)).Tag; if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0) { string Filename = Path.Combine(Application.StartupPath, "Plugins") + @"\" + item.getName() + ".dll"; Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); currentNewsPaperControl = Plugin; Point p = new Point(currentNewsPaperControl.getAttList().getLocation().X *zoomDegree, currentNewsPaperControl.getAttList().getLocation().Y *zoomDegree); Size s = new System.Drawing.Size(currentNewsPaperControl.getAttList().getSize().Width *zoomDegree, currentNewsPaperControl.getAttList().getSize().Height *zoomDegree); Plugin.getCtrl().Location = p; Plugin.getCtrl().Size = s; iObjNumber++; Plugin.getAttList().setInstanceName("Obj" + iObjNumber.ToString()); //Xử lý marker if (Plugin.getName() == "NewsPaperMarker") { lstMarker.Add(Plugin); } MarkerList.lstMarkerList = new List <string>(); foreach (INewsPaperControl c in lstMarker) { MarkerList.lstMarkerList.Add(c.getAttList().getInstanceName()); } break; } } } ((Control)(currentNewsPaperControl)).MouseDown += new MouseEventHandler(MainProgram_MouseDown); ((Control)(currentNewsPaperControl)).MouseUp += new MouseEventHandler(MainProgram_MouseUp); panelInnerScreen.Controls.Add((Control)currentNewsPaperControl); saveControlTraceAndSetRealLocationSize(); }
public ArrayImpl GetAsmProperties() { ArrayImpl result = new ArrayImpl(); var list = AsmType.GetProperties(); foreach (var itm in list) { StructureImpl strct = new StructureImpl(); strct.Insert("Имя", ValueFactory.Create(itm.Name)); strct.Insert("Тип", ValueFactory.Create(itm.PropertyType.Name)); strct.Insert("ДоступноЧтение", ValueFactory.Create(itm.CanRead)); strct.Insert("ДоступнаЗапись", ValueFactory.Create(itm.CanWrite)); //strct.Insert("ИмяМетодаЧтения", ValueFactory.Create(itm.GetMethod.Name)); //strct.Insert("ИмяМетодаЗаписи", ValueFactory.Create(itm.SetMethod.Name)); result.Add(strct); } return(result); }
bool loadControlPlugin() { m_MyControlList = new NewsPaperControlManager(); if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0) { foreach (string Filename in Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll")) { Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); m_MyControlList.LstNewsPaperControl.Add(Plugin); } } } return(true); } return(false); }
private void InstructionsUpdated(IInstructionListManager sender, AsmType asmType) { if ((asmType & AsmType.RadAsm) != 0) { _asm1InstructionCompletions.Clear(); _asm1InstructionCompletions.AddRange( sender.GetSelectedSetInstructions(AsmType.RadAsm) .GroupBy(i => i.Text) .Select(g => new InstructionCompletionItem(g, g.Key, Icon)) ); } if ((asmType & AsmType.RadAsm2) != 0) { _asm2InstructionCompletions.Clear(); _asm2InstructionCompletions.AddRange( sender.GetSelectedSetInstructions(AsmType.RadAsm2) .GroupBy(i => i.Text) .Select(g => new InstructionCompletionItem(g, g.Key, Icon)) ); } }
void buttonBarItem_Click(object sender, Janus.Windows.ButtonBar.ItemEventArgs e) { INewsPaperControl item = (INewsPaperControl)((Janus.Windows.ButtonBar.ButtonBarItem)(sender)).Tag; if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0) { string Filename = Path.Combine(Application.StartupPath, "Plugins") + @"\" + item.getName() + ".dll"; Assembly Asm = Assembly.LoadFile(Filename); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); currentNewsPaperControl = Plugin; } } } ((Control)(currentNewsPaperControl)).MouseDown += new MouseEventHandler(MainProgram_MouseDown); ((Control)(currentNewsPaperControl)).MouseUp += new MouseEventHandler(MainProgram_MouseUp); panelInnerScreen.Controls.Add((Control)currentNewsPaperControl); preState.Add(currentNewsPaperControl.clone()); currentState.Add(currentNewsPaperControl); }
public static CNewspaper readXML(string filename) { CNewspaper news = new CNewspaper(); news.Directory = filename.Substring(0, filename.LastIndexOf("\\")); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filename); news.KindOfNews = xmlDoc.SelectSingleNode("//title").InnerText; news.Datetime = xmlDoc.SelectSingleNode("//date").InnerText; news.NumPages = int.Parse(xmlDoc.SelectSingleNode("//numpages").InnerText); news.Number = int.Parse(xmlDoc.SelectSingleNode("//number").InnerText); foreach (XmlNode n in xmlDoc.SelectNodes("//page")) { CPage p = new CPage(); p.HeightP = int.Parse(n.Attributes["height"].Value); p.WidthP = int.Parse(n.Attributes["width"].Value); string strBackURL = n.Attributes["backgroundURL"].Value; if (strBackURL == "") { p.StrBackground = ""; } else { p.StrBackground = news.Directory + "\\" + strBackURL; } foreach (XmlNode xmlNodeObject in n.SelectNodes("object")) { string strControlName = xmlNodeObject.SelectSingleNode("type").InnerText; for (int i = 0; i < MainProgram.m_MyControlList.LstNewsPaperControl.Count; i++) { if (MainProgram.m_MyControlList.LstNewsPaperControl[i].getName() == strControlName) { Assembly Asm = Assembly.LoadFile(MainProgram.m_MyControlList.LstNewsPaperControl[i].getDllPath()); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); Plugin.loadfromXML(xmlNodeObject.OuterXml, news.Directory + "\\"); p.lstNewsPaperControl.Add(Plugin); break; } } break; } } } foreach (XmlNode xmlNodeObject in n.SelectNodes("marker")) { string strControlName = "NewsPaperMarker"; for (int i = 0; i < MainProgram.m_MyControlList.LstNewsPaperControl.Count; i++) { if (MainProgram.m_MyControlList.LstNewsPaperControl[i].getName() == strControlName) { Assembly Asm = Assembly.LoadFile(MainProgram.m_MyControlList.LstNewsPaperControl[i].getDllPath()); foreach (Type AsmType in Asm.GetTypes()) { if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase") { NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType); Plugin.loadfromXML(xmlNodeObject.OuterXml, news.Directory + "\\"); p.lstNewsPaperControl.Add(Plugin); break; } } break; } } } news.LPages.Add(p); } foreach (CPage page in news.LPages) { List <INewsPaperControl> lstMarker = new List <INewsPaperControl>(); List <INewsPaperControl> lstControl = new List <INewsPaperControl>(); foreach (INewsPaperControl c in page.lstNewsPaperControl) { if (c.getName() == "NewsPaperMarker") { lstMarker.Add(c); } } ReCalculteRealLocation(page, lstMarker); } return(news); }
private void InstructionsUpdatedInvoke(AsmType type) { Asm1Parser.UpdateInstructions(this, type); Asm2Parser.UpdateInstructions(this, type); InstructionsUpdated?.Invoke(this, type); }
public static IEnumerable <INavigationToken> GetInstructionsByName(this IInstructionListManager instructionList, AsmType asmType, string instruction) { var instructions = instructionList.GetSelectedSetInstructions(asmType); return(instructions .Where(i => i.Text == instruction) .SelectMany(i => i.Navigations)); }