Пример #1
0
 void control()
 {
     if(send)	ic.setNum	-=	setNo;
     send	=	false;
     if(PCursor == null){
         state	=	STATUS.None;
         return;
     }
     //アイコンをマウスの後ろに移動
     timer		+=	Time.deltaTime;
     float	n	=	Mathf.Min(timer/maxTime,1.0f);
     Vector3	adPos;
     adPos.x		=	PCursor.transform.position.x - (PCursor.trans.sizeDelta.x * 0.6f);
     adPos.y		=	PCursor.transform.position.y - (PCursor.trans.sizeDelta.y * 0.1f);
     adPos.z		=	PCursor.transform.position.z;
     Vector3		value	=	adPos * n + PREVPOS * (1 - n);
     transform.position	=	value;
     if(n != 1.0f)	return;
     //選択されているキャラをウィンドウに表示
     windowNo.selectNo		=	selectNo;
     ic.selectChara[No+1]	=	selectNo;
     if(!putOn){
         //セレクトウィンドウ以外の時、画像を表示しない
         selectNo				=	4;
         ic.selectChara[No+1]	=	selectNo;
         return;
     }
     if(!PCursor.GetAccel())	return;
     timer	=	0;
     state	=	STATUS.Decision;
 }
Пример #2
0
 public CinfoEagle(string symbol, STATUS status, Texture2D posImg, Point midImg)
 {
     this.symbol = symbol;
     this.status = status;
     this.posImg = posImg;
     this.midImg = midImg;
 }
Пример #3
0
 internal static void StatusSet(STATUS op, int X)
 {
     Debug.Assert(op >= 0 && (int)op < Stat.nowValue.Length);
     Stat.nowValue[(int)op] = X;
     if (Stat.nowValue[(int)op] > Stat.mxValue[(int)op])
         Stat.mxValue[(int)op] = Stat.nowValue[(int)op];
 }
Пример #4
0
 internal static void StatusSet(STATUS op, int x)
 {
     Debug.Assert(op >= 0 && (int)op < _stat.NowValue.Length);
     _stat.NowValue[(int)op] = x;
     if (_stat.NowValue[(int)op] > _stat.MaxValue[(int)op])
         _stat.MaxValue[(int)op] = _stat.NowValue[(int)op];
 }
Пример #5
0
 protected override void EndSequenceAction(STATUS status)
 {
     if(IsSuccess(status))
     {
         mn_CurrentNode = 0;
     }
 }
Пример #6
0
 public CinfoItems(string symbol, STATUS status, Dictionary<Texture2D, Vector2> midPos, Texture2D posImg, Point midImg)
 {
     this.symbol = symbol;
     this.status = status;
     this.posImg = posImg;
     this.midImg = midImg;
 }
Пример #7
0
 internal static void sqlite3StatusSet(STATUS op, int X)
 {
     wsdStatInit();
     Debug.Assert(op >= 0 && (int)op < wsdStat.nowValue.Length);
     wsdStat.nowValue[(int)op] = X;
     if (wsdStat.nowValue[(int)op] > wsdStat.mxValue[(int)op])
         wsdStat.mxValue[(int)op] = wsdStat.nowValue[(int)op];
 }
Пример #8
0
 protected override void EndSequenceAction(STATUS status)
 {
     if(!IsRunning(status))//status != STATUS.RUNNING)
     {
         //Debug.Log ("[RepeatBT] Accion final, status != RUNNING, ejecuto Init");
         Init();
     }
 }
Пример #9
0
	protected virtual void OnCollisionEnter (Collision other)
	{
		if (Status == STATUS.NORMAL && (other.gameObject.tag == "Ball" || other.gameObject.tag == "Target")) {
			// Events setup (I put it here, because it caused random errors in Start method, maybe because of concurrency of many targets starting up at the same time...)
			EventControl.Instance.InitTargetEvents (this);
			Status = STATUS.HIT;
		}
	}
Пример #10
0
 protected override bool SequenceCondition(STATUS status)
 {
     if(IsFailure(status))
     {
         ++mn_CurrentNode;
     }
     return status == STATUS.FAILURE;
 }
 void OnTriggerStay2D(Collider2D other)
 {
     if(state != STATUS.NORMAL)	return;
     CursorManager	cm	=	other.gameObject.GetComponent<CursorManager>();
     if(cm == null)	return;
     if(!cm.GetAccel())	return;
     state	=	STATUS.CLOSE;
 }
Пример #12
0
 public Friends(Player player)
 {
     this.player = player;
     messageCounter = 1;
     friends = new List<long>(200);
     ignores = new List<long>(100);
     clanRanks = new Dictionary<long, int>(100);
     publicStatus = privateStatus = tradeStatus = 0;
 }
Пример #13
0
 public static RC Status(STATUS op, ref int pCurrent, ref int pHighwater, int resetFlag)
 {
     if (op < 0 || (int)op >= Stat.nowValue.Length)
         return SysEx.MISUSE_BKPT();
     pCurrent = Stat.nowValue[(int)op];
     pHighwater = Stat.mxValue[(int)op];
     if (resetFlag != 0)
         Stat.mxValue[(int)op] = Stat.nowValue[(int)op];
     return RC.OK;
 }
Пример #14
0
 public static RC Status(STATUS op, ref int current, ref int highwater, int resetFlag)
 {
     if (op < 0 || (int)op >= _stat.NowValue.Length)
         return SysEx.MISUSE_BKPT();
     current = _stat.NowValue[(int)op];
     highwater = _stat.MaxValue[(int)op];
     if (resetFlag != 0)
         _stat.MaxValue[(int)op] = _stat.NowValue[(int)op];
     return RC.OK;
 }
Пример #15
0
 public static RC sqlite3_status(STATUS op, ref int pCurrent, ref int pHighwater, int resetFlag)
 {
     wsdStatInit();
     if (op < 0 || (int)op >= wsdStat.nowValue.Length)
         return SysEx.SQLITE_MISUSE_BKPT();
     pCurrent = wsdStat.nowValue[(int)op];
     pHighwater = wsdStat.mxValue[(int)op];
     if (resetFlag != 0)
         wsdStat.mxValue[(int)op] = wsdStat.nowValue[(int)op];
     return RC.OK;
 }
Пример #16
0
        public CinfoBullet(string symbol, STATUS status, int speed, GUIDE guide,
            Dictionary<Texture2D, Vector2> midPos, Texture2D posImg, Point midImg)
        {
            this.symbol = symbol;
            this.status = status;

            this.speed = speed;
            this.guide = guide;
            this.posImg = posImg;
            this.midImg = midImg;
        }
