示例#1
0
 internal ExcelColor(ExcelStyles styles, LF.Utils.EPPlus.XmlHelper.ChangedEventHandler ChangedEvent, int worksheetID, string address, eStyleClass cls, StyleBase parent) : 
     base(styles, ChangedEvent, worksheetID, address)
     
 {
     _parent = parent;
     _cls = cls;
 }
示例#2
0
文件: Main.cs 项目: richardy2012/blue
 static void SetStream(LF e, System.IO.TextWriter w)
 {
     if (w == null)
     {
         w = System.IO.TextWriter.Null;
     }
     m_out[(int)e] = w;
 }
 public static HSSFEvaluationWorkbook Create(LF.Utils.NPOI.SS.UserModel.IWorkbook book)
 {
     if (book == null)
     {
         return null;
     }
     return new HSSFEvaluationWorkbook((HSSFWorkbook)book);
 }
 private static void Add(Hashtable m, OperationPtg ptgKey,
     LF.Utils.NPOI.SS.Formula.Functions.Function instance)
 {
     // make sure ptg has single private constructor because map lookups assume singleton keys
     ConstructorInfo[] cc = ptgKey.GetType().GetConstructors();
     if (cc.Length > 1 || (cc.Length > 0 && !cc[0].IsPrivate))
     {
         throw new Exception("Failed to verify instance ("
                 + ptgKey.GetType().Name + ") is a singleton.");
     }
     m[ptgKey] = instance;
 }
示例#5
0
        //[Obsolete]
        //public static void SetBorderLeft(LF.Utils.NPOI.SS.UserModel.CellBorderType border, Region region, HSSFSheet sheet,
        //        HSSFWorkbook workbook)
        //{
        //    SetBorderLeft(border, toCRA(region), sheet, workbook);
        //}
        /// <summary>
        /// Sets the left border for a region of cells by manipulating the cell style
        /// of the individual cells on the left
        /// </summary>
        /// <param name="border">The new border</param>
        /// <param name="region">The region that should have the border</param>
        /// <param name="sheet">The sheet that the region is on.</param>
        /// <param name="workbook">The workbook that the region is on.</param>
        public static void SetBorderLeft(LF.Utils.NPOI.SS.UserModel.BorderStyle border, CellRangeAddress region, HSSFSheet sheet,
                HSSFWorkbook workbook)
        {
            int rowStart = region.FirstRow;
            int rowEnd = region.LastRow;
            int column = region.FirstColumn;

            CellPropertySetter cps = new CellPropertySetter(workbook, HSSFCellUtil.BORDER_LEFT, (int)border);
            for (int i = rowStart; i <= rowEnd; i++)
            {
                cps.SetProperty(HSSFCellUtil.GetRow(i, sheet), column);
            }
        }
        /// <summary>
        /// Adds any formatting to text encoded using the FormattedTextToDB function
        /// </summary>
        /// <param name="toFormat">Encoded text to decode</param>
        /// <returns></returns>
        public static string FormattedTextFromDB(string toFormat)
        {
            string toReturn = toFormat;
            char   CR;
            char   LF;

            CR = System.Convert.ToChar(13);
            LF = System.Convert.ToChar(10);

            toReturn = toReturn.Replace("{<CR>}", CR.ToString());
            toReturn = toReturn.Replace("{<LF>}", LF.ToString());
            toReturn = toReturn.Replace("{<AP>}", "'");
            return(toReturn);
        }
 public WorkItem(int size,
                 LF.Utils.Ionic.Zlib.CompressionLevel compressLevel,
                 CompressionStrategy strategy,
                 int ix)
 {
     this.buffer= new byte[size];
     // alloc 5 bytes overhead for every block (margin of safety= 2)
     int n = size + ((size / 32768)+1) * 5 * 2;
     this.compressed = new byte[n];
     this.compressor = new ZlibCodec();
     this.compressor.InitializeDeflate(compressLevel, false);
     this.compressor.OutputBuffer = this.compressed;
     this.compressor.InputBuffer = this.buffer;
     this.index = ix;
 }
示例#8
0
 internal ExcelStyle(ExcelStyles styles, LF.Utils.EPPlus.XmlHelper.ChangedEventHandler ChangedEvent, int positionID, string Address, int xfsId) :
     base(styles, ChangedEvent, positionID, Address)
 {
     Index = xfsId;
     ExcelXfs xfs;
     if (positionID > -1)
     {
         xfs = _styles.CellXfs[xfsId];
     }
     else
     {
         xfs = _styles.CellStyleXfs[xfsId];
     }
     Styles = styles;
     PositionID = positionID;
     Numberformat = new ExcelNumberFormat(styles, ChangedEvent, PositionID, Address, xfs.NumberFormatId);
     Font = new ExcelFont(styles, ChangedEvent, PositionID, Address, xfs.FontId);
     Fill = new ExcelFill(styles, ChangedEvent, PositionID, Address, xfs.FillId);
     Border = new Border(styles, ChangedEvent, PositionID, Address, xfs.BorderId); 
 }
示例#9
0
        /// <summary>
        /// Calculates the height of a client anchor in points.
        /// </summary>
        /// <param name="sheet">the sheet the anchor will be attached to</param>
        /// <returns>the shape height.</returns>     
        public float GetAnchorHeightInPoints(LF.Utils.NPOI.SS.UserModel.ISheet sheet)
        {
            int y1 = Dy1;
            int y2 = Dy2;
            int row1 = Math.Min(Row1, Row2);
            int row2 = Math.Max(Row1, Row2);

            float points = 0;
            if (row1 == row2)
            {
                points = ((y2 - y1) / 256.0f) * GetRowHeightInPoints(sheet, row2);
            }
            else
            {
                points += ((256.0f - y1) / 256.0f) * GetRowHeightInPoints(sheet, row1);
                for (int i = row1 + 1; i < row2; i++)
                {
                    points += GetRowHeightInPoints(sheet, i);
                }
                points += (y2 / 256.0f) * GetRowHeightInPoints(sheet, row2);
            }

            return points;
        }
示例#10
0
 public void Add_TwoByteArrays_SecondNull()
 {
     byte[] array2 = null;
     array2 = LF.Add(array2);
     ShouldEqualWithDiff(array2.ToUTF8(), LF.ToUTF8());
 }
示例#11
0
 public void Add_TwoByteArrays()
 {
     byte[] array = LF.Add(HT);
     ShouldEqualWithDiff(array.ToUTF8(), $"{LF.ToUTF8()}{HT.ToUTF8()}");
 }
示例#12
0
 internal StyleBase(ExcelStyles styles, LF.Utils.EPPlus.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string Address)
 {
     _styles = styles;
     _ChangedEvent = ChangedEvent;
     _address = Address;
     _positionID = PositionID;
 }
示例#13
0
 public void SetProperty(LF.Utils.NPOI.SS.UserModel.IRow row, int column)
 {
     LF.Utils.NPOI.SS.UserModel.ICell cell = HSSFCellUtil.GetCell(row, column);
     HSSFCellUtil.SetCellStyleProperty(cell, _workbook, _propertyName, _propertyValue);
 }
