/// <summary> /// Формат строки "[#fmt]#;newstype=option#;type=val#;style=val#;baseactive=val#;countdate=val#; /// dateexpiration=val#;strikeprice=val#;delta=val#;openinterest=val" /// </summary> /// <returns></returns> public override String ToString() { var opData = new string[12]; opData[0] = "[#fmt]"; opData[1] = "newstype=option"; opData[2] = "type=" + Type; opData[3] = "style=" + Style; opData[4] = "baseactive=" + BaseActive; opData[5] = "publishdate=" + DatePublished.ToStringUniform(); opData[6] = "dateexpiration=" + DateExpiration.ToStringUniform(); opData[7] = "strikeprice=" + StrikePrice.ToStringUniform(5); opData[8] = "high=" + ContractHigh.ToStringUniform(5); opData[9] = "low=" + ContractLow.ToStringUniform(5); opData[10] = "close=" + ContractClose.ToStringUniform(5); opData[11] = "oi=" + OpenInterest; opData[11] = "volume=" + Volume; return(String.Join(PartsSeparator, opData)); }
// Méthode redéfinie public override void Renouveler(DateTime date) { base.Renouveler(date); // appel de la méthode de la classe ancêtre (MoyenPaiement) DateExpiration = DateExpiration.AddYears(2); }
private void simpleButton3_Click(object sender, EventArgs e) { try { if (txtSerial.Text == GetSerial.GetSerialNumber()) { string pathString; pathString = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\dll\"; System.IO.Directory.CreateDirectory(pathString); System.IO.File.WriteAllBytes(pathString + "ver.txt", new byte[0]); TextWriter tw = new StreamWriter(pathString + "ver.txt"); tw.WriteLine(txtSerial.Text); tw.Close(); DateTime localDateTime = DateTime.Now; //bool test = false; //while (test == false) //{ // try // { // TcpClient client = new TcpClient(); // client.Connect("time.nist.gov", 13); // StreamReader streamReader = new StreamReader(client.GetStream()); // var response = streamReader.ReadToEnd(); // if (response.Length != 0) // { // var utcDateTimeString = response.Substring(7, 17); // localDateTime = DateTime.ParseExact(utcDateTimeString, "yy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); // test = true; // } // } // catch (Exception ee) // { // if (ee is SocketException || ee is IOException) { } // } //} Properties.Settings.Default.DateInisial = localDateTime; DateTime dt1 = localDateTime; TimeSpan oneDay = TimeSpan.FromDays(365); DateTime demain = dt1 + oneDay; Properties.Settings.Default.DateFinal = demain; Properties.Settings.Default.Save(); MessageBox.Show("ثم التفعيل بنجاح ", " البرنامج مفعل ... سينتهي البرنامج في " + DateExpiration.DateExpirationAvocaBine().ToString() + " "); } else { MessageBox.Show("الكود غير صحيح ، تأكد من الكود", "فشل المحاولة"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override void Renouveler(DateTime date) //Par défaut override = virtual si cette classe servait de mère { base.Renouveler(date); DateExpiration = DateExpiration.AddYears(2); }