コード例 #1
0
ファイル: NoteTag.cs プロジェクト: MichaelAquilina/tomboy
		public virtual void Initialize (string element_name)
		{
			this.element_name = element_name;

			flags = TagFlags.CanSerialize | TagFlags.CanSplit;
			SaveType = TagSaveType.Content;
		}
コード例 #2
0
        public virtual void Initialize(string element_name)
        {
            this.element_name = element_name;

            flags    = TagFlags.CanSerialize | TagFlags.CanSplit;
            SaveType = TagSaveType.Content;
        }
コード例 #3
0
 private string GenerateTagNames(TagFlags tags)
 {
     if (mShowTagNames)
     {
         return("[" + tags.ToString() + "]");
     }
     return("");
 }
コード例 #4
0
ファイル: TagHeader.cs プロジェクト: stufkan/DeadDog.Audio
        public TagHeader(FrameReader reader)
        {
            byte[] buffer = new byte[9];
            bool found = false;
            int offset = 0;
            this.version = new Version(0, 0);
            while (reader.stream.Position < reader.stream.Length && !found && reader.stream.Position < 200)
            {
                int b = reader.stream.ReadByte();
                if (b == 0x49)
                {
                    reader.stream.Read(buffer, offset, 9);
                    string text = Encoding.ASCII.GetString(buffer);
                    if (buffer[0] == 0x44 &&
                        buffer[1] == 0x33 &&
                        buffer[2] < 0xff &&
                        buffer[3] < 0xff &&
                        //buffer[4] is the flag byte
                        buffer[5] < 0x80 &&
                        buffer[6] < 0x80 &&
                        buffer[7] < 0x80 &&
                        buffer[8] < 0x80)
                    {
                        this.version = new Version(buffer[2], buffer[3]);
                        this.flags = (TagFlags)buffer[4];
                        this.size = BinaryConverter.ToInt32(buffer, 5, true);

                        if (this.size + reader.stream.Position > reader.stream.Length)
                        {
                            this.version = new Version(0, 0);
                            break;
                        }

                        if ((flags & TagFlags.ExtendedHeader) == TagFlags.ExtendedHeader)
                        {
                            reader.stream.Read(buffer, 0, 4);
                            int extendedsize = BinaryConverter.ToInt32(buffer, 0, true);
                            reader.stream.Seek(extendedsize - 4, SeekOrigin.Current);
                        }

                        this.firstframe = reader.stream.Position;
                        break;
                    }
                    else
                        reader.stream.Seek(-9, SeekOrigin.Current);
                }
            }
            if (version == new Version(0, 0))
            {
                this.isempty = true;
                this.version = empty.version;
                this.flags = empty.flags;
                this.size = empty.size;
                this.firstframe = empty.firstframe;
            }
        }
コード例 #5
0
        private string FormatMessage(object objectToLog, PriorityFlags priorities, TagFlags tags, string message)
        {
            string        text          = GenerateTimeStamp();
            string        text2         = GeneratePriorities(priorities);
            string        text3         = GenerateTagNames(tags);
            string        text4         = GenerateObjectName(objectToLog);
            string        text5         = SerializeObject(objectToLog);
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("{0}{1}{2}{3} {4} {5}", text, text3, text2, text4, message, text5);
            return(stringBuilder.ToString());
        }
コード例 #6
0
 private void LogMessage(object objectToLog, PriorityFlags priorities, TagFlags tags, string message)
 {
     if (mSuppressLogging == 0 && ShouldLogMessage(priorities, tags, objectToLog))
     {
         string value = FormatMessage(objectToLog, priorities, tags, message);
         mLoggerQueue.Enqueue(new KeyValuePair <PriorityFlags, string>(priorities, value));
         if (mFlushAfterEachLog)
         {
             FlushLog();
         }
     }
 }
コード例 #7
0
 internal new void Reset()
 {
     tagIndex  = (originalTagIndex = HtmlTagIndex._NULL);
     nameIndex = HtmlNameIndex._NOTANAME;
     flags     = TagFlags.None;
     partMajor = TagPartMajor.None;
     partMinor = TagPartMinor.Empty;
     name.Reset();
     unstructured.Reset();
     namePosition.Reset();
     unstructuredPosition.Reset();
     attributeTail    = 0;
     currentAttribute = -1;
     attrNamePosition.Reset();
     attrValuePosition.Reset();
 }
コード例 #8
0
 public override void Configure(IDictionary <string, object> dictionary)
 {
     base.Configure(dictionary);
     mPrioritiesToLog = (PriorityFlags)Enum.Parse(typeof(PriorityFlags), mPrioritiesToLogCSV, ignoreCase: true);
     mTagsToLog       = (TagFlags)Enum.Parse(typeof(TagFlags), mTagsToLogCSV, ignoreCase: true);
     if (mTypesToLog.Count > 0)
     {
         mLogAllTypes = false;
         for (int i = 0; i < mTypesToLog.Count; i++)
         {
             ParseTypesToLog(mTypesToLog[i] as string);
         }
     }
     else
     {
         ParseTypesToLog(mTypesToLogCSV);
     }
     CreateLogFilesDirectory(mLogFile);
 }
