예제 #1
0
    public override string ToString()
    {
        var sb = new StringBuilder("Playlist(");

        sb.Append(", IdPlaylist: ");
        sb.Append(IdPlaylist);
        if (Name != null && __isset.name)
        {
            sb.Append(", Name: ");
            sb.Append(Name);
        }
        if (Description != null && __isset.description)
        {
            sb.Append(", Description: ");
            sb.Append(Description);
        }
        if (CreationDate != null && __isset.creationDate)
        {
            sb.Append(", CreationDate: ");
            sb.Append(CreationDate == null ? "<null>" : CreationDate.ToString());
        }
        if (CoverPath != null && __isset.coverPath)
        {
            sb.Append(", CoverPath: ");
            sb.Append(CoverPath);
        }
        sb.Append(")");
        return(sb.ToString());
    }
예제 #2
0
        public Dictionary <string, string> ToDictionary()
        {
            var result = new Dictionary <string, string>();

            if (Name != null)
            {
                result.Add("Name", Name);
            }
            if (AuthorName != null)
            {
                result.Add("AuthorName", AuthorName);
            }
            if (AuthorEmail != null)
            {
                result.Add("AuthorEmail", AuthorEmail);
            }
            if (CreationDate != null)
            {
                result.Add("CreationDate", CreationDate.ToString());
            }
            if (Difficulty != null)
            {
                result.Add("Difficulty", Difficulty.ToString());
            }
            return(result);
        }
예제 #3
0
        public override string ToString()
        {
            var creationDate = CreationDate.ToString("hh:mm:ss.f");
            var deliveryDate = DeliveryDate.ToString("hh:mm:ss.f");
            var spendingTime = Math.Round((DeliveryDate - CreationDate).TotalSeconds, 3).ToString("F3");

            return($"Cake '{Id}' tooks '{spendingTime}' seconds [created '{creationDate}' delivered '{deliveryDate}']");
        }
예제 #4
0
 internal void ToXml(XmlWriter writer, string element)
 {
     writer.WriteStartElement(element);
     writer.WriteAttributeString("date", CreationDate.ToString("s"));
     writer.WriteAttributeString("name", Name);
     writer.WriteAttributeString("owner", OwnerName);
     writer.WriteEndElement();
 }
예제 #5
0
        public string GetSaveEntry()
        {
            List <string> dataToSave = new List <string>()
            {
                NAME_ID, Id.ToString(), Header, Content, CreationDate.ToString(Constants.DATE_FORMAT), RemindDate.ToString(Constants.DATE_FORMAT)
            };

            return(dataToSave.Aggregate((i, j) => i + FileLoader.SEPARATOR + j));
        }
예제 #6
0
        // This implementation of ToString() is only for the purposes of the sample console application.
        // You can override ToString() in your own model class if you want, but you don't need to in order
        // to use the Azure Search .NET SDK.
        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.AppendFormat("Article {0}: {1}", ID, Title).AppendLine();
            builder.AppendFormat("Author: {0}", Author).AppendLine();
            builder.AppendFormat("CreationDate: {0}", CreationDate.ToString()).AppendLine();
            return(builder.ToString());
        }