示例#14
0
        public static Instruccion DescodificarInstruccion(byte codigo, ushort pos)
        {
            Instruccion instruccion       = null;
            ArgMemoria  argumentoMemoria  = Argumento.ConvertirEnArgumento((Main.ObtenerMemoria.ObtenerDireccion((ushort)(pos + 1)).Contenido * 256 + Main.ObtenerMemoria.ObtenerDireccion((ushort)(pos + 2)).Contenido).ToString("X4"), true) as ArgMemoria;
            ArgRegistro argumentoRegistro = Argumento.ConvertirEnArgumento(Main.ObtenerNombreRegistro(codigo % 4), false) as ArgRegistro;
            ArgLiteral  argumentoLiteral  = Argumento.ConvertirEnArgumento(Main.ObtenerMemoria.ObtenerDireccion((ushort)(pos + 1)).Contenido.ToString(), false) as ArgLiteral;

            switch (codigo / 8)
            {
            case 0:
                instruccion = new LD(argumentoRegistro);
                break;

            case 1:
                instruccion = new ST(argumentoRegistro);
                break;

            case 4:
            case 5:
                instruccion = new LDM(argumentoMemoria, argumentoRegistro);
                break;

            case 6:
            case 7:
                instruccion = new STM(argumentoRegistro, argumentoMemoria);
                break;

            case 2:
            case 3:
                instruccion = new LDI(argumentoLiteral, argumentoRegistro);
                break;

            case 8:
                instruccion = new ADD(argumentoRegistro);
                break;

            case 9:
                instruccion = new SUB(argumentoRegistro);
                break;

            case 10:
                instruccion = new CMP(argumentoRegistro);
                break;


            case 11:
                instruccion = new INC();
                break;

            case 12:
                instruccion = new ADI(argumentoLiteral);
                break;

            case 13:
                instruccion = new SUI(argumentoLiteral);
                break;

            case 14:
            case 15:
                instruccion = new CMI(argumentoLiteral);
                break;


            case 16:
                instruccion = new ANA(argumentoRegistro);
                break;

            case 17:
                instruccion = new ORA(argumentoRegistro);
                break;

            case 18:
                instruccion = new XRA(argumentoRegistro);
                break;


            case 19:
                instruccion = new CMA();
                break;

            case 20:
                instruccion = new ANI(argumentoLiteral);
                break;

            case 21:
                instruccion = new ORI(argumentoLiteral);
                break;

            case 22:
            case 23:
                instruccion = new XRI(argumentoLiteral);
                break;

            case 24:
            case 25:
                instruccion = new JMP(argumentoMemoria);
                break;

            case 26:
                instruccion = new BEQ(argumentoMemoria);
                break;

            case 27:
                instruccion = new BC(argumentoMemoria);
                break;

            case 28:
            case 29:
                instruccion = new LF();
                break;

            case 30:
                instruccion = new IN(argumentoMemoria, argumentoRegistro);
                break;

            case 31:
                instruccion = new OUT(argumentoRegistro, argumentoMemoria);
                break;
            }
            return(instruccion);
        }
示例#15
0
 public HSSFEvaluationCell(LF.Utils.NPOI.SS.UserModel.ICell cell)
 {
     _cell = cell;
     _evalSheet = new HSSFEvaluationSheet((HSSFSheet)cell.Sheet);
 }
