Ejemplo n.º 1
0
        public override string ToString()
        {
            if (MZToleranceIsPPM)
            {
                return("m/z: " + MZ.ToString("0.0") + ", MZTolerance: " + MZTolerance.ToString("0.0") + " ppm");
            }

            return("m/z: " + MZ.ToString("0.0") + ", MZTolerance: " + MZTolerance.ToString("0.000") + " Da");
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            if (CustomSICPeak)
            {
                return("m/z " + MZ.ToString("0.00") + " (Custom SIC peak)");
            }

            return("m/z " + MZ.ToString("0.00"));
        }
Ejemplo n.º 3
0
        public override string ToString()
        {
            var data = new List <string> {
                ID.ToString(),
                MonoIsotopicMass.ToString("0.0000"),
                MZ.ToString("0.0000"),
                ChargeState.ToString(),
                NormalizedElutionTime.ToString("0.000"),
                Code
            };

            return(string.Join("; ", data));
        }
    //=====================================================================
    //  FunctionName : InitalizeDataBind
    /// <summary>
    /// 初始化数据绑定
    /// </summary>
    //=====================================================================
    protected void InitalizeDataBind()
    {
        // 查询报告列表
        FilterReportDataBind((string)Session[ConstantsManager.SESSION_USER_ID], FilterReportList);

        // 主表

        // 初始化用户组(UserGroupID)下拉列表
        UserGroupID.DataSource     = GetDataSource_UserGroupID_AdvanceSearch();
        UserGroupID.DataTextField  = "UserGroupName";
        UserGroupID.DataValueField = "UserGroupID";
        UserGroupID.DataBind();
        UserGroupID.RepeatColumns = 1;

        // 初始化所属单位(SubjectID)下拉列表
        SubjectID.DataSource     = GetDataSource_SubjectID_AdvanceSearch();
        SubjectID.DataTextField  = "DWMC";
        SubjectID.DataValueField = "DWBH";
        SubjectID.DataBind();
        SubjectID.RepeatColumns = 1;

        // 初始化性别(XB)下拉列表
        XB.DataSource     = GetDataSource_XB_AdvanceSearch();
        XB.DataTextField  = "MC";
        XB.DataValueField = "DM";
        XB.DataBind();
        XB.RepeatColumns = 1;

        // 初始化民族(MZ)下拉列表
        MZ.DataSource     = GetDataSource_MZ_AdvanceSearch();
        MZ.DataTextField  = "MC";
        MZ.DataValueField = "DM";
        MZ.DataBind();
        MZ.RepeatColumns = 1;

        // 初始化政治面貌(ZZMM)下拉列表
        ZZMM.DataSource     = GetDataSource_ZZMM_AdvanceSearch();
        ZZMM.DataTextField  = "MC";
        ZZMM.DataValueField = "DM";
        ZZMM.DataBind();
        ZZMM.RepeatColumns = 1;

        // 初始化用户状态(UserStatus)下拉列表
        UserStatus.DataSource     = GetDataSource_UserStatus_AdvanceSearch();
        UserStatus.DataTextField  = "MC";
        UserStatus.DataValueField = "DM";
        UserStatus.DataBind();
        UserStatus.Items.Insert(0, new ListItem("选择用户状态", ""));

        // 一对一相关表
    }
Ejemplo n.º 5
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append(ID);
            sb.Append("; ");
            sb.Append(MonoIsotopicMass.ToString("0.0000"));
            sb.Append("; ");
            sb.Append(MZ.ToString("0.0000"));
            sb.Append("; ");
            sb.Append(ChargeState);
            sb.Append("; ");
            sb.Append(NormalizedElutionTime);
            sb.Append("; ");
            sb.Append(Code);

            return(sb.ToString());
        }
    //=====================================================================
    //  FunctionName : InitalizeDataBind
    /// <summary>
    /// 初始化数据绑定
    /// </summary>
    //=====================================================================
    protected void InitalizeDataBind()
    {
        // 初始化用户组(UserGroupID)下拉列表
        UserGroupID.DataSource     = GetDataSource_UserGroupID();
        UserGroupID.DataTextField  = "UserGroupName";
        UserGroupID.DataValueField = "UserGroupID";
        UserGroupID.DataBind();

        // 初始化所属单位(SubjectID)下拉列表
        SubjectID.DataSource     = GetDataSource_SubjectID();
        SubjectID.DataTextField  = "DWMC";
        SubjectID.DataValueField = "DWBH";
        SubjectID.DataBind();

        // 初始化性别(XB)下拉列表
        XB.DataSource     = GetDataSource_XB();
        XB.DataTextField  = "MC";
        XB.DataValueField = "DM";
        XB.DataBind();

        // 初始化民族(MZ)下拉列表
        MZ.DataSource     = GetDataSource_MZ();
        MZ.DataTextField  = "MC";
        MZ.DataValueField = "DM";
        MZ.DataBind();

        // 初始化政治面貌(ZZMM)下拉列表
        ZZMM.DataSource     = GetDataSource_ZZMM();
        ZZMM.DataTextField  = "MC";
        ZZMM.DataValueField = "DM";
        ZZMM.DataBind();

        // 初始化用户状态(UserStatus)下拉列表
        UserStatus.DataSource     = GetDataSource_UserStatus();
        UserStatus.DataTextField  = "MC";
        UserStatus.DataValueField = "DM";
        UserStatus.DataBind();
    }
