Пример #1
0
        public bool Equals(Rank rank)
        {
            if (rank == null)
            {
                throw new ArgumentNullException();
            }

            if (RankFormat != rank.RankFormat)
            {
                return(false);
            }

            switch (RankFormat)
            {
            case ERankFormat.Full:
                return(Prefix.Equals(rank.Prefix) && Title.Equals(rank.Title) && Postfix.Equals(rank.Postfix));

            case ERankFormat.PrefixAndTitle:
                return(Prefix.Equals(rank.Prefix) && Title.Equals(rank.Title));

            case ERankFormat.TitleAndPostfix:
                return(Title.Equals(rank.Title) && Postfix.Equals(rank.Postfix));

            default:     // ERankFormat.TitleOnly
                return(Title.Equals(rank.Title));
            }
        }
 /// <summary>
 /// Check Name equality.
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public bool Equals(Name name) => name == null ? false :
 Suffix.Equals(name.Suffix) &&
 (
     ReferenceEquals(this.Suffix, name.Suffix) ||
     Suffix != null &&
     Suffix.Equals(name.Suffix)
 ) &&
 (
     ReferenceEquals(this.First, name.First) ||
     First != null &&
     First.Equals(name.First)
 ) &&
 (
     ReferenceEquals(this.Middle, name.Middle) ||
     Middle != null &&
     Middle.Equals(name.Middle)
 ) &&
 (
     ReferenceEquals(this.Last, name.Last) ||
     Last != null &&
     Last.Equals(name.Last)
 ) &&
 (
     ReferenceEquals(this.Prefix, name.Prefix) ||
     Prefix != null &&
     Prefix.Equals(name.Prefix)
 ) &&
 (
     ReferenceEquals(this.IsOrganization, name.IsOrganization) ||
     IsOrganization.Equals(name.IsOrganization)
 );
        bool IEquatable <DerivedUnitDimensionMember> .Equals(DerivedUnitDimensionMember other)
        {
            Func <bool> prefixMatches   = () => Prefix?.Equals(other.Prefix) ?? Prefix == other.Prefix;
            Func <bool> baseUnitMatches = () => BaseUnit.Equals(other.BaseUnit);

            return(Exponent == other.Exponent && prefixMatches() && baseUnitMatches());
        }
Пример #4
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Number other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ValueFormat == other.ValueFormat ||
                     ValueFormat != null &&
                     ValueFormat.Equals(other.ValueFormat)
                     ) &&
                 (
                     Font == other.Font ||
                     Font != null &&
                     Font.Equals(other.Font)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.Equals(other.Prefix)
                 ) &&
                 (
                     Suffix == other.Suffix ||
                     Suffix != null &&
                     Suffix.Equals(other.Suffix)
                 ));
        }
 /// <summary>
 /// Equality method between two objects of the same type.
 /// Because the Equals method is strongly typed by generic constraints,
 /// it is not necessary to test for the correct object type.
 /// </summary>
 /// <param name="obj">The other object of this type that we are testing equality with</param>
 /// <returns></returns>
 public virtual bool Equals(LaunchPadToken obj)
 {
     if (obj != null)
     {
         return(Name.Equals(obj.Name) && Prefix.Equals(obj.Prefix) && DefaultValue.Equals(obj.DefaultValue));
     }
     return(false);
 }
Пример #6
0
 public bool Equals(ScanArea other)
 {
     return(Name.Equals(other.Name) &&
            Prefix.Equals(other.Prefix) &&
            Suffix.Equals(other.Suffix) &&
            Location.Equals(other.Location) &&
            Exclusions.SequenceEqual(other.Exclusions) &&
            Inclusions.SequenceEqual(other.Inclusions));
 }
Пример #7
0
        /// <summary>
        /// Gets the prefixed unit.
        /// </summary>
        /// <param name="newPrefix">The prefix.</param>
        /// <returns>A new <see cref="IUnit"/> with the specified <see cref="Prefix"/>.</returns>
        public IUnit GetPrefixedUnit(Prefix newPrefix)
        {
            if (newPrefix.Equals(this.prefixedBaseUnit.Prefix))
            {
                return(this.prefixedBaseUnit);
            }

            return(new NotationBaseUnit(newPrefix, this.Notation, this.prefixedBaseUnit));
        }
