Example #1
0
        private void importUrl(PipelineContext ctx, IDatasourceSink sink, IStreamProvider elt)
        {
            ctx.IncrementEmitted();
            TikaAsyncWorker worker   = new TikaAsyncWorker(this, elt);
            String          fileName = elt.FullName;

            sink.HandleValue(ctx, "record/_start", fileName);
            sink.HandleValue(ctx, "record/lastmodutc", worker.LastModifiedUtc);
            sink.HandleValue(ctx, "record/virtualFilename", elt.VirtualName);

            //Check if we need to convert this file
            if ((ctx.ImportFlags & _ImportFlags.ImportFull) == 0) //Not a full import
            {
                if ((ctx.ImportFlags & _ImportFlags.RetryErrors) == 0 && worker.LastModifiedUtc < previousRun)
                {
                    ctx.Skipped++;
                    return;
                }
                ExistState existState = toExistState(sink.HandleValue(ctx, "record/_checkexist", elt));
                if ((existState & (ExistState.ExistSame | ExistState.ExistNewer | ExistState.Exist)) != 0)
                {
                    ctx.Skipped++;
                    return;
                }
            }

            TikaAsyncWorker popped = pushPop(ctx, sink, worker);

            if (popped != null)
            {
                importUrl(ctx, sink, popped);
            }
        }
Example #2
0
 public Enemy(Texture2D image, Vector2 position, Vector2 screen)
     : base(image, position)
 {
     myPosition = position;
     myScreenSize = screen;
     myState = new ExistState(this);
 }
        protected virtual bool CheckNeedImport(PipelineContext ctx, IDatasourceSink sink, IStreamProvider elt)
        {
            ExistState existState = toExistState(sink.HandleValue(ctx, "record/_checkexist", elt));

            //return true if we need to convert this file
            return((existState & (ExistState.ExistSame | ExistState.ExistNewer | ExistState.Exist)) == 0);
        }
Example #4
0
        public override ExistState Exists(PipelineContext ctx, string key, DateTime?timeStamp)
        {
            ExistState st = DocType.Exists(Connection, key, timeStamp);

            Logs.DebugLog.Log("exist=" + st);
            return(st);
            //return doctype.Exists(connection, key, timeStamp);
        }
Example #5
0
 public Platform(Texture2D image, Texture2D image2, Vector2 position, Vector2 screen)
     : base(image, position)
 {
     myPosition = position;
     myScreenSize = screen;
     myState = new ExistState(this);
     badPlatform = image2;
 }
Example #6
0
 public Enemy(Texture2D image, Vector2 position, Vector2 screen)
     : base(image, position)
 {
     myScreenSize = screen;
     myState = new ExistState(this);
     // Start in lower right hand of screen
     myPosition.X = myScreenSize.X - myTexture.Width;
     myPosition.Y = myScreenSize.Y - myTexture.Height;
 }
Example #7
0
 public Asis(Texture2D texture, Vector2 position, Vector2 screen)
     : base(texture, position)
 {
     myScreenSize = screen;
     myState = new ExistState(this);
     hasJumped = true;
     myPosition.X = 0;
     myPosition.Y = myScreenSize.Y - myTexture.Height;
     direction = "right";
     SetUpInput();
 }
Example #8
0
        public Hero(Texture2D texture, Vector2 position, Vector2 screen, NebulaGame myGame)
            : base(texture, position)
        {
            myScreenSize = screen;
            myState = new ExistState(this);
            hasJumped = true;
            myPosition = position;
            // Change back to  for start of game
            // myPosition.X = myScreenSize.X;

                //

            // myPosition.Y = 0;
            //  myScreenSize.Y - myTexture.Height * 2; ;
            // Start her facing to the right
            direction = "right";

            BoostSound = myGame.Content.Load<SoundEffect>("boost-sound");

            SetUpInput();
        }
        public override Object HandleValue(PipelineContext ctx, String key, Object value)
        {
            ExistState ret = ExistState.NotExist;
            String     k   = keySource.GetKey(ctx, value);

            if (Debug)
            {
                ctx.DebugLog.Log("CheckExistAction: key={0}, source={1}", k == null ? "NULL" : k, this.keySource.Input);
            }
            if (k != null)
            {
                DateTime?dt = dateSource == null ? null : dateSource.GetKeyDate(ctx, value);
                if (Debug)
                {
                    ctx.DebugLog.Log("-- dt={0}, source={1}", dt == null ? "NULL" : dt.ToString(), this.dateSource);
                }
                ret = endPoint.Exists(ctx, k, dt);
                if (Debug)
                {
                    ctx.DebugLog.Log("-- ret={0}", ret);
                }
            }
            return(ret);
        }
Example #10
0
        private void importUrl(PipelineContext ctx, IDatasourceSink sink, IStreamProvider elt)
        {
            int  splitUntil    = elt.ContextNode.ReadInt("@splituntil", this.splitUntil);
            bool objectPerLine = elt.ContextNode.ReadBool("@objectperline", this.objectPerLine);

            ctx.SendItemStart(elt);
            if ((ctx.ActionFlags & _ActionFlags.Skip) != 0)
            {
                return;
            }

            ExistState existState = ExistState.NotExist;

            if ((ctx.ImportFlags & _ImportFlags.ImportFull) == 0) //Not a full import
            {
                existState = toExistState(sink.HandleValue(ctx, "record/_checkexist", null));
            }

            //Check if we need to convert this file
            if ((existState & (ExistState.ExistSame | ExistState.ExistNewer | ExistState.Exist)) != 0)
            {
                ctx.Skipped++;
                ctx.ImportLog.Log("Skipped: {0}. Date={1}", elt, 0);// dtFile);
                return;
            }

            List <String> keys   = new List <string>();
            List <String> values = new List <String>();
            Stream        fs     = null;

            try
            {
                fs = elt.CreateStream(ctx);
                if (!this.objectPerLine)
                {
                    importRecord(ctx, sink, fs, splitUntil);
                }
                else
                {
                    byte[]       buf    = new byte[4096];
                    int          offset = 0;
                    MemoryStream tmp    = new MemoryStream();
                    while (true)
                    {
                        int len = offset + fs.Read(buf, offset, buf.Length - offset);
                        if (len == offset)
                        {
                            break;
                        }
                        int i = offset;
                        for (; i < len; i++)
                        {
                            if (buf[i] == '\n')
                            {
                                break;
                            }
                        }

                        tmp.Write(buf, offset, i - offset);
                        if (i == offset)
                        {
                            offset = 0;
                            continue;
                        }


                        if (tmp.Position > 0)
                        {
                            tmp.Position = 0;
                            importRecord(ctx, sink, tmp, splitUntil);
                            tmp.Position = 0;
                        }
                        if (i + 1 < offset)
                        {
                            tmp.Write(buf, i + 1, len - i - 1);
                        }
                    }
                    if (offset > 0)
                    {
                        tmp.Write(buf, 0, offset);
                    }
                    if (tmp.Position > 0)
                    {
                        tmp.Position = 0;
                        importRecord(ctx, sink, tmp, splitUntil);
                    }
                }
                ctx.OptSendItemStop();
            }
            catch (Exception e)
            {
                ctx.HandleException(e);
            }
        }
Example #11
0
 public void Resurrect()
 {
     myState = new ExistState(this);
     alive = true;
 }