Пример #1
0
    public System.Collections.Generic.List <GameObject> getObjectsOnlyInA(WorldBox boxA, WorldBox boxB)
    {
        System.Collections.Generic.List <GameObject>    results = new System.Collections.Generic.List <GameObject>();
        System.Collections.Generic.HashSet <GameObject> localItems;
        IndexBox box1 = this.getIndexBoxFromWorldBox(boxA);
        IndexBox box2 = this.getIndexBoxFromWorldBox(boxB);

        int[] coordinates = new int[2];
        int[] indices     = new int[2];
        //int i;
        IndexBox itemIndexBox;

        //GameObject currentItem;
        // Check each box inside the larger indexbox
        for (coordinates[0] = box1.getLowCoordinate(0); coordinates[0] <= box1.getHighCoordinate(0); coordinates[0]++)
        {
            // wraparound
            indices[0] = coordinates[0] % this.numBlocks[0];
            if (indices[0] < 0)
            {
                indices[0] += this.numBlocks[0];
            }
            for (coordinates[1] = box1.getLowCoordinate(1); coordinates[1] <= box1.getHighCoordinate(1); coordinates[1]++)
            {
                // wraparound
                indices[1] = coordinates[1] % this.numBlocks[1];
                if (indices[1] < 0)
                {
                    indices[1] += this.numBlocks[1];
                }
                // Make sure that the current point isn't inside the smaller index box
                if (!(box2.contains(coordinates)))
                {
                    // Iterate over each item inside the box
                    localItems = this.worldBlocks[indices[0], indices[1]];
                    foreach (GameObject currentItem in localItems)
                    {
                        //currentItem = localItems[i];
                        itemIndexBox = this.getIndexBoxFromWorldBox(currentItem.getBoundingBox());
                        // Make sure that the item does intersect the larger box but not the smaller index box
                        if (itemIndexBox.intersects(box1) && !(itemIndexBox.intersects(box2)))
                        {
                            // Now add it to the resultant list if needed
                            if (!results.Contains(currentItem))
                            {
                                results.Add(currentItem);
                            }
                        }
                    }
                }
            }
        }
        return(results);
    }
Пример #2
0
    public void attack(GameObject dragon)
    {
        if (!listDragon.Contains(dragon))
        {
            listDragon.Add(dragon);
        }

        controller.stateAttack.target = dragon.gameObject;

        if (dragon.transform.position.x < controller.transform.position.x)
        {
            controller.stateMove.Direction = EDragonStateDirection.RIGHT;
        }
        else
        {
            controller.stateMove.Direction = EDragonStateDirection.LEFT;
        }

        controller.stateMove.State = EEnemyMovement.MOVE_TO_DRAGON;
    }
Пример #3
0
 /*
  * Equation de cercle
  *
  * Soit O centre du cercle et M un point du cercle tel que OM² = raySquare
  * alors le cercle a pour équation :
  * (Ym-Yo)² + (Xm-Xo)² = OM²
  *
  * donc si le rayon entre le centre du cercle et notre unité a une distance <= raySquare alors l'unité est
  * dans le cercle
  */
 void unitIn(Team t)
 {
     foreach (Unit u in t)
     {
         if ((u.transform.position.x - this.transform.position.x) * (u.transform.position.x - this.transform.position.x) +
             (u.transform.position.z - this.transform.position.z) * (u.transform.position.z - this.transform.position.z) <= raySquare)
         {
             if (!unitInCircle.Contains(u))
             {
                 unitInCircle.Add(u);
                 u.canCatchTheBall = false;
             }
         }
         else if (unitInCircle.Contains(u))
         {
             unitInCircle.Remove(u);
             u.canCatchTheBall = true;
         }
     }
 }
