예제 #1
0
        /// <summary>
        /// Creates a XPen based on the specified line format. If not specified color, width and dash style
        /// will be taken from the defaultColor, defaultWidth and defaultDashStyle parameters.
        /// </summary>
        internal static XPen ToXPen(LineFormat lineFormat, XColor defaultColor, double defaultWidth, XDashStyle defaultDashStyle)
        {
            XPen pen = null;

            if (lineFormat == null)
            {
                pen           = new XPen(defaultColor, defaultWidth);
                pen.DashStyle = defaultDashStyle;
            }
            else
            {
                XColor color = defaultColor;
                if (!lineFormat.Color.IsEmpty)
                {
                    color = lineFormat.Color;
                }

                double width = lineFormat.Width.Point;
                if (!lineFormat.Visible)
                {
                    width = 0;
                }
                if (lineFormat.Visible && width == 0)
                {
                    width = defaultWidth;
                }

                pen            = new XPen(color, width);
                pen.DashStyle  = lineFormat._dashStyle;
                pen.DashOffset = 10 * width;
            }
            return(pen);
        }
예제 #2
0
                    /// <summary>
                    /// Normal constructor.  Caller directly provides name of any correspondingly created LMH object and the directory path that will be the root for the resulting dirctory tree of files that this tool manages.
                    /// <para/>Sets the following default values:
                    /// DateTreeFormat="yyyy/MM", FileNamePrefix="Log_", FileNameExtension=".txt",
                    /// LogGate=Debug,
                    /// IncludeDate=true, IncludeQpc=true, IncludeSource=true, IncludeData=true,
                    /// IncludeThreadInfo=false, IncludeNamedValueSet=true, IncludeFileAndLine=false,
                    /// PruneInterval=10.0 seconds, AdvanceRules={1 year, 10000000 bytes, test period=10 seconds}, MesgQueueSize=5000,
                    /// CreateDirectoryIfNeeded = true, MaxInitialAutoCleanupIterations=0, MaxEntriesToDeletePerIteration=50,
                    /// FileHeaderLines = null, FileHeaderLinesDelegate = null,
                    /// </summary>
                    public Config(string name, string dirPath)
                    {
                        Name         = name;
                        base.DirPath = dirPath;

                        LogGate = Logging.LogGate.Debug;

                        DateTreeFormat    = @"yyyy/MM";    // use of / as path delimiter is intentional.  It is cross platform and does not trigger escape char handling in DateTime.ToString method.
                        FileNamePrefix    = "Log_";
                        FileNameExtension = ".txt";

                        LineFormat = new LineFormat(true, true, true, true, true, false, "\r\n", "\t")
                        {
                            IncludeThreadInfo = false, IncludeNamedValueSet = false
                        };

                        IncludeQpc        = true;
                        IncludeData       = true;
                        IncludeThreadInfo = true;

                        PruneInterval = TimeSpan.FromSeconds(10.0);
                        AdvanceRules  = new FileRotationLoggingConfig.AdvanceRules()
                        {
                            FileAgeLimit = TimeSpan.FromDays(365.25), fileSizeLimit = 10000000, TestPeriod = TimeSpan.FromSeconds(10.0)
                        };

                        MesgQueueSize = 5000;

                        base.CreateDirectoryIfNeeded         = true;
                        base.MaxInitialAutoCleanupIterations = 0;
                        base.MaxEntriesToDeletePerIteration  = 50;
                    }
예제 #3
0
        public static void Run()
        {
            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Instantiate a new Workbook
            Workbook workbook = new Workbook();

            // Get the first default sheet
            Worksheet sheet = workbook.Worksheets[0];

            // Add Watermark
            Aspose.Cells.Drawing.Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1,
                                                                            "CONFIDENTIAL", "Arial Black", 50, false, true
                                                                            , 18, 8, 1, 1, 130, 800);

            // Get the fill format of the word art
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency
            wordArtFormat.Transparency = 0.9;

            // Make the line invisible
            LineFormat lineFormat = wordart.Line;

            // Save the file
            workbook.Save(outputDir + "outputAddWordArtWatermarkToWorksheet.xlsx");

            Console.WriteLine("AddWordArtWatermarkToWorksheet executed successfully.\r\n");
        }