Ejemplo n.º 7
0
        protected void OnBtnLoadClick(object sender, EventArgs e)
        {
            txtFile.Text        = "";
            txtType.Text        = "";
            txtInformation.Text = "";
            cmbArch.Items.Clear();
            lblSubsystem.Visible    = false;
            txtSubsystem.Visible    = false;
            tabStrings.Visible      = false;
            tabGemResources.Visible = false;
            tabSegments.Visible     = false;
            tabNeResources.Visible  = false;
            tabLeVxdVersion.Visible = false;
            tabLxResources.Visible  = false;
            tabPeResources.Visible  = false;
            tabBeResources.Visible  = false;

            OpenFileDialog dlgOpen = new OpenFileDialog {
                Title = "Choose executable file", MultiSelect = false
            };

            if (dlgOpen.ShowDialog(this) != DialogResult.Ok)
            {
                return;
            }

            txtFile.Text        = dlgOpen.FileName;
            txtInformation.Text = "";
            txtOs.Text          = "";
            txtSubsystem.Text   = "";
            txtType.Text        = "";

            IExecutable mzExe         = new MZ(dlgOpen.FileName);
            IExecutable neExe         = new libexeinfo.NE(dlgOpen.FileName);
            IExecutable stExe         = new AtariST(dlgOpen.FileName);
            IExecutable lxExe         = new libexeinfo.LX(dlgOpen.FileName);
            IExecutable coffExe       = new COFF(dlgOpen.FileName);
            IExecutable peExe         = new libexeinfo.PE(dlgOpen.FileName);
            IExecutable geosExe       = new Geos(dlgOpen.FileName);
            IExecutable elfExe        = new ELF(dlgOpen.FileName);
            IExecutable recognizedExe = null;

            if (mzExe.Recognized)
            {
                recognizedExe = mzExe;
                if (((MZ)mzExe).ResourceObjectRoots != null && ((MZ)mzExe).ResourceObjectRoots.Any())
                {
                    tabGemResources.Update(((MZ)mzExe).ResourceObjectRoots, ((MZ)mzExe).GemColorIcons);
                    tabGemResources.Visible = true;
                }
            }

            if (neExe.Recognized)
            {
                recognizedExe = neExe;
                if (((libexeinfo.NE)neExe).Resources.types != null && ((libexeinfo.NE)neExe).Resources.types.Any())
                {
                    tabNeResources.Update(((libexeinfo.NE)neExe).Resources.types,
                                          ((libexeinfo.NE)neExe).Header.target_os);
                    tabNeResources.Visible = true;
                }
            }
            else if (lxExe.Recognized)
            {
                recognizedExe = lxExe;
                if (((libexeinfo.LX)lxExe).WinVersion != null)
                {
                    tabLeVxdVersion.Visible = true;
                    tabLeVxdVersion.Update(((libexeinfo.LX)lxExe).WinVersion);
                }

                if (((libexeinfo.LX)lxExe).neFormatResourceTable.types != null &&
                    ((libexeinfo.LX)lxExe).neFormatResourceTable.types.Any())
                {
                    tabLxResources.Update(((libexeinfo.LX)lxExe).neFormatResourceTable.types);
                    tabLxResources.Visible = true;
                }
            }
            else if (peExe.Recognized)
            {
                recognizedExe = peExe;
                if (((libexeinfo.PE)peExe).WindowsResourcesRoot?.children != null)
                {
                    tabPeResources.Update(((libexeinfo.PE)peExe).WindowsResourcesRoot);
                    tabPeResources.Visible = true;
                }

                if (((libexeinfo.PE)peExe).BeosResources != null)
                {
                    tabBeResources.Update(((libexeinfo.PE)peExe).BeosResources, peExe.IsBigEndian);
                    tabBeResources.Visible = true;
                }
            }
            else if (stExe.Recognized)
            {
                recognizedExe = stExe;
                if (((AtariST)stExe).ResourceObjectRoots != null && ((AtariST)stExe).ResourceObjectRoots.Any())
                {
                    tabGemResources.Update(((AtariST)stExe).ResourceObjectRoots, ((AtariST)stExe).GemColorIcons);
                    tabGemResources.Visible = true;
                }
            }
            else if (coffExe.Recognized)
            {
                recognizedExe = coffExe;
            }
            else if (elfExe.Recognized)
            {
                recognizedExe = elfExe;
            }
            else if (geosExe.Recognized)
            {
                recognizedExe = geosExe;
            }
            else
            {
                txtType.Text = "Format not recognized";
            }

            if (recognizedExe == null)
            {
                return;
            }

            txtType.Text        = recognizedExe.Type;
            txtInformation.Text = recognizedExe.Information;
            foreach (Architecture arch in recognizedExe.Architectures)
            {
                cmbArch.Items.Add(Enums.ArchitectureName.FirstOrDefault(ar => ar.arch == arch).longName);
            }
            cmbArch.SelectedIndex = 0;

            if (recognizedExe.RequiredOperatingSystem.MajorVersion > 0)
            {
                txtOs.Text = $"{recognizedExe.RequiredOperatingSystem.Name}" +
                             $" {recognizedExe.RequiredOperatingSystem.MajorVersion}" +
                             $".{recognizedExe.RequiredOperatingSystem.MinorVersion}";
            }
            else
            {
                txtOs.Text = recognizedExe.RequiredOperatingSystem.Name;
            }

            if (!string.IsNullOrEmpty(recognizedExe.RequiredOperatingSystem.Subsystem))
            {
                lblSubsystem.Visible = true;
                txtSubsystem.Visible = true;
                txtSubsystem.Text    = recognizedExe.RequiredOperatingSystem.Subsystem;
            }

            if (recognizedExe.Strings != null && recognizedExe.Strings.Any())
            {
                tabStrings.Update(recognizedExe.Strings);
                tabStrings.Visible = true;
            }

            if (recognizedExe.Segments != null && recognizedExe.Segments.Any())
            {
                tabSegments.Update(recognizedExe.Segments);
                tabSegments.Visible = true;
            }
        }
