Exemple #1
0
        void WriteHeader(StringBuilder text, LogMeter log)
        {
            AppendKeyValuePair(text, "Format", "TraceWizardLog");
            AppendKeyValuePair(text, "Version", TwAssembly.Version().ToString());

            WriteCustomerInfo(text, log.Customer);
            WriteMeterInfo(text, log.Meter);
        }
Exemple #2
0
        private Version GetCurrentFileVersion(string[] lines)
        {
            Version version = TwAssembly.Version();

            foreach (string line in lines)
            {
                if (line.Contains("@DATA"))
                {
                    break;
                }

                if (line.Contains("% Version: "))
                {
                    version = new Version(line.Split(':')[1].Trim());
                }
            }
            return(version);
        }
Exemple #3
0
        void WriteHeader(System.Text.StringBuilder text, string dataSource, double conversionFactor)
        {
            text.AppendLine("% Format: Trace Wizard Analysis");
            text.AppendLine("% Version: " + TwAssembly.Version());
            text.AppendLine("% TwConversionFactor: " + conversionFactor.ToString("0.000000"));
            text.AppendLine("%");
            text.AppendLine("@RELATION event");
            text.AppendLine();

            if (Attributes.IsKeyCodeEnabled)
            {
                text.AppendLine("@ATTRIBUTE keycode           STRING");
            }

            if (Attributes.IsEventIdEnabled)
            {
                text.AppendLine("@ATTRIBUTE eventid           NUMERIC");
            }

            if (Attributes.IsStartTimeEnabled)
            {
                text.AppendLine("@ATTRIBUTE starttime         DATE \"yyyy-MM-dd HH:mm:ss\"");
            }

            if (Attributes.IsEndTimeEnabled)
            {
                text.AppendLine("@ATTRIBUTE endtime           DATE \"yyyy-MM-dd HH:mm:ss\"");
            }

            if (Attributes.IsDurationEnabled)
            {
                text.AppendLine("@ATTRIBUTE duration          NUMERIC");
            }

            if (Attributes.IsFirstCycleEnabled)
            {
                text.AppendLine("@ATTRIBUTE firstcycle        {True,False}");
            }

            if (Attributes.IsManuallyClassifiedEnabled)
            {
                text.AppendLine("@ATTRIBUTE preserved         {True,False}");
            }

            if (Attributes.IsChannelEnabled)
            {
                text.AppendLine("@ATTRIBUTE channel           {None,Runt,Trickle,Base,Super}");
            }

            if (Attributes.IsVolumeEnabled)
            {
                text.AppendLine("@ATTRIBUTE volume            NUMERIC");
            }

            if (Attributes.IsPeakEnabled)
            {
                text.AppendLine("@ATTRIBUTE peak              NUMERIC");
            }

            if (Attributes.IsModeEnabled)
            {
                text.AppendLine("@ATTRIBUTE mode              NUMERIC");
            }

            if (Attributes.IsModeFrequencyEnabled)
            {
                text.AppendLine("@ATTRIBUTE modefrequency     NUMERIC");
            }

            if (Attributes.IsHourEnabled)
            {
                text.AppendLine("@ATTRIBUTE hour              NUMERIC");
            }

            if (Attributes.IsIsWeekendEnabled)
            {
                text.AppendLine("@ATTRIBUTE isweekend         {True,False}");
            }

            if (Attributes.IsTimeToLongerEventEnabled)
            {
                text.AppendLine("@ATTRIBUTE timetolongerevent NUMERIC");
            }

            if (Attributes.IsUserNotesEnabled)
            {
                text.AppendLine("@ATTRIBUTE notes             STRING");
            }

            if (Attributes.IsFixtureClassEnabled)
            {
                text.AppendLine("@ATTRIBUTE class             {" + BuildFixtureClasses() + "}");
            }

            if (Attributes.IsClassifiedUsingFixtureListEnabled)
            {
                text.AppendLine("@ATTRIBUTE classifiedusingfixturelist {True,False}");
            }

            if (Attributes.IsManuallyApprovedEnabled)
            {
                text.AppendLine("@ATTRIBUTE manuallyapproved  {True,False}");
            }

            if (Attributes.IsManuallyClassifiedFirstCycleEnabled)
            {
                text.AppendLine("@ATTRIBUTE manuallyclassifiedfirstcycle  {True,False}");
            }

            text.AppendLine();
        }
Exemple #4
0
        public Analysis Load(string dataSource)
        {
            string[] lines = System.IO.File.ReadAllLines(dataSource);

            if (IsOldVersion(lines))
            {
                throw new Exception("Please migrate the analysis file " + dataSource + " to version " + TwAssembly.Version() + " or later.");
            }

            double twConversionFactor = GetTwConversionFactor(lines);

            Attributes = LoadAttributes(lines);

            LogMeter log = LoadLog(lines);

            FixtureProfiles fixtureProfiles = LoadFixtureProfiles(lines);

            Events events = LoadEvents(lines);

            LoadFlows(lines, events);

            events.UpdateVolume();

            var analysis = new AnalysisDatabase(dataSource, events, log, fixtureProfiles);

            analysis.Events.ConversionFactor = twConversionFactor;
            analysis.Events.UpdateChannel();
            analysis.Events.UpdateSuperPeak();
            analysis.Events.UpdateLinkedList();
            analysis.Events.UpdateOriginalVolume();

            return(analysis);
        }