예제 #4
0
        public FrameSequence(IStreamReader reader) : base(reader)
        {
            // FRAME = Frame Begin LineFormat AreaFormat [GELFRAME] [SHAPEPROPS] End

            // Frame
            this.Frame = (Frame)BiffRecord.ReadRecord(reader);

            // Begin
            this.Begin = (Begin)BiffRecord.ReadRecord(reader);

            // LineFormat
            this.LineFormat = (LineFormat)BiffRecord.ReadRecord(reader);

            // AreaFormat
            this.AreaFormat = (AreaFormat)BiffRecord.ReadRecord(reader);

            // [GELFRAME]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.GelFrame)
            {
                this.GelFrameSequence = new GelFrameSequence(reader);
            }

            // [SHAPEPROPS]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.ShapePropsStream)
            {
                this.ShapePropsSequence = new ShapePropsSequence(reader);
            }

            // End
            this.End = (End)BiffRecord.ReadRecord(reader);
        }
        public List <IIdentifiedProtein> ReadFromFile(string filename)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException("File not exist : " + filename);
            }

            var result = new List <IIdentifiedProtein>();

            long fileSize = new FileInfo(filename).Length;

            Progress.SetRange(0, fileSize);
            using (var br = new StreamReader(filename))
            {
                String line = br.ReadLine();

                ProteinFormat = new LineFormat <IIdentifiedProtein>(IdentifiedProteinPropertyConverterFactory.GetInstance(), line, engineName);

                while ((line = br.ReadLine()) != null)
                {
                    if (0 == line.Trim().Length)
                    {
                        break;
                    }

                    Progress.SetPosition(br.BaseStream.Position);

                    result.Add(ProteinFormat.ParseString(line));
                }
            }

            return(result);
        }
        public static void Run()
        {
            // ExStart:AddWordArtWatermarkToChart
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Open the existing excel file.
            Workbook workbook = new Workbook(dataDir + "sample.xlsx");

            // Get the chart in the first worksheet.
            Aspose.Cells.Charts.Chart chart = workbook.Worksheets[0].Charts[0];

            // Add a WordArt watermark (shape) to the chart's plot area.
            Aspose.Cells.Drawing.Shape wordart = chart.Shapes.AddTextEffectInChart(MsoPresetTextEffect.TextEffect2,
                                                                                   "CONFIDENTIAL", "Arial Black", 66, false, false, 1200, 500, 2000, 3000);

            // Get the shape's fill format.
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency.
            wordArtFormat.Transparency = 0.9;

            // Get the line format.
            LineFormat lineFormat = wordart.Line;

            // Set Line format to invisible.
            lineFormat.Weight = 0.0;

            // Save the excel file.
            workbook.Save(dataDir + "output_out_.xlsx");
            // ExEnd:AddWordArtWatermarkToChart
        }
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Open the existing excel file.
            Workbook workbook = new Workbook(sourceDir + "sampleAddWordArtWatermarkToChart.xlsx");

            // Get the chart in the first worksheet.
            Aspose.Cells.Charts.Chart chart = workbook.Worksheets[0].Charts[0];

            // Add a WordArt watermark (shape) to the chart's plot area.
            Aspose.Cells.Drawing.Shape wordart = chart.Shapes.AddTextEffectInChart(MsoPresetTextEffect.TextEffect2,
                                                                                   "CONFIDENTIAL", "Arial Black", 66, false, false, 1200, 500, 2000, 3000);

            // Get the shape's fill format.
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency.
            wordArtFormat.Transparency = 0.9;

            // Get the line format.
            LineFormat lineFormat = wordart.Line;

            // Set Line format to invisible.
            lineFormat.Weight = 0.0;

            // Save the excel file.
            workbook.Save(outputDir + "outputAddWordArtWatermarkToChart.xlsx");

            Console.WriteLine("AddWordArtWatermarkToChart executed successfully.");
        }
        private void InitLabelFormat(List <string> headers)
        {
            string sline = string.Empty;

            foreach (string header in headers)
            {
                if (header.StartsWith("H	PLINE"))
                {
                    this.proteinFormat = new LineFormat <CensusProteinItem>(CensusProteinItemPropertyConverterFactory.GetInstance(), header.Substring(2));
                }
                else if (header.StartsWith("H	SLINE"))
                {
                    sline = header.Substring(2).Trim();
                    this.peptideFormat = new LineFormat <CensusPeptideItem>(CensusPeptideItemPropertyConverterFactory.GetInstance(), sline);
                }
                else if (header.StartsWith("H	&SLINE"))
                {
                    string line = header.Substring(3).Trim();
                    if (line.Equals(sline))
                    {
                        continue;
                    }

                    if (line.Length > sline.Length)
                    {
                        this.peptideFormat = new LineFormat <CensusPeptideItem>(CensusPeptideItemPropertyConverterFactory.GetInstance(), line);
                    }
                }
            }
        }
예제 #9
0
        private string lineFormatConvert(byte[] data, LineFormat outputFormat)
        {
            string formatter = "";

            // prefix
            if ((outputFormat & LineFormat.WithHexPrefix) == LineFormat.WithHexPrefix)
            {
                formatter += "0x{0,2:x2}";
            }
            else
            {
                formatter += "{0,2:x2}";
            }
            // seprator
            if ((outputFormat & LineFormat.SepratedByComma) == LineFormat.SepratedByComma)
            {
                formatter += ", ";
            }
            else
            {
                formatter += " ";
            }

            // convert line
            string outString = "";

            foreach (byte ch in data)
            {
                outString += String.Format(formatter, ch);
            }
            return(outString.Trim());
        }