예제 #7
0
        public void ShowInfo()
        {
            string s = "";

            s += "Name:               " + SavedName + "\n";
            s += "File path:          " + LastPath + "\n";
            s += "Creation date:  " + CreationDate.ToString() + "\n";
            s += "Last save:          " + LastEdit.ToString() + "\n";
            MessageBox.Show(s, "About this project", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
예제 #8
0
 void DrawCreationDate()
 {
     tk.FillColor   = textColor;
     tk.StrokeColor = textColor;
     tk.DrawSurface(calendarArea.Start, calendarArea.Width, calendarArea.Height,
                    calendarIcon, ScaleMode.AspectFit, true);
     tk.FontSize   = EXTRA_INFO_FONT_SIZE;
     tk.FontWeight = FontWeight.Light;
     tk.DrawText(dateArea.Start, dateArea.Width, dateArea.Height, CreationDate.ToString("dd/MM/yyyy"));
 }
예제 #9
0
 public string ToLogFileString()
 {
     // Переносы для удобства в логе не используем
     return(Type.ToString() +
            GlobalDefines.PUBLISHING_LOG_FIELDS_SEPARATOR +
            CreationDate.ToString() +
            GlobalDefines.PUBLISHING_LOG_FIELDS_SEPARATOR +
            PCWbkName.Replace("\r", "").Replace('\n', GlobalDefines.PUBLISHING_LOG_LFCR_SYMBOL) +
            GlobalDefines.PUBLISHING_LOG_FIELDS_SEPARATOR +
            Text.Replace("\r", "").Replace('\n', GlobalDefines.PUBLISHING_LOG_LFCR_SYMBOL));
 }
예제 #10
0
        /// <summary>
        /// Получить имя файла соответствующее конкретному типу сообщения
        /// </summary>
        /// <returns>имя файла</returns>
        public virtual string GetFileName()
        {
            string res = string.Format("SP.{0:00}.{1}{2}.{3}{4}.txt",
                                       LogicalHLR,
                                       CreationDate.ToString("yyyyMMdd"),
                                       CreationDate.ToString("HHmmss"),
                                       (int)Initiator,
                                       FileNumber.ToString().PadLeft(13, '0'));

            return(res);
        }
예제 #11
0
        public string GetSaveEntry()
        {
            List <string> dataToSave = new List <string>()
            {
                NAME_ID, Id.ToString(), Header, Content, CreationDate.ToString(Constants.DATE_FORMAT)
            };

            foreach (var item in Items)
            {
                dataToSave.Add(getItemSaveFragment(item));
            }

            return(dataToSave.Aggregate((i, j) => i + FileLoader.SEPARATOR + j));
        }
예제 #12
0
        public List <Claim> ToClaims()
        {
            var claims = new List <Claim>();

            claims.Add(new Claim("username", UserName));
            claims.Add(new Claim("creation-date", CreationDate.ToString("o")));
            claims.Add(new Claim("last-seen", LastSeen.ToString("o")));
            claims.Add(new Claim("last-edit", LastEdit.ToString("o")));
            claims.Add(new Claim("account-type", AccountType.ToString()));
            claims.Add(new Claim("account-status", AccountStatus.ToString()));
            claims.Add(new Claim("recovery-email", Email ?? string.Empty));
            claims.Add(new Claim("recovery-verified", EmailConfirmed.ToString()));
            claims.Add(new Claim("2fa-enabled", TwoFactorEnabled.ToString()));
            claims.Add(new Claim("pgp-public-key", PGPPublicKey ?? string.Empty));
            return(claims);
        }
예제 #13
0
        public override string ToString()
        {
            Message = Message.Replace("\"", string.Empty);
            Message = Message.Replace("\n\r", string.Empty);
            Message = Message.Replace("\n", string.Empty);
            Message = Message.Replace("\r", string.Empty);
            // enum ToString() docs : //http://msdn.microsoft.com/en-us/library/system.enum.tostring(v=vs.71).aspx
            string exceptionName = string.IsNullOrEmpty(ExceptionName) ? "Logger" : ExceptionName;

            return(string.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\"",
                                 Id.ToString(),
                                 Type.ToString("g"),
                                 CreationDate.ToString(),
                                 Message,
                                 exceptionName));
        }
예제 #14
0
 /// <summary>
 /// Converts this object to its equivalent serialized XML representation.
 /// </summary>
 /// <returns>The serialized representation of this Graphmatic object.</returns>
 public XElement ToXml()
 {
     return(new XElement("Document",
                         new XAttribute("Format", 1),                                   // file format version
                         new XAttribute("Author", Author),                              // original author
                         new XAttribute("Version", Properties.Resources.VersionString), // most recent editing version
                         new XAttribute("OriginalVersion", OriginalVersion),            // original editing version
                         new XAttribute("CreationDate", CreationDate.ToString()),       // date the document was created
                         new XAttribute("ID", Guid.ToString()),                         // guid of the document
                         new XElement("Resources",
                                      Resources.Values.Select(r => r.ToXml())),
                         new XElement("PageOrder",
                                      PageOrder.Select(page => new XElement("Reference", new XAttribute("ID", page.Guid)))),
                         CurrentResource != null ?
                         new XElement("CurrentResource", CurrentResource.Guid) :
                         null));
 }
예제 #15
0
        public TOVehicleReservation ToTO()
        {
            TOVehicleReservation toVehicleReservation = new TOVehicleReservation();

            toVehicleReservation.FromDate      = FromDate.ToString();
            toVehicleReservation.FromLocation  = FromLocation;
            toVehicleReservation.NumOfDays     = NumOfDays;
            toVehicleReservation.Price         = Price;
            toVehicleReservation.ReservationId = ReservationId;
            toVehicleReservation.ToDate        = ToDate.ToString();
            toVehicleReservation.ToLocation    = ToLocation;
            toVehicleReservation.Type          = Type;
            //toVehicleReservation.Vehicle = Vehicle.ToTO();
            toVehicleReservation.VehicleId       = VehicleId;
            toVehicleReservation.CreationDate    = CreationDate.ToString();
            toVehicleReservation.IsVehicleRated  = IsVehicleRated;
            toVehicleReservation.IsRentACarRated = IsRentACarRated;

            return(toVehicleReservation);
        }
예제 #16
0
        internal void ToXml(XmlWriter writer, string element)
        {
            writer.WriteStartElement(element);
            writer.WriteAttributeString("cmtr", Committer);
            writer.WriteAttributeString("date", CreationDate.ToString());
            writer.WriteAttributeString("cset", ChangesetId.ToString());
            writer.WriteElementString("owner", Owner);

            if (changes != null)
            {
                writer.WriteStartElement("Changes");

                foreach (Change change in changes)
                {
                    change.ToXml(writer, "Change");
                }

                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
예제 #17
0
        public BsonDocument ToBsonDocument()
        {
            BsonArray lib = new BsonArray(Library);

            BsonDocument document = new BsonDocument()
            {
                { "_id", _id },
                { "Name", Name },
                { "Library", lib },
                { "ClassName", ClassName },
                { "Duration", Duration },
                { "Delta", Delta },
                { "Interpolation", Interpolation },
                { "Tags", Tags },
                { "Notes", Notes },
                { "CodeSample", CodeSample },
                { "CreationDate", CreationDate.ToString("o") },
                { "EditDate", EditDate.ToString("o") },
                { "Author", Author },
                { "Editor", Editor }
            };

            return(document);
        }
예제 #18
0
        // Prepares the SDF file header section. Respective properties must be set in advance.
        // Constitutes "Record 1" according to ISO 25178-71
        private void PrepareHeaderSection()
        {
            // for single profiles YScale must be 0
            if (NumberOfProfiles == 1)
            {
                YScale = 0;
            }
            if (double.IsNaN(XScale))
            {
                return;
            }
            if (double.IsNaN(YScale))
            {
                return;
            }
            if (double.IsNaN(ZScale))
            {
                return;
            }
            if (!Relaxed)
            {
                // the SDF definition suffers from the historical restriction of 65535 points per profile
                // there is no error message up to now, it is just not possible to create data.
                if (NumberOfPointsPerProfile > ushort.MaxValue)
                {
                    return;
                }
                if (NumberOfProfiles > ushort.MaxValue)
                {
                    return;
                }
            }
            // instantiate the StringBuilder for the header section
            headerSectionSb = new StringBuilder();
            if (ForceIsoFormat)
            {
                headerSectionSb.AppendLine("aISO-1.0");
            }
            else
            {
                headerSectionSb.AppendLine("aBCR-1.0");
            }
            headerSectionSb.AppendLine($"ManufacID   = {TruncateManufacID(ManufacurerId)}"); // just to make sure no "=" is added
            headerSectionSb.AppendLine($"CreateDate  = {CreationDate.ToString("ddMMyyyyHHmm")}");
            headerSectionSb.AppendLine($"ModDate     = {ModificationDate.ToString("ddMMyyyyHHmm")}");
            headerSectionSb.AppendLine($"NumPoints   = {NumberOfPointsPerProfile}");
            headerSectionSb.AppendLine($"NumProfiles = {NumberOfProfiles}");
            headerSectionSb.AppendLine($"Xscale      = {XScale.ToString("G17")}");
            headerSectionSb.AppendLine($"Yscale      = {YScale.ToString("G17")}");
            headerSectionSb.AppendLine($"Zscale      = {ZScale.ToString("G17")}");
            headerSectionSb.AppendLine("Zresolution = -1"); // clause 5.2.8, do not modify!
            headerSectionSb.AppendLine("Compression = 0");  // clause 5.2.9, do not modify!
            switch (zDataType)
            {
            case ZDataType.Double:
                headerSectionSb.AppendLine("DataType    = 7");
                break;

            case ZDataType.Int32:
                headerSectionSb.AppendLine("DataType    = 6");
                break;

            case ZDataType.Int16:
                headerSectionSb.AppendLine("DataType    = 5");
                break;

            default:
                headerSectionSb.AppendLine("DataType    = ?");     // this should not happen!
                break;
            }
            headerSectionSb.AppendLine("CheckType   = 0"); // clause 5.2.11, do not modify!
            headerSectionSb.AppendLine("*");
        }
예제 #19
0
파일: Note.cs 프로젝트: giedreols/gNote
 public override string ToString()
 {
     return(Text + "\nCreated: " + CreationDate.ToString() + "\nEdited: " + EditingDate.ToString());
 }
예제 #20
0
 public override string ToString()
 {
     return($"{DomainName}, {CreationDate.ToString()}, {ExperationDate.ToString()}, {OwnedTimespan.Days}, {Response}");
 }
 public override string ToString()
 {
     return("ID= " + IDForCustomer + " " + CreationDate.ToString("dd/MM/yyyy"));
 }
예제 #22
0
 public string GetInformation()
 {
     return(CreationDate.ToString());
 }
예제 #23
0
        internal override string GetRtfFormattedRule()
        {
            RichTextBox rTxtBx = new RichTextBox();

            if (ReverseRule)
            {
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, "<lar:");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, "Not");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, ">\r\n");
            }

            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "<bar:");
            print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.red, "FileExistsPrependRegSz");
            print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Path");
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
            print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, FilePath);
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Key");
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
            print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, "HKEY_LOCAL_MACHINE");
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Subkey");
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
            print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, SubKey);
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Value");
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
            print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, Value);
            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");

            if (RegType32)
            {
                print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " RegType32");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, RegType32.ToString().ToLower());
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            }


            if (UseVersion)
            {
                print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Version");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, Version);
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            }

            if (UseModifiedDate)
            {
                print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Modified");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, ModifiedDate.ToString());
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            }

            if (UseCreationDate)
            {
                print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Created");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, CreationDate.ToString());
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            }

            if (UseSize)
            {
                print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Size");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, FileSize.ToString());
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            }

            if (UseLanguage)
            {
                print(rTxtBx, GroupDisplayer.elementAndAttributeFont, GroupDisplayer.blue, " Language");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "=\"");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, Language.ToString());
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\"");
            }

            print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "/>");

            if (ReverseRule)
            {
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.black, "\r\n");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, "</lar:");
                print(rTxtBx, GroupDisplayer.boldFont, GroupDisplayer.black, "Not");
                print(rTxtBx, GroupDisplayer.normalFont, GroupDisplayer.green, ">");
            }

            return(rTxtBx.Rtf);
        }