Пример #17
0
 public Worker(string url, string jobTrackerUrl)
 {
     this.url = url;
     this.jobTrackerUrl = jobTrackerUrl;
     CURRENT_STATUS_WORKER = STATUS.WORKER_WAITING; // For STATUS command of PuppetMaster
     LOCK_STATUS_WORKER = STATUS.WORKER_WAITING; // For STATUS command of PuppetMaster
     CURRENT_STATUS_JOBTRACKER = STATUS.JOBTRACKER_DISABLED;
     workerMonitor = new object();
     mapperMonitor = new object();
     jobtrackerMonitor = new object();
     timerJT = new Timer(checkJTStatus, null, ALIVE_TIME_INTERVAL_IN_MS, Timeout.Infinite);
 }
 void init()
 {
     timer += 0.1f;
     float t = timer;
     t = Mathf.Pow(t, 3);
     transSize.x = t;
     transSize.y = t;
     trans.localScale = transSize;
     if (timer < 1.0f)	return;
     timer = 1.0f;
     trans.localScale = Vector3.one;
     state	=	STATUS.NORMAL;
     if(No != 1)	npcButton.state	=	NPCButton.STATUS.NOTURN;
 }
Пример #19
0
 public void freezec()
 {
     if (LOCK_STATUS_JOBTRACKER != STATUS.JOBTRACKER_FROZEN)
     {
         Console.WriteLine("[D] Freezing job tracker...");
         PREVIOUS_STATUS_JOBTRACKER = CURRENT_STATUS_JOBTRACKER;
         CURRENT_STATUS_JOBTRACKER = STATUS.JOBTRACKER_FROZEN;
         LOCK_STATUS_JOBTRACKER = STATUS.JOBTRACKER_FROZEN;
     }
     else
     {
         Console.WriteLine("[D] Freeze called on job tracker, but it's already frozen...");
     }
 }
Пример #20
0
 void Close()
 {
     timer -= 0.1f;
     float t = timer;
     t = Mathf.Pow(t, 3);
     transSize.x = t;
     transSize.y = t;
     childTrans.localScale	=	transSize;
     if (timer >= 0.0f)	return;
     timer = 0.0f;
     childTrans.localScale	=	Vector3.zero;
     trans.sizeDelta			=	DEFALUTSIZE;
     state					=	STATUS.NONE;
 }
 void close()
 {
     timer -= 0.1f;
     float t = timer;
     t = Mathf.Pow(t, 3);
     transSize.x = t;
     transSize.y = t;
     trans.localScale = transSize;
     activFlg	=	false;
     if(No != 1)	npcButton.state	=	NPCButton.STATUS.NONE;
     if (timer > 0.0f)	return;
     timer = 0.0f;
     trans.localScale = Vector3.zero;
     state		=	STATUS.NONE;
 }
Пример #22
0
        public STATUS Connect()
        {
            // Create a socket connection with the specified server and port.
            IPEndPoint ipe = new IPEndPoint(IPAddress.Parse(IP), PORT);
            socket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            try
            {
                socket.Connect(ipe);
            }
            catch
            {
                return status = STATUS.DISCONNECTED;
            }

            return status = STATUS.CONNECTED;
        }
Пример #23
0
 // Update is called once per frame
 void Update()
 {
     //Do we need to switch
     if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         if (currentStatus == STATUS.MAN)
         {
             //then we need to load goop
             Instantiate(goop, GameObject.FindGameObjectWithTag("man").transform.position, Quaternion.identity);
             GameObject.Destroy(GameObject.FindWithTag("man"));
             currentStatus = STATUS.GOOP;
         }else
         {
             Instantiate(man, GameObject.FindGameObjectWithTag("goop").transform.position, Quaternion.identity);
             GameObject.Destroy(GameObject.FindWithTag("goop"));
             currentStatus = STATUS.MAN;
         }
     }
 }
Пример #24
0
 public void scrollStop()
 {
     status = STATUS.NOT;
 }
Пример #25
0
 protected virtual void EndSequenceAction(STATUS status)
 {
     if(IsFailure(status))
     {
         Init();
         //Debug.Log("[SequentialBT] FAILURE al final, ejecuto Init");
     }
 }
Пример #26
0
 public void NextWave()
 {
     waveCount += 1;
     waveStatus = STATUS.STANDBY;
 }
Пример #27
0
        private ScheduledJob(byte[] bytes)
        {
            #region FIXDLEN_DATA

            ProductVersion        = (PRODUCT_VERSION)BitConverter.ToUInt16(bytes, 0x00);
            FileVersion           = BitConverter.ToUInt16(bytes, 0x02);
            Uuid                  = new Guid(BitConverter.ToInt32(bytes, 0x04), BitConverter.ToInt16(bytes, 0x08), BitConverter.ToInt16(bytes, 0x0A), Helper.GetSubArray(bytes, 0x0C, 0x08));
            ApplicationNameOffset = BitConverter.ToUInt16(bytes, 0x14);
            TriggerOffset         = BitConverter.ToUInt16(bytes, 0x16);
            ErrorRetryCount       = BitConverter.ToUInt16(bytes, 0x18);
            ErrorRetryInterval    = BitConverter.ToUInt16(bytes, 0x1A);
            IdleDeadline          = BitConverter.ToUInt16(bytes, 0x1C);
            IdleWait              = BitConverter.ToUInt16(bytes, 0x1E);
            //Priority = (PRIORITY_CLASS)BitConverter.ToUInt32(bytes, 0x20);
            MaximumRuntime = BitConverter.ToUInt32(bytes, 0x24);
            ExitCode       = BitConverter.ToUInt32(bytes, 0x28);
            Status         = (STATUS)BitConverter.ToUInt32(bytes, 0x2C);
            Flags          = (TASK_FLAG)BitConverter.ToUInt32(bytes, 0x30);
            #region RunTime

            short year         = BitConverter.ToInt16(bytes, 0x34);
            short month        = BitConverter.ToInt16(bytes, 0x36);
            short day          = BitConverter.ToInt16(bytes, 0x3A);
            short hour         = BitConverter.ToInt16(bytes, 0x3C);
            short minute       = BitConverter.ToInt16(bytes, 0x3E);
            short second       = BitConverter.ToInt16(bytes, 0x40);
            short milliseconds = BitConverter.ToInt16(bytes, 0x42);
            if (year != 0)
            {
                RunTime = new DateTime(year, month, day, hour, minute, second, milliseconds, DateTimeKind.Utc);
            }
            else
            {
                RunTime = new DateTime(0);
            }

            #endregion RunTime

            #endregion FIXDLEN_DATA

            #region Variable-Length Data Section

            RunningInstanceCount  = BitConverter.ToUInt16(bytes, 0x44);
            ApplicationNameLength = BitConverter.ToUInt16(bytes, ApplicationNameOffset);
            ApplicationName       = Encoding.Unicode.GetString(bytes, ApplicationNameOffset + 0x02, ApplicationNameLength * 0x02).Split('\0')[0];

            int parameterOffset = ApplicationNameOffset + 0x02 + (ApplicationNameLength * 2);
            ParameterLength = BitConverter.ToUInt16(bytes, parameterOffset);
            Parameters      = Encoding.Unicode.GetString(bytes, parameterOffset, ParameterLength * 0x02).Split('\0')[0];

            int workingdirectoryOffset = parameterOffset + 0x02 + (ParameterLength * 2);
            WorkingDirectoryLength = BitConverter.ToUInt16(bytes, workingdirectoryOffset);
            WorkingDirectory       = Encoding.Unicode.GetString(bytes, workingdirectoryOffset, WorkingDirectoryLength * 2).Split('\0')[0];

            int authorOffset = workingdirectoryOffset + 0x02 + (WorkingDirectoryLength * 2);
            AuthorLength = BitConverter.ToUInt16(bytes, authorOffset);
            Author       = Encoding.Unicode.GetString(bytes, authorOffset, AuthorLength * 2).Split('\0')[0];

            int commentOffset = authorOffset + 0x02 + (AuthorLength * 2);
            CommentLength = BitConverter.ToUInt16(bytes, commentOffset);
            Comment       = Encoding.Unicode.GetString(bytes, commentOffset, CommentLength * 2).Split('\0')[0];

            #region StartTime

            year      = BitConverter.ToInt16(bytes, TriggerOffset + 0x06);
            month     = BitConverter.ToInt16(bytes, TriggerOffset + 0x08);
            day       = BitConverter.ToInt16(bytes, TriggerOffset + 0x0A);
            hour      = BitConverter.ToInt16(bytes, TriggerOffset + 0x12);
            minute    = BitConverter.ToInt16(bytes, TriggerOffset + 0x14);
            StartTime = new DateTime(year, month, day, hour, minute, 0, DateTimeKind.Utc);

            #endregion StartTime

            #endregion Variable-Length Data Section
        }