예제 #10
0
        private void InitializeProteinFormat(IIdentifiedResult identifiedResult, string oldProteinHeader)
        {
            var           proteins         = identifiedResult.GetProteins();
            List <string> proAnnotations   = AnnotationUtils.GetAnnotationKeys(proteins);
            string        newProteinHeader = StringUtils.GetMergedHeader(oldProteinHeader, proAnnotations, '\t');

            ProteinFormat = new LineFormat <IIdentifiedProtein>(IdentifiedProteinPropertyConverterFactory.GetInstance(), newProteinHeader, GetEngineName(), proteins);
        }
예제 #11
0
        internal ShapeRenderer(XGraphics gfx, Shape shape, FieldInfos fieldInfos)
            : base(gfx, shape, fieldInfos)
        {
            this.shape = shape;
            LineFormat lf = (LineFormat)this.shape.GetValue("LineFormat", GV.ReadOnly);

            this.lineFormatRenderer = new LineFormatRenderer(lf, gfx);
        }
예제 #12
0
 private static CandleData ParseCandleFormatted(string line, int timeframe, LineFormat format)
 {
     if (format == LineFormat.CommaSeparated)
     {
         return(ParseCandleCommaFormatted(line, timeframe));
     }
     return(ParseCandleSpaceFormatted(line, timeframe));
 }
예제 #13
0
        public ShapeRenderer(XGraphics gfx, Shape shape, FieldInfos fieldInfos)
            : base(gfx, shape, fieldInfos)
        {
            _shape = shape;
            LineFormat lf = (LineFormat)_shape.GetValue("LineFormat", GV.ReadOnly);

            _lineFormatRenderer = new LineFormatRenderer(lf, gfx);
        }
예제 #14
0
        private void InitializePeptideFormat(IIdentifiedResult identifiedResult, string oldPeptideHeader)
        {
            var           spectra          = identifiedResult.GetSpectra();
            List <string> pepAnnotations   = AnnotationUtils.GetAnnotationKeys(spectra);
            string        newPeptideHeader = StringUtils.GetMergedHeader(oldPeptideHeader, pepAnnotations, '\t');

            PeptideFormat = new LineFormat <IIdentifiedSpectrum>(IdentifiedSpectrumPropertyConverterFactory.GetInstance(), newPeptideHeader, GetEngineName(), spectra);
        }
예제 #15
0
        public AxisLineFormatGroup(IStreamReader reader)
        {
            // *4(AxisLine LineFormat)

            this.AxisLine = (AxisLine)BiffRecord.ReadRecord(reader);

            this.LineFormat = (LineFormat)BiffRecord.ReadRecord(reader);
        }
 private void InitDefaultFormat()
 {
     this.proteinFormat = new LineFormat <CensusProteinItem>(
         CensusProteinItemPropertyConverterFactory.GetInstance(),
         "PLINE	LOCUS	AVERAGE_RATIO	STANDARD_DEVIATION	WEIGHTED_AVERAGE	PEPTIDE_NUM	SPEC_COUNT	DESCRIPTION");
     this.peptideFormat = new LineFormat <CensusPeptideItem>(
         CensusPeptideItemPropertyConverterFactory.GetInstance(),
         "SLINE	UNIQUE	SEQUENCE	RATIO	REGRESSION_FACTOR	DETERMINANT_FACTOR	XCorr	deltaCN	SAM_INT	REF_INT	AREA_RATIO	SINGLETON_SCORE	FILE_NAME");
 }
예제 #17
0
 protected void FlattenLineFormat(LineFormat lineFormat, LineFormat refLineFormat)
 {
     if (refLineFormat != null)
     {
         if (lineFormat._width.IsNull)
         {
             lineFormat._width = refLineFormat._width;
         }
     }
 }
예제 #18
0
        internal ShapeRenderer(XGraphics gfx, RenderInfo renderInfo, FieldInfos fieldInfos)
            : base(gfx, renderInfo, fieldInfos)
        {
            this.shape = (Shape)renderInfo.DocumentObject;
            LineFormat lf = (LineFormat)this.shape.GetValue("LineFormat", GV.ReadOnly);

            this.lineFormatRenderer = new LineFormatRenderer(lf, gfx);
            FillFormat ff = (FillFormat)this.shape.GetValue("FillFormat", GV.ReadOnly);

            this.fillFormatRenderer = new FillFormatRenderer(ff, gfx);
        }