示例#16
0
        public async Task OnTick()
        {
            await Task.FromResult(0);

            try
            {
                PP.LastFlatbed(PP.Position.GetNearestFlatbed());

                if (PP.CurrentVehicle == LF)
                {
                    Game.DisableControlThisFrame(0, Control.VehicleMoveUpDown);
                    if (!LF.IsControlOutside())
                    {
                        if (manualControl)
                        {
                            if (Game.IsControlPressed(0, liftKey))
                            {
                                LF.DropBedManually(true);
                            }
                            if (Game.IsControlPressed(0, lowerKey))
                            {
                                LF.DropBedManually(false);
                            }
                        }
                        else
                        {
                            if (Game.IsControlJustPressed(0, hookKey))
                            {
                                await LF.DropBed();
                            }
                        }
                    }
                    FreezeEntityPosition(LF.Handle, false);
                    LF.IsPersistent = false;

                    if (LF.CurrentTowingVehicle().Handle != 0 && PP.IsInVehicle(LF))
                    {
                        if (Game.IsControlPressed(2, Control.VehicleAccelerate))
                        {
                            ApplyForceToEntity(Game.Player.LastVehicle.Handle, 3, 0F, -0.04F, 0F, 0F, 0F, 0F, 0, true, true, true, true, true);
                        }
                        if (Game.IsControlPressed(2, Control.VehicleBrake))
                        {
                            ApplyForceToEntity(Game.Player.LastVehicle.Handle, 3, 0F, 0.04F, 0F, 0F, 0F, 0F, 0, true, true, true, true, true);
                        }
                    }
                }
                else
                {
                    LF.IsPersistent = true;
                }

                if (PP.IsInVehicle())
                {
                    if (PP.CurrentVehicle.IsOnAllWheels)
                    {
                        if (DecorGetFloat(PP.CurrentVehicle.Handle, gHeightDecor) == 0f)
                        {
                            DecorSetFloat(PP.CurrentVehicle.Handle, gHeightDecor, PP.CurrentVehicle.HeightAboveGround);
                        }
                    }
                    if (PP.CurrentVehicle.IsThisFlatbed3() && !LFList.Contains(PP.CurrentVehicle))
                    {
                        LFList.Add(PP.CurrentVehicle);
                    }
                }

                if (LF.Exists())
                {
                    if (!PP.IsInVehicle(LF) && LF.IsControlOutside() && (PP.Position.DistanceTo(LF.ControlDummyPos()) <= 2f | PP.Position.DistanceTo(LF.ControlDummy2Pos()) <= 2f))
                    {
                        if (manualControl)
                        {
                            DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HELP", "Press {0} to lift/lower the bed."), $"{liftKey.GetButtonIcon()} {lowerKey.GetButtonIcon()}"));
                            if (Game.IsControlPressed(0, liftKey))
                            {
                                LF.DropBedManually(true);
                            }
                            if (Game.IsControlPressed(0, lowerKey))
                            {
                                LF.DropBedManually(false);
                            }
                        }
                        else
                        {
                            DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HELP", "Press {0} to lift/lower the bed."), hookKey.GetButtonIcon()));
                            if (Game.IsControlJustPressed(0, hookKey))
                            {
                                await LF.DropBed();
                            }
                        }
                    }

                    if (!DecorGetBool(LF.Handle, helpDecor) && LV.IsThisFlatbed3())
                    {
                        if (manualControl)
                        {
                            DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HELP", "Press {0} to lift/lower the bed."), $"{liftKey.GetButtonIcon()} {lowerKey.GetButtonIcon()}"));
                        }
                        else
                        {
                            DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HELP", "Press {0} to lift/lower the bed."), hookKey.GetButtonIcon()));
                        }
                        DecorSetBool(LF.Handle, helpDecor, true);
                    }

                    if (marker)
                    {
                        LF.DrawMarkerTick();
                    }
                    if (LF.IsFlatbedDropped())
                    {
                        LF.TurnOnIndicators();
                    }
                    else
                    {
                        LF.TurnOffIndicators();
                    }

                    if (LF.CurrentTowingVehicle().Handle != 0)
                    {
                        if (!LF.CurrentTowingVehicle().IsAttachedTo(LF))
                        {
                            LF.CurrentTowingVehicle(null);
                            TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, 0);
                        }
                    }

                    if (DoesEntityExist(GetEntityAttachedTo(LF.Handle)) && LF.CurrentTowingVehicle().Handle == 0)
                    {
                        LF.CurrentTowingVehicle(GetEntityAttachedTo(LF.Handle));
                        TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, GetEntityAttachedTo(LF.Handle));
                    }

                    if (PP.IsInVehicle()) //Player is in vehicle
                    {
                        //Detach towing vehicle if player is inside towing vehicle
                        if (PP.CurrentVehicle == LF.CurrentTowingVehicle())
                        {
                            if (LV.IsVehicleFacingFlatbed(LF))
                            {
                                await LF.CurrentTowingVehicle().DetachToFix(false);
                            }
                            else
                            {
                                await LF.CurrentTowingVehicle().DetachToFix(true);
                            }
                            LF.CurrentTowingVehicle().IsPersistent = false;
                            LF.CurrentTowingVehicle(null);
                            TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, 0);
                        }

                        //Load vehicle while player is pressing hookkey on bed
                        if (LV.IsAlive && LV.Position.DistanceTo(LF.AttachDummyPos()) <= 2f)
                        {
                            if (!LV.IsThisFlatbed3() && LF.CurrentTowingVehicle().Handle == 0 && AC.Contains(LV.ClassType))
                            {
                                DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HOOK", "Press {0} to load {1}."), hookKey.GetButtonIcon(), PP.CurrentVehicle.LocalizedName));
                                if (Game.IsControlJustPressed(0, hookKey))
                                {
                                    LF.CurrentTowingVehicle(PP.CurrentVehicle);
                                    TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, PP.CurrentVehicle.Handle);
                                    PP.CurrentVehicle.IsEngineRunning = false;
                                    PP.CurrentVehicle.IsPersistent    = true;
                                    if (PP.CurrentVehicle == LF.CurrentTowingVehicle())
                                    {
                                        PP.Task.LeaveVehicle(LF.CurrentTowingVehicle(), true);
                                    }
                                    await Delay(3000);

                                    if (LV.IsVehicleFacingFlatbed(LF))
                                    {
                                        LV.AttachToFix(LF, LF.AttachDummyIndex(), LV.AttachCoords(), Vector3.Zero);
                                    }
                                    else
                                    {
                                        LV.AttachToFix(LF, LF.AttachDummyIndex(), LV.AttachCoords(), new Vector3(0f, 0f, 180f));
                                    }
                                }
                            }
                        }

                        //Load vehicle while player is pressing hookkey on attach marker
                        if (LF.AttachPosition().IsAnyVehicleNearAttachPosition(2f))
                        {
                            if (!LV.IsThisFlatbed3() && LF.CurrentTowingVehicle().Handle == 0 && LF.IsFlatbedDropped() && AC.Contains(LV.ClassType))
                            {
                                if (LV.Model != LF.Model)
                                {
                                    DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HOOK", "Press {0} to load {1}."), hookKey.GetButtonIcon(), LV.LocalizedName));
                                    if (Game.IsControlJustPressed(0, hookKey))
                                    {
                                        LF.CurrentTowingVehicle(LV);
                                        TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, LV.Handle);
                                        LV.IsPersistent = true;
                                        if (DecorGetFloat(LF.CurrentTowingVehicle().Handle, gHeightDecor) == 0f && LV.IsOnAllWheels)
                                        {
                                            DecorSetFloat(LF.CurrentTowingVehicle().Handle, gHeightDecor, LF.CurrentTowingVehicle().HeightAboveGround);
                                        }
                                        FreezeEntityPosition(LF.Handle, true);
                                        if (PP.CurrentVehicle == LV)
                                        {
                                            PP.Task.LeaveVehicle();
                                        }

                                        if (LV.IsVehicleFacingFlatbed(LF))
                                        {
                                            do
                                            {
                                                PP.Task.GoTo(LV.GetRopeHook());
                                                await Delay(100);
                                            } while (!(PP.Position.DistanceTo(LV.GetRopeHook()) <= 1.5f));
                                        }
                                        else
                                        {
                                            do
                                            {
                                                PP.Task.GoTo(LV.GetRopeHookRear());
                                                await Delay(100);
                                            } while (!(PP.Position.DistanceTo(LV.GetRopeHookRear()) <= 1.5f));
                                        }

                                        PP.Task.ClearAll();

                                        //Vehicle heading is almost same as Flatbed
                                        if (LV.IsVehicleFacingFlatbed(LF))
                                        {
                                            TriggerServerEvent("flatbed:AddRope", PP.Handle, LF.Handle, LV.Handle);
                                            ES = false;
                                            Rope rope = World.AddRope((RopeType)6, LF.WinchDummyPos(), Vector3.Zero, LF.WinchDummyPos().DistanceTo(LV.GetRopeHook()), 0.1f, false);
                                            rope.AttachEntities(LF, LF.WinchDummyPos(), LV, LV.GetRopeHook(), LF.WinchDummyPos().DistanceTo(LV.GetRopeHook()));
                                            rope.ActivatePhysics();
                                            do
                                            {
                                                if (ES == true)
                                                {
                                                    ES = false;
                                                    rope.StopWinding();
                                                    rope.DetachEntity(LF);
                                                    rope.DetachEntity(LV);
                                                    rope.Delete();
                                                    return;
                                                }
                                                if (!LV.IsAnyPedBlockingVehicle(LF))
                                                {
                                                    rope.StartWinding();
                                                    Game.DisableControlThisFrame(0, Control.VehicleMoveUpDown);
                                                }
                                                await Delay(5);
                                            } while (!(rope.Length <= 1.9f));
                                            rope.StopWinding();
                                            rope.DetachEntity(LF);
                                            rope.DetachEntity(LV);
                                            rope.Delete();
                                            FreezeEntityPosition(LF.Handle, false);
                                            LV.AttachToFix(LF, LF.AttachDummyIndex(), LV.AttachCoords(), Vector3.Zero);
                                        }
                                        //Vehicle heading is the opposite of Flatbed
                                        else
                                        {
                                            TriggerServerEvent("flatbed:AddRope", PP.Handle, LF.Handle, LV.Handle);
                                            ES = false;
                                            Rope rope = World.AddRope((RopeType)6, LF.WinchDummyPos(), Vector3.Zero, LF.WinchDummyPos().DistanceTo(LV.GetRopeHookRear()), 0.1f, false);
                                            rope.AttachEntities(LF, LF.WinchDummyPos(), LV, LV.GetRopeHookRear(), LF.WinchDummyPos().DistanceTo(LV.GetRopeHookRear()));
                                            rope.ActivatePhysics();
                                            do
                                            {
                                                if (ES == true)
                                                {
                                                    ES = false;
                                                    rope.StopWinding();
                                                    rope.DetachEntity(LF);
                                                    rope.DetachEntity(LV);
                                                    rope.Delete();
                                                    return;
                                                }
                                                if (!LV.IsAnyPedBlockingVehicle(LF))
                                                {
                                                    rope.StartWinding();
                                                    Game.DisableControlThisFrame(0, Control.VehicleMoveUpDown);
                                                }
                                                await Delay(5);
                                            } while (!(rope.Length <= 1.9f));
                                            rope.StopWinding();
                                            rope.DetachEntity(LF);
                                            rope.DetachEntity(LV);
                                            rope.Delete();
                                            FreezeEntityPosition(LF.Handle, false);
                                            LV.AttachToFix(LF, LF.AttachDummyIndex(), LV.AttachCoords(), Vector3.Zero);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else //Player is not in vehicle
                    {
                        //Unload vehicle while flatbed is lowered
                        if (LF.IsFlatbedDropped() && PP.Position.DistanceTo(LF.AttachDummyPos()) <= 3f)
                        {
                            if (World.GetDistance(LF.CurrentTowingVehicle().Position, PP.Position) <= 3f)
                            {
                                DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_UNHOOK", "Press {0} to unload {1}."), hookKey.GetButtonIcon(), LF.CurrentTowingVehicle().LocalizedName));
                                if (Game.IsControlJustPressed(0, hookKey))
                                {
                                    Vehicle towVeh = LF.CurrentTowingVehicle();
                                    FreezeEntityPosition(LF.Handle, true);
                                    towVeh.SteeringScale = 0f;
                                    if (towVeh.IsVehicleFacingFlatbed(LF))
                                    {
                                        await towVeh.DetachToFix(false);
                                    }
                                    else
                                    {
                                        await towVeh.DetachToFix(true);
                                    }
                                    await Delay(1000);

                                    if (towVeh.IsDriveable2())
                                    {
                                        PP.Task.EnterVehicle(towVeh, VehicleSeat.Driver, 5000, 1f);
                                        do
                                        {
                                            Game.DisableControlThisFrame(0, Control.VehicleMoveUpDown);
                                            await Delay(5);
                                        } while (!(towVeh.Position.DistanceTo(LF.AttachPosition()) <= 2f));
                                    }
                                    else
                                    {
                                        do
                                        {
                                            if (towVeh.IsVehicleFacingFlatbed(LF))
                                            {
                                                towVeh.PushVehicleBack();
                                            }
                                            else
                                            {
                                                towVeh.PushVehicleForward();
                                            }
                                            Game.DisableControlThisFrame(0, Control.VehicleMoveUpDown);
                                            await Delay(5);
                                        } while (!(towVeh.Position.DistanceTo(LF.AttachPosition()) <= 2f));
                                    }

                                    FreezeEntityPosition(LF.Handle, false);
                                    towVeh.IsPersistent = false;
                                    LF.CurrentTowingVehicle(null);
                                    TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, 0);
                                }
                            }
                        }

                        if (LF.CurrentTowingVehicle().Handle == 0 && LF.IsFlatbedDropped() && LF.AttachPosition().IsAnyVehicleNearAttachPosition(2f))
                        {
                            Vehicle thatVehicle = PP.Position.WorldGetClosestVehicle();
                            //Vehicle heading is almost same as Flatbed
                            if (thatVehicle.Model != LF.Model && AC.Contains(thatVehicle.ClassType) && PP.Position.DistanceTo(thatVehicle.GetRopeHook()) <= 1.5f)
                            {
                                DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HOOK", "Press {0} to load {1}."), hookKey.GetButtonIcon(), thatVehicle.LocalizedName));
                                if (Game.IsControlJustPressed(0, hookKey))
                                {
                                    LF.CurrentTowingVehicle(thatVehicle);
                                    TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, thatVehicle.Handle);
                                    thatVehicle.IsPersistent = true;
                                    if (thatVehicle.IsOnAllWheels)
                                    {
                                        if (DecorGetFloat(thatVehicle.Handle, gHeightDecor) == 0f)
                                        {
                                            DecorSetFloat(thatVehicle.Handle, gHeightDecor, thatVehicle.HeightAboveGround);
                                        }
                                    }
                                    FreezeEntityPosition(LF.Handle, true);
                                    TriggerServerEvent("flatbed:AddRope", PP.Handle, LF.Handle, LV.Handle);
                                    ES = false;
                                    Rope rope = World.AddRope((RopeType)6, LF.WinchDummyPos(), Vector3.Zero, LF.WinchDummyPos().DistanceTo(thatVehicle.GetRopeHook()), 0.1f, false);
                                    rope.AttachEntities(LF, LF.WinchDummyPos(), thatVehicle, thatVehicle.GetRopeHook(), LF.WinchDummyPos().DistanceTo(thatVehicle.GetRopeHook()));
                                    rope.ActivatePhysics();
                                    do
                                    {
                                        if (ES == true)
                                        {
                                            ES = false;
                                            rope.StopWinding();
                                            rope.DetachEntity(LF);
                                            rope.DetachEntity(thatVehicle);
                                            rope.Delete();
                                            return;
                                        }
                                        if (!thatVehicle.IsAnyPedBlockingVehicle(LF))
                                        {
                                            rope.StartWinding();
                                            Game.DisableControlThisFrame(0, Control.VehicleMoveUpDown);
                                        }
                                        await Delay(5);
                                    } while (!(rope.Length <= 1.9f));
                                    rope.StopWinding();
                                    rope.DetachEntity(LF);
                                    rope.DetachEntity(thatVehicle);
                                    rope.Delete();
                                    FreezeEntityPosition(LF.Handle, false);
                                    thatVehicle.AttachToFix(LF, LF.GetBoneIndex("misc_a"), thatVehicle.AttachCoords(), Vector3.Zero);
                                }
                            }

                            //Vehicle heading is the opposite of Flatbed
                            if (thatVehicle.Model != LF.Model && AC.Contains(thatVehicle.ClassType) && PP.Position.DistanceTo(thatVehicle.GetRopeHookRear()) <= 1.5f)
                            {
                                DisplayHelpTextThisFrame(String.Format(GetLangEntry("INM_FB_HOOK", "Press {0} to load {1}."), hookKey.GetButtonIcon(), thatVehicle.LocalizedName));
                                if (Game.IsControlJustPressed(0, hookKey))
                                {
                                    LF.CurrentTowingVehicle(thatVehicle);
                                    TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, thatVehicle.Handle);
                                    thatVehicle.IsPersistent = true;
                                    if (thatVehicle.IsOnAllWheels)
                                    {
                                        if (DecorGetFloat(thatVehicle.Handle, gHeightDecor) == 0f)
                                        {
                                            DecorSetFloat(thatVehicle.Handle, gHeightDecor, thatVehicle.HeightAboveGround);
                                        }
                                    }
                                    FreezeEntityPosition(LF.Handle, true);
                                    TriggerServerEvent("flatbed:AddRope", PP.Handle, LF.Handle, LV.Handle);
                                    ES = false;
                                    Rope rope = World.AddRope((RopeType)6, LF.WinchDummyPos(), Vector3.Zero, LF.WinchDummyPos().DistanceTo(thatVehicle.GetRopeHookRear()), 0.1f, false);
                                    rope.AttachEntities(LF, LF.WinchDummyPos(), thatVehicle, thatVehicle.GetRopeHookRear(), LF.WinchDummyPos().DistanceTo(thatVehicle.GetRopeHookRear()));
                                    rope.ActivatePhysics();
                                    do
                                    {
                                        if (ES == true)
                                        {
                                            ES = false;
                                            rope.StopWinding();
                                            rope.DetachEntity(LF);
                                            rope.DetachEntity(thatVehicle);
                                            rope.Delete();
                                            return;
                                        }
                                        if (!thatVehicle.IsAnyPedBlockingVehicle(LF))
                                        {
                                            rope.StartWinding();
                                            Game.DisableControlThisFrame(0, Control.VehicleMoveUpDown);
                                        }
                                        await Delay(5);
                                    } while (!(rope.Length <= 1.9f));
                                    rope.StopWinding();
                                    rope.DetachEntity(LF);
                                    rope.DetachEntity(thatVehicle);
                                    rope.Delete();
                                    FreezeEntityPosition(LF.Handle, false);
                                    thatVehicle.AttachToFix(LF, LF.GetBoneIndex("misc_a"), thatVehicle.AttachCoords(), new Vector3(0f, 0f, 180f));
                                }
                            }
                        }
                    }

                    if (World.GetDistance(LF.CurrentTowingVehicle().Position, LF.Position) >= 20f)
                    {
                        LF.CurrentTowingVehicle().IsPersistent = false;
                        LF.CurrentTowingVehicle(null);
                        TriggerServerEvent("flatbed:SetTowingVehicle", PP.Handle, LF.Handle, 0);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"{ex.Message}{ex.StackTrace}");
            }
        }
