コード例 #1
0
ファイル: ValuesType.cs プロジェクト: Corprus/unilogviewer
 public override void ReInit(LogType logType, LogIniSection section)
 {
     base.ReInit(logType, section);
     FInit(section.Values[KeyValueType],
         (section.Values[KeyIncludeConditions] == "1"),
         (ParentLogType.Conditions[ParentLogType.LogTypeFile.Sections[section.Values[KeyCondition]].SectionName]));
 }
コード例 #2
0
ファイル: BaseType.cs プロジェクト: Corprus/unilogviewer
        public virtual void ReInit(LogType logType, LogIniSection section)
        {
            ParentLogType = logType;
            Section = section;
            try
            {
                Name = section.Values[true, Consts.KeyName, section.SectionName];
                Title = section.Values[KeyTitle];
                if (Title.Length == 0)
                    Title = Name;
                if (ParentLogType != null) //То есть это и есть лог тайп
                    Style = ParentLogType.Styles[section.Values[KeyStyle]];
                if (Style == null)
                    Style = new StyleType(false, false, false, false, System.Drawing.Color.Black, System.Drawing.Color.White, true, false);
                try
                {
                    TitleType = (TitleType)Enum.Parse(typeof(TitleType), section.Values[KeyTitleType], false);
                }
                catch (ArgumentException)
                {
                    TitleType = TitleType.Title;
                }
            }
            catch (IniFiles.Exceptions.IniFileRequiredFieldReadException e)
            {
                throw new Common.Exceptions.LogTypeLoadException(
                    string.Format("Required field missing in the log type description : {0}", e.Message), e);

            }
        }
コード例 #3
0
ファイル: ConditionType.cs プロジェクト: Corprus/unilogviewer
 public override void ReInit(LogType logType, LogIniSection section)
 {
     base.ReInit(logType, section);
     FInit(
         section.Values[KeyStartsWith],
         section.Values[KeyEndsWith],
         section.ArrayValues[KeyContain],
         section.ArrayValues[KeyExclude]);
 }
コード例 #4
0
ファイル: Log.cs プロジェクト: Corprus/unilogviewer
 public Log(LogType type, string fileName)
 {
     StructureType = type;
     LogFile = new FileReader(fileName);
     string[] logFileStrings = LogFile.ReadFile();
     Program.MainForm.InitProgressLevel(logFileStrings.Length, 0, "Processing Log...");
     RootBlock = new BlockValue(StructureType.RootBlockType,ref logFileStrings);
     Program.MainForm.EndProgress();
 }
コード例 #5
0
ファイル: BlockType.cs プロジェクト: Corprus/unilogviewer
 public override void ReInit(LogType logType, LogIniSection section)
 {
     base.ReInit(logType, section);
     StartCondition = ParentLogType.Conditions[section.Values[IniKeyStartCondition]];
     EndCondition = ParentLogType.Conditions[section.Values[IniKeyEndCondition]];
     ChildBlockTypes = (ParentLogType.BlockTypes.GetList(section.ArrayValues[IniKeyChildBlockTypes]));
     ChildStringTypes = (ParentLogType.StringTypes.GetList(section.ArrayValues[IniKeyChildStringTypes]));
     if ((ChildBlockTypes.Count == 0) && (ChildStringTypes.Count == 0))
         throw new Common.Exceptions.LogTypeLoadException("Both ChildBLockTypes and ChildStringTypes are empty");
 }
コード例 #6
0
ファイル: StringType.cs プロジェクト: Corprus/unilogviewer
        public override void ReInit(LogType logType, LogIniSection section)
        {
            base.ReInit(logType, section);
            Condition = ParentLogType.Conditions[section.Values[IniKeyCondition]];
            UseSeparator = (section.Values[IniKeyUseSeparator] == "1");
            if (section.Values[IniKeySeparator].Length > 0)
            {
                var separatorArray = section.ArrayValues[IniKeySeparator, false];
                Separator = separatorArray.Select(separatorString => separatorString[0]).ToArray();
                int temporary;
                if (!(int.TryParse(section.Values[IniKeyTitleValueIndex], out temporary)))
                    temporary = 0;
                TitleValueIndex = temporary;
                TitleValueType = section.Values[IniKeyTitleValueType];
            }
            else
                UseSeparator = false;

            var children = section.ArrayValues[IniKeyChildTypes];
            ChildTypes = new List<ValuesType>();
            ChildTypes.AddRange(children.AsParallel().Select(typeName => ParentLogType.ValueTypes[typeName]));
        }