Пример #28
0
 public bool IsFailure(STATUS status)
 {
     return(status == STATUS.FAILURE);
 }
Пример #29
0
 public bool IsError(STATUS status)
 {
     return(status == STATUS.ERROR);
 }
        public void login(string username, string password)
        {
            var  msg  = new STATUS();
            USER Info = new USER();

            if (string.IsNullOrEmpty(username))
            {
                msg.MESSAGE = "User is required";
                goto Error;
            }
            if (String.IsNullOrEmpty(password))
            {
                msg.MESSAGE = "Password is required";
                goto Error;
            }
            if (username.Length > 50)
            {
                msg.MESSAGE = "Username must be less than or equal 50 character";
                goto Error;
            }
            if (password.Length > 50)
            {
                msg.MESSAGE = "Password must be less than or equal 50 character";
                goto Error;
            }
            if (username.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of Username";
                goto Error;
            }
            if (password.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of Password";
                goto Error;
            }

            Info = fetch.getDetails(username, fetch.PasswordEncrypt(password));
            if (String.IsNullOrEmpty(Info.HashCode))
            {
                msg.MESSAGE = "Wrong Id And Password";
                goto Error;
            }
            else
            {
                goto Success;
            }

Error:
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(msg);

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Flush();
            Context.Response.Write(strJSON);
            return;

Success:
            JavaScriptSerializer js1 = new JavaScriptSerializer();
            string strJSON1 = js1.Serialize(Info);

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Flush();
            Context.Response.Write(strJSON1);
        }