예제 #24
0
        //Adds playlist to the database
        public void AddplaylistQuery()
        {
            string sql = $"INSERT INTO Playlist (name, creationDate, consumerID) VALUES ('{Name}','{CreationDate.ToString("yyyy-MM-dd")}','{OwnerID}')";

            DatabaseConnector.InsertQueryDB(sql);
        }
예제 #25
0
        public string DataToString(FileFormat fileFormat)
        {
            // all file types are explicitly designed for MSDOS
            // for this the newline is hard coded as "CR LF"
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            StringBuilder sb = new StringBuilder();

            switch (fileFormat)
            {
            case FileFormat.Txt:
                // **********************************************************
                // Very simple format, no place for comments etc.
                // http://resource.npl.co.uk/softgauges/Help.htm
                // **********************************************************
                sb.Append($"{DeltaX:F3}\r\n");
                foreach (double z in zData)
                {
                    sb.Append($"{z:F6}\r\n");
                }
                break;

            case FileFormat.SigmaSurf:
                // **********************************************************
                // Format used by the freeware SigmaSurf
                // http://www.digitalmetrology.com
                // **********************************************************
                sb.Append("SigmaSurf_Data 1.0\r\n");
                sb.Append($"IDENTIFICATION: {SampleIdentification}\r\n");
                sb.Append($"DATE: {CreationDate.ToString("dd MMM yyyy - HH:mm")}\r\n");
                sb.Append($"SPACING_UM: {DeltaX.ToString("F5")}\r\n");
                sb.Append($"NUMBER_OF_POINTS: {zData.Length}\r\n");
                sb.Append($"PROFILE_UM:\r\n");
                foreach (double z in zData)
                {
                    sb.Append($"{z:F6}\r\n");     // resolution 1 pm
                }
                break;

            case FileFormat.Prf:
                // **********************************************************
                // not well documented, implementation taken
                // from the following NPL site:
                // http://resource.npl.co.uk/softgauges/Help.htm
                // **********************************************************
                sb.Append("1 2\r\n");
                sb.Append("SG2004 0.000000e+000 PRF\r\n");
                sb.Append(string.Format("CX M {0:e} MM 1.000000e+000 D\r\n", (double)zData.Length));
                sb.Append(string.Format("CZ M {0:e} MM 1.000000e-009 L\r\n", (double)zData.Length));
                sb.Append("EOR\r\n");
                sb.Append("STYLUS_RADIUS 0.000000e+000 MM\r\n");
                sb.Append(string.Format("SPACING CX {0:e}\r\n", DeltaX * 1000.0));     // in mm!
                sb.Append("MAP 1.000000e+000 CZ CZ 1.000000e+000 1.000000e+000\r\n");
                sb.Append("MAP 2.000000e+000 CZ CX 1.000000e+000 0.000000e+000\r\n");
                sb.Append($"COMMENT {SampleIdentification}\r\n");
                sb.Append("EOR\r\n");
                foreach (double z in zData)
                {
                    sb.Append($"{z * 1e6:F0}\r\n");     // resolution 1 pm, as in example
                }
                sb.Append("EOR\r\n");
                sb.Append("EOF\r\n");
                break;

            case FileFormat.PrDE:
            case FileFormat.PrEN:
                // **********************************************************
                // This format was propably developed by PTB and documented
                // on the following web site:
                // http://www.ptb.de/en/org/5/51/517/rptb_web/wizard/greeting.php
                // Umlaute are part of the definition!
                // It seems to originate from MSDOS times.
                // update in format definition to avoid Umlaute as described in:
                // https://ptb.de/rptb
                // **********************************************************
                double xLen        = DeltaX * (zData.Length - 1);
                double xResolution = 1000.0 / DeltaX;
                sb.Append($"Profil {FileName}\r\n");
                if (fileFormat == FileFormat.PrDE)
                {
                    sb.Append($"X-Maß = {xLen:F8} X-Auflösung {xResolution:F6} Punkte/Zeile : {zData.Length}\r\n");
                }
                if (fileFormat == FileFormat.PrEN)
                {
                    sb.Append($"X-len = {xLen:F8} X-resolution {xResolution:F6} points/scanline: {zData.Length}\r\n");
                }
                foreach (double z in zData)
                {
                    sb.Append($"{z:F6}\r\n");     // resolution 1 pm, as in example
                }
                // from the format definition:
                // "The last of all z-values shall be in the last line and not followed by a line feed."
                sb.Length--;
                sb.Length--;
                break;

            case FileFormat.Smd:
                // **********************************************************
                // Standardized format used by the surface texture community
                // uses some non printeable characters
                // This format was designed for F1 softgauges (only?)
                // ISO 5436-2:2012
                // **********************************************************
                string endOfRecord = $"{(char)3}\r\n";
                sb.Append($"ISO 5436-2:2012\0{FileName}\0\r\n");
                sb.Append("PRF\0 1 ISO5436\0\r\n");
                sb.Append($"CX\0 I\0 {zData.Length} mm\0 1.0e0 D\0 {DeltaX / 1000:e5} \r\n");
                sb.Append($"CZ\0 A\0 {zData.Length} um\0 1.0e0 D\0\r\n");
                sb.Append(endOfRecord);     // end of record 1
                sb.Append($"DATE: {CreationDate.ToString("dd-MMMM-yyyy")}\0\r\n");
                sb.Append($"TIME: {CreationDate.ToString("HH:mm")}\0\r\n");
                sb.Append("CREATED_BY Michael Matus, BEV\0\r\n"); //TODO
                sb.Append($"COMMENT /* {UserComment} */\0\r\n");
                sb.Append(endOfRecord);                           // end of record 2
                foreach (double z in zData)
                {
                    sb.Append($"{z:F5}\r\n");
                }
                sb.Append(endOfRecord);     // end of record 3
                // checksum calculation
                ushort chkSum = 0;
                string s      = sb.ToString();
                byte[] buffer = System.Text.Encoding.ASCII.GetBytes(s);
                foreach (byte byt in buffer)
                {
                    chkSum += (ushort)byt;
                }
                sb.Append($"{chkSum.ToString()}\r\n");
                sb.Append(endOfRecord);     // end of record 4
                sb.Append($"{(char)26}");   // end of file
                break;

            case FileFormat.Bcr:
                // **********************************************************
                // GPS data files according to
                // ISO 25178-7, ISO 25178-71 and EUNA 15178.
                // **********************************************************
                sb.AppendLine("aBCR - 1.0");
                sb.AppendLine($"ManufacID   = BEV / SIOS NMM");
                sb.AppendLine($"CreateDate  = {CreationDate.ToString("ddMMyyyyHHmm")}");
                sb.AppendLine($"ModDate     = {DateTime.UtcNow.ToString("ddMMyyyyHHmm")}");
                sb.AppendLine($"NumPoints   = {zData.Length}");
                sb.AppendLine("NumProfiles = 1");
                sb.AppendLine($"Xscale      = {(DeltaX * 1e-6).ToString("G17")}");
                sb.AppendLine($"Yscale      = 0");
                sb.AppendLine($"Zscale      = 1.0e-6");
                sb.AppendLine("Zresolution = -1");    // clause 5.2.8, do not modify!
                sb.AppendLine("Compression = 0");     // clause 5.2.9, do not modify!
                sb.AppendLine("DataType    = 7");
                sb.AppendLine("CheckType   = 0");     // clause 5.2.11, do not modify!
                sb.AppendLine("*");
                foreach (double z in zData)
                {
                    sb.AppendLine($"{z:G17}");     // round-trip format
                }
                sb.AppendLine("*");
                string AppName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
                string AppVer  = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
                sb.AppendLine($"ConvertedBy          = {AppName} version {AppVer}");
                sb.AppendLine($"SampleIdentification = {SampleIdentification}");
                sb.AppendLine($"FileName             = {FileName}");     // this is useless
                sb.AppendLine($"UserComment          = {UserComment}");
                sb.AppendLine($"TrimmedStart         = {Start} µm");
                sb.AppendLine($"TrimmedLength        = {Length} µm");
                sb.AppendLine($"TipConvolution       = {TipConvolutionMessage}");
                sb.AppendLine("*");
                break;

            case FileFormat.Csv:
                double x = 0.0;
                sb.AppendLine("x in µm,z in µm");
                foreach (double z in zData)
                {
                    sb.AppendLine($"{x:G17},{z:G17}");
                    x += DeltaX;
                }
                break;

            case FileFormat.Unknown:
            case FileFormat.X3p:
                // will not be implemented!
                throw new NotImplementedException();

            default:
                break;
            }
            return(sb.ToString());
        }