Ejemplo n.º 8
0
        // 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;
        }
Ejemplo n.º 9
0
        public override string GetValue(string fieldName)
        {
            switch (fieldName)
            {
            case Fields.Sequence:
                return(Sequence);

            case Fields.Accession:
                return(Accession);

            case Fields.Unique:
                return(Unique ? "1" : "0");

            case Fields.Database:
                return(Database);

            case Fields.DatabaseVersion:
                return(DatabaseVersion);

            case Fields.SearchEngine:
                return(string.Join("|", SearchEngines));

            case Fields.Reliability:
                if (Reliability == MzTab.ReliabilityScore.NotSet)
                {
                    return(MzTab.NullFieldText);
                }
                return(((int)Reliability).ToString());

            case Fields.Modifications:
                return(Modifications);

            case Fields.RetentionTime:
                return(string.Join("|", RetentionTime));

            case Fields.Charge:
                return(Charge.ToString());

            case Fields.MZ:
                return(MZ.ToString());

            case Fields.Uri:
                return(Uri.ToString());

            case Fields.SpectraReference:
                return(SpectraReference);

            case Fields.RetentionTimeWindow:
                return(string.Join("|", RetentionTimeWindows));
            }

            if (fieldName.Contains("["))
            {
                string     condensedFieldName;
                List <int> indices = MzTab.GetFieldIndicies(fieldName, out condensedFieldName);

                switch (condensedFieldName)
                {
                case Fields.AbundanceAssay:
                    return(GetListValue(_abundanceAssays, indices[0]));

                case Fields.AbundanceStudyVariable:
                    return(GetListValue(_abundanceStudyVariables, indices[0]));

                case Fields.AbundanceStDevStudyVariable:
                    return(GetListValue(_abundanceStdevStudyVariables, indices[0]));

                case Fields.AbudnanceStdErrorStudyVariable:
                    return(GetListValue(_abundanceStandardErrorStudyVariables, indices[0]));

                case Fields.BestSearchEngineScore:
                    return(GetListValue(_bestSearchEngineScores, indices[0]));
                }
            }

            if (fieldName.StartsWith(MzTab.OptionalColumnPrefix))
            {
                return(GetOptionalData(fieldName));
            }

            throw new ArgumentException("Unexpected field name: " + fieldName);
        }