Пример #4
0
 public void OnCollisionEnter(Collision collision)
 {
     if (collision.transform.CompareTag("Ball"))
     {
         if (!pocketTriggerBallList.Contains(collision.collider.GetInstanceID()))
         {
             HOAudioManager.PottedBall();
             collision.transform.GetComponent <PoolBall>().CloseRenderer();
             pocketTriggerBallList.Add(collision.collider.GetInstanceID());
         }
     }
 }
    public static void FilterGrid(this GridControl grid, System.Collections.Generic.List <string> columnNames, string criteria, string query_add)
    {
        GridView view  = grid.MainView as GridView;
        string   query = "";

        criteria = criteria.Trim().ToLower();

        foreach (var item in criteria.Split(' '))
        {
            string subquery = "";

            if (item.Length == 0)
            {
                continue;
            }

            foreach (GridColumn col in view.Columns) // foreach (GridColumn col in view.VisibleColumns)
            {
                if (col.FieldName.Length == 0)
                {
                    continue;
                }
                if (columnNames.Contains(col.FieldName) == false)
                {
                    continue;
                }

                if (subquery.Length > 0)
                {
                    subquery += " OR ";
                }

                subquery += String.Format("[{0}] LIKE '%{1}%'", col.FieldName, EscapeLikeValue(item));
            }

            if (subquery.Length > 0)
            {
                if (query.Length > 0)
                {
                    query += " AND ";
                }

                query += String.Format("({0})", subquery);
            }
        }

        if (query_add.Length > 0 && query.Length > 0)
        {
            query += String.Format(" OR ({0})", query_add);
        }

        view.ActiveFilterString = query;
    }
    public void Setup()
    {
#if UNITY_EDITOR
        // Search for "InitTestSceneXXXXXXXX" generated by test runner and save the path in the EditorPrefs
        for (int i = 0; i < EditorSceneManagement.EditorSceneManager.sceneCount; ++i)
        {
            Scene scene = EditorSceneManagement.EditorSceneManager.GetSceneAt(i);
            if (scene.name.StartsWith("InitTestScene"))
            {
                EditorPrefs.SetString("InitTestScene", scene.path);
                break;
            }
        }

        string scenesWithAutoLightMap = "";

        // For each scene in the build settings, force build of the lightmaps if it has "DoLightmap" label.
        foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes)
        {
            SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath <SceneAsset>(scene.path);
            var        labels     = new System.Collections.Generic.List <string>(AssetDatabase.GetLabels(sceneAsset));

            if (labels.Contains("DoLightmap"))
            {
                EditorSceneManagement.EditorSceneManager.OpenScene(scene.path, EditorSceneManagement.OpenSceneMode.Single);

                Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand;
                EditorSceneManagement.EditorSceneManager.SaveOpenScenes();

                Lightmapping.Clear();
                Lightmapping.Bake();

                scenesWithAutoLightMap += scene.path + ";";

                EditorSceneManagement.EditorSceneManager.SaveOpenScenes();

                Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.Iterative;
                EditorSceneManagement.EditorSceneManager.SaveOpenScenes();

                EditorSceneManagement.EditorSceneManager.NewScene(EditorSceneManagement.NewSceneSetup.EmptyScene);
            }
        }

        EditorPrefs.SetString("ScenesWithAutoLightMap", scenesWithAutoLightMap);

        // Re-open testrunner scene
        string initTestSceneString = EditorPrefs.GetString("InitTestScene");
        if (!string.IsNullOrEmpty(initTestSceneString))
        {
            EditorSceneManagement.EditorSceneManager.OpenScene(initTestSceneString, EditorSceneManagement.OpenSceneMode.Single);
        }
#endif
    }
 void AddNewEnemy(ActionController ac)
 {
     if (!_savedTarget.Contains(ac))
     {
         _savedTarget.Add(ac);
         // give target damage.
         if (_freeChains.Count > 0 && AssignChainToNewTarget(_freeChains[0]))
         {
             _freeChains.RemoveAt(0);
         }
     }
 }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        System.Collections.Generic.List <State> listcopy;

        listcopy = new System.Collections.Generic.List <State>(list);
        foreach (State tmp in listcopy)
        {
            if (list.Contains(tmp))
            {
                tmp.OnUpdate();
            }
        }
    }
 public static System.Collections.Generic.List <int> CommonElements(System.Collections.Generic.List <int> list1, System.Collections.Generic.List <int> list2)
 {
     System.Collections.Generic.List <int> sameIntegers = new System.Collections.Generic.List <int>();
     foreach (int item in list1)
     {
         if (list2.Contains(item))
         {
             sameIntegers.Add(item);
         }
     }
     sameIntegers.Sort();
     return(sameIntegers);
 }