コード例 #9
0
        internal new void Reset()
        {
            this.tagIndex  = this.originalTagIndex = HtmlTagIndex._NULL;
            this.nameIndex = HtmlNameIndex._NOTANAME;
            this.flags     = HtmlToken.TagFlags.None;
            this.partMajor = HtmlToken.TagPartMajor.None;
            this.partMinor = HtmlToken.TagPartMinor.Empty;

            this.name.Reset();
            this.unstructured.Reset();

            this.namePosition.Reset();
            this.unstructuredPosition.Reset();

            this.attributeTail    = 0;
            this.currentAttribute = -1;

            this.attrNamePosition.Reset();
            this.attrValuePosition.Reset();
        }
コード例 #10
0
 public static void Log(object objectToLog, PriorityFlags priorities, TagFlags tags, string message)
 {
     Instance.LogMessage(objectToLog, priorities, tags, message);
 }
コード例 #11
0
 public void Initialize()
 {
     this.Editable = false;
     flags         = TagFlags.IsSerializable;
 }
コード例 #12
0
ファイル: TagHeader.cs プロジェクト: stufkan/DeadDog.Audio
 public TagHeader(Version version, TagFlags flags, int size, long firstframe)
 {
     this.version = version;
     this.flags = flags;
     this.size = size;
     this.firstframe = firstframe;
 }
コード例 #13
0
 public static void LogTrace(object objectToLog, string message, TagFlags tags = TagFlags.NO_TAG)
 {
     Instance.LogMessage(objectToLog, PriorityFlags.TRACE, tags, message);
 }
コード例 #14
0
 public static void LogDebug(object objectToLog, string message, TagFlags tags = TagFlags.NO_TAG)
 {
     Instance.LogMessage(objectToLog, PriorityFlags.DEBUG, tags, message);
 }
コード例 #15
0
        private bool ShouldLogMessage(PriorityFlags priorities, TagFlags tags, object objectToLog)
        {
            if (!mWriteToDeviceConsole && !mWriteToFile && !mWriteToUnityConsole)
            {
                return(false);
            }
            bool flag  = (priorities & mPrioritiesToLog) > PriorityFlags.NONE;
            bool flag2 = (tags & mTagsToLog) > (TagFlags)0;
            bool flag3 = mLogAllTypes;

            if (!flag3)
            {
                Type type = null;
                if (objectToLog is string)
                {
                    type = Type.GetType(objectToLog as string);
                }
                else if (objectToLog is Type)
                {
                    type = objectToLog as Type;
                }
                else if (objectToLog != null)
                {
                    type = objectToLog.GetType();
                }
                if (type != null)
                {
                    if (mTypesToLogMap.TryGetValue(type, out var value))
                    {
                        switch (value)
                        {
                        case PriorityFlags.NONE:
                            flag3 = false;
                            break;

                        case PriorityFlags.ALL:
                            flag3 = true;
                            break;

                        default:
                            flag3 = value <= priorities;
                            break;
                        }
                    }
                }
                else
                {
                    flag3 = false;
                }
            }
            bool result = false;

            if (mLogAllTypes)
            {
                result = ((flag2 && flag3 && flag) ? true : false);
            }
            else if (mTagsToLog != TagFlags.ALL)
            {
                result = ((!mTagAndTypeRestrictive) ? (flag3 || flag2) : (flag3 && flag2));
            }
            else if (flag3)
            {
                result = true;
            }
            else if (flag2)
            {
                result = (flag ? true : false);
            }
            else if (flag)
            {
                result = true;
            }
            return(result);
        }
コード例 #16
0
 public static void LogInfo(object objectToLog, string message, TagFlags tags = TagFlags.NO_TAG)
 {
     Instance.LogMessage(objectToLog, PriorityFlags.INFO, tags, message);
 }
コード例 #17
0
	public void Initialize () 
	{
		this.Editable = false;
		flags = TagFlags.IsSerializable;
	}
コード例 #18
0
 public static void LogFatal(object objectToLog, string message, TagFlags tags = TagFlags.NO_TAG)
 {
     Instance.LogMessage(objectToLog, PriorityFlags.FATAL, tags, message);
 }
コード例 #19
0
 public static void LogWarning(object objectToLog, string message, TagFlags tags = TagFlags.NO_TAG)
 {
     Instance.LogMessage(objectToLog, PriorityFlags.WARNING, tags, message);
 }