Пример #31
0
        public static void CheckResult()
        {
            bool broken_up = false;
            bool reset = false;
            bool was_final_fight = false;
            bool surrender = false;
            try
            {
                UNIT_END_COMBAT type = UNIT_END_COMBAT.UNIT_STAYS;
                int dx, dy;

                surp_contact = false;

                /* check attack result */
                if ((atk_result & Unit.FIGHT_TYPES.AR_UNIT_KILLED) == Unit.FIGHT_TYPES.AR_UNIT_KILLED)
                {
                    Scenario.scen_inc_casualties_for_unit(cur_atk);
                    engine_remove_unit(cur_atk);
                    cur_atk = null;
                }
                if ((atk_result & Unit.FIGHT_TYPES.AR_TARGET_KILLED) == Unit.FIGHT_TYPES.AR_TARGET_KILLED)
                {
                    Scenario.scen_inc_casualties_for_unit(cur_def);
                    engine_remove_unit(cur_def);
                    cur_def = null;
                }
                /* CHECK IF SCENARIO IS FINISHED DUE TO UNITS_KILLED OR UNITS_SAVED */
                if (Scenario.scen_check_result(false))
                {
                    engine_finish_scenario();
                    return;
                }
                reset = true;
                if (df_units.Count > 0)
                {
                    if (((atk_result & Unit.FIGHT_TYPES.AR_TARGET_SUPPRESSED) == Unit.FIGHT_TYPES.AR_TARGET_SUPPRESSED) ||
                        ((atk_result & Unit.FIGHT_TYPES.AR_TARGET_KILLED) == Unit.FIGHT_TYPES.AR_TARGET_KILLED))
                    {
                        df_units.Clear();
                        if ((atk_result & Unit.FIGHT_TYPES.AR_TARGET_KILLED) == Unit.FIGHT_TYPES.AR_TARGET_KILLED)
                            cur_unit = null;
                        else
                        {
                            /* supressed unit looses its actions */
                            cur_unit.cur_mov = 0;
                            cur_unit.cur_atk_count = 0;
                            cur_unit.unused = false;
                            broken_up = true;
                        }
                    }
                    else
                    {
                        reset = false;
                        df_units.RemoveAt(0);
                    }
                }
                else
                    was_final_fight = true;
                if (!reset)
                {
                    /* continue fights */
                    if (engine_get_next_combatants())
                    {
                        status = STATUS.STATUS_ATTACK;
                        phase = PHASE.PHASE_INIT_ATK;
                    }
                    else
                        Console.WriteLine("Deadlock! No remaining combatants but supposed to continue fighting? How is this supposed to work????");
                }
                else
                {
                    /* clear suppression from defensive fire */
                    if (cur_atk != null)
                    {
                        cur_atk.suppr = 0;
                        cur_atk.unused = false;
                    }
                    if (cur_def != null)
                        cur_def.suppr = 0;
                    /* if this was the final fight between selected unit and selected target
                       check if one of these units was completely suppressed and surrenders
                       or flees */
                    if (was_final_fight)
                    {
                        engine_clear_backup(); /* no undo allowed after attack */
                        if (cur_atk != null && cur_def != null)
                        {
                            if ((atk_result & Unit.FIGHT_TYPES.AR_UNIT_ATTACK_BROKEN_UP) == Unit.FIGHT_TYPES.AR_UNIT_ATTACK_BROKEN_UP)
                            {
                                /* unit broke up the attack */
                                broken_up = true;
                            }
                            else
                                /* total suppression may only cause fleeing or
                                   surrender if: both units are ground/naval units in
                                   close combat: the unit that causes suppr must
                                   have range 0 (melee)
                                   inf . fort (fort may surrender)
                                   fort . adjacent inf (inf will not flee) */
                                if (((cur_atk.sel_prop.flags & UnitFlags.FLYING) != UnitFlags.FLYING) &&
                                    (cur_def.sel_prop.flags & UnitFlags.FLYING) != UnitFlags.FLYING)
                                {
                                    if ((atk_result & Unit.FIGHT_TYPES.AR_UNIT_SUPPRESSED) == Unit.FIGHT_TYPES.AR_UNIT_SUPPRESSED &&
                                         ((atk_result & Unit.FIGHT_TYPES.AR_TARGET_SUPPRESSED) != Unit.FIGHT_TYPES.AR_TARGET_SUPPRESSED) &&
                                         cur_def.sel_prop.rng == 0)
                                    {
                                        /* cur_unit is suppressed */
                                        engine_handle_suppr(cur_atk, out type, out dx, out dy);
                                        if (type == UNIT_END_COMBAT.UNIT_FLEES)
                                        {
                                            status = STATUS.STATUS_MOVE;
                                            phase = PHASE.PHASE_INIT_MOVE;
                                            move_unit = cur_atk;
                                            fleeing_unit = 1;
                                            dest_x = dx; dest_y = dy;
                                            return;
                                        }
                                        else
                                            if (type == UNIT_END_COMBAT.UNIT_SURRENDERS)
                                            {
                                                surrender = true;
                                                surrender_unit = cur_atk;
                                            }
                                    }
                                    else
                                        if ((atk_result & Unit.FIGHT_TYPES.AR_TARGET_SUPPRESSED) == Unit.FIGHT_TYPES.AR_TARGET_SUPPRESSED &&
                                             (atk_result & Unit.FIGHT_TYPES.AR_UNIT_SUPPRESSED) != Unit.FIGHT_TYPES.AR_UNIT_SUPPRESSED &&
                                             cur_atk.sel_prop.rng == 0)
                                        {
                                            /* cur_target is suppressed */
                                            engine_handle_suppr(cur_def, out type, out dx, out dy);
                                            if (type == UNIT_END_COMBAT.UNIT_FLEES)
                                            {
                                                status = STATUS.STATUS_MOVE;
                                                phase = PHASE.PHASE_INIT_MOVE;
                                                move_unit = cur_def;
                                                fleeing_unit = 1;
                                                dest_x = dx; dest_y = dy;
                                                return;
                                            }
                                            else
                                                if (type == UNIT_END_COMBAT.UNIT_SURRENDERS)
                                                {
                                                    surrender = true;
                                                    surrender_unit = cur_def;
                                                }
                                        }
                                }
                        }
                        /* clear pointers */
                        if (cur_atk == null) cur_unit = null;
                        if (cur_def == null) cur_target = null;
                    }
                    if (broken_up)
                    {
                        phase = PHASE.PHASE_BROKEN_UP_MSG;
                        Console.WriteLine("Attack Broken Up!");
                        return;
                    }
                    if (surrender)
                    {
                        string msg = (surrender_unit.sel_prop.flags & UnitFlags.SWIMMING) == UnitFlags.SWIMMING ?
                            "Ship is scuttled!" : "Surrenders!";
                        phase = PHASE.PHASE_SURRENDER_MSG;
                        Console.WriteLine(msg);
                        return;
                    }
                    phase = PHASE.PHASE_END_COMBAT;
                }
            }
            finally
            {
                AI_Enemy.Action.action_queue(EngineActionsTypes.ACTION_END_COMBAT);
                //stateMachine.Send(EngineActionsTypes.ACTION_END_COMBAT);
            }
        }