Пример #8
0
 public override bool Equals(object obj)
 {
     return(obj is PowerHeader header &&
            Count == header.Count &&
            Prefix.Equals(header.Prefix) &&
            VersionData.Equals(header.VersionData) &&
            LevelVersion.Equals(header.LevelVersion) &&
            EffectVersion.Equals(header.EffectVersion) &&
            InventionOriginAssignmentVersion.Equals(header.InventionOriginAssignmentVersion));
 }
Пример #9
0
        public override bool Equals(object obj)
        {
            var other = obj as CompoundModelReference <T>;

            if (other == null)
            {
                return(false);
            }
            return(Prefix.Equals(other.Prefix) &&
                   Reference.Equals(other.Reference));
        }
Пример #10
0
        /// <summary>
        /// The PInfo class is defined to be equal if, for all sections where both names are defined (minimum two), none are not equal
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public bool Equals(PInfo b)
        {
            int i = 0;

            if (Prefix != null && b.Prefix != null)
            {
                if (!Prefix.Equals(b.Prefix))
                {
                    return(false);
                }
                i++;
            }
            if (FirstName != null && b.FirstName != null)
            {
                if (!FirstName.Equals(b.FirstName))
                {
                    return(false);
                }
                i++;
            }
            if (MiddleName != null && b.MiddleName != null)
            {
                if (!MiddleName.Equals(b.MiddleName))
                {
                    return(false);
                }
                i++;
            }
            if (LastName != null && b.LastName != null)
            {
                if (!LastName.Equals(b.LastName))
                {
                    return(false);
                }
                i++;
            }
            if (Suffix != null && b.Suffix != null)
            {
                if (!Suffix.Equals(b.Suffix))
                {
                    return(false);
                }
                i++;
            }
            if (i < 2)
            {
                return(false);
            }

            return(true);
        }
Пример #11
0
 public void startRecordInput()
 {
     recording.StartAt = DateTime.Now;
     if (Prefix != null && Prefix.Equals("") == false)
     {
         Filename = Prefix + "_" + Name + inputPrefix + ".wav";
     }
     else
     {
         Filename = Name + inputPrefix + ".wav";
     }
     inputFilePath = Path.Combine(outputFolder, Filename);
     writerInput   = new WaveFileWriter(inputFilePath, eventInput.WaveFormat);
     eventInput.StartRecording();
 }
Пример #12
0
        /// <summary>
        /// Returns true if CommonPerson instances are equal
        /// </summary>
        /// <param name="other">Instance of CommonPerson to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CommonPerson other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     LastUpdateTime == other.LastUpdateTime ||
                     LastUpdateTime != null &&
                     LastUpdateTime.Equals(other.LastUpdateTime)
                     ) &&
                 (
                     FirstName == other.FirstName ||
                     FirstName != null &&
                     FirstName.Equals(other.FirstName)
                 ) &&
                 (
                     LastName == other.LastName ||
                     LastName != null &&
                     LastName.Equals(other.LastName)
                 ) &&
                 (
                     MiddleNames == other.MiddleNames ||
                     MiddleNames != null &&
                     MiddleNames.SequenceEqual(other.MiddleNames)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.Equals(other.Prefix)
                 ) &&
                 (
                     Suffix == other.Suffix ||
                     Suffix != null &&
                     Suffix.Equals(other.Suffix)
                 ) &&
                 (
                     OccupationCode == other.OccupationCode ||
                     OccupationCode != null &&
                     OccupationCode.Equals(other.OccupationCode)
                 ));
        }
        /// <summary>
        /// Returns true if OrgApacheSlingCommonsMetricsInternalLogReporterProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingCommonsMetricsInternalLogReporterProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingCommonsMetricsInternalLogReporterProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Period == other.Period ||
                     Period != null &&
                     Period.Equals(other.Period)
                     ) &&
                 (
                     TimeUnit == other.TimeUnit ||
                     TimeUnit != null &&
                     TimeUnit.Equals(other.TimeUnit)
                 ) &&
                 (
                     Level == other.Level ||
                     Level != null &&
                     Level.Equals(other.Level)
                 ) &&
                 (
                     LoggerName == other.LoggerName ||
                     LoggerName != null &&
                     LoggerName.Equals(other.LoggerName)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.Equals(other.Prefix)
                 ) &&
                 (
                     Pattern == other.Pattern ||
                     Pattern != null &&
                     Pattern.Equals(other.Pattern)
                 ) &&
                 (
                     RegistryName == other.RegistryName ||
                     RegistryName != null &&
                     RegistryName.Equals(other.RegistryName)
                 ));
        }