示例#17
0
 internal override bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry)
 {
     bool result = Left.Evaluate(entry);
     switch (Conjunction)
     {
         case LogicalConjunction.AND:
             if (result)
                 result = Right.Evaluate(entry);
             break;
         case LogicalConjunction.OR:
             if (!result)
                 result = Right.Evaluate(entry);
             break;
         case LogicalConjunction.XOR:
             result ^= Right.Evaluate(entry);
             break;
     }
     return result;
 }
示例#18
0
 internal override bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry)
 {
     FileAttributes fileAttrs = entry.Attributes;
     return _Evaluate(fileAttrs);
 }
示例#19
0
        internal override bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry)
        {
            bool result = (ObjectType == 'D')
                ? entry.IsDirectory
                : !entry.IsDirectory;

            if (Operator != ComparisonOperator.EqualTo)
                result = !result;
            return result;
        }
示例#20
0
 internal override bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry)
 {
     DateTime x;
     switch (Which)
     {
         case WhichTime.atime:
             x = entry.AccessedTime;
             break;
         case WhichTime.mtime:
             x = entry.ModifiedTime;
             break;
         case WhichTime.ctime:
             x = entry.CreationTime;
             break;
         default: throw new ArgumentException("??time");
     }
     return _Evaluate(x);
 }