예제 #19
0
        void MapObject(LineFormat lineFormat, DocumentObjectModel.Shapes.LineFormat domLineFormat)
        {
            if (domLineFormat.Color.IsEmpty)
            {
                lineFormat.Color = XColor.Empty;
            }
            else
            {
#if noCMYK
                lineFormat.Color = XColor.FromArgb(domLineFormat.Color.Argb);
#else
                lineFormat.Color = ColorHelper.ToXColor(domLineFormat.Color, domLineFormat.Document.UseCmykColor);
#endif
            }
            switch (domLineFormat.DashStyle)
            {
            case DocumentObjectModel.Shapes.DashStyle.Dash:
                lineFormat.DashStyle = XDashStyle.Dash;
                break;

            case DocumentObjectModel.Shapes.DashStyle.DashDot:
                lineFormat.DashStyle = XDashStyle.DashDot;
                break;

            case DocumentObjectModel.Shapes.DashStyle.DashDotDot:
                lineFormat.DashStyle = XDashStyle.DashDotDot;
                break;

            case DocumentObjectModel.Shapes.DashStyle.Solid:
                lineFormat.DashStyle = XDashStyle.Solid;
                break;

            case DocumentObjectModel.Shapes.DashStyle.SquareDot:
                lineFormat.DashStyle = XDashStyle.Dot;
                break;

            default:
                lineFormat.DashStyle = XDashStyle.Solid;
                break;
            }
            switch (domLineFormat.Style)
            {
            case DocumentObjectModel.Shapes.LineStyle.Single:
                lineFormat.Style = LineStyle.Single;
                break;
            }
            lineFormat.Visible = domLineFormat.Visible;
            if (domLineFormat.IsNull("Visible"))
            {
                lineFormat.Visible = true;
            }
            lineFormat.Width = domLineFormat.Width.Point;
        }
                /// <summary>
                /// Constructor - <see cref="FileRotationLoggingConfig"/> parameter defines all initial values for the configuration and operation of this LMH.
                /// </summary>
                public TextFileRotationLogMessageHandler(FileRotationLoggingConfig frlConfig)
                    : base(frlConfig.name, frlConfig.logGate, recordSourceStackFrame: frlConfig.includeFileAndLine)
                {
                    // replace the default LogMessageHandlerLogger with a normal QueuedLogger.  This is for use by all levels of this LMH type.
                    //  this allows generated messages to be inserted into and handled by the entire distribution system rather than just by this LMH instance.
                    logger = new QueuedLogger(Name, LogGate);

                    config  = frlConfig;
                    dirMgr  = new File.DirectoryFileRotationManager(config.name);
                    lineFmt = new LineFormat(true, config.includeQpcTime, true, true, true, config.includeFileAndLine, "\r\n", "\t")
                    {
                        IncludeThreadInfo = config.includeThreadInfo, IncludeNamedValueSet = config.includeNamedValueSet
                    };

                    dirMgrConfig = new MosaicLib.File.DirectoryFileRotationManager.Config();

                    dirMgrConfig.dirPath        = config.dirPath;
                    dirMgrConfig.fileNamePrefix = config.fileNamePrefix;
                    dirMgrConfig.fileNameSuffix = config.fileNameSuffix;

                    if (config.nameUsesDateAndTime)
                    {
                        dirMgrConfig.fileNamePattern = File.DirectoryFileRotationManager.FileNamePattern.ByDate;
                    }
                    else
                    {
                        dirMgrConfig.fileNamePattern = File.DirectoryFileRotationManager.FileNamePattern.Numeric4DecimalDigits;
                    }

                    dirMgrConfig.excludeFileNamesSet = config.excludeFileNamesSet;

                    dirMgrConfig.advanceRules = config.advanceRules;
                    double testPeriodInSec = config.advanceRules.testPeriodInSec;

                    if (testPeriodInSec == 0.0)
                    {
                        testPeriodInSec = Math.Min(10.0, config.advanceRules.fileAgeLimitInSec / 3.0);
                    }
                    dirMgrConfig.advanceRules.testPeriodInSec = testPeriodInSec;

                    dirMgrConfig.purgeRules = config.purgeRules;

                    dirMgrConfig.enableAutomaticCleanup  = true;
                    dirMgrConfig.maxAutoCleanupDeletes   = 200;
                    dirMgrConfig.createDirectoryIfNeeded = config.createDirectoryIfNeeded;

                    SetupDirMgr();
                }