Пример #32
0
    public void connect()
    {
        rbuffer_ = new byte[READBUFF_SIZE];
        rwpos_   = 0;

        wbuffer_ = new byte[WRITEBUFF_SIZE];
        wwpos_   = 0;

        flags   = 0;
        status_ = 0;

        var addrs = Dns.GetHostAddresses(ipaddr_);

        foreach (var a in addrs)
        {
            Debug.LogFormat("parse dns({0}) => {1}", ipaddr_, a.ToString());
        }

        int index = 0;

        connectResult_ = (bool result) =>
        {
            if (result)
            {
                callback_(true);
            }
            else
            {
                IPAddress addr = null;
                if (index < addrs.Length)
                {
                    addr = addrs[index++];
                    if (addr != null && addr.AddressFamily == AddressFamily.InterNetwork || addr.AddressFamily == AddressFamily.InterNetworkV6)
                    {
                        socket_          = new Socket(addr.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                        socket_.NoDelay  = true;
                        socket_.Blocking = false;

                        Debug.LogFormat("send buffer size {0}", socket_.SendBufferSize);

                        sending = false;

                        Debug.LogFormat("connect to {0}:{1} r{2} w{3}", addr.ToString(), port_, READBUFF_SIZE, WRITEBUFF_SIZE);

                        try
                        {
                            status_ = STATUS.CONNECTING;
                            socket_.Connect(new IPEndPoint(addr, port_));
                            if (socket_.Connected)
                            {
                                status_ = STATUS.CONNECTED;
                                callback_(true);
                                return;
                            }
                        }
                        catch (SocketException e)
                        {
                            if (e.SocketErrorCode != SocketError.WouldBlock &&
                                e.SocketErrorCode != SocketError.InProgress)
                            {
                                Debug.LogFormat("connect to {0}:{1} error:{2}", addr, port_, e.Message);
                                connectResult_(false);
                            }
                        }
                    }
                }
                else
                {
                    callback_(false);
                }
            }
        };
        connectResult_(false);
    }
Пример #33
0
 public ToDoTask(string title, string description, DateTime startDate, DateTime endDate, int Registered_userId, STATUS status, SCOPE scope)
 {
     Title            = title;
     Description      = description;
     StartDate        = startDate;
     EndDate          = endDate;
     RegisteredUserId = Registered_userId;
     Status           = status;
     Scope            = scope;
 }
Пример #34
0
 public Person(string name, SEX sex, string identityCode, string phoneNumber, string address, STATUS status = STATUS.AVAILABLE)
 {
     Name         = name;
     Sex          = sex;
     IdentityCode = identityCode;
     PhoneNumber  = phoneNumber;
     Address      = address;
     Status       = status;
 }
Пример #35
0
 private void ResetStatus()
 {
     SelectObject(null);
     status = STATUS.SELECT;
     quad.SetActive(false);
 }
Пример #36
0
        private async void DataReceivedHandler(object sender, DataReceivedArgs e)
        {
            // TODO: Look closer to this!
            try
            {
                foreach (var b in e.Data)
                {
                    if ((b == 0x7E) && (_status == STATUS.Searching))
                    {
                        // Beginning of a new message
                        _status = STATUS.Data;
                        message.Clear();
                        message.Add(b);
                    }
                    else if ((b == 0x7E) && _status == STATUS.Data && message.Count == 1 && message[0] == 0x7E)
                    {
                        Console.WriteLine("Skipping end of frame");
                    }
                    else if ((b == 0x7E) && _status == STATUS.Data)
                    {
                        // End of message
                        _status = STATUS.Searching;
                        message.Add(b);

                        var raw = new RawMessage()
                        {
                            // TODO: Remove constant HOME
                            Location  = "Home",
                            Id        = Guid.NewGuid(),
                            TimeStamp = DateTime.Now
                        };

                        raw.Raw = string.Concat(Array.ConvertAll(message.ToArray(), x => string.Format($"{x.ToString("X2")} ")));
                        raw.Raw = raw.Raw.Remove(raw.Raw.Length - 1, 1);
                        await SendToQueue(raw);

                        if (PrintToScreen)
                        {
                            Console.WriteLine(raw.Raw);
                        }

                        // if (_bw != null)
                        // {
                        //     message.ForEach(item => _bw.Write(item));
                        // }

//                     IHDLCMessage hdlcMessage = new HDLCMessage();
                        var parser      = new Parser();
                        var hdlcMessage = parser.Parse(message.Skip(1).Take(message.Count - 1).ToList());

                        if (PrintToScreen && hdlcMessage.Data.Count > 0)
                        {
                            Console.WriteLine('\n' + JsonSerializer.Serialize(hdlcMessage));
                        }
                    }
                    else if (_status == STATUS.Data)
                    {
                        // Inside a message
                        message.Add(b);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Пример #37
0
 protected void SetStatus(STATUS status)
 {
     this.status = status;
 }
Пример #38
0
    public void Poll()
    {
        if (socket_ != null && status_ > 0)
        {
            if (status_ == STATUS.CONNECTING)
            {
                /*if (socket_.Poll(0, SelectMode.SelectError))
                 * {
                 *  status_ = STATUS.CLOSED;
                 *  object o = socket_.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
                 *  Debug.LogFormat("connect SelectError {0}", o.ToString);
                 *  socket_.Close();
                 *  callback_(false);
                 * }
                 * else */if (socket_.Poll(0, SelectMode.SelectWrite))
                {
                    if (socket_.Connected)
                    {
                        status_ = STATUS.CONNECTED;
                        //callback_(true);
                        connectResult_(true);
                        object o = socket_.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
                        Debug.LogFormat("connect SelectError {0}", o);
                    }
                    else
                    {
                        object o = socket_.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Error);
                        Debug.LogFormat("connect SelectError {0}", o);
                        status_ = STATUS.CLOSED;
                        socket_.Close();
                        connectResult_(false);
                    }
                }
            }
            else if (status_ == STATUS.CONNECTED)
            {
                if (socket_.Poll(0, SelectMode.SelectRead))
                {
                    try
                    {
                        do
                        {
                            int bytesRead = socket_.Receive(rbuffer_, (int)rwpos_, (int)(rbuffer_.Length - rwpos_), SocketFlags.None);
                            if (bytesRead > 0)
                            {
                                rwpos_ += bytesRead;

                                splitPacket();
                            }
                            else
                            {
                                Debug.LogFormat("PacketReceiver::onRecv(): recv bytes : {0}", bytesRead);
                                socket_.Close();
                                status_ = STATUS.CLOSED;
                                if (disconnect_ != null)
                                {
                                    disconnect_();
                                }
                                break;
                            }
                        } while (socket_ != null && socket_.Available > 0);
                    }
                    catch (SocketException e)
                    {
                        if (e.SocketErrorCode == SocketError.WouldBlock ||
                            e.SocketErrorCode == SocketError.TryAgain)
                        {
                            Debug.LogFormat("socket recv block ");
                        }
                        else
                        {
                            Debug.LogFormat("PacketReceiver::onRecv(): {0}", e.Message);
                            socket_.Close();
                            status_ = STATUS.CLOSED;
                            if (disconnect_ != null)
                            {
                                disconnect_();
                            }
                        }
                    }
                }

                if (socket_ != null && socket_.Connected && sending && socket_.Poll(0, SelectMode.SelectWrite))
                {
                    int bytes = 0;

                    try
                    {
                        bytes = socket_.Send(wbuffer_, wwpos_, SocketFlags.None);
                        if (bytes == wwpos_)
                        {
                            sending = false;
                            wwpos_  = 0;
                            //Debug.LogFormat("send complete {0}", bytes);
                        }
                        else
                        {
                            Array.Copy(wbuffer_, bytes, wbuffer_, 0, wwpos_ - bytes);
                            wwpos_ -= bytes;
                            //Debug.LogFormat("socket.send exx1 block {0}<==>{1} {2}", bytes, wwpos_);
                        }
                    }
                    catch (SocketException e)
                    {
                        if (e.SocketErrorCode == SocketError.WouldBlock ||
                            e.SocketErrorCode == SocketError.TryAgain)
                        {
                            Array.Copy(wbuffer_, bytes, wbuffer_, 0, wwpos_ - bytes);
                            wwpos_ -= bytes;
                            //Debug.LogFormat("socket.send exx block {0}<==>{1} {2}", bytes, wwpos_, e.Message);
                        }
                        else
                        {
                            //Debug.LogFormat("socket.send exception==>{0}", e.Message);
                        }
                    }
                }
            }
        }
    }
Пример #39
0
 public static void ActionAttack(object[] args)
 {
     AI_Enemy.Action action = (AI_Enemy.Action)args[0];
     if (!action.unit.CheckAttack( action.target, Unit.UNIT_ATTACK.UNIT_ACTIVE_ATTACK))
     {
         Console.WriteLine("'{0}' ({1},{2}) can not attack '{3}' ({4},{5})",
                  action.unit.name, action.unit.x, action.unit.y,
                  action.target.name, action.target.x, action.target.y);
         return;
     }
     if (!Engine.map.mask[action.target.x, action.target.y].spot)
     {
         Console.WriteLine("'%{0}' may not attack unit '{1}' (not visible)", action.unit.name, action.target.name);
         return;
     }
     Engine.cur_unit = action.unit;
     Engine.cur_target = action.target;
     Engine.cur_unit.GetDefensiveFireUnits(Engine.cur_target, Scenario.units, ref Engine.df_units);
     if (Engine.engine_get_next_combatants())
     {
         Engine.status = STATUS.STATUS_ATTACK;
         Engine.phase = PHASE.PHASE_INIT_ATK;
         AI_Enemy.Action.action_queue(EngineActionsTypes.ACTION_INIT_ATTACK);
         //stateMachine.Send(EngineActionsTypes.ACTION_INIT_ATTACK);
         Engine.engine_clear_danger_mask();
     #if TODO
         if (Engine.cur_ctrl == PLAYER_CTRL_HUMAN)
             image_hide(gui.cursors, 1);
     #endif
     }
 }
        public void sendsmsmulti(string hashcode, string username, string password, string receiver, string message)
        {
            var     msg  = new STATUS();
            string  send = "";
            var     obj  = new SEND_SMS();
            decimal i    = 0;

            if (String.IsNullOrEmpty(hashcode))
            {
                msg.MESSAGE = "Hash is required";
                goto Error;
            }
            if (hashcode.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of hashcode";
                goto Error;
            }
            if (string.IsNullOrEmpty(username))
            {
                msg.MESSAGE = "User is required";
                goto Error;
            }
            if (String.IsNullOrEmpty(password))
            {
                msg.MESSAGE = "Password is required";
                goto Error;
            }
            if (String.IsNullOrEmpty(receiver))
            {
                msg.MESSAGE = "phone number is required";
                goto Error;
            }
            if (!IsValid(receiver))
            {
                msg.MESSAGE = "phone number is required";
                goto Error;
            }
            if (username.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of phone number";
                goto Error;
            }
            if (username.Length > 50)
            {
                msg.MESSAGE = "Username must be less than or equal 50 character";
                goto Error;
            }
            if (password.Length > 50)
            {
                msg.MESSAGE = "Password must be less than or equal 50 character";
                goto Error;
            }
            if (receiver.Length > 50)
            {
                msg.MESSAGE = "Phone number must be less than or equal 50 character";
                goto Error;
            }
            if (username.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of Username";
                goto Error;
            }
            if (password.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of Password";
                goto Error;
            }
            if (string.IsNullOrEmpty(message))
            {
                msg.MESSAGE = "Message is required";
                goto Error;
            }
            if (message.Length > 5000)
            {
                msg.MESSAGE = "Password must be less than or equal 5000 character";
                goto Error;
            }

            var counter = fetch.getCreditNo(username, fetch.PasswordEncrypt(password), hashcode);

            if (counter.Contains("User"))
            {
                msg.MESSAGE = counter;
                goto Error;
            }
            else
            {
                char[]   a       = new char[] { ',' };
                string[] numbers = receiver.Split(a);

                int count = numbers.Count() * (int)(Math.Ceiling(message.Length / 150.0));
                if (count > int.Parse(counter))
                {
                    msg.MESSAGE = "Not Enough Balance";
                    goto Error;
                }
                var            conn  = ConnectionClass.GetConnection();
                var            cmd   = new SqlCommand();
                SqlTransaction trans = null;
                StringBuilder  sb    = new StringBuilder();
                foreach (var item in numbers)
                {
                    sb.Append("EXEC FSP_SEND_SMS_I '" + item + "','" + username + "','" + message + "','0','','' ; ");
                }
                cmd.Connection  = conn;
                cmd.CommandText = sb.ToString();
                conn.Open();
                trans           = conn.BeginTransaction();
                cmd.Transaction = trans;
                try
                {
                    var data = cmd.ExecuteNonQuery();
                    if (data > 0)
                    {
                        msg.MESSAGE = "Successfully Send!";
                        trans.Commit();
                        goto Error;
                    }
                    else
                    {
                        msg.MESSAGE = "Not Succesfull!";
                        trans.Rollback();
                        goto Error;
                    }
                }
                catch
                {
                    trans.Rollback();
                }
                finally
                {
                }
            }
Error:
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(msg);

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Flush();
            Context.Response.Write(strJSON);
            return;
        }
Пример #41
0
        public static void EndMove()
        {
            /* fade out sound */
            #if WITH_SOUND
                    audio_fade_out( 0, 500 ); /* move sound channel */
            #endif
            /* decrease fuel for way_pos hex tiles of movement */
            if (move_unit.CheckFuelUsage() && Config.supply)
            {
                move_unit.cur_fuel -= move_unit.CalcFuelUsage(  way_pos);
                if (move_unit.cur_fuel < 0)
                    move_unit.cur_fuel = 0;
            }
            /* clear move buffer image */
            #if TODO
                    if ( !blind_cpu_turn )
                       image_delete( &move_image );
            #endif
            /* run surprise contact */
            if (surp_unit != null)
            {
                cur_unit = move_unit;
                cur_target = surp_unit;
                surp_contact = true;
                surp_unit = null;
                if (engine_get_next_combatants())
                {
                    status = STATUS.STATUS_ATTACK;
                    phase = PHASE.PHASE_INIT_ATK;
                    if (!blind_cpu_turn)
                    {
            #if TODO
                                image_hide( gui.cursors, 1 );
            #endif
                        draw_map = true;
            #if TODO_RR
                        form.Draw();
            #endif
                    }
                }
                return;
            }
            /* reselect unit -- cur_unit may differ from move_unit! */
            if (cur_ctrl == PLAYERCONTROL.PLAYER_CTRL_HUMAN)
                engine_select_unit(cur_unit);
            /* status */
            engine_set_status(STATUS.STATUS_NONE);
            phase = PHASE.PHASE_NONE;
            AI_Enemy.Action.action_queue(EngineActionsTypes.ACTION_NONE);
            //stateMachine.Send(EngineActionsTypes.ACTION_NONE);

            /* allow new human/cpu input */
            if (!blind_cpu_turn)
            {
                if (cur_ctrl == PLAYERCONTROL.PLAYER_CTRL_HUMAN)
                {
            #if TODO
                            gui_set_cursor( CURSOR_STD );
                            image_hide( gui.cursors, 0 );
                            old_mx = old_my = -1;
            #endif
                }
                draw_map = true;
            #if TODO_RR
                form.Draw();
            #endif
            }
        }
    private void RightTriggerPressed(object sender, VRTK.ControllerInteractionEventArgs e)
    {
        if (sceneManager.pointerOnMenu)
        {
            return;
        }
        switch (status)
        {
        case STATUS.DEFAULT:
            if (sceneManager.activeEntity.entity != null)
            {
                if (sceneManager.activeEntity.entity.entityType == MEntity.MEntityType.POINT)
                {
                    status     = STATUS.CONNECTING;
                    activeEdge = null;
                    SelectEntity(sceneManager.activeEntity.entity);
                    curObj = sceneManager.activeEntity.obj;
                }
                else if (((MFace)sceneManager.activeEntity.entity).faceType == MFace.MFaceType.POLYGON ||
                         ((MFace)sceneManager.activeEntity.entity).faceType == MFace.MFaceType.CIRCLE ||
                         ((MFace)sceneManager.activeEntity.entity).faceType == MFace.MFaceType.GENERAL_FLAT)
                {
                    status = STATUS.SELECT_POINT;
                    SelectEntity(sceneManager.activeEntity.entity);
                    curObj = sceneManager.activeEntity.obj;
                }
            }
            break;

        case STATUS.SELECT_POINT:
            if (sceneManager.activeEntity.entity == null)
            {
                ResetStatus();
            }
            else
            {
                SelectEntity(sceneManager.activeEntity.entity);
                activeTextMesh.SetActive(true);
                status     = STATUS.ADJUST_LEN;
                activeEdge = null;
            }
            break;

        case STATUS.CONNECTING:
            if (sceneManager.activeEntity.entity == null ||
                (sceneManager.activeEntity.entity.entityType == MEntity.MEntityType.EDGE &&
                 ((MEdge)sceneManager.activeEntity.entity).edgeType != MEdge.MEdgeType.LINEAR) ||
                (sceneManager.activeEntity.entity.entityType == MEntity.MEntityType.FACE &&
                 ((MFace)sceneManager.activeEntity.entity).faceType == MFace.MFaceType.GENERAL_CURVE)
                )
            {
                ResetStatus();
            }
            else
            {
                curObj.CreateLinearEdge((MPoint)selectedEntity[0], new MPoint(activePoint.position));
                ResetStatus();
            }
            break;

        case STATUS.ADJUST_LEN:
            curObj.CreateLinearEdge((MPoint)selectedEntity[1], new MPoint(activePoint.position));
            ResetStatus();
            break;
        }
    }
Пример #43
0
 public bool IsRunning(STATUS status)
 {
     return(status == STATUS.RUNNING);
 }
        public void sendsms(string hashcode, string username, string password, string receiver, string message)
        {
            var     msg  = new STATUS();
            string  send = "";
            var     obj  = new SEND_SMS();
            decimal i    = 0;

            if (String.IsNullOrEmpty(hashcode))
            {
                msg.MESSAGE = "Hash is required";
                goto Error;
            }
            if (hashcode.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of hashcode";
                goto Error;
            }
            if (string.IsNullOrEmpty(username))
            {
                msg.MESSAGE = "User is required";
                goto Error;
            }
            if (String.IsNullOrEmpty(password))
            {
                msg.MESSAGE = "Password is required";
                goto Error;
            }
            if (String.IsNullOrEmpty(receiver))
            {
                msg.MESSAGE = "phone number is required";
                goto Error;
            }
            if (username.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of phone number";
                goto Error;
            }
            if (username.Length > 50)
            {
                msg.MESSAGE = "Username must be less than or equal 50 character";
                goto Error;
            }
            if (password.Length > 50)
            {
                msg.MESSAGE = "Password must be less than or equal 50 character";
                goto Error;
            }
            if (receiver.Length > 50)
            {
                msg.MESSAGE = "Phone number must be less than or equal 50 character";
                goto Error;
            }
            if (username.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of Username";
                goto Error;
            }
            if (password.Contains(" "))
            {
                msg.MESSAGE = "Invalid Format of Password";
                goto Error;
            }
            if (string.IsNullOrEmpty(message))
            {
                msg.MESSAGE = "Message is required";
                goto Error;
            }
            if (message.Length > 5000)
            {
                msg.MESSAGE = "Password must be less than or equal 5000 character";
                goto Error;
            }
            obj.USER_IDS = username;
            obj.HASHCODE = hashcode;
            obj.PASSWORD = fetch.PasswordEncrypt(password);
            obj.NUMBER   = receiver;
            obj.MESSAGE  = message;

            msg.MESSAGE = save.Send_API_SMS(obj);


Error:
            JavaScriptSerializer js = new JavaScriptSerializer();
            string strJSON = js.Serialize(msg);

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Flush();
            Context.Response.Write(strJSON);
            return;
        }
Пример #45
0
 public bool IsSuccess(STATUS status)
 {
     return(status == STATUS.SUCCESS);
 }
Пример #46
0
 private async Task <IEnumerable <Ticket> > getTicketsByStatus(string flight_id, STATUS status)
 {
     try
     {
         var sql =
             from m in this.Context.Tickets
             where m.FlightId.Equals(flight_id) && m.Status == status
             orderby m.TicketId
             select m;
         return(await sql.Distinct().ToListAsync());
     }
     catch (Exception e)
     {
         Console.WriteLine("GetTicketByStatus() Unexpected: " + e);
         return(null);
     }
 }
Пример #47
0
 public AttackSM(NavMeshAgent ag, FiniStateMachine st, KitchenHelper hp, STATUS _status, stateType stateTYPE, Animator an) : base(ag, st, hp, _status, stateTYPE, an)
 {
     attackingTime = status.getCurrentweapon.attackdelay;
     attacktimer   = attackingTime;
 }
Пример #48
0
 void MatchStart()
 {
     SqliteHandler sqlite = SqliteHandler.GetInstance();
     Logger.Info("Request recieved", hostAddress);
     sqlite.ExecuteQuery((command) => {
         Logger.Info("Matching Start", hostAddress);
         result = Match(command);
     });
     Logger.Info("Matching End", hostAddress);
 }
Пример #49
0
        private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
        {
            var serialPort = (SerialPort)sender;
            var byte2Read  = serialPort.BytesToRead;
            var data       = new byte[byte2Read];

            _counter++;
            serialPort.Read(data, 0, data.Length);
            _dataCounter += byte2Read;

            if ((_counter % 1000) == 0)
            {
                Console.WriteLine($"Data coming from MBus ({_dataCounter})");
            }


            foreach (var b in data)
            {
                if ((b == 0x7E) && (_status == STATUS.Searching))
                {
                    // Beginning of a new message
                    _status = STATUS.Data;
                    message.Clear();
                    message.Add(b);
                    // Console.Write($"{b.ToString("X2")} ");
                }
                else if ((b == 0x7E) && _status == STATUS.Data && message.Count == 1 && message[0] == 0x7E)
                {
                    Console.WriteLine("Skipping end of frame");
                }
                else if ((b == 0x7E) && _status == STATUS.Data)
                {
                    if (message.Count == 1)
                    {
                        message.Clear();
                        message.Add(b);
                    }
                    else
                    {
                        // End of message
                        _status = STATUS.Searching;
                        message.Add(b);
                        // Console.WriteLine($"{b.ToString("X2")}");
                        Console.WriteLine($"Message length: {message.Count}");
                        message.ForEach(item => Console.Write($"{item.ToString("X2")} "));
                        Console.WriteLine();

                        if (_bw != null)
                        {
                            message.ForEach(item => _bw.Write(item));
                        }
                    }
                }
                else if (_status == STATUS.Data)
                {
                    // Inside a message
                    message.Add(b);
                    // Console.Write($"{b.ToString("X2")} ");
                }
                else
                {
                    Console.WriteLine($"Waiting for package start");
                }
            }
        }
Пример #50
0
 public MultiDragScrolled()
 {
     status = STATUS.NOT;
 }
Пример #51
0
 private void UpdateStatus(Location entity, STATUS status)
 {
     entity.Status = status;
     this.Update(entity);
 }
Пример #52
0
 private void UpdatePriceStatus(Price price, STATUS status)
 {
     price.Status = status;
     _context.Prices.Update(price);
     _context.SaveChanges();
 }
Пример #53
0
 private void UpdateGroupStatus(Group group, STATUS status)
 {
     group.Status = status;
     _context.Groups.Update(group);
     _context.SaveChanges();
 }
Пример #54
0
 private void UpdateStatus(Customer entity, STATUS status)
 {
     entity.Status = status;
     this.Update(entity);
 }
Пример #55
0
 private async Task <IEnumerable <Flight> > getFlightsByStatus(STATUS status)
 {
     return(await this.FindAsync(m => m.Status == status));
 }
Пример #56
0
 public CommonAttack(STATUS nextStatus, ANIM_INDEX animIndex, bool CanUnderAttack) : this(nextStatus, animIndex)
 {
     mCanUnderAttack = CanUnderAttack;
 }
Пример #57
0
 protected virtual bool SequenceCondition(STATUS status)
 {
     if(IsSuccess(status))
     {
         //Debug.Log("[SequentialBT] Aumento contador de nodos");
         ++mn_CurrentNode;
         return true;
     }
     return false;
 }
Пример #58
0
    public CommonAttack(STATUS nextStatus, ANIM_INDEX animIndex)
    {
//        this.mBackStatus = backStatus;
        this.mNextStatus = nextStatus;
        this.mAnimIndex  = animIndex;
    }
        internal ScheduledJob(byte[] bytes)
        {
            #region FIXDLEN_DATA

            ProductVersion = (PRODUCT_VERSION)BitConverter.ToUInt16(bytes, 0x00);
            FileVersion = BitConverter.ToUInt16(bytes, 0x02);
            UUID = new Guid(BitConverter.ToInt32(bytes, 0x04), BitConverter.ToInt16(bytes, 0x08), BitConverter.ToInt16(bytes, 0x0A), NativeMethods.GetSubArray(bytes, 0x0C, 0x08));
            ApplicationNameOffset = BitConverter.ToUInt16(bytes, 0x14);
            TriggerOffset = BitConverter.ToUInt16(bytes, 0x16);
            ErrorRetryCount = BitConverter.ToUInt16(bytes, 0x18);
            ErrorRetryInterval = BitConverter.ToUInt16(bytes, 0x1A);
            IdleDeadline = BitConverter.ToUInt16(bytes, 0x1C);
            IdleWait = BitConverter.ToUInt16(bytes, 0x1E);
            //Priority = (PRIORITY_CLASS)BitConverter.ToUInt32(bytes, 0x20);
            MaximumRuntime = BitConverter.ToUInt32(bytes, 0x24);
            ExitCode = BitConverter.ToUInt32(bytes, 0x28);
            Status = (STATUS)BitConverter.ToUInt32(bytes, 0x2C);
            Flags = (TASK_FLAG)BitConverter.ToUInt32(bytes, 0x30);
            #region RunTime

            short year = BitConverter.ToInt16(bytes, 0x34);
            short month = BitConverter.ToInt16(bytes, 0x36);
            short day = BitConverter.ToInt16(bytes, 0x3A);
            short hour = BitConverter.ToInt16(bytes, 0x3C);
            short minute = BitConverter.ToInt16(bytes, 0x3E);
            short second = BitConverter.ToInt16(bytes, 0x40);
            short milliseconds = BitConverter.ToInt16(bytes, 0x42);
            if (year != 0)
            {
                RunTime = new DateTime(year, month, day, hour, minute, second, milliseconds, DateTimeKind.Utc);
            }
            else
            {
                RunTime = new DateTime(0);
            }

            #endregion RunTime

            #endregion FIXDLEN_DATA

            #region Variable-Length Data Section

            RunningInstanceCount = BitConverter.ToUInt16(bytes, 0x44);
            ApplicationNameLength = BitConverter.ToUInt16(bytes, ApplicationNameOffset);
            ApplicationName = Encoding.Unicode.GetString(bytes, ApplicationNameOffset + 0x02, ApplicationNameLength * 0x02).Split('\0')[0];

            int parameterOffset = ApplicationNameOffset + 0x02 + (ApplicationNameLength * 2);
            ParameterLength = BitConverter.ToUInt16(bytes, parameterOffset);
            Parameters = Encoding.Unicode.GetString(bytes, parameterOffset, ParameterLength * 0x02).Split('\0')[0];

            int workingdirectoryOffset = parameterOffset + 0x02 + (ParameterLength * 2);
            WorkingDirectoryLength = BitConverter.ToUInt16(bytes, workingdirectoryOffset);
            WorkingDirectory = Encoding.Unicode.GetString(bytes, workingdirectoryOffset, WorkingDirectoryLength * 2).Split('\0')[0];

            int authorOffset = workingdirectoryOffset + 0x02 + (WorkingDirectoryLength * 2);
            AuthorLength = BitConverter.ToUInt16(bytes, authorOffset);
            Author = Encoding.Unicode.GetString(bytes, authorOffset, AuthorLength * 2).Split('\0')[0];

            int commentOffset = authorOffset + 0x02 + (AuthorLength * 2);
            CommentLength = BitConverter.ToUInt16(bytes, commentOffset);
            Comment = Encoding.Unicode.GetString(bytes, commentOffset, CommentLength * 2).Split('\0')[0];

            #region StartTime

            year = BitConverter.ToInt16(bytes, TriggerOffset + 0x06);
            month = BitConverter.ToInt16(bytes, TriggerOffset + 0x08);
            day = BitConverter.ToInt16(bytes, TriggerOffset + 0x0A);
            hour = BitConverter.ToInt16(bytes, TriggerOffset + 0x12);
            minute = BitConverter.ToInt16(bytes, TriggerOffset + 0x14);
            StartTime = new DateTime(year, month, day, hour, minute, 0, DateTimeKind.Utc);

            #endregion StartTime

            #endregion Variable-Length Data Section
        }
Пример #60
0
 public override void OnInit()
 {
     status     = STATUS.INACTIVE;
     giveupTime = 0f;
 }