示例#21
0
 internal override bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry)
 {
     return _Evaluate(entry.UncompressedSize);
 }
示例#22
0
        internal override bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry)
        {
            // swap forward slashes in the entry.FileName for backslashes
            string transformedFileName = entry.FileName.Replace("/", "\\");

            return _Evaluate(transformedFileName);
        }
示例#23
0
 internal abstract bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry);
示例#24
0
 public void Add_TwoByteArrays_FirstNull()
 {
     byte[] array1 = null;
     array1 = array1.Add(LF);
     ShouldEqualWithDiff(array1.ToUTF8(), LF.ToUTF8());
 }
示例#25
0
文件: Main.cs 项目: richardy2012/blue
 public static void WriteLine(LF e, string stFormat)
 {
     GetStream(e).WriteLine(stFormat);
 }
示例#26
0
 private bool Evaluate(LF.Utils.Ionic.Zip.ZipEntry entry)
 {
     bool result = _Criterion.Evaluate(entry);
     return result;
 }
示例#27
0
 public HSSFEvaluationCell(LF.Utils.NPOI.SS.UserModel.ICell cell, IEvaluationSheet evalSheet)
 {
     _cell = cell;
     _evalSheet = evalSheet;
 }
示例#28
0
        /// <summary>
        /// Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
        /// </summary>
        /// <remarks>
        ///
        /// <para>
        /// This method applies the criteria set in the FileSelector instance (as described in
        /// the <see cref="FileSelector.SelectionCriteria"/>) to the specified ZipFile.  Using this
        /// method, for example, you can retrieve all entries from the given ZipFile that
        /// have filenames ending in .txt.
        /// </para>
        ///
        /// <para>
        /// Normally, applications would not call this method directly.  This method is used
        /// by the ZipFile class.
        /// </para>
        ///
        /// <para>
        /// Using the appropriate SelectionCriteria, you can retrieve entries based on size,
        /// time, and attributes. See <see cref="FileSelector.SelectionCriteria"/> for a
        /// description of the syntax of the SelectionCriteria string.
        /// </para>
        ///
        /// </remarks>
        ///
        /// <param name="zip">The ZipFile from which to retrieve entries.</param>
        ///
        /// <returns>a collection of ZipEntry objects that conform to the criteria.</returns>
        public ICollection<LF.Utils.Ionic.Zip.ZipEntry> SelectEntries(LF.Utils.Ionic.Zip.ZipFile zip)
        {
            if (zip == null)
                throw new ArgumentNullException("zip");

            var list = new List<LF.Utils.Ionic.Zip.ZipEntry>();

            foreach (LF.Utils.Ionic.Zip.ZipEntry e in zip)
            {
                if (this.Evaluate(e))
                    list.Add(e);
            }

            return list;
        }
示例#29
0
 public ArrayRecord(LF.Utils.NPOI.SS.Formula.Formula formula, CellRangeAddress8Bit range):base(range)
 {
     _options = 0; //YK: Excel 2007 leaves this field unset
     _field3notUsed = 0;
     _formula = formula;
 }
示例#30
0
        /// <summary>
        /// Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
        /// </summary>
        /// <remarks>
        ///
        /// <para>
        /// This method applies the criteria set in the FileSelector instance (as described in
        /// the <see cref="FileSelector.SelectionCriteria"/>) to the specified ZipFile.  Using this
        /// method, for example, you can retrieve all entries from the given ZipFile that
        /// have filenames ending in .txt.
        /// </para>
        ///
        /// <para>
        /// Normally, applications would not call this method directly.  This method is used
        /// by the ZipFile class.
        /// </para>
        ///
        /// <para>
        /// This overload allows the selection of ZipEntry instances from the ZipFile to be restricted
        /// to entries contained within a particular directory in the ZipFile.
        /// </para>
        ///
        /// <para>
        /// Using the appropriate SelectionCriteria, you can retrieve entries based on size,
        /// time, and attributes. See <see cref="FileSelector.SelectionCriteria"/> for a
        /// description of the syntax of the SelectionCriteria string.
        /// </para>
        ///
        /// </remarks>
        ///
        /// <param name="zip">The ZipFile from which to retrieve entries.</param>
        ///
        /// <param name="directoryPathInArchive">
        /// the directory in the archive from which to select entries. If null, then
        /// all directories in the archive are used.
        /// </param>
        ///
        /// <returns>a collection of ZipEntry objects that conform to the criteria.</returns>
        public ICollection<LF.Utils.Ionic.Zip.ZipEntry> SelectEntries(LF.Utils.Ionic.Zip.ZipFile zip, string directoryPathInArchive)
        {
            if (zip == null)
                throw new ArgumentNullException("zip");

            var list = new List<LF.Utils.Ionic.Zip.ZipEntry>();
            // workitem 8559
            string slashSwapped = (directoryPathInArchive == null) ? null : directoryPathInArchive.Replace("/", "\\");
            // workitem 9174
            if (slashSwapped != null)
            {
                while (slashSwapped.EndsWith("\\"))
                    slashSwapped = slashSwapped.Substring(0, slashSwapped.Length - 1);
            }
            foreach (LF.Utils.Ionic.Zip.ZipEntry e in zip)
            {
                if (directoryPathInArchive == null || (Path.GetDirectoryName(e.FileName) == directoryPathInArchive)
                    || (Path.GetDirectoryName(e.FileName) == slashSwapped)) // workitem 8559
                    if (this.Evaluate(e))
                        list.Add(e);
            }

            return list;
        }
示例#31
0
 //[Obsolete]
 //public static void SetBorderTop(LF.Utils.NPOI.SS.UserModel.CellBorderType border, Region region, HSSFSheet sheet,
 //        HSSFWorkbook workbook)
 //{
 //    SetBorderTop(border, toCRA(region), sheet, workbook);
 //}
 /// <summary>
 /// Sets the borderBottom attribute of the HSSFRegionUtil object
 /// </summary>
 /// <param name="border">The new border</param>
 /// <param name="region">The region that should have the border</param>
 /// <param name="sheet">The sheet that the region is on.</param>
 /// <param name="workbook">The workbook that the region is on.</param>
 public static void SetBorderTop(LF.Utils.NPOI.SS.UserModel.BorderStyle border, CellRangeAddress region, HSSFSheet sheet,
         HSSFWorkbook workbook)
 {
     int colStart = region.FirstColumn;
     int colEnd = region.LastColumn;
     int rowIndex = region.FirstRow;
     CellPropertySetter cps = new CellPropertySetter(workbook, HSSFCellUtil.BORDER_TOP, (int)border);
     LF.Utils.NPOI.SS.UserModel.IRow row = HSSFCellUtil.GetRow(rowIndex, sheet);
     for (int i = colStart; i <= colEnd; i++)
     {
         cps.SetProperty(row, i);
     }
 }