예제 #21
0
        public List <IIdentifiedSpectrum> ReadFromFile(string filename)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException("File not exist : " + filename);
            }

            var result = new List <IIdentifiedSpectrum>();

            long fileSize = new FileInfo(filename).Length;

            Progress.SetRange(0, fileSize);
            try
            {
                using (var br = new StreamReader(filename))
                {
                    String line = br.ReadLine();

                    PeptideFormat = new LineFormat <IIdentifiedSpectrum>(IdentifiedSpectrumPropertyConverterFactory.GetInstance(),
                                                                         line, "sequest");

                    while ((line = br.ReadLine()) != null)
                    {
                        if (0 == line.Trim().Length)
                        {
                            break;
                        }

                        Progress.SetPosition(br.BaseStream.Position);

                        result.Add(PeptideFormat.ParseString(line));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(MyConvert.Format("Reading from file {0} error :\n" + ex.Message, filename), ex);
            }

            string enzymeFile = filename + ".enzyme";

            if (File.Exists(enzymeFile))
            {
                new ProteaseFile().Fill(enzymeFile, result);
            }

            return(result);
        }
예제 #22
0
        /// <summary>
        /// Renders the line format of the shape.
        /// </summary>
        protected void RenderLineFormat()
        {
            LineFormat lf = GetValueAsIntended("LineFormat") as LineFormat;

            if (lf != null && (lf.IsNull("Visible") || lf.Visible == true))
            {
                RenderNameValuePair("fLine", "1");
                TranslateAsNameValuePair("LineFormat.Color", "lineColor", RtfUnit.Undefined, "0");
                TranslateAsNameValuePair("LineFormat.Width", "lineWidth", RtfUnit.EMU, ToEmu(1).ToString());
                TranslateAsNameValuePair("LineFormat.DashStyle", "lineDashing", RtfUnit.Undefined, "0");
            }
            else
            {
                RenderNameValuePair("fLine", "0");
            }
        }
        private void InitLabelFreeFormat(List <string> headers)
        {
            Regex  proteinReg    = new Regex(@"AVG\((\S+)_INT/(\S+)_INT\)");
            string sampleName    = "";
            string referenceName = "";

            foreach (string header in headers)
            {
                if (header.StartsWith("H	PLINE"))
                {
                    Match m = proteinReg.Match(header);
                    sampleName    = m.Groups[1].Value;
                    referenceName = m.Groups[2].Value;

                    CensusProteinItemPropertyConverterFactory factory = CensusProteinItemPropertyConverterFactory.GetInstance();

                    IPropertyConverter <CensusProteinItem> averageRatioConverter = new CensusProteinItem_AVERAGE_RATIO_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusProteinItem>(averageRatioConverter, MyConvert.Format("AVG({0}_INT/{1}_INT)", sampleName, referenceName)));

                    IPropertyConverter <CensusProteinItem> sdConverter = new CensusProteinItem_STANDARD_DEVIATION_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusProteinItem>(sdConverter, MyConvert.Format("STDEV({0}_INT/{1}_INT)", sampleName, referenceName)));

                    this.proteinFormat = new LineFormat <CensusProteinItem>(factory, header.Substring(2));
                }
                else if (header.StartsWith("H	SLINE"))
                {
                    string        peptideHeader = header.Substring(2);
                    List <string> parts         = new List <string>(peptideHeader.Split(new char[] { '\t' }));
                    parts.Remove(MyConvert.Format("SPEC_COUNT({0})", sampleName));
                    parts.Remove(MyConvert.Format("SPEC_COUNT({0})", referenceName));
                    peptideHeader = StringUtils.Merge(parts, "\t");

                    CensusPeptideItemPropertyConverterFactory factory = CensusPeptideItemPropertyConverterFactory.GetInstance();

                    IPropertyConverter <CensusPeptideItem> ratioConverter = new CensusPeptideItem_RATIO_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusPeptideItem>(ratioConverter, MyConvert.Format("{0}_INT/{1}_INT", sampleName, referenceName)));

                    IPropertyConverter <CensusPeptideItem> samIntConverter = new CensusPeptideItem_SAM_INT_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusPeptideItem>(samIntConverter, MyConvert.Format("INT({0})", sampleName)));

                    IPropertyConverter <CensusPeptideItem> refIntConverter = new CensusPeptideItem_REF_INT_Converter();
                    factory.RegisterConverter(new PropertyAliasConverter <CensusPeptideItem>(refIntConverter, MyConvert.Format("INT({0})", referenceName)));

                    this.peptideFormat = new LineFormat <CensusPeptideItem>(factory, peptideHeader);
                }
            }
        }
        public void WriteToFile(string fileName, List <IAnnotation> t)
        {
            if (this.Format == null)
            {
                var line = (from ann in t
                            from key in ann.Annotations.Keys
                            select key).Distinct().ToList();

                this.Format = new LineFormat <IAnnotation>(new AnnotationPropertyConverterFactory(), line.Merge('\t'));
            }

            using (StreamWriter sw = new StreamWriter(fileName))
            {
                sw.WriteLine(this.Format.GetHeader());
                t.ForEach(m => sw.WriteLine(this.Format.GetString(m)));
            }
        }
        public List <IAnnotation> ReadFromFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException("File not exist : " + fileName);
            }

            var result = new List <IAnnotation>();

            long fileSize = new FileInfo(fileName).Length;

            Progress.SetRange(0, fileSize);

            char[] cs = new char[] { '\t' };
            using (var br = new StreamReader(fileName))
            {
                String line = br.ReadLine();

                this.Format = new LineFormat <IAnnotation>(factory, line);

                int lineCount = 0;
                while ((line = br.ReadLine()) != null)
                {
                    if (0 == line.Trim().Length)
                    {
                        break;
                    }

                    if (Progress.IsCancellationPending())
                    {
                        throw new UserTerminatedException();
                    }

                    lineCount++;
                    if (lineCount == 100)
                    {
                        lineCount = 0;
                        Progress.SetPosition(br.GetCharpos());
                    }

                    result.Add(this.Format.ParseString(line));
                }
            }

            return(result);
        }
