示例#1
0
        public void SaveTextProperties(TextNote t)
        {
            FormattedText tFormatted = t.GetFormattedText();
            TextRange     tr         = new TextRange(0, 1);

            int textNoteTypeID = t.TextNoteType.Id.IntegerValue;

            string lowercaseAlph = "abcdefghijklmnopqrstuvwxyz";

            string plaintext = tFormatted.GetPlainText();
            bool   isUpper   = true;

            foreach (char c in plaintext)
            {
                if (lowercaseAlph.Contains(c))
                {
                    isUpper = false;
                    break;
                }
            }

            bool textNoteAllCapsStatus = isUpper;

            Debug("textNoteAllCapsStatus" + textNoteAllCapsStatus.ToString());

            FormatStatus textNoteBoldStatus = tFormatted.GetBoldStatus(tr);

            Debug("textNoteBoldStatuss" + textNoteBoldStatus.ToString());
            FormatStatus textNoteItalicsStatus = tFormatted.GetItalicStatus(tr);

            Debug("textNoteItalicsStatus" + textNoteItalicsStatus.ToString());
            FormatStatus textNoteUnderlineStatus = tFormatted.GetUnderlineStatus(tr);

            Debug("textNoteUnderlineStatus" + textNoteUnderlineStatus.ToString());

            TextFormattingContainer container = new TextFormattingContainer();

            container.textNoteAllCapsStatus   = textNoteAllCapsStatus;
            container.textNoteTypeID          = textNoteTypeID;
            container.textNoteBoldStatus      = textNoteBoldStatus;
            container.textNoteItalicsStatus   = textNoteItalicsStatus;
            container.textNoteUnderlineStatus = textNoteUnderlineStatus;

            byte[] containerBytes;

            BinaryFormatter bf = new BinaryFormatter();

            using (var ms = new MemoryStream())
            {
                bf.Serialize(ms, container);
                containerBytes = ms.ToArray();
            }
            var assembly    = Assembly.GetCallingAssembly();
            var assemblyDir = new FileInfo(assembly.Location).Directory.FullName;

            File.WriteAllBytes(assemblyDir + @"\LM2FormatSelectorSave.bin", containerBytes);
        }
 public MediaInfo(MediaType aMediaType, bool aIsErasable, string aDataType, BlankStatus aDiskStatus,
              BlankStatus aSessionStatus, FormatStatus aBgFormatStatus, int aFirstTrack, int aTotalSessions,
              bool aIsRestricted, long aSize)
 {
     fCurrentMediaType = aMediaType;
       IsErasable = aIsErasable;
       fDataType = aDataType;
       fDiskStatus = aDiskStatus;
       fSessionStatus = aSessionStatus;
       fBgFormatStatus = aBgFormatStatus;
       fFirstTrack = aFirstTrack;
       fTotalSessions = aTotalSessions;
       IsRestricted = aIsRestricted;
       Size = aSize;
 }
示例#3
0
 public MediaInfo(MediaType aMediaType, bool aIsErasable, string aDataType, BlankStatus aDiskStatus,
                  BlankStatus aSessionStatus, FormatStatus aBgFormatStatus, int aFirstTrack, int aTotalSessions,
                  bool aIsRestricted, long aSize)
 {
     fCurrentMediaType = aMediaType;
     IsErasable        = aIsErasable;
     fDataType         = aDataType;
     fDiskStatus       = aDiskStatus;
     fSessionStatus    = aSessionStatus;
     fBgFormatStatus   = aBgFormatStatus;
     fFirstTrack       = aFirstTrack;
     fTotalSessions    = aTotalSessions;
     IsRestricted      = aIsRestricted;
     Size = aSize;
 }