示例#32
0
 public void Add_IgnoringNonStringNonByteArray()
 {
     byte[] array = LF.Add(TEXT_DATA, 1, CR, DateTime.Now, 10.5, 785m, new UnitTest(), FF);
     ShouldEqualWithDiff(array.ToUTF8(), $"{LF.ToUTF8()}{TEXT_DATA}{CR.ToUTF8()}{FF.ToUTF8()}");
 }
示例#33
0
 public void Add_FourByteArrays()
 {
     byte[] array = LF.Add(HT, CR, FF);
     ShouldEqualWithDiff(array.ToUTF8(), $"{LF.ToUTF8()}{HT.ToUTF8()}{CR.ToUTF8()}{FF.ToUTF8()}");
 }
示例#34
0
 public override void Serialize(LF.Utils.NPOI.Util.ILittleEndianOutput out1)
 {
     
 }
 public override void Serialize(LF.Utils.NPOI.Util.ILittleEndianOutput out1)
 {
     out1.WriteShort(field_1_cEntries);
 }
示例#36
0
        /// <summary>
        /// Extracts the header footer.
        /// </summary>
        /// <param name="hf">The header or footer</param>
        /// <returns></returns>
        private String ExtractHeaderFooter(LF.Utils.NPOI.SS.UserModel.IHeaderFooter hf)
        {
            StringBuilder text = new StringBuilder();

            if (hf.Left != null)
            {
                text.Append(hf.Left);
            }
            if (hf.Center != null)
            {
                if (text.Length > 0)
                    text.Append("\t");
                text.Append(hf.Center);
            }
            if (hf.Right != null)
            {
                if (text.Length > 0)
                    text.Append("\t");
                text.Append(hf.Right);
            }
            if (text.Length > 0)
                text.Append("\n");

            return text.ToString();
        }
示例#37
0
 internal ExcelNumberFormat(ExcelStyles styles, LF.Utils.EPPlus.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string Address, int index) :
     base(styles, ChangedEvent, PositionID, Address)
 {
     Index = index;
 }
示例#38
0
 public void Add_ThreeByteArraysAndTwoStrings()
 {
     byte[] array = LF.Add(TEXT_DATA, CR, TEXT_DATA, FF);
     ShouldEqualWithDiff(array.ToUTF8(), $"{LF.ToUTF8()}{TEXT_DATA}{CR.ToUTF8()}{TEXT_DATA}{FF.ToUTF8()}");
 }
示例#39
0
文件: Main.cs 项目: richardy2012/blue
 static System.IO.TextWriter GetStream(LF e)
 {
     return(m_out[(int)e]);
 }