예제 #26
0
        protected Unit GetLineWidth()
        {
            LineFormat lf = GetValueAsIntended("LineFormat") as LineFormat;

            if (lf != null && (lf.IsNull("Visible") || lf.Visible == true))
            {
                if (lf.IsNull("Width"))
                {
                    return(1);
                }
                else
                {
                    return(lf.Width);
                }
            }
            return(0);
        }
예제 #27
0
    public static LineFormat GetFormat(string fullText, LineFormat lastLine = LineFormat.Action)
    {
        LineFormat format = LineFormat.Action;

        if (fullText.Length == 0)
        {
            return(format);
        }

        string[] dialogueBroken = fullText.Split(':');

        string lowerText = fullText.ToLower();

        if (lowerText.StartsWith("int.") || lowerText.StartsWith("ext."))
        {
            format = LineFormat.SceneHeading;
        }
        else if (fullText.StartsWith("[") && fullText.EndsWith("]"))
        {
            format = LineFormat.MissionHeading;
        }
        else if ((fullText.ToUpper() == fullText && fullText.EndsWith("TO:")) || fullText.StartsWith(">") || fullText == "FADE IN:")
        {
            format = LineFormat.Transition;
            if (fullText.StartsWith(">"))
            {
                fullText = fullText.Remove(0, 1).Trim();
            }
        }
        else if ((fullText[0] == '@' || fullText.ToUpper() == fullText) && fullText != "...")
        {
            format = LineFormat.Character;
        }
        else if ((lastLine == LineFormat.Character || lastLine == LineFormat.Dialogue) && fullText.StartsWith("(") && fullText.EndsWith(")"))
        {
            format = LineFormat.Parenthetical;
        }
        else if (dialogueBroken.Length > 1 || lastLine == LineFormat.Character || lastLine == LineFormat.Parenthetical)
        {
            format = LineFormat.Dialogue;
        }

        return(format);
    }
예제 #28
0
        public void Reset()
        {
            br.DiscardBufferedData();
            br.BaseStream.Seek(0, SeekOrigin.Begin);

            lastLine      = br.ReadLine();
            proteinFormat = new LineFormat <IIdentifiedProtein>(IdentifiedProteinPropertyConverterFactory.GetInstance(), lastLine);

            lastLine      = br.ReadLine();
            peptideFormat = new LineFormat <IIdentifiedSpectrum>(IdentifiedSpectrumPropertyConverterFactory.GetInstance(), lastLine);

            while ((lastLine = br.ReadLine()) != null)
            {
                if (lastLine.StartsWith("$"))
                {
                    break;
                }
            }
        }
예제 #29
0
                    /// <summary>
                    /// Copy constructor helper method.
                    /// </summary>
                    public void SetFrom(Config rhs)
                    {
                        Name              = rhs.Name;
                        DateTreeFormat    = rhs.DateTreeFormat;
                        FileNamePrefix    = rhs.FileNamePrefix;
                        FileNameExtension = rhs.FileNameExtension;
                        LogGate           = rhs.LogGate;

                        LineFormat = new LineFormat(rhs.LineFormat);

                        PruneInterval = rhs.PruneInterval;
                        AdvanceRules  = rhs.AdvanceRules;

                        MesgQueueSize = rhs.MesgQueueSize;

                        FileHeaderLines         = ((rhs.FileHeaderLines != null) ? new List <string>(rhs.FileHeaderLines).ToArray() : null);
                        FileHeaderLinesDelegate = rhs.FileHeaderLinesDelegate;

                        base.SetFrom(rhs);
                    }