Ejemplo n.º 10
0
 public bool Equals(MZPeak other)
 {
     return(MZ.Equals(other.MZ) && Intensity.Equals(other.Intensity));
 }
Ejemplo n.º 11
0
 public override int GetHashCode()
 {
     return(MZ.GetHashCode() ^ Intensity.GetHashCode());
 }
        private void button2_Click(object sender, EventArgs e)
        {
            MZ [] f = new MZ[9];
            for (int i = 0; i < 9; i++)
            {
                f[i] = new MZ();
            }

            Convert.ToDouble(textBox1.Text);
            Convert.ToInt32(textBox1.Text);

            int    x  = Convert.ToInt32(textBox1.Text);
            double fx = 0;

            fx            = ucgencoor(x, 0, 0, 50);
            label198.Text = "MX = " + fx.ToString();

            double y = Convert.ToDouble(textBox2.Text);

            y = y * 100;
            double fy = 0;

            fy            = ucgencoor(y, 0, 0, 50);
            label199.Text = "MY = " + fy.ToString();

            double z = Convert.ToDouble(textBox3.Text);

            z = z * 100;
            double fz = 0;

            fz            = ucgencoor(z, 0, 0, 50);
            label200.Text = "MZ = " + fz.ToString();
            f[0].m        = min(fx, fy, fz);
            label214.Text = f[0].m.ToString();  ////////////////////////////
            f[0].z        = 0;

            int    x1  = Convert.ToInt32(textBox1.Text);
            double fx1 = 0;

            fx1           = ucgencoor(x, 0, 50, 100);
            label201.Text = "MX = " + fx1.ToString();

            double y1 = Convert.ToDouble(textBox2.Text);

            y1 = y1 * 100;
            double fy1 = 0;

            fy1           = ucgencoor(y, 50, 100, 100);
            label202.Text = "MY = " + fy1.ToString();

            double z1 = Convert.ToDouble(textBox3.Text);

            z1 = z1 * 100;
            double fz1 = 0;

            fz1           = ucgencoor(z, 50, 100, 100);
            label203.Text = "MZ = " + fz1.ToString();
            f[1].m        = min(fx1, fy1, fz1);
            label215.Text = f[1].m.ToString(); /////////////////////////////////
            f[1].z        = 0.5;

            int    x2  = Convert.ToInt32(textBox1.Text);
            double fx2 = 0;

            fx2           = ucgencoor(x, 50, 100, 100);
            label204.Text = "MX = " + fx2.ToString();

            double y2 = Convert.ToDouble(textBox2.Text);;

            y2 = y2 * 100;
            double fy2 = 0;

            fy2           = ucgencoor(y, 0, 50, 100);
            label205.Text = "MY = " + fy2.ToString();

            double z2 = Convert.ToDouble(textBox3.Text);

            z2 = z2 * 100;
            double fz2 = 0;

            fz2           = ucgencoor(z, 0, 50, 100);
            label206.Text = "MZ = " + fz2.ToString();
            f[2].m        = min(fx2, fy2, fz2);
            label216.Text = f[2].m.ToString(); /////////////////////////////////
            f[2].z        = 1;

            int    x3  = Convert.ToInt32(textBox1.Text);
            double fx3 = 0;

            fx3           = ucgencoor(x, 0, 0, 50);
            label207.Text = "MX = " + fx3.ToString();

            double y3 = Convert.ToDouble(textBox2.Text);

            y3 = y3 * 100;
            double fy3 = 0;

            fy3           = ucgencoor(y, 50, 100, 100);
            label208.Text = "MY = " + fy3.ToString();

            double z3 = Convert.ToDouble(textBox3.Text);

            z3 = z3 * 100;
            double fz3 = 0;

            fz3           = ucgencoor(z, 50, 100, 100);
            label209.Text = "MZ = " + fz3.ToString();
            f[3].m        = min(fx3, fy3, fz3);
            label217.Text = f[3].m.ToString(); /////////////////////////////////
            f[3].z        = 0;

            int    x4  = Convert.ToInt32(textBox1.Text);
            double fx4 = 0;

            fx4           = ucgencoor(x, 0, 0, 50);
            label222.Text = "MX = " + fx4.ToString();

            double y4 = Convert.ToDouble(textBox2.Text);

            y4 = y4 * 100;
            double fy4 = 0;

            fy4           = ucgencoor(y, 0, 50, 100);
            label221.Text = "MY = " + fy4.ToString();

            double z4 = Convert.ToDouble(textBox3.Text);

            z4 = z4 * 100;
            double fz4 = 0;

            fz4           = ucgencoor(z, 0, 50, 100);
            label220.Text = "MZ = " + fz4.ToString();
            f[4].m        = min(fx4, fy4, fz4);
            label218.Text = f[4].m.ToString(); /////////////////////////////////
            f[4].z        = 0;

            int    x5  = Convert.ToInt32(textBox1.Text);
            double fx5 = 0;

            fx5           = ucgencoor(x, 0, 50, 100);
            label263.Text = "MX = " + fx5.ToString();

            double y5 = Convert.ToDouble(textBox2.Text);

            y5 = y5 * 100;
            double fy5 = 0;

            fy5           = ucgencoor(y, 0, 0, 50);
            label262.Text = "MY = " + fy5.ToString();

            double z5 = Convert.ToDouble(textBox3.Text);

            z5 = z5 * 100;
            double fz5 = 0;

            fz5           = ucgencoor(z, 0, 0, 50);
            label261.Text = "MZ = " + fz5.ToString();
            f[5].m        = min(fx5, fy5, fz5);
            label259.Text = f[5].m.ToString(); /////////////////////////////////
            f[5].z        = 0.5;

            int    x6  = Convert.ToInt32(textBox1.Text);
            double fx6 = 0;

            fx6           = ucgencoor(x, 0, 50, 100);
            label304.Text = "MX = " + fx6.ToString();

            double y6 = Convert.ToDouble(textBox2.Text);

            y6 = y6 * 100;
            double fy6 = 0;

            fy6           = ucgencoor(y, 0, 50, 100);
            label303.Text = "MY = " + fy6.ToString();

            double z6 = Convert.ToDouble(textBox3.Text);

            z6 = z6 * 100;
            double fz6 = 0;

            fz6           = ucgencoor(z, 0, 50, 100);
            label302.Text = "MZ = " + fz6.ToString();
            f[6].m        = min(fx6, fy6, fz6);
            label300.Text = f[6].m.ToString(); /////////////////////////////////
            f[6].z        = 0.5;

            int    x7  = Convert.ToInt32(textBox1.Text);
            double fx7 = 0;

            fx7           = ucgencoor(x, 50, 100, 100);
            label345.Text = "MX = " + fx7.ToString();

            double y7 = Convert.ToDouble(textBox2.Text);

            y7 = y7 * 100;
            double fy7 = 0;

            fy7           = ucgencoor(y, 0, 0, 50);
            label344.Text = "MY = " + fy7.ToString();

            double z7 = Convert.ToDouble(textBox3.Text);

            z7 = z7 * 100;
            double fz7 = 0;

            fz7           = ucgencoor(z, 0, 0, 50);
            label343.Text = "MZ = " + fz7.ToString();
            f[7].m        = min(fx7, fy7, fz7);
            label341.Text = f[7].m.ToString(); /////////////////////////////////
            f[7].z        = 1;

            int    x8  = Convert.ToInt32(textBox1.Text);
            double fx8 = 0;

            fx8           = ucgencoor(x, 50, 100, 100);
            label386.Text = "MX = " + fx8.ToString();

            double y8 = Convert.ToDouble(textBox2.Text);

            y8 = y8 * 100;
            double fy8 = 0;

            fy8           = ucgencoor(y, 50, 100, 100);
            label385.Text = "MY = " + fy8.ToString();

            double z8 = Convert.ToDouble(textBox3.Text);

            z8 = z8 * 100;
            double fz8 = 0;

            fz8           = ucgencoor(z, 50, 100, 100);
            label384.Text = "MZ = " + fz8.ToString();
            f[8].m        = min(fx8, fy8, fz8);
            label382.Text = f[8].m.ToString(); /////////////////////////////////
            f[8].z        = 1;

            double pay   = 0;
            double payda = 0;
            double sonuc = 0;

            for (int i = 0; i < 9; i++)
            {
                pay   += f[i].m * f[i].z;
                payda += f[i].m;
            }
            sonuc         = pay / payda;
            label423.Text = sonuc.ToString();
        }
Ejemplo n.º 13
0
 public bool Equals(MZPeak other)
 {
     // Odd to use mass equals on intensity, might have to make that more generic sometime
     return(MZ.FussyEquals(other.MZ) && Intensity.FussyEquals(other.Intensity));
 }
Ejemplo n.º 14
0
 public override string ToString()
 {
     return("m/z: " + MZ.ToString("0.0000") + " ±" + MZToleranceDa.ToString("0.0000"));
 }
Ejemplo n.º 15
0
        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");
            }
        }