Пример #14
0
        public void concatInOut()
        {
            if (outputFilepath != null && outputFilepath.Equals("") == false && inputFilePath != null && inputFilePath.Equals("") == false)
            {
                using (var input = new AudioFileReader(inputFilePath))
                    using (var output = new AudioFileReader(outputFilepath))
                    {
                        if (Prefix != null && Prefix.Equals("") == false)
                        {
                            FilenameCom = Prefix + "_" + Name + combinePrefix + ".wav";
                        }
                        else
                        {
                            FilenameCom = Name + combinePrefix + ".wav";
                        }
                        var combineFilepath = Path.Combine(outputFolder, FilenameCom);
                        Console.WriteLine(combineFilepath);
                        var gabung = new MixingSampleProvider(new[] { input, output });
                        try {
                            WaveFileWriter.CreateWaveFile16(combineFilepath, gabung);
                        }catch (Exception e)
                        {
                            Console.WriteLine("failed delete");
                        }

                        this.recording.Filename = FilenameCom;
                        this.recording.Location = combineFilepath;
                        TimeSpan x = this.recording.StartAt - this.recording.StopAt;
                        this.recording.Duration = x.TotalSeconds;
                        EventHandler cc = CombineComplete;
                        try
                        {
                            input?.Dispose();
                            output?.Dispose();
                            File.Delete(inputFilePath);
                            File.Delete(outputFilepath);
                        }catch (Exception e)
                        {
                            Console.WriteLine("failed delete");
                        }

                        if (cc != null)
                        {
                            cc(this, EventArgs.Empty);
                        }
                    }
            }
        }
Пример #15
0
        /// <inheritdoc />
        public bool Equals([AllowNull] CurrentValue other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                     ) &&
                 (
                     XAnchor == other.XAnchor ||
                     XAnchor != null &&
                     XAnchor.Equals(other.XAnchor)
                 ) &&
                 (
                     Offset == other.Offset ||
                     Offset != null &&
                     Offset.Equals(other.Offset)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.Equals(other.Prefix)
                 ) &&
                 (
                     Suffix == other.Suffix ||
                     Suffix != null &&
                     Suffix.Equals(other.Suffix)
                 ) &&
                 (
                     Font == other.Font ||
                     Font != null &&
                     Font.Equals(other.Font)
                 ));
        }
Пример #16
0
        public override string Generate()
        {
            Resolve();
            var text    = new StringBuilder("");
            var isBlock = Prefix.Equals("*");

            if (isBlock)
            {
                text.AppendLine(T() + "/*");
            }

            foreach (var l in Lines)
            {
                text.AppendLine(T() + l);
            }

            if (isBlock)
            {
                text.AppendLine(T() + "*/");
            }

            return(text.ToString());
        }
Пример #17
0
 public bool Equals(AllocationParams other)
 {
     return(true && Flags.Equals(other.Flags) && Align.Equals(other.Align) && Prefix.Equals(other.Prefix) && Padding.Equals(other.Padding));
 }
Пример #18
0
        /// <summary>
        /// Gets the prefixed unit.
        /// </summary>
        /// <param name="newPrefix">The prefix.</param>
        /// <returns>A new <see cref="IUnit"/> with the specified <see cref="Prefix"/>.</returns>
        public IUnit GetPrefixedUnit(Prefix newPrefix)
        {
            if (newPrefix.Equals(this.prefixedBaseUnit.Prefix))
            {
                return this.prefixedBaseUnit;
            }

            return new NotationBaseUnit(newPrefix, this.Notation, this.prefixedBaseUnit);
        }