예제 #30
0
        /// <summary>
        /// Initializes a new instance of the LineFormatRenderer class with the specified graphics, line format
        /// and default width.
        /// </summary>
        public LineFormatRenderer(XGraphics gfx, LineFormat lineFormat, double defaultWidth)
        {
            _gfx = gfx;
            bool visible = false;
            double width = 0;

            if (lineFormat != null)
            {
                width = lineFormat._width;
                if (width == 0 && !lineFormat.Color.IsEmpty)
                    width = defaultWidth;
                visible = lineFormat.Visible || width > 0 || !lineFormat.Color.IsEmpty;
            }

            if (visible)
            {
                _pen = new XPen(lineFormat.Color, width);
                _pen.DashStyle = lineFormat.DashStyle;
            }
        }
                /// <summary>
                /// Constructor - <see cref="FileRotationLoggingConfig"/> parameter defines all initial values for the configuration and operation of this LMH.
                /// </summary>
                public TextFileRotationLogMessageHandler(FileRotationLoggingConfig frlConfig)
                    : base(frlConfig.name, frlConfig.logGate, frlConfig.includeFileAndLine, true)
                {
                    // replace the default LogMessageHandlerLogger with a normal QueuedLogger.  This is for use by all levels of this LMH type.
                    //  this allows generated messages to be inserted into and handled by the entire distribution system rather than just by this LMH instance.
                    logger = new QueuedLogger(Name, LogGate, frlConfig.includeFileAndLine);

                    config = frlConfig;
                    dirMgr = new File.DirectoryFileRotationManager(config.name);
                    lineFmt = new LineFormat(true, config.includeQpcTime, true, true, true, config.includeFileAndLine, "\r\n", "\t") { IncludeThreadInfo = config.includeThreadInfo };

                    dirMgrConfig = new MosaicLib.File.DirectoryFileRotationManager.Config();

                    dirMgrConfig.dirPath = config.dirPath;
                    dirMgrConfig.fileNamePrefix = config.name;
                    dirMgrConfig.fileNameSuffix = ".log";

                    if (config.nameUsesDateAndTime)
                        dirMgrConfig.fileNamePattern = File.DirectoryFileRotationManager.FileNamePattern.ByDate;
                    else
                        dirMgrConfig.fileNamePattern = File.DirectoryFileRotationManager.FileNamePattern.Numeric4DecimalDigits;

                    dirMgrConfig.excludeFileNamesSet = config.excludeFileNamesSet;

                    dirMgrConfig.advanceRules.fileSizeLimit = config.advanceRules.fileSizeLimit;
                    dirMgrConfig.advanceRules.fileAgeLimitInSec = config.advanceRules.fileAgeLimitInSec;
                    double testPeriodInSec = config.advanceRules.testPeriodInSec;
                    if (testPeriodInSec == 0.0)
                        testPeriodInSec = Math.Min(10.0, config.advanceRules.fileAgeLimitInSec / 3.0);
                    dirMgrConfig.advanceRules.testPeriodInSec = testPeriodInSec;

                    dirMgrConfig.purgeRules.dirNumFilesLimit = config.purgeRules.dirNumFilesLimit;
                    dirMgrConfig.purgeRules.dirTotalSizeLimit = config.purgeRules.dirTotalSizeLimit;
                    dirMgrConfig.purgeRules.fileAgeLimitInSec = config.purgeRules.fileAgeLimitInSec;

                    dirMgrConfig.enableAutomaticCleanup = true;
                    dirMgrConfig.maxAutoCleanupDeletes = 200;
                    dirMgrConfig.createDirectoryIfNeeded = config.createDirectoryIfNeeded;

                    SetupDirMgr();
                }
예제 #32
0
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Instantiate a new Workbook
            Workbook workbook = new Workbook();

            // Get the first default sheet
            Worksheet sheet = workbook.Worksheets[0];

            // Add Watermark
            Aspose.Cells.Drawing.Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1,
                                                                            "CONFIDENTIAL", "Arial Black", 50, false, true
                                                                            , 18, 8, 1, 1, 130, 800);

            // Get the fill format of the word art
            FillFormat wordArtFormat = wordart.Fill;

            // Set the transparency
            wordArtFormat.Transparency = 0.9;

            // Make the line invisible
            LineFormat lineFormat = wordart.Line;

            dataDir = dataDir + "Watermark_Test.out.xls";
            // Save the file
            workbook.Save(dataDir);
            // ExEnd:1

            Console.WriteLine("\nProcess completed successfully.\nFile saved at " + dataDir);
        }
예제 #33
0
 /// <summary>
 /// Initializes a new instance of the LineFormatRenderer class with the specified graphics and
 /// line format.
 /// </summary>
 public LineFormatRenderer(XGraphics gfx, LineFormat lineFormat) :
     this(gfx, lineFormat, 0)
 { }