예제 #26
0
        public void SaveSQLite(string filePath)
        {
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            else
            {
                SQLiteConnection.CreateFile(filePath);
            }

            var dbc = new SQLiteConnection("Data Source=" + filePath + ";Version=3;");

            dbc.Open();

            // tables
            new SQLiteCommand(
                "create table Account (name varchar(50), crdate varchar(20), devise varchar(10), passe varchar(32));",
                dbc).ExecuteNonQuery();
            new SQLiteCommand(
                "create table Operations (id varchar(36), date varchar(20), comm text, cred varchar(20), deb varchar(20), type varchar(10), budget varchar(50), remid varchar(36));",
                dbc).ExecuteNonQuery();
            new SQLiteCommand(
                "create table ReminderOperations (id varchar(36), date varchar(20), comm text, cred varchar(20), deb varchar(20), type varchar(10), budget varchar(50), nbrep int, typerep int, auto int);",
                dbc).ExecuteNonQuery();
            new SQLiteCommand("create table Budgets (name varchar(50), color varchar(20));", dbc).ExecuteNonQuery();

            // account info
            new SQLiteCommand(
                "insert into Account (name, crdate, devise, passe) values ('" + Name.Sanitize() + "', '" +
                CreationDate.ToString("dd/MM/yyyy") + "', '" + Currency.ShortName + "', '" + Pass + "')", dbc)
            .ExecuteNonQuery();

            // operations
            foreach (var o in Operations)
            {
                new SQLiteCommand(
                    "insert into Operations (id, date, comm, cred, deb, type, budget, remid) values ('" + o.ID + "', '" +
                    o.Date.ToString("dd/MM/yyyy") + "', '" + o.Commentary.Sanitize() + "', '" +
                    o.Credit.ToString(culture.NumberFormat) + "', '" + o.Debit.ToString(culture.NumberFormat) + "', '" +
                    o.Type + "', '" + o.Budget.Sanitize() + "', '" + o.RmdOptID + "')", dbc).ExecuteNonQuery();
            }

            // reminder operations
            foreach (var o in ReminderOperations)
            {
                new SQLiteCommand(
                    "insert into ReminderOperations (id, date, comm, cred, deb, type, budget, nbrep, typerep, auto) values ('" +
                    o.ID + "', '" + o.DueDate.ToString("dd/MM/yyyy") + "', '" + o.Commentary.Sanitize() + "', '" +
                    o.Credit.ToString(culture.NumberFormat) + "', '" + o.Debit.ToString(culture.NumberFormat) + "', '" +
                    o.Type + "', '" + o.Budget.Sanitize() + "', " + o.NbOfRepetition + ", " + (int)o.RepetitionType +
                    ", " + (o.AutomaticallyAdded ? 1 : 0) + ")", dbc).ExecuteNonQuery();
            }

            // budgets
            foreach (var b in Budgets)
            {
                new SQLiteCommand(
                    "insert into Budgets (name, color) values ('" + b.Key.Sanitize() + "', '" +
                    ColorTranslator.ToHtml(b.Value) + "')", dbc).ExecuteNonQuery();
            }

            dbc.Close();
        }