Пример #10
0
 private void ModifyControllerSpeed(PF2DController controller, bool isMultiply)
 {
     //if isMultiply set to false, will divide then
     if (moveSpeedMultiplier < 0)
     {
         Debug.LogWarning(GetType().Name + " of " + name + " warning: moveSpeedMultiplier set < 0. This might cause strange move.");
     }
     if (moveSpeedMultiplier == 0)
     {
         Debug.LogWarning(GetType().Name + " of " + name + " warning: moveSpeedMultiplier set to 0. To avoid bugs, the script will not modify movingSpeed.");
     }
     else
     {
         if (thingsHasBeenSpeedUp.Contains(controller) == true && isMultiply == true)
         {
             return;                                                                         //has been multiplied, don't do twice.
         }
         if (thingsHasBeenSpeedUp.Contains(controller) == false && isMultiply == true)
         {
             Debug.Log("original move speed is " + controller.movingSpeed);
             controller.movingSpeed *= moveSpeedMultiplier;
             //p.AddVelocity(new Vector2((moveSpeedMultiplier-1)*rb.velocity.x, (moveSpeedMultiplier - 1) * rb.velocity.y));
             //rb.velocity *=  moveSpeedMultiplier * (p.isFacingRight ? 1f : -1f);
             thingsHasBeenSpeedUp.Add(controller);
             Debug.Log("set multiplied completed. now speed is " + controller.movingSpeed);
         }
         else if (thingsHasBeenSpeedUp.Contains(controller) == false && isMultiply == false)
         {
             Debug.LogWarning(GetType().Name + " warning: trying to divide speed of " + controller.gameObject.name + " which isn't multiplied before. To avoid bugs the speed will not divide. Check your flow.");
         }
         else if (thingsHasBeenSpeedUp.Contains(controller) == true && isMultiply == false)
         {
             controller.movingSpeed /= moveSpeedMultiplier;
             thingsHasBeenSpeedUp.Remove(controller);
             Debug.Log("set divided completed. now speed is " + controller.movingSpeed);
         }
     }
 }