예제 #34
0
                /// <summary>Basic constructor.</summary>
                /// <param name="name">Defines the LMH name.</param>
                /// <param name="logGate">Defines the LogGate value for messages handled here.  Messages with MesgType that is not included in this gate will be ignored.</param>
                /// <param name="lineFmt">Gives the line formatting rules that will be used for this LMH</param>
                /// <param name="ostream">Gives the StreamWriter instance to which the output text will be written.</param>
                /// <param name="flushAfterEachWrite">Set to true to flush the ostream after each write, or false to Flush only when explicitly told to by the LogDistribution system.</param>
                public StreamWriterLogMessageHandlerBase(string name, LogGate logGate, LineFormat lineFmt, System.IO.StreamWriter ostream, bool flushAfterEachWrite)
                    : base(name, logGate, lineFmt.IncludeFileAndLine, true)
                {
                    this.lineFmt = lineFmt;
                    this.ostream = ostream;
                    this.flushAfterEachWrite = flushAfterEachWrite;

                    if (lineFmt == null)
                        Utils.Asserts.TakeBreakpointAfterFault("LineFmt is null");
                    if (ostream == null)
                        Utils.Asserts.TakeBreakpointAfterFault("ostream is null");

                    // add an action to close the ostream when this object is disposed.
                    AddExplicitDisposeAction(
                        () =>
                        {
                            if (this.ostream != null)
                            {
                                this.ostream.Close();
                                this.ostream = null;
                            }
                        });
                }
예제 #35
0
 /// <summary>Basic constructor.</summary>
 /// <param name="appName">Gives the name of the appication that will be used as a prefix for the debug log messages that are generated</param>
 /// <param name="name">Defines the LMH name.</param>
 /// <param name="logGate">Defines the LogGate value for messages handled here.  Messages with MesgType that is not included in this gate will be ignored.</param>
 public Win32DebugLogMessageHandler(string appName, string name, LogGate logGate)
     : base(name, logGate, false, true)
 {
     this.appName = appName;
     this.lineFmt = new LineFormat(false, true, true, true, true, false, "\n", " ");
     if (String.IsNullOrEmpty(appName))
         Utils.Asserts.TakeBreakpointAfterFault("AppName is empty");
 }
예제 #36
0
 /// <summary>Basic constructor.</summary>
 /// <param name="name">Defines the LMH name.</param>
 /// <param name="logGate">Defines the LogGate value for messages handled here.  Messages with MesgType that is not included in this gate will be ignored.</param>
 /// <param name="lineFmt">Gives the line formatting rules that will be used for this LMH</param>
 public ConsoleLogMesssageHandler(string name, LogGate logGate, LineFormat lineFmt)
     : base(name, logGate, lineFmt, new System.IO.StreamWriter(Console.OpenStandardOutput()), true)
 {
 }
예제 #37
0
 /// <summary>Basic constructor.</summary>
 /// <param name="name">Defines the LMH name.</param>
 /// <param name="logGate">Defines the LogGate value for messages handled here.  Messages with MesgType that is not included in this gate will be ignored.</param>
 /// <param name="lineFmt">Gives the line formatting rules that will be used for this LMH</param>
 public DiagnosticTraceLogMessageHandler(string name, LogGate logGate, LineFormat lineFmt)
     : base(name, logGate, false, true)
 {
     this.lineFmt = lineFmt;
 }
예제 #38
0
 /// <summary>
 /// Creates a XPen based on the specified line format. If not specified color and width will be taken
 /// from the defaultColor and defaultWidth parameter.
 /// </summary>
 internal static XPen ToXPen(LineFormat lineFormat, XColor defaultColor, double defaultWidth)
 {
   return ToXPen(lineFormat, defaultColor, defaultWidth, XDashStyle.Solid);
 }
예제 #39
0
 /// <summary>
 /// Creates a XPen based on the specified line format. If not specified color and width will be taken
 /// from the defaultPen parameter.
 /// </summary>
 internal static XPen ToXPen(LineFormat lineFormat, XPen defaultPen)
 {
   return ToXPen(lineFormat, defaultPen.Color, defaultPen.Width, defaultPen.DashStyle);
 }
예제 #40
0
    /// <summary>
    /// Creates a XPen based on the specified line format. If not specified color, width and dash style
    /// will be taken from the defaultColor, defaultWidth and defaultDashStyle parameters.
    /// </summary>
    internal static XPen ToXPen(LineFormat lineFormat, XColor defaultColor, double defaultWidth, XDashStyle defaultDashStyle)
    {
      XPen pen = null;
      if (lineFormat == null)
      {
        pen = new XPen(defaultColor, defaultWidth);
        pen.DashStyle = defaultDashStyle;
      }
      else
      {
        XColor color = defaultColor;
        if (!lineFormat.Color.IsEmpty)
          color = lineFormat.Color;

        double width = lineFormat.Width.Point;
        if (!lineFormat.Visible)
          width = 0;
        if (lineFormat.Visible && width == 0)
          width = defaultWidth;

        pen = new XPen(color, width);
        pen.DashStyle = lineFormat.dashStyle;
        pen.DashOffset = 10 * width;
      }
      return pen;
    }