コード例 #7
0
ファイル: StyleType.cs プロジェクト: Corprus/unilogviewer
        public override void ReInit(LogType logType, LogIniSection section)
        {
            base.ReInit(logType, section);
            Bold = section.BoolValues[KeyBold];
            Italic = section.BoolValues[KeyItalic];
            Underline = section.BoolValues[KeyUnderline];
            Strike = section.BoolValues[KeyStrike];

            Trim = section.BoolValues[KeyTrim, true];
            Visible = section.BoolValues[KeyVisible, true];
            try
            {
                Color = Color.FromName(section.Values[KeyColor]);
            }
            catch (Exception)
            {
                Color = Color.Black;
            }
            try
            {
                Background = Color.FromName(section.Values[KeyBackground]);
                if (section.Values[KeyBackground].Length == 0)
                    Background = Color.White;
            }
            catch (Exception)
            {
                Background = Color.White;
            }
            ReInitFont();
        }
コード例 #8
0
        public void AddLogType(string logTypeFileName)
        {
            if (TypesList == null)
                TypesList = new List<LogType>();
            bool bHasSameName = (TypesList.Any(type => type.LogName == logTypeFileName));

            bool addTypeAccepted = true;
            string logFileIniFileNameWithoutFolders = logTypeFileName.Substring(logTypeFileName.LastIndexOf("\\", StringComparison.Ordinal) + 1, logTypeFileName.Length - logTypeFileName.LastIndexOf("\\", StringComparison.Ordinal) - 1);
            bHasSameName = (bHasSameName || (File.Exists(string.Format("{0}\\{1}", IniSettingsManager.LogTypesFolder, logFileIniFileNameWithoutFolders))));

            if (bHasSameName)
               addTypeAccepted = (MessageBox.Show(Consts.AskAddLogTypeWithSameName, Consts.HeaderSameLogTypePresent, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, Consts.DefaultMessageBoxOptions) == DialogResult.Yes);

            if (!addTypeAccepted) return;

            var newFileName = logFileIniFileNameWithoutFolders;

            if (bHasSameName)
            {
                string[] sLogTypes = Directory.GetFiles(IniSettingsManager.LogTypesFolder, newFileName);
                int i = 0;
                while (sLogTypes.Length > 0)
                {
                    newFileName = logFileIniFileNameWithoutFolders.Substring(0, logFileIniFileNameWithoutFolders.LastIndexOf(".", StringComparison.Ordinal)) + i.ToString(System.Globalization.CultureInfo.InvariantCulture) + "." + Consts.LogTypeExtension;
                    sLogTypes = Directory.GetFiles(IniSettingsManager.LogTypesFolder, newFileName);
                    i++;
                }
            }
            newFileName = string.Format("{0}\\{1}", IniSettingsManager.LogTypesFolder, newFileName);
            File.Copy(logTypeFileName, newFileName);
            try
            {
                var newType = new LogType(newFileName);
                AddLogType(newType);
            }
            catch (Common.Exceptions.LogTypeLoadException e)
            {
                _hadInconsistencies = true;
                MessageBox.Show(e.Message, Resources.CannotLoadLogTypeMessage, MessageBoxButtons.OK,
                                MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, Consts.DefaultMessageBoxOptions);
            }
        }
コード例 #9
0
 private void AddLogType(LogType logType)
 {
     if (TypesList == null)
         TypesList = new List<LogType>();
     TypesList.Add(logType);
 }
コード例 #10
0
ファイル: BaseType.cs プロジェクト: Corprus/unilogviewer
 protected BaseType(LogType logType, LogIniSection section)
 {
     ReInit(logType, section);
 }