示例#40
0
        public static string readOthersData(string[,] masterInventorList)
        {
            String lineOfFile; // this is the file of others' document data.

            {
                //string temp = masterInventorList[0, 0];  // this works! Can see mIL.


                //var fileName = string.Format("{0}\\goodotherdata100-short.csv", Directory.GetCurrentDirectory());
                var fileName = string.Format("{0}\\goodotherdata100-fake.csv", Directory.GetCurrentDirectory());

                string patentNumber, patentDate11, inventorNames, assignee, patentTitle, APD, CPCcodes;

                using (StreamReader sr = new StreamReader(fileName))
                {
                    string currentLine;
                    // currentLine will be null when the StreamReader reaches the end of file

                    string[,] masterRiskList = new string[10000, 24]; // store others' docouments of concern
                    int concernedEntryCounter = 0;

                    string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    //fileOut = new System.IO.StreamWriter("out1.txt");

                    while ((currentLine = sr.ReadLine()) != null)
                    {
                        (patentNumber, patentDate11, inventorNames, assignee, patentTitle, APD, CPCcodes) = getOthersFields(currentLine);
                        //return (patentNumber, patentDate11, inventorNames, assignee, patentTitle, APD, CPCcodes);
                        // iterate over inventor names
                        // create other versions of names

                        // split "inventors" into as many full names as there are inventors
                        string[] inventorsFullNames;
                        int      numberInventors;

                        inventorsFullNames = inventorNames.Split(';');
                        numberInventors    = inventorsFullNames.Length;
                        bool somethingToWrite = false;

                        for (int i = 1; i < numberInventors + 1; i++)
                        {
                            string fullName = inventorsFullNames[i - 1];
                            string lastName, firstName, middleName;
                            //
                            // delete addresses (in parentheses)
                            // delete quote and commas
                            //

                            string regex            = "(\\[.*\\])|(\".*\")|('.*')|(\\(.*\\))";
                            string fullName_cleaned = Regex.Replace(fullName, regex, "");

                            fullName_cleaned = Regex.Replace(fullName_cleaned, @",", "");   // remove commas
                            fullName_cleaned = fullName_cleaned.Trim('"');                  // delete quotes
                            fullName_cleaned = fullName_cleaned.Replace(".", string.Empty); // delete periods
                            fullName_cleaned = fullName_cleaned.Replace("-", string.Empty); // delete hyphens
                            fullName_cleaned = fullName_cleaned.ToUpper();                  // convert to upper

                            string[] inventorNameFragments;
                            inventorNameFragments = fullName_cleaned.Split(' ');
                            int numberOfNameFragments = inventorNameFragments.Length;
                            lastName = inventorNameFragments[0];
                            try
                            {
                                firstName = inventorNameFragments[1];
                            }
                            catch
                            {
                                firstName = "";
                            }
                            try
                            {
                                middleName = inventorNameFragments[2];
                            }
                            catch
                            {
                                middleName = "";
                            }

                            // DETERMINE NAME OPTIONS FOR THIS "OTHER" DOCUMENT.

                            string space = Convert.ToString(' ');
                            string LFM, LF, LF1; // LFM = Last, First, Middle, LF = last first, LF1 = last and first letter of first.
                            string LFM1, LF1M1;  // LFM1 = last first middle initial,  LF1M1 = last and first initial and middle initial

                            LFM = String.Concat(lastName, space, firstName, space, middleName);
                            LF  = String.Concat(lastName, space, firstName);

                            try {
                                LF1 = String.Concat(lastName, space, firstName.Substring(0, 1));
                            }
                            catch
                            {
                                LF1 = lastName;
                            }

                            try
                            {
                                LFM1 = String.Concat(lastName, space, firstName, space, middleName.Substring(0, 1));
                            }
                            catch
                            {
                                LFM1 = "";
                            }
                            try
                            {
                                LF1M1 = String.Concat(lastName, space, firstName.Substring(0, 1), space, middleName.Substring(0, 1));
                            }
                            catch
                            {
                                LF1M1 = "";
                            }

                            // Is this inventor (an "other" inventor) named in masterInventorList in any way?
                            // Putting it another way:
                            //     1. earlier, we read a group of "our" patent documents
                            //     2. from "our" list, we created masterInventorList[i, j]
                            //     3. mIL contains various spellings of our inventor names, and bibliographic data from their patents
                            //     4. the comments below show where this info is located in mIL (LF1 - e.g., means Last name + Initial of first name.)

                            //  masterInventorList[presentRowNumber, 0] = LFM;
                            //  masterInventorList[presentRowNumber, 1] = LF;
                            //  masterInventorList[presentRowNumber, 2] = LF1;
                            //  masterInventorList[presentRowNumber, 3] = LFM1;
                            //  masterInventorList[presentRowNumber, 4] = LF1M1;
                            //  masterInventorList[presentRowNumber, 5] = patentNo;
                            //  masterInventorList[presentRowNumber, 6] = title;
                            //  masterInventorList[presentRowNumber, 7] = date1;
                            //  masterInventorList[presentRowNumber, 8] = date2;
                            //  masterInventorList[presentRowNumber, 9] = assignee;
                            //  masterInventorList[presentRowNumber, 10] = inventorString;
                            //  masterInventorList[presentRowNumber, 11] = CPCcodes;
                            //
                            //      5. At this point (in the instant method -- readOthersData -- we have one row of a record of others'
                            //          patent publications in a relevant time period and CPC group.
                            //      6. What we want to determine now -- DO ANY OF "OUR" INVENTORS NAMES "MATCH" THE NAME OF THE PRESENT (OTHER) PUBLICATION?
                            //          IF YES, THEN FLAG THIS OTHER RECORD AS A POSSIBLE THEFT FROM US.
                            //

                            // Iterate through masterInventorList, looking for matches.



                            suspicionLevel thisSuspicion;
                            thisSuspicion = suspicionLevel.Low;



                            for (int j = 0; j < 15; j++) // to do -- need to set "1000" correctly
                            {
                                string temp1 = masterInventorList[1, 0];
                                string ourName, concerningName;
                                ourName        = LFM.Trim();
                                concerningName = masterInventorList[j, 0];
                                try
                                {
                                    concerningName = concerningName.Trim();
                                }
                                catch
                                {
                                    concerningName = "nooneMatchesThis";
                                }

                                if (ourName == concerningName)
                                {
                                    // match of complete name -- classify as highly suspicous
                                    thisSuspicion = suspicionLevel.High;
                                    masterRiskList[concernedEntryCounter, 0] = thisSuspicion.ToString();
                                    masterRiskList[concernedEntryCounter, 1] = patentNumber;
                                    masterRiskList[concernedEntryCounter, 2] = patentDate11;
                                    masterRiskList[concernedEntryCounter, 3] = inventorNames;
                                    masterRiskList[concernedEntryCounter, 4] = assignee;
                                    masterRiskList[concernedEntryCounter, 5] = patentTitle;
                                    masterRiskList[concernedEntryCounter, 6] = APD;
                                    masterRiskList[concernedEntryCounter, 7] = CPCcodes;

                                    //to do - there are many more fields to store
                                }
                                else if (thisSuspicion != suspicionLevel.High && ((LF.Trim() == masterInventorList[j, 1])) || (LF1.Trim() == masterInventorList[j, 2]))
                                {
                                    // match of last and first names -- classify as moderately suspicous
                                    thisSuspicion = suspicionLevel.Medium;
                                    masterRiskList[concernedEntryCounter, 1] = thisSuspicion.ToString();
                                    //to do - there are many more fields to store
                                }
                            }

                            if (thisSuspicion.ToString() != suspicionLevel.Low.ToString()) // have we logged this "other" publication?
                            {
                                // we have stored this publication as suspicious, so
                                // increment the pointer for that table
                                // if there is something to write, write it.
                                string vertBar = Convert.ToString('|');


                                string lineToWrite;

                                string a, b, d, c, e, f, g, h;
                                a           = masterRiskList[concernedEntryCounter, 0];
                                b           = masterRiskList[concernedEntryCounter, 1];
                                c           = masterRiskList[concernedEntryCounter, 2];
                                d           = masterRiskList[concernedEntryCounter, 3];
                                e           = masterRiskList[concernedEntryCounter, 4];
                                f           = masterRiskList[concernedEntryCounter, 5];
                                g           = masterRiskList[concernedEntryCounter, 6];
                                h           = masterRiskList[concernedEntryCounter, 7];
                                lineToWrite = String.Concat(a, vertBar, b, vertBar, c, vertBar, d, vertBar, e, vertBar, f, vertBar, g, vertBar, h);
                                using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "out2.txt"), true))
                                {
                                    outputFile.WriteLine(lineToWrite);
                                }
                                concernedEntryCounter += 1;
                            }
                        }
                    }  // end of while loop.
                }
            }
            lineOfFile = "test";
            return(lineOfFile); // return the data.
        }
示例#41
0
文件: Main.cs 项目: richardy2012/blue
        /// <summary> Initialize the logging system. </summary>
        /// <param name="stArgs">The command line arguments.</param>
        /// <remarks>
        /// Do a prelim sweep of command line args to set streams.
        /// We can't use the ErrorHandling subsystem or the Options Subsystem because
        /// logging is a more fundamental subsystem that the others depend on.
        /// <para>Activate via:
        /// '-l:XXXXX' where XXXXX is {Codegen, Verbose, Parser, Resolve }
        /// Can specify multiple switches</para>
        /// </remarks>
        public static void InitLogging(string [] stArgs)
        {
            //m_out = new System.IO.StreamWriter("blue.log");

            // Set all streams to null by default
            m_out = new System.IO.TextWriter[((int)LF.All) + 1];
            for (int i = 0; i < m_out.Length; i++)
            {
                m_out[i] = System.IO.TextWriter.Null;
            }


            // Check command line switches
            for (int i = 0; i < stArgs.Length; i++)
            {
                string st = stArgs[i];

                if (st.Length < 3)
                {
                    continue;
                }

                if (st[0] != '-' && st[0] != '/')
                {
                    continue;
                }

                if (st[1] != 'l')
                {
                    continue;
                }
                if (st[2] != ':')
                {
                    continue;
                }

                string stSub = st.Substring(3);

                LF lf = LF.Invalid;
                if (stSub == "Codegen")
                {
                    lf = LF.CodeGen;
                }
                else if (stSub == "Verbose")
                {
                    lf = LF.Verbose;
                }
                else if (stSub == "Parser")
                {
                    lf = LF.Parser;
                }
                else if (stSub == "Resolve")
                {
                    lf = LF.Resolve;
                }

                if (lf != LF.Invalid)
                {
                    SetStream(lf, Console.Out);
                }

                // Clear option so that it doesn't get confused with a real option
                stArgs[i] = "";
            }
            //SetStream(LF.Verbose, Console.Out);
            //SetStream(LF.CodeGen, Console.Out);

            CreateAllStream();

            WriteLine(LF.All, "Logging services initialized");
        }
示例#42
0
        internal void FinishOutputStream(Stream s,
                                         CountingStream entryCounter,
                                         Stream encryptor,
                                         Stream compressor,
                                         LF.Utils.Ionic.Crc.CrcCalculatorStream output)
        {
            if (output == null) return;

            output.Close();

            // by calling Close() on the deflate stream, we write the footer bytes, as necessary.
            if ((compressor as LF.Utils.Ionic.Zlib.DeflateStream) != null)
                compressor.Close();
#if BZIP
            else if ((compressor as LF.Utils.Ionic.BZip2.BZip2OutputStream) != null)
                compressor.Close();
#if !NETCF
            else if ((compressor as LF.Utils.Ionic.BZip2.ParallelBZip2OutputStream) != null)
                compressor.Close();
#endif
#endif

#if !NETCF
            else if ((compressor as LF.Utils.Ionic.Zlib.ParallelDeflateOutputStream) != null)
                compressor.Close();
#endif

            encryptor.Flush();
            encryptor.Close();

            _LengthOfTrailer = 0;

            _UncompressedSize = output.TotalBytesSlurped;

#if AESCRYPTO
            WinZipAesCipherStream wzacs = encryptor as WinZipAesCipherStream;
            if (wzacs != null && _UncompressedSize > 0)
            {
                s.Write(wzacs.FinalAuthentication, 0, 10);
                _LengthOfTrailer += 10;
            }
#endif
            _CompressedFileDataSize = entryCounter.BytesWritten;
            _CompressedSize = _CompressedFileDataSize;   // may be adjusted
            _Crc32 = output.Crc;

            // Set _RelativeOffsetOfLocalHeader now, to allow for re-streaming
            StoreRelativeOffset();
        }