예제 #27
0
 public override string ToString() => $"Трансформер \"{Mark}\", Уровень мощности: {PowerLevel}, Дата создания: {CreationDate.ToString("d")}";
예제 #28
0
            public void ToRow(DataTable tbl)
            {
                tbl.Rows.Add(
                    CustomerID.ToString("G0", gb),

                    CashRequestID.ToString("G0", gb),
                    CreationDate.ToString("d/MMM/yyyy H:mm:ss", gb),
                    ManualDecisionTime.ToString("d/MMM/yyyy H:mm:ss", gb),
                    ApprovedAmount.ToString("C0", gb),

                    InterestRate.ToString("P2", gb),
                    RepaymentPeriod.ToString("G0", gb),
                    ManualSetupFeePercent.ToString("P2", gb),
                    BrokerSetupFeePercent.ToString("P2", gb),

                    SpreadSetupFee ? "spread" : "deduced",
                    string.Empty,
                    string.Empty,
                    string.Empty,

                    "total"
                    );

                var first = GetFirstTrail();
                var main  = GetMainTrail();
                var last  = GetLastTrail();

                if (first.IsEmpty && main.IsEmpty && last.IsEmpty)
                {
                    return;
                }

                tbl.Rows.Add(
                    string.Empty,

                    first.GetTrailID("First"),
                    first.DecisionTimeStr,
                    first.StatusStr,
                    first.TagStr,

                    main.GetTrailID("Main"),
                    main.DecisionTimeStr,
                    main.StatusStr,
                    main.TagStr,

                    last.GetTrailID("Last"),
                    last.DecisionTimeStr,
                    last.StatusStr,
                    last.TagStr,

                    string.Empty
                    );

                var firstTraces = first.Traces;
                var mainTraces  = main.Traces;
                var lastTraces  = last.Traces;

                int maxLen = Math.Max(firstTraces.Length, Math.Max(mainTraces.Length, lastTraces.Length));

                for (int i = 0; i < maxLen; i++)
                {
                    NotAutoApprovedTrace f = i < firstTraces.Length ? firstTraces[i] : new NotAutoApprovedTrace();
                    NotAutoApprovedTrace m = i < mainTraces.Length ? mainTraces[i] : new NotAutoApprovedTrace();
                    NotAutoApprovedTrace l = i < lastTraces.Length ? lastTraces[i] : new NotAutoApprovedTrace();

                    tbl.Rows.Add(
                        string.Empty,

                        string.Empty,
                        f.TraceNameStr,
                        f.CommentStr,
                        string.Empty,

                        string.Empty,
                        m.TraceNameStr,
                        m.Comment,
                        string.Empty,

                        string.Empty,
                        l.TraceNameStr,
                        l.CommentStr,
                        string.Empty,

                        string.Empty
                        );
                }         // for i
            }             // ToRow
        /// <summary>
        /// Serializes this instance of <see cref="ConfigurationStoreProperties" /> into a <see cref="Microsoft.Azure.AzConfig.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.AzConfig.Runtime.Json.JsonObject"/> container to serialize this object into. If the caller
        /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
        /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Microsoft.Azure.AzConfig.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="ConfigurationStoreProperties" /> as a <see cref="Microsoft.Azure.AzConfig.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.AzConfig.Runtime.Json.JsonNode ToJson(Microsoft.Azure.AzConfig.Runtime.Json.JsonObject container, Microsoft.Azure.AzConfig.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.AzConfig.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.AzConfig.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != CreationDate ? (Microsoft.Azure.AzConfig.Runtime.Json.JsonNode) new Microsoft.Azure.AzConfig.Runtime.Json.JsonString(CreationDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", System.Globalization.CultureInfo.InvariantCulture)) : null, "creationDate", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.AzConfig.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)Endpoint)?.ToString()) ? (Microsoft.Azure.AzConfig.Runtime.Json.JsonNode) new Microsoft.Azure.AzConfig.Runtime.Json.JsonString(Endpoint.ToString()) : null, "endpoint", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.AzConfig.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)ProvisioningState)?.ToString()) ? (Microsoft.Azure.AzConfig.Runtime.Json.JsonNode) new Microsoft.Azure.AzConfig.Runtime.Json.JsonString(ProvisioningState.ToString()) : null, "provisioningState", container.Add);
            }
            AfterToJson(ref container);
            return(container);
        }