Пример #19
0
 public bool Equals(Key other)
 {
     return(Prefix.Equals(other.Prefix) && Suffix.Equals(other.Suffix));
 }
Пример #20
0
 public bool Equals(Region other)
 {
     return(Name.Equals(other.Name) && Prefix.Equals(other.Prefix) && Suffix.Equals(other.Suffix) && Locations.SequenceEqual(other.Locations));
 }
Пример #21
0
        static void Main(string[] args)
        {
            GeneralMethods PTEGE = new GeneralMethods();
            //     string folderpath1 = ConfigurationManager.AppSettings["Folderpath"].ToString();
            //     string folderpath = (folderpath1 + DateTime.Now.ToString("dd-MM-yyyy"));
            //     string aaa = PTEGE.AutoFolderCreate(folderpath);



            string oper      = null;
            string Trackernm = ConfigurationManager.AppSettings["Trackername"].ToString().ToUpper();

            if (Trackernm.Contains("NEW"))
            {
                oper = ConfigurationManager.AppSettings["Operatornew"].ToString();
            }
            else if (Trackernm.Contains("OLD"))
            {
                oper = ConfigurationManager.AppSettings["Operatorold"].ToString();
            }

            try
            {
                int MoveFile;
                // create c1 = new create();
                //c1.createawb(@"E:\JITESH\PingAutomation\Output_File\20190114_123638.xls", "MAGNUM CARGO PVT. LTD", "020");
                Console.WriteLine("program is started");
                FileStream   files;
                StreamWriter strWriter;
                String       FileName = ConfigurationManager.AppSettings["LogfilePath"] + @"\PingAutomation" + DateTime.Now.ToString("dd-MMM-yyyy") + ".txt";
                files     = new FileStream(FileName, FileMode.Append, FileAccess.Write, FileShare.None);
                strWriter = new StreamWriter(files);
                strWriter.WriteLine("---------------------------------------------------------------");
                strWriter.WriteLine("Log generated at " + DateTime.Now.ToString("dd-MMM-yyyy HH:mm"));
                strWriter.WriteLine(" ");
                Console.WriteLine("Log");

                //   create cc = new create();
                //    cc.createawb(@"E:\JITESH\PingAutomation\Output_File\20190131_060021.xls", "MAGNUM CARGO PVT. LTD", "020", "50752100", strWriter);



                #region datatable of status 2-ACk and hawb count 0
                DataSet TrackerData = new DataSet();

                TrackerData = PTEGE.isPresentontracker();
                int o = TrackerData.Tables[0].Rows.Count;
                #endregion
                if (o >= 1)
                {
                    #region get clientdetails from tracker

                    for (int w = 0; w < o; w++)
                    {
                        Console.WriteLine("clientdetails");
                        string ClientName1 = TrackerData.Tables["Table1"].Rows[w]["Client_Name"].ToString();

                        int clen = ClientName1.Length;
                        if (clen < 15)
                        {
                            int sss = clen - 1;
                            ClientName = ClientName1.Substring(0, clen);
                        }
                        else
                        {
                            ClientName = ClientName1.Substring(0, 15);
                        }
                        Prefix         = TrackerData.Tables["Table1"].Rows[w]["Pfx"].ToString();
                        AWBNo          = TrackerData.Tables["Table1"].Rows[w]["AWB_No"].ToString();
                        HAWBcount      = TrackerData.Tables["Table1"].Rows[w]["Hawb Count"].ToString();
                        Shipmentstatus = TrackerData.Tables["Table1"].Rows[w]["Shipment_Status"].ToString();
                        Console.WriteLine(ClientName + " " + Prefix + " " + AWBNo);
                        string a        = AWBNo.Substring(0, 4);
                        string b        = AWBNo.Substring(4, 4);
                        string spaceAWB = a + " " + b;

                        DataSet dd        = new DataSet();
                        string  excelpath = ConfigurationManager.AppSettings["RuleExcel_Ping"].ToString();
                        dd = PTEGE.ImportexcelData(excelpath, ClientName);
                        #endregion
                        int v = dd.Tables[0].Rows.Count;
                        Thread.Sleep(300);
                        for (int h = 0; h < v; h++)
                        {
                            Thread.Sleep(300);
                            string Prefixexcl = dd.Tables["Sheet1"].Rows[h][1].ToString();

                            if (Prefixexcl.Contains(Prefix))
                            {
                                Thread.Sleep(300);
                                string Rule_Nm = dd.Tables["Sheet1"].Rows[h][2].ToString();
                                if (!Rule_Nm.Contains("Not_Done"))
                                {
                                    #region pst
                                    string fpath = null;
                                    try
                                    {
                                        IEnumerable <MailItem> mailItems = readPst(ConfigurationManager.AppSettings["PSTFilePath"].ToString(), ConfigurationManager.AppSettings["PSTFolder"].ToString());
                                        foreach (MailItem mailItem in mailItems)
                                        {
                                            string ReceivedTime = string.Empty, Sender = string.Empty, MailBody = string.Empty;
                                            string Subject = string.Empty;

                                            //Sender = mailItem.SenderEmailAddress;
                                            Sender  = mailItem.SenderName;
                                            Subject = mailItem.Subject;
                                            {
                                                List <string> tempFileName    = new List <string>();
                                                List <string> tempPDFFileName = new List <string>();

                                                //  string temp = mailItem.Attachments[1].FileName;

                                                String FolderName = NewFolderName();
                                                int    k          = 1;

                                                int j = mailItem.Attachments.Count;


                                                if (mailItem.Attachments.Count == 0)
                                                {
                                                    Application app1          = new Application();
                                                    NameSpace   outlookNs1    = app1.GetNamespace("MAPI");
                                                    MAPIFolder  MoveToFolder1 = outlookNs1.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderDeletedItems);
                                                    mailItem.Move(MoveToFolder1);
                                                    strWriter.WriteLine(mailItem.Subject + " Have Moved to Deleted folder successfully as attachment is not present");
                                                    strWriter.WriteLine(" ");
                                                    strWriter.WriteLine("-------------------------------------------------------");
                                                    strWriter.WriteLine(" ");
                                                    MoveFile = 0;
                                                    //  break;
                                                }


                                                Console.WriteLine("mail attachment");
                                                if (mailItem.Attachments.Count >= 1)
                                                {
                                                    if (!string.IsNullOrEmpty(Subject))
                                                    {
                                                        if (Subject.Contains(AWBNo) || Subject.Contains(spaceAWB))
                                                        {
                                                            DataSet ex = new DataSet();
                                                            excelpath = ConfigurationManager.AppSettings["RuleExcel_Ping"].ToString();
                                                            ex        = PTEGE.ImportexcelData(excelpath, ClientName);
                                                            int p = ex.Tables[0].Rows.Count;

                                                            for (int x = 0; x < p; x++)
                                                            {
                                                                Thread.Sleep(300);
                                                                Console.WriteLine("RULECOUNT = " + x);
                                                                string Prefixexcel = ex.Tables["Sheet1"].Rows[x][1].ToString();
                                                                Thread.Sleep(300);
                                                                if (Prefix.Equals(Prefixexcel))
                                                                {
                                                                    Thread.Sleep(300);
                                                                    string Rule_Name = ex.Tables["Sheet1"].Rows[x][2].ToString();
                                                                    if (!Rule_Name.Contains("Not_Done"))
                                                                    {
                                                                        Console.WriteLine("Rule present");
                                                                        for (int g = 1; g <= mailItem.Attachments.Count; g++)
                                                                        {
                                                                            if (mailItem.Attachments[g].FileName.Contains(".pdf") || mailItem.Attachments[g].FileName.Contains(".PDF"))
                                                                            {
                                                                                Console.WriteLine("attachment downloaded");
                                                                                fpath = ConfigurationManager.AppSettings["PDFFolderPath"].ToString();
                                                                                mailItem.Attachments[g].SaveAsFile(fpath + mailItem.Attachments[g].FileName);
                                                                                string filename = fpath + mailItem.Attachments[g].FileName;
                                                                                Console.WriteLine(filename);
                                                                                string newfilename;
                                                                                string newpath;

                                                                                bool fHasSpace = filename.Contains(" ");
                                                                                if (fHasSpace == true)
                                                                                {
                                                                                    newpath = filename.Replace(" ", "");
                                                                                    Console.WriteLine(newpath);
                                                                                    //  newfilename = Prefix + "-" + AWBNo;

                                                                                    if (File.Exists(newpath))
                                                                                    {
                                                                                        File.Delete(newpath);
                                                                                    }
                                                                                    System.IO.File.Move(filename, newpath);
                                                                                }
                                                                                else
                                                                                {
                                                                                    newpath = filename;
                                                                                    Console.WriteLine(newpath);
                                                                                }

                                                                                Console.WriteLine("Rule creation");
                                                                                string  rulename         = Rule_Name + "_" + Prefixexcel;
                                                                                String  targetfile       = DateTime.Now.ToString("yyyyMMdd_hhmmss");
                                                                                String  targetfile1      = targetfile + ".xls";
                                                                                string  targetfolderpath = ConfigurationManager.AppSettings["Output_File_Path"].ToString();
                                                                                string  outputfile       = targetfolderpath + targetfile1;
                                                                                Process process          = new Process();
                                                                                process.StartInfo.FileName               = "cmd.exe";
                                                                                process.StartInfo.CreateNoWindow         = true;
                                                                                process.StartInfo.RedirectStandardInput  = true;
                                                                                process.StartInfo.RedirectStandardOutput = true;
                                                                                process.StartInfo.UseShellExecute        = false;
                                                                                process.Start();
                                                                                Thread.Sleep(2000);
                                                                                process.StandardInput.WriteLine("PDECMD -R\"" + rulename + "\" -F\"" + newpath + "\" -O\"" + outputfile);
                                                                                Thread.Sleep(8000);
                                                                                string xyz = process.StandardOutput.ReadLine();
                                                                                process.StandardInput.Flush();
                                                                                process.StandardInput.Close();
                                                                                process.WaitForExit();
                                                                                Thread.Sleep(2000);
                                                                                Console.WriteLine(process.StandardOutput.ReadToEnd());
                                                                                string xyz1         = process.StandardOutput.ReadLine();
                                                                                string outputReader = process.StandardOutput.ReadToEnd();
                                                                                PTEGE.changeoperator(Prefix, AWBNo, "Automation", strWriter);
                                                                                driver = new ChromeDriver();
                                                                                Console.WriteLine("rule created");
                                                                                Thread.Sleep(2000);
                                                                                create c = new create();
                                                                                c.createawb(outputfile, ClientName, Prefix, AWBNo, strWriter, driver);
                                                                                w = o;
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    catch (System.Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        PTEGE.changeoperator(Prefix, AWBNo, oper, strWriter);
                                        PTEGE.UpdatePingStatus(Prefix, AWBNo, strWriter);
                                        //   PTEGE.changeoperator(Prefix, AWBNo, "IntelecS", strWriter);
                                        driver.Close();
                                        driver.Quit();
                                        break;
                                    }
                                    #endregion
                                }
                            }
                        }
                    }
                }

                driver.Close();
                driver.Quit();
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Пример #22
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Cells other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Equals(Values, other.Values) ||
                     Values != null && other.Values != null &&
                     Values.SequenceEqual(other.Values)
                     ) &&
                 (
                     Equals(Format, other.Format) ||
                     Format != null && other.Format != null &&
                     Format.SequenceEqual(other.Format)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.Equals(other.Prefix)
                 ) &&
                 (
                     Equals(PrefixArray, other.PrefixArray) ||
                     PrefixArray != null && other.PrefixArray != null &&
                     PrefixArray.SequenceEqual(other.PrefixArray)
                 ) &&
                 (
                     Suffix == other.Suffix ||
                     Suffix != null &&
                     Suffix.Equals(other.Suffix)
                 ) &&
                 (
                     Equals(SuffixArray, other.SuffixArray) ||
                     SuffixArray != null && other.SuffixArray != null &&
                     SuffixArray.SequenceEqual(other.SuffixArray)
                 ) &&
                 (
                     Height == other.Height ||
                     Height != null &&
                     Height.Equals(other.Height)
                 ) &&
                 (
                     Align == other.Align ||
                     Align != null &&
                     Align.Equals(other.Align)
                 ) &&
                 (
                     Equals(AlignArray, other.AlignArray) ||
                     AlignArray != null && other.AlignArray != null &&
                     AlignArray.SequenceEqual(other.AlignArray)
                 ) &&
                 (
                     Line == other.Line ||
                     Line != null &&
                     Line.Equals(other.Line)
                 ) &&
                 (
                     Fill == other.Fill ||
                     Fill != null &&
                     Fill.Equals(other.Fill)
                 ) &&
                 (
                     Font == other.Font ||
                     Font != null &&
                     Font.Equals(other.Font)
                 ) &&
                 (
                     ValuesSrc == other.ValuesSrc ||
                     ValuesSrc != null &&
                     ValuesSrc.Equals(other.ValuesSrc)
                 ) &&
                 (
                     FormatSrc == other.FormatSrc ||
                     FormatSrc != null &&
                     FormatSrc.Equals(other.FormatSrc)
                 ) &&
                 (
                     PrefixSrc == other.PrefixSrc ||
                     PrefixSrc != null &&
                     PrefixSrc.Equals(other.PrefixSrc)
                 ) &&
                 (
                     SuffixSrc == other.SuffixSrc ||
                     SuffixSrc != null &&
                     SuffixSrc.Equals(other.SuffixSrc)
                 ) &&
                 (
                     AlignSrc == other.AlignSrc ||
                     AlignSrc != null &&
                     AlignSrc.Equals(other.AlignSrc)
                 ));
        }
Пример #23
0
        public void TestPrefixEquality()
        {
            // Object setup
            object obj1 = new object();
            Prefix p1 = new Prefix();
            Prefix p2 = new Prefix();
            Prefix p3 = new Prefix("Hello", "World", "Foobar");
            Prefix p4 = new Prefix("Hello", "World", "Foobar");
            Prefix p5 = null;
            Prefix p6 = p1;

            // Equality
            Assert.IsTrue(Prefix.Equals(p1, p2));
            Assert.IsTrue(p1.Equals(p2));
            Assert.IsTrue(p1 == p2);
            Assert.IsTrue(Prefix.Equals(p3, p4));
            Assert.IsTrue(p3.Equals(p4));
            Assert.IsTrue(p3 == p4);

            // Inequality
            Assert.IsFalse(p1.Equals(obj1));
            Assert.IsFalse(Prefix.Equals(p1, obj1));
            Assert.IsFalse(Prefix.Equals(p1, p3));
            Assert.IsFalse(p1.Equals(p3));
            Assert.IsTrue(p1 != p3);
            Assert.IsFalse(Prefix.Equals(p2, p4));
            Assert.IsFalse(p2.Equals(p4));
            Assert.IsTrue(p2 != p4);

            // Checks against null objects
            Assert.IsFalse(Prefix.Equals(p1, p5));
            Assert.IsFalse(Prefix.Equals(p5, p1));
            Assert.IsTrue(p1 != p5);
            Assert.IsTrue(p5 != p1);

            // Checks against null
            Assert.IsFalse(p1.Equals(null));
            Assert.IsTrue(Prefix.Equals(p5, null));
            Assert.IsTrue(Prefix.Equals(null, p5));
            Assert.IsTrue(p5 == null);
            Assert.IsTrue(null == p5);

            // Checks against self
            Assert.IsTrue(p1.Equals(p6));

            // Checks against null or invalid
            Assert.IsTrue(Prefix.IsNullOrNotExists(p1));
            Assert.IsTrue(Prefix.IsNullOrNotExists(p2));
            Assert.IsFalse(Prefix.IsNullOrNotExists(p3));
            Assert.IsFalse(Prefix.IsNullOrNotExists(p4));
            Assert.IsTrue(Prefix.IsNullOrNotExists(p5));

            // Hash codes are equal;
            Assert.IsTrue(p1.GetHashCode() == p2.GetHashCode());
            Assert.IsTrue(p3.GetHashCode() == p4.GetHashCode());
        }