示例#43
0
文件: Main.cs 项目: richardy2012/blue
 public static void WriteLine(LF e, string stFormat, params object [] arg)
 {
     GetStream(e).WriteLine(stFormat, arg);
 }
示例#44
0
        /// <summary>
        ///   Prepare the given stream for output - wrap it in a CountingStream, and
        ///   then in a CRC stream, and an encryptor and deflator as appropriate.
        /// </summary>
        /// <remarks>
        ///   <para>
        ///     Previously this was used in ZipEntry.Write(), but in an effort to
        ///     introduce some efficiencies in that method I've refactored to put the
        ///     code inline.  This method still gets called by ZipOutputStream.
        ///   </para>
        /// </remarks>
        internal void PrepOutputStream(Stream s,
                                       long streamLength,
                                       out CountingStream outputCounter,
                                       out Stream encryptor,
                                       out Stream compressor,
                                       out LF.Utils.Ionic.Crc.CrcCalculatorStream output)
        {
            TraceWriteLine("PrepOutputStream: e({0}) comp({1}) crypto({2}) zf({3})",
                           FileName,
                           CompressionLevel,
                           Encryption,
                           _container.Name);

            // Wrap a counting stream around the raw output stream:
            // This is the last thing that happens before the bits go to the
            // application-provided stream.
            outputCounter = new CountingStream(s);

            // Sometimes the incoming "raw" output stream is already a CountingStream.
            // Doesn't matter. Wrap it with a counter anyway. We need to count at both
            // levels.

            if (streamLength != 0L)
            {
                // Maybe wrap an encrypting stream around that:
                // This will happen BEFORE output counting, and AFTER deflation, if encryption
                // is used.
                encryptor = MaybeApplyEncryption(outputCounter);

                // Maybe wrap a compressing Stream around that.
                // This will happen BEFORE encryption (if any) as we write data out.
                compressor = MaybeApplyCompression(encryptor, streamLength);
            }
            else
            {
                encryptor = compressor = outputCounter;
            }
            // Wrap a CrcCalculatorStream around that.
            // This will happen BEFORE compression (if any) as we write data out.
            output = new LF.Utils.Ionic.Crc.CrcCalculatorStream(compressor, true);
        }
示例#45
0
        internal ExcelGradientFill(ExcelStyles styles, LF.Utils.EPPlus.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string address, int index) :
            base(styles, ChangedEvent, PositionID, address)

        {
            Index = index;
        }
示例#46
0
        public static void processRecord(string record1, ref int presentRowNumber, string[,] masterInventorList)
        // this is processRecord(string record1)
        {
            String patentNo, lastName, firstName, middleName, title, date1, date2, assignee, inventorString, CPCcodes;
            int    numberInventors;
            string LFM, LF, LF1; // LFM = Last, First, Middle, LF = last first, LF1 = last and first letter of first.
            string LFM1, LF1M1;  // LFM1 = last first middle initial,  LF1M1 = last and first initial and middle initial

            LFM = "";
            LF  = ""; LF1 = ""; LFM1 = ""; LF1M1 = "";

            // there should be five/six "|" in here.
            // no -> error
            // yes -> split into fields

            (patentNo, title, date1, date2, assignee, inventorString, CPCcodes) = findFields(record1);

            // split "inventors" into as many full names as there are inventors
            string[] inventorsFullNames;
            inventorsFullNames = inventorString.Split(';');
            numberInventors    = inventorsFullNames.Length;


            // create other versions of names

            for (int i = 1; i < numberInventors + 1; i++)
            {
                string fullName = inventorsFullNames[i - 1];
                //
                // delete addresses (in parentheses)
                // delete quote and commas
                //

                string regex            = "(\\[.*\\])|(\".*\")|('.*')|(\\(.*\\))";
                string fullName_cleaned = Regex.Replace(fullName, regex, "");

                fullName_cleaned = Regex.Replace(fullName_cleaned, @",", "");   // remove commas
                fullName_cleaned = fullName_cleaned.Trim('"');                  // delete quotes
                fullName_cleaned = fullName_cleaned.Replace(".", string.Empty); // delete periods
                fullName_cleaned = fullName_cleaned.Replace("-", string.Empty); // delete hyphens
                fullName_cleaned = fullName_cleaned.ToUpper();                  // convert to upper

                string[] inventorNameFragments;
                inventorNameFragments = fullName_cleaned.Split(' ');
                int numberOfNameFragments = inventorNameFragments.Length;
                lastName   = inventorNameFragments[0];
                firstName  = inventorNameFragments[1];
                middleName = inventorNameFragments[2];

                // save flattened list of documents and names


                string space = Convert.ToString(' ');

                LFM = String.Concat(lastName, space, firstName, space, middleName);
                LF  = String.Concat(lastName, space, firstName);
                LF1 = String.Concat(lastName, space, firstName.Substring(0, 1));
                try
                {
                    LFM1 = String.Concat(lastName, space, firstName, space, middleName.Substring(0, 1));
                }
                catch
                {
                    LFM1 = "";
                }
                try
                {
                    LF1M1 = String.Concat(lastName, space, firstName.Substring(0, 1), space, middleName.Substring(0, 1));
                }
                catch
                {
                    LF1M1 = "";
                }

                // here we have all the info for one line of the masterInventorTable
                //--------all the name versions for one intentor
                //--------all the info. on one patent publicaiton.
                //
                try
                {
                    masterInventorList[presentRowNumber, 0] = LFM.Trim();
                }
                catch
                {
                    masterInventorList[presentRowNumber, 0] = LFM;
                }

                try
                {
                    masterInventorList[presentRowNumber, 1] = LF.Trim();
                }
                catch
                {
                    masterInventorList[presentRowNumber, 1] = LF;
                }

                try
                {
                    masterInventorList[presentRowNumber, 2] = LF1.Trim();
                }
                catch
                {
                    masterInventorList[presentRowNumber, 2] = LF1;
                }

                try
                {
                    masterInventorList[presentRowNumber, 3] = LFM1.Trim();
                }
                catch
                {
                    masterInventorList[presentRowNumber, 3] = LFM1;
                }

                try
                {
                    masterInventorList[presentRowNumber, 4] = LF1M1.Trim();
                }
                catch
                {
                    masterInventorList[presentRowNumber, 4] = LF1M1;
                }
                ;
                masterInventorList[presentRowNumber, 5]  = patentNo;
                masterInventorList[presentRowNumber, 6]  = title;
                masterInventorList[presentRowNumber, 7]  = date1;
                masterInventorList[presentRowNumber, 8]  = date2;
                masterInventorList[presentRowNumber, 9]  = assignee;
                masterInventorList[presentRowNumber, 10] = inventorString;
                masterInventorList[presentRowNumber, 11] = CPCcodes;

                presentRowNumber += 1;
            }

            return;
        }