예제 #30
0
        /// <summary>
        /// Save the General.Global.ShowInformationTypes settings to the settings file
        /// </summary>
        /// <param name="infoNode">XML-node for the General.Global.ShowInformationTypes settings</param>
        public void Save(XmlNode infoNode)
        {
            string xpath;

            xpath = "./officialStatistics";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, OfficialStatistics.ToString());

            xpath = "./unit";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Unit.ToString());

            xpath = "./contact";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Contact.ToString());

            xpath = "./lastUpdated";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, LastUpdated.ToString());

            xpath = "./refPeriod";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, RefPeriod.ToString());

            xpath = "./stockFA";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, StockFa.ToString());

            xpath = "./cfPrices";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, CFPrices.ToString());

            xpath = "./dayADj";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, DayAdj.ToString());

            xpath = "./seasAdj";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, SeasAdj.ToString());

            xpath = "./basePeriod";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, BasePeriod.ToString());

            xpath = "./updateFrequency";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, UpdateFrequency.ToString());

            xpath = "./nextUpdate";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, NextUpdate.ToString());

            xpath = "./survey";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Survey.ToString());

            xpath = "./link";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Link.ToString());

            xpath = "./creationDate";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, CreationDate.ToString());

            xpath = "./copyright";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Copyright.ToString());

            xpath = "./source";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Source.ToString());

            xpath = "./matrix";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Matrix.ToString());

            xpath = "./database";
            SettingsHelper.SetSettingAttributeValue(xpath, "enabled", infoNode, Database.ToString());
        }