private static void luaE_freethread(lua_State L, lua_State L1) { LX l = fromstate(L1); luaF_close(L1, L1.stack[0]); /* close all upvalues for this thread */ lua_assert(L1.openupval == null); luai_userstatefree(L1); freestack(L1); //luaM_free(L, l); //FIXME:added }
//===================================================================== // FunctionName : InitalizeDataBind /// <summary> /// 初始化数据绑定 /// </summary> //===================================================================== protected void InitalizeDataBind() { // 初始化类型(LX)下拉列表 LX.DataSource = GetDataSource_LX(); LX.DataTextField = "MC"; LX.DataValueField = "DM"; LX.DataBind(); // 初始化上级代码(SJDM)下拉列表 SJDM.DataTextField = "MC"; SJDM.DataValueField = "DM"; LXCoupled(); }
public Boolean Save() { Boolean Saved = true; try { XmlNode Node; m_Doc.RemoveAll(); Node = m_Doc.CreateXmlDeclaration("1.0", "utf-8", String.Empty); m_Doc.AppendChild(Node); Node = m_Doc.CreateComment(String.Format(" ScpControl Configuration Data. {0} ", DateTime.Now)); m_Doc.AppendChild(Node); Node = m_Doc.CreateWhitespace("\r\n"); m_Doc.AppendChild(Node); Node = m_Doc.CreateNode(XmlNodeType.Element, "ScpControl", null); { CreateTextNode(Node, "Idle", Idle.ToString()); CreateTextNode(Node, "LX", LX.ToString()); CreateTextNode(Node, "LY", LY.ToString()); CreateTextNode(Node, "RX", RX.ToString()); CreateTextNode(Node, "RY", RY.ToString()); CreateTextNode(Node, "LED", LED.ToString()); CreateTextNode(Node, "Rumble", Rumble.ToString()); CreateTextNode(Node, "Triggers", Triggers.ToString()); CreateTextNode(Node, "Latency", Latency.ToString()); CreateTextNode(Node, "DeadL", DeadL.ToString()); CreateTextNode(Node, "DeadR", DeadR.ToString()); CreateTextNode(Node, "Native", Native.ToString()); CreateTextNode(Node, "SSP", SSP.ToString()); CreateTextNode(Node, "Brightness", Brightness.ToString()); CreateTextNode(Node, "Bus", Bus.ToString()); CreateTextNode(Node, "Force", Repair.ToString()); } m_Doc.AppendChild(Node); m_Doc.Save(m_File); } catch { Saved = false; } return(Saved); }
//===================================================================== // FunctionName : InitalizeDataBind /// <summary> /// 初始化数据绑定 /// </summary> //===================================================================== protected void InitalizeDataBind() { // 查询报告列表 FilterReportDataBind((string)Session[ConstantsManager.SESSION_USER_ID], FilterReportList); // 主表 // 初始化类型(LX)下拉列表 LX.DataSource = GetDataSource_LX_AdvanceSearch(); LX.DataTextField = "MC"; LX.DataValueField = "DM"; LX.DataBind(); LX.Items.Insert(0, new ListItem("选择类型", "")); // 初始化上级代码(SJDM)下拉列表 SJDM.DataTextField = "MC"; SJDM.DataValueField = "DM"; LXCoupled(); // 一对一相关表 }
// TODO: Icons void OnLoadComplete(object sender, EventArgs eventArgs) { if (Context.Executables?.Count > 0) { lblPanelName.Text = "Please wait while reading executables found"; prgProgress.MaxValue = Context.Executables.Count; prgProgress.MinValue = 0; prgProgress.Value = 0; foreach (string file in Context.Executables) { var exeStream = new FileStream(file, FileMode.Open, FileAccess.Read); var mzExe = new MZ(exeStream); var neExe = new NE(exeStream); var stExe = new AtariST(exeStream); var lxExe = new LX(exeStream); var coffExe = new COFF(exeStream); var peExe = new PE(exeStream); var geosExe = new Geos(exeStream); var elfExe = new ELF(exeStream); IExecutable recognizedExe; if (neExe.Recognized) { recognizedExe = neExe; } else if (lxExe.Recognized) { recognizedExe = lxExe; } else if (peExe.Recognized) { recognizedExe = peExe; } else if (mzExe.Recognized) { recognizedExe = mzExe; } else if (coffExe.Recognized) { recognizedExe = coffExe; } else if (stExe.Recognized) { recognizedExe = stExe; } else if (elfExe.Recognized) { recognizedExe = elfExe; } else if (geosExe.Recognized) { recognizedExe = geosExe; } else { exeStream.Close(); continue; } if (recognizedExe.Strings != null) { strings.AddRange(recognizedExe.Strings); } foreach (Architecture exeArch in recognizedExe.Architectures) { ArchitecturesTypeArchitecture?arch = ExeArchToSchemaArch(exeArch); if (arch.HasValue && !architectures.Contains($"{arch.Value}")) { architectures.Add($"{arch.Value}"); } } operatingSystems.Add(new TargetOsEntry { name = recognizedExe.RequiredOperatingSystem.Name, version = $"{recognizedExe.RequiredOperatingSystem.MajorVersion}.{recognizedExe.RequiredOperatingSystem.MinorVersion}" }); switch (recognizedExe) { case NE _: if (neExe.Versions != null) { foreach (NE.Version exeVersion in neExe.Versions) { versions.Add(exeVersion.FileVersion); versions.Add(exeVersion.ProductVersion); version = exeVersion.ProductVersion; foreach (KeyValuePair <string, Dictionary <string, string> > kvp in exeVersion. StringsByLanguage) { if (kvp.Value.TryGetValue("CompanyName", out string tmpValue)) { developer = tmpValue; } if (kvp.Value.TryGetValue("ProductName", out string tmpValue2)) { product = tmpValue2; } } } } break; case PE _: if (peExe.Versions != null) { foreach (PE.Version exeVersion in peExe.Versions) { versions.Add(exeVersion.FileVersion); versions.Add(exeVersion.ProductVersion); version = exeVersion.ProductVersion; foreach (KeyValuePair <string, Dictionary <string, string> > kvp in exeVersion. StringsByLanguage) { if (kvp.Value.TryGetValue("CompanyName", out string tmpValue)) { developer = tmpValue; } if (kvp.Value.TryGetValue("ProductName", out string tmpValue2)) { product = tmpValue2; } } } } break; case LX _: if (lxExe.WinVersion != null) { versions.Add(lxExe.WinVersion.FileVersion); versions.Add(lxExe.WinVersion.ProductVersion); version = lxExe.WinVersion.ProductVersion; foreach (KeyValuePair <string, Dictionary <string, string> > kvp in lxExe.WinVersion. StringsByLanguage) { if (kvp.Value.TryGetValue("CompanyName", out string tmpValue)) { developer = tmpValue; } if (kvp.Value.TryGetValue("ProductName", out string tmpValue2)) { product = tmpValue2; } } } break; } exeStream.Close(); prgProgress.Value++; } strings = strings.Distinct().ToList(); strings.Sort(); if (strings.Count == 0 && minimumPanel == Panels.Strings) { minimumPanel = Panels.Versions; } else { maximumPanel = Panels.Strings; } panelStrings.treeStrings.DataStore = strings; versions = versions.Distinct().ToList(); versions.Sort(); panelVersions.treeVersions.DataStore = versions; architectures = architectures.Distinct().ToList(); architectures.Sort(); panelVersions.treeArchs.DataStore = architectures; Dictionary <string, List <string> > osEntriesDictionary = new Dictionary <string, List <string> >(); foreach (TargetOsEntry osEntry in operatingSystems) { if (string.IsNullOrEmpty(osEntry.name)) { continue; } osEntriesDictionary.TryGetValue(osEntry.name, out List <string> osvers); if (osvers == null) { osvers = new List <string>(); } osvers.Add(osEntry.version); osEntriesDictionary.Remove(osEntry.name); osEntriesDictionary.Add(osEntry.name, osvers); } operatingSystems = new List <TargetOsEntry>(); foreach (KeyValuePair <string, List <string> > kvp in osEntriesDictionary.OrderBy(t => t.Key)) { kvp.Value.Sort(); foreach (string s in kvp.Value.Distinct()) { operatingSystems.Add(new TargetOsEntry { name = kvp.Key, version = s }); } } panelVersions.treeOs.DataStore = operatingSystems; if (versions.Count > 0 || architectures.Count > 0 || operatingSystems.Count > 0) { maximumPanel = Panels.Versions; } } prgProgress.Visible = false; btnPrevious.Enabled = false; switch (minimumPanel) { case Panels.Description: pnlPanel.Content = panelDescription; currentPanel = Panels.Description; break; case Panels.Strings: pnlPanel.Content = panelStrings; currentPanel = Panels.Strings; break; case Panels.Versions: pnlPanel.Content = panelVersions; currentPanel = Panels.Versions; break; } if (currentPanel == maximumPanel) { btnNext.Text = "Finish"; } lblPanelName.Visible = false; }
public Boolean Save() { Boolean Saved = true; try { XmlNode Node, Entry; m_Xdoc.RemoveAll(); Node = m_Xdoc.CreateXmlDeclaration("1.0", "utf-8", String.Empty); m_Xdoc.AppendChild(Node); Node = m_Xdoc.CreateComment(String.Format(" ScpControl Configuration Data. {0} ", DateTime.Now)); m_Xdoc.AppendChild(Node); Node = m_Xdoc.CreateWhitespace("\r\n"); m_Xdoc.AppendChild(Node); Node = m_Xdoc.CreateNode(XmlNodeType.Element, "ScpControl", null); Entry = m_Xdoc.CreateNode(XmlNodeType.Element, "Idle", null); Entry.InnerText = Idle.ToString(); Node.AppendChild(Entry); Entry = m_Xdoc.CreateNode(XmlNodeType.Element, "LX", null); Entry.InnerText = LX.ToString(); Node.AppendChild(Entry); Entry = m_Xdoc.CreateNode(XmlNodeType.Element, "LY", null); Entry.InnerText = LY.ToString(); Node.AppendChild(Entry); Entry = m_Xdoc.CreateNode(XmlNodeType.Element, "RX", null); Entry.InnerText = RX.ToString(); Node.AppendChild(Entry); Entry = m_Xdoc.CreateNode(XmlNodeType.Element, "RY", null); Entry.InnerText = RY.ToString(); Node.AppendChild(Entry); Entry = m_Xdoc.CreateNode(XmlNodeType.Element, "LED", null); Entry.InnerText = LED.ToString(); Node.AppendChild(Entry); m_Xdoc.AppendChild(Node); m_Xdoc.Save(m_File); } catch { Saved = false; } return(Saved); }
public static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("exeinfo version 0.1 © 2017-2018 Natalia Portillo"); Console.WriteLine("Usage: exeinfo file.exe"); return; } bool recognized = false; IExecutable mzExe = new MZ(args[0]); IExecutable neExe = new NE(args[0]); IExecutable stExe = new AtariST(args[0]); IExecutable lxExe = new LX(args[0]); IExecutable coffExe = new COFF(args[0]); IExecutable peExe = new PE(args[0]); IExecutable geosExe = new Geos(args[0]); IExecutable elfExe = new ELF(args[0]); if (neExe.Recognized) { recognized = true; Console.Write(neExe.Information); if (((NE)neExe).Versions != null) { foreach (NE.Version vers in ((NE)neExe).Versions) { Console.WriteLine("\tVersion resource {0}:", vers.Name); Console.WriteLine("\t\tFile version: {0}", vers.FileVersion); Console.WriteLine("\t\tProduct version: {0}", vers.ProductVersion); Console.WriteLine("\t\tFile type: {0}", Version.TypeToString(vers.FileType)); if (vers.FileType == VersionFileType.VFT_DRV) { Console.WriteLine("\t\tFile subtype: {0} driver", Version.DriverToString(vers.FileSubtype)); } else if (vers.FileType == VersionFileType.VFT_DRV) { Console.WriteLine("\t\tFile subtype: {0} font", Version.FontToString(vers.FileSubtype)); } else if (vers.FileSubtype > 0) { Console.WriteLine("\t\tFile subtype: {0}", (uint)vers.FileSubtype); } Console.WriteLine("\t\tFile flags: {0}", vers.FileFlags); Console.WriteLine("\t\tFile OS: {0}", Version.OsToString(vers.FileOs)); foreach (KeyValuePair <string, Dictionary <string, string> > strByLang in vers.StringsByLanguage) { string cultureName; string encodingName; try { cultureName = new CultureInfo(Convert.ToInt32(strByLang.Key.Substring(0, 4), 16)) .DisplayName; } catch { cultureName = $"unsupported culture 0x{Convert.ToInt32(strByLang.Key.Substring(0, 4), 16):X4}"; } try { encodingName = Encoding .GetEncoding(Convert.ToInt32(strByLang.Key.Substring(4), 16)) .EncodingName; } catch { encodingName = $"unsupported encoding 0x{Convert.ToInt32(strByLang.Key.Substring(4), 16):X4}"; } Console.WriteLine("\t\tStrings for {0} in codepage {1}:", cultureName, encodingName); foreach (KeyValuePair <string, string> strings in strByLang.Value) { Console.WriteLine("\t\t\t{0}: {1}", strings.Key, strings.Value); } } } } if (neExe.Strings != null && neExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in neExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } else if (lxExe.Recognized) { recognized = true; Console.Write(lxExe.Information); if (((LX)lxExe).WinVersion != null) { NE.Version vers = ((LX)lxExe).WinVersion; Console.WriteLine("\tVxD version resource {0}:", vers.Name); Console.WriteLine("\t\tFile version: {0}", vers.FileVersion); Console.WriteLine("\t\tProduct version: {0}", vers.ProductVersion); Console.WriteLine("\t\tFile type: {0}", Version.TypeToString(vers.FileType)); if (vers.FileType == VersionFileType.VFT_DRV) { Console.WriteLine("\t\tFile subtype: {0} driver", Version.DriverToString(vers.FileSubtype)); } else if (vers.FileType == VersionFileType.VFT_DRV) { Console.WriteLine("\t\tFile subtype: {0} font", Version.FontToString(vers.FileSubtype)); } else if (vers.FileSubtype > 0) { Console.WriteLine("\t\tFile subtype: {0}", (uint)vers.FileSubtype); } Console.WriteLine("\t\tFile flags: {0}", vers.FileFlags); Console.WriteLine("\t\tFile OS: {0}", Version.OsToString(vers.FileOs)); foreach (KeyValuePair <string, Dictionary <string, string> > strByLang in vers.StringsByLanguage) { string cultureName; string encodingName; try { cultureName = new CultureInfo(Convert.ToInt32(strByLang.Key.Substring(0, 4), 16)) .DisplayName; } catch { cultureName = $"unsupported culture 0x{Convert.ToInt32(strByLang.Key.Substring(0, 4), 16):X4}"; } try { encodingName = Encoding.GetEncoding(Convert.ToInt32(strByLang.Key.Substring(4), 16)) .EncodingName; } catch { encodingName = $"unsupported encoding 0x{Convert.ToInt32(strByLang.Key.Substring(4), 16):X4}"; } Console.WriteLine("\t\tStrings for {0} in codepage {1}:", cultureName, encodingName); foreach (KeyValuePair <string, string> strings in strByLang.Value) { Console.WriteLine("\t\t\t{0}: {1}", strings.Key, strings.Value); } } } if (lxExe.Strings != null && lxExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in lxExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } else if (peExe.Recognized) { recognized = true; Console.Write(peExe.Information); if (((PE)peExe).Versions != null) { foreach (PE.Version vers in ((PE)peExe).Versions) { Console.WriteLine("\tVersion resource {0}:", vers.Name); Console.WriteLine("\t\tFile version: {0}", vers.FileVersion); Console.WriteLine("\t\tProduct version: {0}", vers.ProductVersion); Console.WriteLine("\t\tFile type: {0}", Version.TypeToString(vers.FileType)); if (vers.FileType == VersionFileType.VFT_DRV) { Console.WriteLine("\t\tFile subtype: {0} driver", Version.DriverToString(vers.FileSubtype)); } else if (vers.FileType == VersionFileType.VFT_DRV) { Console.WriteLine("\t\tFile subtype: {0} font", Version.FontToString(vers.FileSubtype)); } else if (vers.FileSubtype > 0) { Console.WriteLine("\t\tFile subtype: {0}", (uint)vers.FileSubtype); } Console.WriteLine("\t\tFile flags: {0}", vers.FileFlags); Console.WriteLine("\t\tFile OS: {0}", Version.OsToString(vers.FileOs)); foreach (KeyValuePair <string, Dictionary <string, string> > strByLang in vers.StringsByLanguage) { string cultureName; string encodingName; try { cultureName = new CultureInfo(Convert.ToInt32(strByLang.Key.Substring(0, 4), 16)) .DisplayName; } catch { cultureName = $"unsupported culture 0x{Convert.ToInt32(strByLang.Key.Substring(0, 4), 16):X4}"; } try { encodingName = Encoding .GetEncoding(Convert.ToInt32(strByLang.Key.Substring(4), 16)) .EncodingName; } catch { encodingName = $"unsupported encoding 0x{Convert.ToInt32(strByLang.Key.Substring(4), 16):X4}"; } Console.WriteLine("\t\tStrings for {0} in codepage {1}:", cultureName, encodingName); foreach (KeyValuePair <string, string> strings in strByLang.Value) { Console.WriteLine("\t\t\t{0}: {1}", strings.Key, strings.Value); } } } } if (peExe.Strings != null && peExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in peExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } else if (mzExe.Recognized) { recognized = true; Console.Write(mzExe.Information); if (((MZ)mzExe).ResourceStream != null || ((MZ)mzExe).ResourceHeader.rsh_vrsn != 0 && ((MZ)mzExe).ResourceHeader.rsh_vrsn != 1 && ((MZ)mzExe).ResourceHeader.rsh_vrsn != 4 && ((MZ)mzExe).ResourceHeader.rsh_vrsn != 5) { PrintGemResources(((MZ)mzExe).ResourceHeader, ((MZ)mzExe).ResourceObjectRoots, ((MZ)mzExe).ResourceExtension, ((MZ)mzExe).GemColorIcons); } if (mzExe.Strings != null && mzExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in mzExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } if (stExe.Recognized) { recognized = true; Console.Write(stExe.Information); if (((AtariST)stExe).ResourceStream != null || ((AtariST)stExe).ResourceHeader.rsh_vrsn != 0 && ((AtariST)stExe).ResourceHeader.rsh_vrsn != 1 && ((AtariST)stExe).ResourceHeader.rsh_vrsn != 4 && ((AtariST)stExe).ResourceHeader.rsh_vrsn != 5) { PrintGemResources(((AtariST)stExe).ResourceHeader, ((AtariST)stExe).ResourceObjectRoots, ((AtariST)stExe).ResourceExtension, ((AtariST)stExe).GemColorIcons); } if (stExe.Strings != null && stExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in stExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } if (coffExe.Recognized) { recognized = true; Console.Write(coffExe.Information); if (coffExe.Strings != null && coffExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in coffExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } else if (elfExe.Recognized) { recognized = true; Console.Write(elfExe.Information); if (elfExe.Strings != null && elfExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in elfExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } if (geosExe.Recognized) { recognized = true; Console.Write(geosExe.Information); if (geosExe.Strings != null && geosExe.Strings.Any()) { Console.WriteLine("\tStrings:"); foreach (string str in geosExe.Strings) { Console.WriteLine("\t\t{0}", str); } } } if (!recognized) { Console.WriteLine("Executable format not recognized"); } }