Пример #11
0
 static public int Contains(IntPtr l)
 {
     try {
         System.Collections.Generic.List <UnityEngine.GameObject> self = (System.Collections.Generic.List <UnityEngine.GameObject>)checkSelf(l);
         UnityEngine.GameObject a1;
         checkType(l, 2, out a1);
         var ret = self.Contains(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Contains(IntPtr l)
 {
     try {
         System.Collections.Generic.List <System.Int32> self = (System.Collections.Generic.List <System.Int32>)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.Contains(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #13
0
    /// <summary>
    /// Calculates the defines to set on the C# project based on a list of defines to add
    /// and a list of defines to remove.
    /// </summary>
    /// <param name="addDefines">The semicolon separated list of defines to add.</param>
    /// <param name="removeDefines">The semicolon separated list of defines to remove.</param>
    /// <returns>The final calculated list of defines.</returns>
    public string CalculateDefines(string addDefines, string removeDefines)
    {
        var addArray    = addDefines.Trim(';').Split(';');
        var removeArray = removeDefines.Trim(';').Split(';');

        var list = new System.Collections.Generic.List <string>();

        foreach (var a in addArray)
        {
            if (!list.Contains(a))
            {
                list.Add(a);
            }
        }
        foreach (var r in removeArray)
        {
            if (list.Contains(r))
            {
                list.Remove(r);
            }
        }

        return(string.Join(";", list.ToArray()));
    }
 static public int Contains(IntPtr l)
 {
     try {
         System.Collections.Generic.List <System.Int32> self = (System.Collections.Generic.List <System.Int32>)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         var ret = self.Contains(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int Contains(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.List <string> obj = (System.Collections.Generic.List <string>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <string>));
         string arg0 = ToLua.CheckString(L, 2);
         bool   o    = obj.Contains(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int Contains(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.List <VisowFrameWork.LuaComponent> obj = (System.Collections.Generic.List <VisowFrameWork.LuaComponent>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <VisowFrameWork.LuaComponent>));
         VisowFrameWork.LuaComponent arg0 = (VisowFrameWork.LuaComponent)ToLua.CheckObject <VisowFrameWork.LuaComponent>(L, 2);
         bool o = obj.Contains(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    public static int Sum(System.Collections.Generic.List <int> myList)
    {
        System.Collections.Generic.List <int> sumUnique = new System.Collections.Generic.List <int>();

        int sumIntegers = 0;

        foreach (int item in myList)
        {
            if (!sumUnique.Contains(item))
            {
                sumIntegers += item;
                sumUnique.Add(item);
            }
        }
        return(sumIntegers);
    }
 static int Contains(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.List <UnityEngine.EventSystems.EventTrigger.Entry> obj = (System.Collections.Generic.List <UnityEngine.EventSystems.EventTrigger.Entry>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <UnityEngine.EventSystems.EventTrigger.Entry>));
         UnityEngine.EventSystems.EventTrigger.Entry arg0 = (UnityEngine.EventSystems.EventTrigger.Entry)ToLua.CheckObject <UnityEngine.EventSystems.EventTrigger.Entry>(L, 2);
         bool o = obj.Contains(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #19
0
 static int Contains(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.List <System.Action <Framework.BaseUi> > obj = (System.Collections.Generic.List <System.Action <Framework.BaseUi> >)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <System.Action <Framework.BaseUi> >));
         System.Action <Framework.BaseUi> arg0 = (System.Action <Framework.BaseUi>)ToLua.CheckDelegate <System.Action <Framework.BaseUi> >(L, 2);
         bool o = obj.Contains(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #20
0
    public void AddOrRemoveSelectedObjects(System.Collections.Generic.IEnumerable <SongObject> songObjects)
    {
        var selectedObjectsList = new System.Collections.Generic.List <SongObject>(currentSelectedObjects);

        foreach (SongObject songObject in songObjects)
        {
            if (!selectedObjectsList.Contains(songObject))
            {
                AddToSelectedObjects(songObject);
            }
            else
            {
                RemoveFromSelectedObjects(songObject);
            }
        }
    }
 static int Contains(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.Collections.Generic.List <UnityEngine.Material> obj = (System.Collections.Generic.List <UnityEngine.Material>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <UnityEngine.Material>));
         UnityEngine.Material arg0 = (UnityEngine.Material)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Material));
         bool o = obj.Contains(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Пример #22
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (!enabled)
        {
            return;
        }
        //creat frosted Ice when walking on water
        if (CheckLayerIsInTheLayerMask(col.gameObject.layer, water))
        {
            if (frozenWater.Contains(col.gameObject))
            {
                return;                                       //already did the ice instantiation.
            }
            if (icePrefab == null)
            {
                Debug.LogError(GetType().Name + " error: trying to instantiate ice while icePrefab not selected.");
                return;
            }
            Rigidbody2D rb = GetComponent <Rigidbody2D>();
            if (rb)
            {
                rb.velocity -= new Vector2(0, rb.velocity.y);
            }
            transform.position += new Vector3(0, heightTuning * 1.3f);  //this help ice effect work normally

            //create an ice
            Vector3 p = new Vector3(
                col.transform.position.x,
                col.bounds.ClosestPoint(transform.position).y + heightTuning);
            GameObject ice            = Instantiate(icePrefab, p, Quaternion.Euler(0, 0, 0)) as GameObject;
            float      iceLocalLength = col.bounds.size.x / ice.transform.lossyScale.x;
            ice.transform.localScale = new Vector3(iceLocalLength, ice.transform.localScale.y);
            ice.transform.SetParent(col.transform);
            //Debug.Log("An ice " + ice.name + " has been instantiated.");
            //create finished.

            frozenWater.Add(col.gameObject);
        }

        PropertyFrozen f = col.gameObject.GetComponent <PropertyFrozen>();

        if (f != null)
        {
            //Debug.Log("Ready to set stay frozen");
            f.StayFrozen(true);
        }
    }
Пример #23
0
 private bool tes03(int[] nums)
 {
     print(nums.Length);
     System.Collections.Generic.List <int> lisnt = new System.Collections.Generic.List <int>();
     for (int i = 0; i < nums.Length; i++)
     {
         if (lisnt.Contains(nums[i]))
         {
             return(true);
         }
         else
         {
             lisnt.Add(nums[i]);
         }
     }
     return(false);
 }
    static int Contains(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> obj = (System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)ToLua.CheckObject(L, 1, typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>));
            UnityEngine.EventSystems.RaycastResult arg0 = StackTraits <UnityEngine.EventSystems.RaycastResult> .Check(L, 2);

            bool o = obj.Contains(arg0);
            LuaDLL.lua_pushboolean(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #25
0
    public static void SetTimeScaleModifierIsPost(bool isPost, GameObject source)
    {
        if (!m_sources.Contains(source))
        {
            m_sources.Add(source);
            m_multipliers.Add(1f);
        }

        if (!m_post.ContainsKey(source))
        {
            m_post.Add(source, false);
        }

        int index = m_sources.IndexOf(source);

        m_post[source] = isPost;
        UpdateTimeScale();
    }
Пример #26
0
 public virtual void OnSceneGUI()
 {
     if (targetList.Contains(target))
     {
         // We got all targets.
         if (target == targetList [0])
         {
             // First call of OnSceneGUI(). Time to relay.
             OnMultiEdit(targetList);
         }
     }
     else
     {
         // Build the target list first, skipping the first event.
         // First event usually is a Layout event which is generally not interesting anyway.
         targetList.Add(target);
     }
 }
Пример #27
0
    // Uses the worldBlocks array to speed up the search for objects inside the given index box. This is good when the box is small
    private System.Collections.Generic.List <GameObject> searchWorldForIndexBox(IndexBox indexBox)
    {
        System.Collections.Generic.List <GameObject>    resultantList = new System.Collections.Generic.List <GameObject>();
        System.Collections.Generic.HashSet <GameObject> localItems;
        //GameObject tempItem;
        int x1 = (int)(indexBox.getLowCoordinate(0));
        int x2 = (int)(indexBox.getHighCoordinate(0));
        int y1 = (int)(indexBox.getLowCoordinate(1));
        int y2 = (int)(indexBox.getHighCoordinate(1));
        int i, j, x, y;

        // check each block inside the bounding box
        for (i = x1; i <= x2; i++)
        {
            // wraparound
            x = i % this.numBlocks[0];
            if (x < 0)
            {
                x += this.numBlocks[0];
            }
            for (j = y1; j <= y2; j++)
            {
                // wraparound
                y = j % this.numBlocks[1];
                if (y < 0)
                {
                    y += this.numBlocks[1];
                }
                // check each item in the block
                localItems = this.worldBlocks[x, y];
                foreach (GameObject currentItem in localItems)
                {
                    //tempItem = localItems[k];
                    // make sure the item isn't there already
                    if (!resultantList.Contains(currentItem))
                    {
                        //Now we store it in the list of collisions
                        resultantList.Add(currentItem);
                    }
                }
            }
        }
        return(resultantList);
    }
    public static System.Collections.Generic.List <int> DifferentElements(System.Collections.Generic.List <int> list1, System.Collections.Generic.List <int> list2)
    {
        System.Collections.Generic.List <int> listDifferents = new System.Collections.Generic.List <int>();


        foreach (int item in list1)
        {
            if (!list2.Contains(item))
            {
                listDifferents.Add(item);
            }
        }

        foreach (int item in list2)
        {
            if (!list1.Contains(item))
            {
                listDifferents.Add(item);
            }
        }
        listDifferents.Sort();
        return(listDifferents);
    }
Пример #29
0
    protected bool loadObject()
    {
        EInbox obj   = new EInbox();
        bool   isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest);

        if (!db.select(dbConn, obj))
        {
            if (CurID <= 0)
            {
                return(false);
            }
            else
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            }
        }
        if (obj.UserID != 0 && obj.UserID != user.UserID)
        {
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
        }
        if (obj.InboxReadDate.Ticks.Equals(0))
        {
            obj.InboxReadDate = AppUtils.ServerDateTime();
            db.update(dbConn, obj);
        }
        if (obj.InboxType.Equals(EInbox.INBOX_TYPE_DATE_OF_BIRTH) || obj.InboxType.Equals(EInbox.INBOX_TYPE_DATE_OF_BIRTH_18) || obj.InboxType.Equals(EInbox.INBOX_TYPE_DATE_OF_BIRTH_65) || obj.InboxType.Equals(EInbox.INBOX_TYPE_PROBATION))
        {
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Emp_View.aspx?EmpID=" + obj.EmpID);
        }
        else if (obj.InboxType.Equals(EInbox.INBOX_TYPE_TERMINATION))
        {
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/EmpTab_Termination_View.aspx?EmpID=" + obj.EmpID);
        }
        else if (obj.InboxType.Equals(EInbox.INBOX_TYPE_WORKPERMITEXPIRY))
        {
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Emp_Permit_view.aspx?EmpID=" + obj.EmpID + "&EmpPermitID=" + obj.InboxRelatedRecID);
        }
        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);

        InboxFromUserID.Text = obj.GetFromUserName(dbConn);
        InboxSubject.Text    = AppUtils.GetActualInboxSubject(dbConn, obj);
        DBFilter inboxAttachmentFilter = new DBFilter();

        inboxAttachmentFilter.add(new Match("InboxID", obj.InboxID));
        ArrayList inboxAttachmentList = EInboxAttachment.db.select(dbConn, inboxAttachmentFilter);

        if (inboxAttachmentList.Count > 0)
        {
            InboxAttachmentRepeater.DataSource = inboxAttachmentList;
            InboxAttachmentRepeater.DataBind();
        }
        else
        {
            AttachmentRow.Visible = false;
        }
        System.Collections.Generic.List <string> inboxTypeArray = new System.Collections.Generic.List <string>(obj.InboxType.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries));
        if (inboxTypeArray.Contains(EInbox.INBOX_TYPE_FOR_ECHANNEL) && !inboxTypeArray.Contains(EInbox.INBOX_TYPE_FOR_ECHANNEL_SUBMITTED))
        {
            eChannelRow.Visible = true;
            InboxMessage.Text  += "<br/>"
                                  + "<p style=\"color:red\">" + HttpUtility.HtmlEncode(HROne.Translation.PageMessage.BANKFILE_CONSOLIDATION_MESSAGE) + "<br/>"
                                  + HttpUtility.HtmlEncode(HROne.Translation.PageMessage.BANKFILE_CLEARING_MESSAGE) + "</p><br/>";
        }
        else
        {
            eChannelRow.Visible = false;
        }

        return(true);
    }
Пример #30
0
    public static System.Collections.IEnumerator Extract(string inFile, string outDir, DelegateProgress progress, DelegateFinish finish,
                                                         System.Collections.Generic.List <string> skipList = null)
    {
        UnityEngine.Debug.Log(inFile + "->" + outDir);
        bool bFail = false;

        if (System.IO.File.Exists(inFile))
        {
            System.IO.FileStream fin = System.IO.File.OpenRead(inFile);
            //UnityEngine.Debug.Log("Open " + inFile + " = " + fin);
            if (fin != null)
            {
                System.IO.BinaryReader fbr = new System.IO.BinaryReader(fin);

                if (!System.IO.Directory.Exists(outDir))
                {
                    System.IO.Directory.CreateDirectory(outDir);
                }
                int nFiles = fbr.ReadInt32();
                for (int i = 0; i < nFiles; ++i)
                {
                    yield return(1);

                    int    nameLen  = fbr.ReadInt32();
                    string fileName = System.Text.Encoding.UTF8.GetString(fbr.ReadBytes(nameLen));
                    int    byteLen  = fbr.ReadInt32();

                    long fileSize = 0;
                    if (skipList != null && skipList.Contains(fileName))
                    {
                        UnityEngine.Debug.Log("Skip: " + fileName + " Length: " + byteLen);
                        fbr.ReadBytes(byteLen);
                    }
                    else
                    {
                        UnityEngine.Debug.Log("Extract: " + fileName + " Length: " + byteLen);
                        byte[] nbytes = null;
                        try {
                            if (byteLen > 0)
                            {
                                nbytes = Decompress(fbr.ReadBytes(byteLen));
                            }
                            else
                            {
                                throw new System.IndexOutOfRangeException("ZeroLength");
                            }
                        } catch (System.Exception e) {
                            UnityEngine.Debug.LogError(e.Message);
                            fileSize = -1;
                            bFail    = true;
                        }

                        if (nbytes != null)
                        {
                            fileSize = nbytes.LongLength;
                            System.IO.FileStream fs = System.IO.File.Create(outDir + "/" + fileName);
                            fs.Write(nbytes, 0, nbytes.Length);
                            fs.Close();
                        }
                    }
                    if (progress != null)
                    {
                        progress(i + 1, nFiles, fileName, fileSize);
                    }
                    if (bFail)
                    {
                        break;
                    }
                }
                fbr.Close();
                fin.Close();
            }
            else
            {
                UnityEngine.Debug.LogError("Open " + inFile + " = " + fin);
            }
        }
        if (finish != null && !bFail)
        {
            finish(inFile);
        }
    }