Пример #1
0
    private Unit GroupBy(Func <Cod, Cod, bool> equiparator, List <Cod> cods)
    {
        Unit unit = new Unit();

        if (IsNullOrEmptyList(cods))
        {
            return(unit);
        }

        Seq seq = new Seq();

        unit.Add(seq);
        seq.Add(cods[0]);

        for (int i = 1; i < cods.Count; i++)
        {
            if (!equiparator(cods[i - 1], cods[i]))
            {
                seq = new Seq();
                unit.Add(seq);
            }

            seq.Add(cods[i]);
        }

        return(unit);
    }
Пример #2
0
		void AddNativeLibrary (ArchiveFileList files, string path, string abi, string archiveFileName)
		{
			string fileName = string.IsNullOrEmpty (archiveFileName) ? Path.GetFileName (path) : archiveFileName;
			var item = (filePath: path, archivePath: $"lib/{abi}/{fileName}");
			if (files.Any (x => x.archivePath == item.archivePath)) {
				Log.LogCodedWarning ("XA4301", path, 0, Properties.Resources.XA4301, item.archivePath);
				return;
			}
			files.Add (item);
		}
Пример #3
0
        /// <summary> 测试方法 耗时2.5s </summary>
        public static void LongTimeMethod()
        {
            var list2 = new Collections.Generic.List <string>();

            for (int i = 0; i < 5000000; i++)
            {
                list2.Add(i.ToString());
            }
            list2 = null;
        }
Пример #4
0
        void AddNativeLibrary(ArchiveFileList files, string path, string abi)
        {
            var    item          = (filePath : path, archivePath : $"lib/{abi}");
            string filename      = "/" + Path.GetFileName(item.filePath);
            string inArchivePath = item.archivePath + filename;

            if (files.Any(x => (x.archivePath + "/" + Path.GetFileName(x.filePath)) == inArchivePath))
            {
                Log.LogCodedWarning("XA4301", path, 0, Properties.Resources.XA4301, inArchivePath);
                return;
            }
            files.Add(item);
        }
Пример #5
0
        void AddNativeLibrary(ArchiveFileList files, string path, string abi)
        {
            var    item          = (filePath : path, archivePath : $"lib/{abi}");
            string filename      = "/" + Path.GetFileName(item.filePath);
            string inArchivePath = item.archivePath + filename;

            if (files.Any(x => (x.archivePath + "/" + Path.GetFileName(x.filePath)) == inArchivePath))
            {
                Log.LogCodedWarning("XA4301", path, 0, $"Apk already contains the item {inArchivePath}; ignoring.");
                return;
            }
            files.Add(item);
        }
Пример #6
0
        private static (ILine first, ILine second) GetOverlapping(ILine first, ILine second)
        {
            var firstOverlap  = new Line();
            var secondOverlap = new Line();

            foreach (var firstTilePosition in first)
            {
                var secondTilePosition = second.FirstOrDefault(tilePosition => tilePosition.Coordinates.IsOverlapping(firstTilePosition.Coordinates));
                if (secondTilePosition != default(TilePosition))
                {
                    firstOverlap.Add(firstTilePosition);
                    secondOverlap.Add(secondTilePosition);
                }
            }

            return(firstOverlap, secondOverlap);
        }
Пример #7
0
    /// <summary>
    /// 在给定范围内查找指定方向的最近物体
    /// </summary>
    /// <param name="transList">列表</param>
    /// <param name="current">当前物体</param>
    /// <param name="dir">查找方向</param>
    public static Transform FindClosestTrans(Transform[] transList, Transform current, Vector2 dir)
    {
        var alternativeTrans = new System.Collections.Generic.List <Transform>();

        dir = dir.normalized;

        // 筛选指定方向区域的按钮
        foreach (var trans in transList)
        {
            if (trans == current)
            {
                continue;
            }

            if (dir == Vector2.up)
            {
                if (trans.position.y >= current.position.y)
                {
                    alternativeTrans.Add(trans);
                }
            }
            else if (dir == Vector2.down)
            {
                if (trans.position.y <= current.position.y)
                {
                    alternativeTrans.Add(trans);
                }
            }
            else if (dir == Vector2.left)
            {
                if (trans.position.x <= current.position.x)
                {
                    alternativeTrans.Add(trans);
                }
            }
            else if (dir == Vector2.right)
            {
                if (trans.position.x >= current.position.x)
                {
                    alternativeTrans.Add(trans);
                }
            }
        }

        if (alternativeTrans.Count == 0)
        {
            return(null);
        }

        if (alternativeTrans.Count == 1)
        {
            return(alternativeTrans[0]);
        }

        // 查找筛选后点距最小的按钮
        float     minDistance  = float.MaxValue;
        Transform closestTrans = null;

        foreach (var trans in alternativeTrans)
        {
            var dis = Vector2.Distance(trans.position, current.position);
            if (dis < minDistance)
            {
                minDistance  = dis;
                closestTrans = trans;
            }
        }

        return(closestTrans);
    }
Пример #8
0
    static void SetGraphicsSettings()
    {
        Debug.Log("Setting Graphics Settings");

        const string     GraphicsSettingsAssetPath = "ProjectSettings/GraphicsSettings.asset";
        SerializedObject graphicsManager           = new SerializedObject(UnityEditor.AssetDatabase.LoadAllAssetsAtPath(GraphicsSettingsAssetPath)[0]);

        SerializedProperty deferred = graphicsManager.FindProperty("m_Deferred.m_Mode");

        deferred.enumValueIndex = 1;

        SerializedProperty deferredReflections = graphicsManager.FindProperty("m_DeferredReflections.m_Mode");

        deferredReflections.enumValueIndex = 1;

        SerializedProperty screenSpaceShadows = graphicsManager.FindProperty("m_ScreenSpaceShadows.m_Mode");

        screenSpaceShadows.enumValueIndex = 1;

        SerializedProperty legacyDeferred = graphicsManager.FindProperty("m_LegacyDeferred.m_Mode");

        legacyDeferred.enumValueIndex = 1;

        SerializedProperty depthNormals = graphicsManager.FindProperty("m_DepthNormals.m_Mode");

        depthNormals.enumValueIndex = 1;

        SerializedProperty motionVectors = graphicsManager.FindProperty("m_MotionVectors.m_Mode");

        motionVectors.enumValueIndex = 1;

        SerializedProperty lightHalo = graphicsManager.FindProperty("m_LightHalo.m_Mode");

        lightHalo.enumValueIndex = 1;

        SerializedProperty lensFlare = graphicsManager.FindProperty("m_LensFlare.m_Mode");

        lensFlare.enumValueIndex = 1;

#if ENV_SET_INCLUDED_SHADERS && VRC_CLIENT
        SerializedProperty alwaysIncluded = graphicsManager.FindProperty("m_AlwaysIncludedShaders");
        alwaysIncluded.arraySize = 0;   // clear GraphicsSettings->Always Included Shaders - these cause a +5s app startup time increase on Quest.
                                        // include Shader objects as resources instead

#if ENV_SEARCH_FOR_SHADERS
        Resources.LoadAll("", typeof(Shader));
        System.Collections.Generic.List <Shader> foundShaders = Resources.FindObjectsOfTypeAll <Shader>()
                                                                .Where(s => { string name = s.name.ToLower(); return(0 == (s.hideFlags & HideFlags.DontSave)); })
                                                                .GroupBy(s => s.name)
                                                                .Select(g => g.First())
                                                                .ToList();
#else
        System.Collections.Generic.List <Shader> foundShaders = new System.Collections.Generic.List <Shader>();
#endif

        for (int shaderIdx = 0; shaderIdx < ensureTheseShadersAreAvailable.Length; ++shaderIdx)
        {
            if (foundShaders.Any(s => s.name == ensureTheseShadersAreAvailable[shaderIdx]))
            {
                continue;
            }
            Shader namedShader = Shader.Find(ensureTheseShadersAreAvailable[shaderIdx]);
            if (namedShader != null)
            {
                foundShaders.Add(namedShader);
            }
        }

        foundShaders.Sort((s1, s2) => s1.name.CompareTo(s2.name));

        // populate Resources list of "always included shaders"
        ShaderAssetList alwaysIncludedShaders = AssetDatabase.LoadAssetAtPath <ShaderAssetList>("Assets/Resources/AlwaysIncludedShaders.asset");
        alwaysIncludedShaders.Shaders = new Shader[foundShaders.Count];
        for (int shaderIdx = 0; shaderIdx < foundShaders.Count; ++shaderIdx)
        {
            alwaysIncludedShaders.Shaders[shaderIdx] = foundShaders[shaderIdx];
        }
#endif

        SerializedProperty preloaded = graphicsManager.FindProperty("m_PreloadedShaders");
        preloaded.ClearArray();
        preloaded.arraySize = 0;

        SerializedProperty spritesDefaultMaterial = graphicsManager.FindProperty("m_SpritesDefaultMaterial");
        spritesDefaultMaterial.objectReferenceValue = Shader.Find("Sprites/Default");

        SerializedProperty renderPipeline = graphicsManager.FindProperty("m_CustomRenderPipeline");
        renderPipeline.objectReferenceValue = null;

        SerializedProperty transparencySortMode = graphicsManager.FindProperty("m_TransparencySortMode");
        transparencySortMode.enumValueIndex = 0;

        SerializedProperty transparencySortAxis = graphicsManager.FindProperty("m_TransparencySortAxis");
        transparencySortAxis.vector3Value = Vector3.forward;

        SerializedProperty defaultRenderingPath = graphicsManager.FindProperty("m_DefaultRenderingPath");
        defaultRenderingPath.intValue = 1;

        SerializedProperty defaultMobileRenderingPath = graphicsManager.FindProperty("m_DefaultMobileRenderingPath");
        defaultMobileRenderingPath.intValue = 1;

        SerializedProperty tierSettings = graphicsManager.FindProperty("m_TierSettings");
        tierSettings.ClearArray();
        tierSettings.arraySize = 0;

#if ENV_SET_LIGHTMAP
        SerializedProperty lightmapStripping = graphicsManager.FindProperty("m_LightmapStripping");
        lightmapStripping.enumValueIndex = 1;

        SerializedProperty instancingStripping = graphicsManager.FindProperty("m_InstancingStripping");
        instancingStripping.enumValueIndex = 2;

        SerializedProperty lightmapKeepPlain = graphicsManager.FindProperty("m_LightmapKeepPlain");
        lightmapKeepPlain.boolValue = true;

        SerializedProperty lightmapKeepDirCombined = graphicsManager.FindProperty("m_LightmapKeepDirCombined");
        lightmapKeepDirCombined.boolValue = true;

        SerializedProperty lightmapKeepDynamicPlain = graphicsManager.FindProperty("m_LightmapKeepDynamicPlain");
        lightmapKeepDynamicPlain.boolValue = true;

        SerializedProperty lightmapKeepDynamicDirCombined = graphicsManager.FindProperty("m_LightmapKeepDynamicDirCombined");
        lightmapKeepDynamicDirCombined.boolValue = true;

        SerializedProperty lightmapKeepShadowMask = graphicsManager.FindProperty("m_LightmapKeepShadowMask");
        lightmapKeepShadowMask.boolValue = true;

        SerializedProperty lightmapKeepSubtractive = graphicsManager.FindProperty("m_LightmapKeepSubtractive");
        lightmapKeepSubtractive.boolValue = true;
#endif

#if ENV_SET_FOG
        SerializedProperty fogStripping = graphicsManager.FindProperty("m_FogStripping");
        fogStripping.enumValueIndex = 1;

        SerializedProperty fogKeepLinear = graphicsManager.FindProperty("m_FogKeepLinear");
        fogKeepLinear.boolValue = true;

        SerializedProperty fogKeepExp = graphicsManager.FindProperty("m_FogKeepExp");
        fogKeepExp.boolValue = true;

        SerializedProperty fogKeepExp2 = graphicsManager.FindProperty("m_FogKeepExp2");
        fogKeepExp2.boolValue = true;
#endif

        SerializedProperty albedoSwatchInfos = graphicsManager.FindProperty("m_AlbedoSwatchInfos");
        albedoSwatchInfos.ClearArray();
        albedoSwatchInfos.arraySize = 0;

        SerializedProperty lightsUseLinearIntensity = graphicsManager.FindProperty("m_LightsUseLinearIntensity");
        lightsUseLinearIntensity.boolValue = true;

        SerializedProperty lightsUseColorTemperature = graphicsManager.FindProperty("m_LightsUseColorTemperature");
        lightsUseColorTemperature.boolValue = true;

        graphicsManager.ApplyModifiedProperties();
    }
Пример #9
0
    private void PerformShift()
    {
        // the focus object must be moved
        Debug.Assert(focusObject.GetComponentInParent <VtsObjectShiftingOriginBase>());

        // compute the transformation change
        double[] originalNavigationPoint = umap.UnityToVtsNavigation(zero3d);
        double[] targetNavigationPoint   = umap.UnityToVtsNavigation(VtsUtil.U2V3(focusObject.transform.position));
        if (!VtsMapMakeLocal.MakeLocal(umap, targetNavigationPoint))
        {
            Debug.Assert(false, "failed shifting origin");
            return;
        }
        Vector3 move = -focusObject.transform.position;
        float   Yrot = (float)(targetNavigationPoint[0] - originalNavigationPoint[0]) * Mathf.Sign((float)originalNavigationPoint[1]);

        // find objects that will be transformed
        var objs = new System.Collections.Generic.List <VtsObjectShiftingOriginBase>();

        foreach (VtsObjectShiftingOriginBase obj in FindObjectsOfType <VtsObjectShiftingOriginBase>())
        {
            // ask if the object allows to be transformed by this map
            if (obj.enabled && obj.OnBeforeOriginShift(this))
            {
                objs.Add(obj);
            }
        }

        // actually transform the objects
        foreach (VtsObjectShiftingOriginBase obj in objs)
        {
            // only transform object's topmost ancestor - its childs will inherit the change
            // an object is shifted only once even if it has multiple VtsObjectShiftingOriginBase components
            if (!obj.transform.parent || !obj.transform.parent.GetComponentInParent <VtsObjectShiftingOriginBase>() &&
                obj == obj.GetComponents <VtsObjectShiftingOriginBase>()[0])
            {
                obj.transform.localPosition += move;
                obj.transform.RotateAround(Vector3.zero, Vector3.up, Yrot);
            }
        }

        // notify the object that it was transformed
        foreach (VtsObjectShiftingOriginBase obj in objs)
        {
            obj.OnAfterOriginShift();
        }

        // force all objects cameras to recompute positions -> improves precision
        foreach (VtsCameraBase cam in FindObjectsOfType <VtsCameraBase>())
        {
            cam.OriginShifted();
        }

        // force all collider probes to recompute positions -> improves precision
        // warning: this has big performance impact!
        if (updateColliders)
        {
            foreach (VtsColliderProbe col in FindObjectsOfType <VtsColliderProbe>())
            {
                col.OriginShifted();
            }
        }
    }
Пример #10
0
 public virtual bool Recibir(Pallet pallet)
 {
     Pallets.Add(pallet);
     pallet.Pasaje();
     return(true);
 }
Пример #11
0
    private void Drive(object sender, EventArgs e)
    {
        screen.Text = "Energy: " + life;

        if (startis)
        {
            tx = 520;
            ty = y + 100;
        }
        try
        {
            g.DrawImage(auto, tx, ty, 50, 50);
        }
        catch (Exception ex)
        {
            int vx;
        }

        try
        {
            g.DrawImage(bg, x, 0, canvas.Width, canvas.Height);
        }
        catch (Exception ex)
        {
            int vx;
        }

        try
        {
            g.DrawImage(bg, x - 1280, 0, canvas.Width, canvas.Height);
        }
        catch (Exception ex)
        {
            int vx;
        }

        if (x < 0)
        {
            x = 1300;
        }
        x -= 60;

        int v  = 0;
        int w  = 0;
        int xx = rnd.Next(5000);

        if (xx < 2500)
        {
            v = rnd.Next(2) * (rnd.Next(20) + 30);
        }
        else if (xx > 2500)
        {
            w = rnd.Next(2) * (rnd.Next(20) + 30);
        }
        y += v;
        y -= w;

        if (y < 100)
        {
            y += 60;
        }

        if (y > 700)
        {
            y -= 60;
        }

        Row row = new Row();

        row.SetLocation(1280, y);
        int xy = rnd.Next(10);

        if (xy == 0)
        {
            Other car = new Other();
            car.x = 1280;
            car.y = y;
            others.Add(car);
        }
        int px = rnd.Next(10);

        if (px == 0)
        {
            row.AddBlockAbove();
        }
        if (px == 1)
        {
            row.DelBlockAbove();
        }
        if (px == 2)
        {
            row.AddBlockBelow();
        }
        if (px == 3)
        {
            row.DelBlockBelow();
        }
        if (rows.Count != 0)
        {
            rows.Insert(rows.Count - 1, row);
        }
        else
        {
            rows.Add(row);
        }
        for (int i = 0; i < rows.Count; i++)
        {
            System.Collections.Generic.List <Block> blocks = rows[i].blocks;
            for (int j = 0; j < blocks.Count; j++)
            {
                int   k     = j + 1;
                int   l     = blocks.Count / 2;
                Block block = blocks[j];
                block.x -= 100;
                try
                {
                    g.FillRectangle(new SolidBrush(Color.Gray), block.x, block.y, width, height);
                    if (k == l + 1)
                    {
                        g.FillRectangle(new SolidBrush(Color.White), block.x, block.y, 40, 6);
                    }
                    //g.DrawImage(bloc, block.x, block.y, width, height);
                }
                catch (Exception ex)
                {
                    int vx;
                }
            }
            for (int k = 0; k < others.Count; k++)
            {
                Other car = others[k];
                car.x -= 100;
                g.DrawImage(other, car.x, car.y, 30, 30);
            }
        }

        if (!startis)
        {
            Block block = rows[-14 + count].blocks[0];
            int   they  = block.y;
            if (ty < they)
            {
                life--;
            }
            block = rows[-14 + count].blocks[rows[-14 + count].blocks.Count - 1];
            they  = block.y;
            if (ty > they)
            {
                life--;
            }
        }

        if (life <= 0)
        {
            Application.Exit();
        }

        count++;
    }
Пример #12
0
    public void OnMailData(ServerMsgObj msg)
    {
        // MailData maildate = JsonUtility.FromJson<MailData>(msg.Msg);

        for (int i = 0; i < 5; i++)
        {
            MailDatas Mail = new MailDatas();
            Item      item = new Item();
            System.Collections.Generic.List <Item> itemlist = new System.Collections.Generic.List <Item>();
            switch (i)
            {
            case 0:
                item.itemId  = 30001;
                item.itemNum = 10 + i;
                itemlist.Add(item);
                break;

            case 1:
                item.itemId  = 30006;
                item.itemNum = 10 + i;
                itemlist.Add(item);
                break;

            case 2:
                item.itemId  = 30011;
                item.itemNum = 10 + i;
                itemlist.Add(item);
                break;

            case 3:
                item.itemId  = 30016;
                item.itemNum = 10 + i;
                itemlist.Add(item);
                break;

            case 4:
                item.itemId  = 30021;
                item.itemNum = 10 + i;
                itemlist.Add(item);
                break;
            }
            Mail.mail_id   = 1000 + i;
            Mail.ico_id    = 20110;
            Mail.addresser = "卫东" + i;
            Mail.content   = "是人,都有一颗心,有血有肉。是心,难免会生情,有牵有挂。人与人一旦有了感情,就会关心,就会惦记;心与心一旦有了相吸,就会眷恋,就会难舍。其实,人心都是肉长的,每一份惦记,都关着情;每一份感动,都连着心;每一声问候,都藏着真;每一份守望,都是用情至深!人与人之间,全凭一颗坦诚的心;心与心之间,全凭一份挚热的情。人心是肉长,是真情,女人也会流泪,男人也会动容;人心是肉长,是真情,小孩也会感动,老人也会触动;人心是肉长,是真情,我们都要铭记,都要珍惜,都要感恩心中!" +
                             "是人,都有一颗心,有血有肉。是心,难免会生情,有牵有挂。人与人一旦有了感情,就会关心,就会惦记;心与心一旦有了相吸,就会眷恋,就会难舍。其实,人心都是肉长的,每一份惦记,都关着情;每一份感动,都连着心;每一声问候,都藏着真;每一份守望,都是用情至深!人与人之间,全凭一颗坦诚的心;心与心之间,全凭一份挚热的情。人心是肉长,是真情,女人也会流泪,男人也会动容;人心是肉长,是真情,小孩也会感动,老人也会触动;人心是肉长,是真情,我们都要铭记,都要珍惜,都要感恩心中!";


            Mail.date     = Util.Utc2DateTime(long.Parse(((int)ConvertDateTimeInt(DateTime.Now) + i).ToString()));
            Mail.mailname = "卫东置信" + i;
            Mail.isRead   = 0;

            if (i % 2 == 0)
            {
            }
            switch (i)
            {
            case 0:
                Mail.type = 1;
                break;

            case 1:
                Mail.type     = 2;
                Mail.mailitem = itemlist;
                break;

            case 2:
                Mail.type = 3;
                break;

            case 3:
                Mail.type = 1;
                break;

            case 4:
                Mail.type     = 2;
                Mail.mailitem = itemlist;
                break;
            }
            bool idcon = false;
            if (PostBoxMgr.Instance.MailData.Count > 0)
            {
                for (int idx = 0; idx < PostBoxMgr.Instance.MailData.Count; idx++)
                {
                    if (PostBoxMgr.Instance.MailData[idx].mail_id == Mail.mail_id)
                    {
                        idcon = true;
                    }
                }
            }
            if (false == idcon)
            {
                PostBoxMgr.Instance.MailData.Add(Mail);
            }
        }
        PostBoxMgr.Instance.isUpd = true;
    }
Пример #13
0
// ------------------------------------------ FIM DOS CASOS TESTE -----------------------------------------------------------


    private System.Collections.Generic.List <Vector2> pawn_moves(GameObject[][] tab, GameObject peca, Vector2 posPeca, System.Collections.Generic.List <Vector2> resultado, bool[] peoesBrancos, bool[] peoesPretos)
    {
        // Movimento do peões
        if (peca.name.StartsWith("White Pawn"))
        {
            int numeroPeao = (int)peca.name.ToCharArray()[11] - 49;
            if ((int)posPeca.x + 1 < tab.Length)
            {
                if (tab[(int)posPeca.x + 1][(int)posPeca.y] == null)
                {
                    // Só pode andar pra frente se estiver vazio
                    resultado.Add(new Vector2(posPeca.x + 1, posPeca.y));
                    if (peca.name.StartsWith("White") && peoesBrancos[numeroPeao] == false && tab[(int)posPeca.x + 2][(int)posPeca.y] == null)
                    {
                        resultado.Add(new Vector2(posPeca.x + 2, posPeca.y));
                    }
                }
                if ((int)posPeca.y + 1 < tab.Length &&
                    tab[(int)posPeca.x + 1][(int)posPeca.y + 1] != null &&
                    tab[(int)posPeca.x + 1][(int)posPeca.y + 1].name.StartsWith("Black"))
                {
                    // Comer para diagonal esquerda
                    resultado.Add(new Vector2(posPeca.x + 1, posPeca.y + 1));
                }
                if ((int)posPeca.y - 1 >= 0 &&
                    tab[(int)posPeca.x + 1][(int)posPeca.y - 1] != null &&
                    tab[(int)posPeca.x + 1][(int)posPeca.y - 1].name.StartsWith("Black"))
                {
                    // Comer para diagonal direita
                    resultado.Add(new Vector2(posPeca.x + 1, posPeca.y - 1));
                }
            }
        }
        else if (peca.name.StartsWith("Black Pawn"))
        {
            int numeroPeao = (int)peca.name.ToCharArray()[11] - 49;
            if ((int)posPeca.x - 1 >= 0)
            {
                if (tab[(int)posPeca.x - 1][(int)posPeca.y] == null)
                {
                    // Só pode andar pra frente se estiver vazio
                    resultado.Add(new Vector2(posPeca.x - 1, posPeca.y));
                    if (peca.name.StartsWith("Black") && peoesPretos[numeroPeao] == false && tab[(int)posPeca.x - 2][(int)posPeca.y] == null)
                    {
                        resultado.Add(new Vector2(posPeca.x - 2, posPeca.y));
                    }
                }
                if ((int)posPeca.y + 1 < tab.Length &&
                    tab[(int)posPeca.x - 1][(int)posPeca.y + 1] != null &&
                    tab[(int)posPeca.x - 1][(int)posPeca.y + 1].name.StartsWith("White"))
                {
                    // Comer para diagonal direita em relação as peças pretas
                    resultado.Add(new Vector2(posPeca.x - 1, posPeca.y + 1));
                }
                if ((int)posPeca.y - 1 >= 0 &&
                    tab[(int)posPeca.x - 1][(int)posPeca.y - 1] != null &&
                    tab[(int)posPeca.x - 1][(int)posPeca.y - 1].name.StartsWith("White"))
                {
                    // Comer para diagonal esquerda em relação as peças pretas
                    resultado.Add(new Vector2(posPeca.x - 1, posPeca.y - 1));
                }
            }
        }
        return(resultado);
    }
Пример #14
0
    //protected void btnSubmit_Click(object sender, EventArgs e)
    public void process()
    {
        try
        {
            //if (txtStartDate.Text.Trim() == "" || txtTime.Text.Trim() == "")
            //{
            //    WebMsgBox.Show("Please enter Start Date and Time", this.Page);
            //    return;
            //}
            //string StartDate = txtStartDate.Text.Trim();
            //string time = txtTime.Text.Trim();
            ArrayList tbName = new ArrayList();

            //tbName.Add("A50001");
            tbName.Add("ADDMAST-1");

            //tbName.Add("AGENTMAST");
            tbName.Add("ALLVCR-2");
            //tbName.Add("ALOGIN");
            tbName.Add("AVS_ACC-3");

            tbName.Add("AVS_DDS-4");

            // tbName.Add("AVS_DDS_LOCK");
            //tbName.Add("AVS_DDSHISTORY");
            tbName.Add("Avs_FreezAccDetails-5");
            //tbName.Add("AVS_InvAccountMaster");
            //tbName.Add("AVS_InvDepositeMaster");
            //tbName.Add("AVS_InvParameter");
            //tbName.Add("AVS_LienMarkDetails");
            //tbName.Add("AVS_LnTrx");

            //tbName.Add("Avs_Notice_Chrg");

            //tbName.Add("AVS_SHRALLOTMENT");
            //tbName.Add("AVS_SHRAPP");

            //tbName.Add("AVS1000");
            //tbName.Add("DEPOSITGL");
            tbName.Add("DEPOSITINFO-6");
            tbName.Add("LoanInfo-7");
            //tbName.Add("GLMAST");
            //tbName.Add("ImageMaster");
            //tbName.Add("ImageRelation");
            //tbName.Add("INTERESTMASTER");
            //tbName.Add("INTRESTMASTER");
            //tbName.Add("LIEN_MARK");
            //tbName.Add("LOANSCHEDULE");
            tbName.Add("MASTER-8");
            //tbName.Add("MEMSTAT");

            tbName.Add("SHARESINFO-9");



            //EntryDate = EntryDate;
            string StartDate1 = conn.ConvertDate(EntryDate).ToString();

            System.Collections.Generic.List <System.Web.UI.WebControls.ListItem> files = new System.Collections.Generic.List <System.Web.UI.WebControls.ListItem>();

            if (!Directory.Exists(@"C:\Backup"))
            {
                Directory.CreateDirectory(@"C:\Backup");
            }

            SqlConnection Conn = new SqlConnection(conn.DbName());
            try
            {
                foreach (string Tb in tbName)
                {
                    DataTable dt  = new DataTable();
                    DataTable dt1 = new DataTable();

                    string[] Tbn    = Tb.Split('-');
                    string   tbname = Tbn[0].ToString();


                    SqlDataAdapter sda = new SqlDataAdapter("ISP_AVS0179", Conn);
                    sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sda.SelectCommand.Parameters.Add("@Flag", SqlDbType.NVarChar).Value      = tbname;
                    sda.SelectCommand.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = StartDate1;
                    sda.Fill(dt);

                    SqlDataAdapter sda1 = new SqlDataAdapter("ISP_AVS0180", Conn);
                    sda1.SelectCommand.CommandType = CommandType.StoredProcedure;
                    sda1.SelectCommand.Parameters.Add("@Flag", SqlDbType.NVarChar).Value = tbname;
                    sda1.Fill(dt1);
                    string[] typeArr = dt1.Rows.OfType <DataRow>().Select(k => k[1].ToString()).ToArray();


                    string fileName = Tbn[1] + "-" + DateTime.Now.Date.ToShortDateString() + DateTime.Now.ToShortTimeString();
                    fileName = fileName.Replace("/", "");
                    fileName = fileName.Replace("AM", "");
                    fileName = fileName.Replace("PM", "");
                    fileName = fileName.Replace(" ", "");
                    fileName = fileName.Replace(":", "");



                    if (dt.Rows.Count > 0)
                    {
                        try
                        {
                            StreamWriter sw;
                            using (sw = File.CreateText(@"C:\Backup\" + fileName + ".txt"))
                            {
                                string type;
                                int    i;
                                int    j = 0;
                                sw.Write("Insert Into " + Tb + " (");
                                for (i = 0; i < dt.Columns.Count; i++)
                                {
                                    if (i != dt.Columns.Count - 1)
                                    {
                                        sw.Write(dt.Columns[i].ColumnName + ",");
                                    }
                                    else
                                    {
                                        sw.Write(dt.Columns[i].ColumnName);
                                    }
                                }
                                sw.Write(") \r\n Values ");
                                foreach (DataRow row in dt.Rows)
                                {
                                    int RowCount = dt.Rows.Count;
                                    j += 1;
                                    sw.Write("(");
                                    object[] array = row.ItemArray;
                                    string   value = string.Empty;
                                    for (i = 0; i < array.Length; i++)
                                    {
                                        type = typeArr[i];
                                        if (type == "float" || type == "bigint" || type == "numeric" || type == "int")
                                        {
                                            value = array[i].ToString();
                                            if (value.Trim() == "")
                                            {
                                                value = "null";
                                            }
                                            sw.Write(value);
                                        }
                                        else if (type == "nvarchar" || type == "varchar")
                                        {
                                            sw.Write("'" + array[i].ToString() + "'");
                                        }
                                        else if (type == "datetime2" || type == "datetime")
                                        {
                                            string date = array[i].ToString();
                                            if (date != "")
                                            {
                                                if (date.Contains("-"))
                                                {
                                                    string[] ab  = date.Split('-');
                                                    string   chk = ab[0];
                                                    if (chk.Length > 2)
                                                    {
                                                    }
                                                    else
                                                    {
                                                        string date1 = ab[2];
                                                        string date2 = date1.Substring(0, 4);
                                                        date1 = date1.Substring(4);
                                                        date  = date2 + "-" + ab[1] + "-" + ab[0] + " " + date1;
                                                    }
                                                }
                                                else if (date.Contains("/"))
                                                {
                                                    string[] ab  = date.Split('/');
                                                    string   chk = ab[0];
                                                    if (chk.Length > 2)
                                                    {
                                                    }
                                                    else
                                                    {
                                                        string date1 = ab[2];
                                                        string date2 = date1.Substring(0, 4);
                                                        date1 = date1.Substring(4);
                                                        date  = date2 + "-" + ab[1] + "-" + ab[0] + " " + date1;
                                                    }
                                                }
                                            }
                                            sw.Write("'" + date + "'");
                                        }
                                        else
                                        {
                                            sw.Write(array[i].ToString());
                                        }

                                        if (i != array.Length - 1)
                                        {
                                            sw.Write(",");
                                        }
                                    }

                                    if (j == RowCount)
                                    {
                                        sw.Write(") \r\n");
                                    }
                                    else
                                    {
                                        sw.Write("), \r\n");
                                    }
                                }
                            }
                            //StringBuilder SBTxt = new StringBuilder();

                            //SBTxt.Append(sw.ToString());
                            //StringBuilder SBTxt1 = new StringBuilder();
                            //SBTxt1.Append(encrypt(SBTxt.ToString()));
                            //sw.Close();



                            StreamReader  sr    = new StreamReader(@"C:\Backup\" + fileName + ".txt");
                            StringBuilder SBTxt = new StringBuilder();
                            SBTxt.Append(sr.ReadToEnd().ToString());
                            StringBuilder SBTxt1 = new StringBuilder();
                            // SBTxt1.Append(SBTxt.ToString());
                            SBTxt1.Append(encrypt(SBTxt.ToString()));
                            sr.Close();
                            var fs = new FileStream(@"C:\Backup\" + fileName + ".txt", FileMode.Truncate);
                            fs.Close();
                            StreamWriter sw1;
                            using (sw1 = File.CreateText(@"C:\Backup\" + fileName + ".txt"))
                            {
                                sw1.Write(SBTxt1.ToString());
                            }
                            sw1.Close();
                            files.Add(new System.Web.UI.WebControls.ListItem(@"C:\Backup\" + fileName + ".txt"));
                        }
                        catch (Exception Ex)
                        {
                            ExceptionLogging.SendErrorToText(Ex);
                        }

                        //StreamReader sr1 = new StreamReader(@"D:\MyDir\" + fileName + ".txt");
                        //StringBuilder SBTxt2 = new StringBuilder();
                        //SBTxt2.Append(sr1.ReadToEnd().ToString());
                        //StringBuilder SBTxt3 = new StringBuilder();
                        //SBTxt3.Append(Decrypt(SBTxt2.ToString()));
                        //sr1.Close();



                        //Response.Clear();
                        //Response.ClearContent();
                        //Response.ClearHeaders();
                        //Response.Buffer = true;
                        //Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".txt");
                        //Response.Charset = "";
                        //Response.ContentType = "application/octet-stream";
                        //using (StringWriter writer = new StringWriter())
                        //{
                        //    writer.WriteLine(SBTxt1);
                        //    writer.Close();
                        //    Response.Output.Write(writer);
                        //}
                        //HttpContext.Current.Response.Flush();
                        //HttpContext.Current.Response.SuppressContent = true;
                        //HttpContext.Current.ApplicationInstance.CompleteRequest();

                        //using (sw = File.CreateText(@"D:\MyDir\" + fileName + "Decrypt.txt"))
                        //{
                        //    sw.Write(SBTxt3.ToString());
                        //}
                        //sw.Close();
                    }
                }

                using (ZipFile zip = new ZipFile())
                {
                    zip.AlternateEncodingUsage = ZipOption.AsNecessary;
                    //zip.AddDirectoryByName("Files");
                    foreach (System.Web.UI.WebControls.ListItem li in files)
                    {
                        zip.AddFile(li.Value, "Your Files");
                    }
                    Response.Clear();
                    Response.BufferOutput = false;
                    string zipName = String.Format("Backup_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"));
                    Response.ContentType = "application/zip";
                    Response.AddHeader("content-disposition", "attachment; filename=" + zipName);
                    zip.Save(Response.OutputStream);
                    //WebMsgBox.Show("BACKUP Successful", this.Page);
                    Response.End();
                }

                //WebMsgBox.Show("BACKUP Successful", this.Page);
            }
            catch (Exception Ex)
            {
                ExceptionLogging.SendErrorToText(Ex);
                //WebMsgBox.Show("Error while BACKUP", this.Page);
            }
            finally
            {
                Conn.Close();
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }
Пример #15
0
    private System.Collections.Generic.List <Vector2> bishop_moves(GameObject[][] tabuleiro, string adv_color, Vector2 posPeca, System.Collections.Generic.List <Vector2> resultado)
    {
        bool parouDir = false, parouEsq = false;
        // Primeiro 'for' é para os bispos brancos subirem no tabuleiro
        int j = 1;

        for (int i = (int)posPeca.x + 1; i < tabuleiro.Length; i++)
        {
            if (!parouEsq || !parouDir)
            {
                // Se entrou aqui ainda da pra subir pra algum lado

                // Os 'ifs' abaixo são pra saber se saiu do tabuleiro
                if ((int)posPeca.y + j >= tabuleiro.Length)
                {
                    parouEsq = true;
                }
                if ((int)posPeca.y - j < 0)
                {
                    parouDir = true;
                }

                if (!parouEsq)
                {
                    // Se entrou aqui ainda da pra subir pra esquerda
                    if (tabuleiro[i][(int)posPeca.y + j] == null)
                    {
                        // Se o lugar ta vazio
                        resultado.Add(new Vector2(i, (int)posPeca.y + j));
                    }
                    else if (tabuleiro[i][(int)posPeca.y + j].name.StartsWith(adv_color))
                    {
                        // Se o lugar possui uma peça preta pode mover, mas se sabe as posições seguintes são invalidas
                        resultado.Add(new Vector2(i, (int)posPeca.y + j));
                        parouEsq = true;
                    }
                    else
                    {
                        parouEsq = true;
                    }
                }
                if (!parouDir)
                {
                    // Se entrou aqui ainda da pra subir pra direita
                    if (tabuleiro[i][(int)posPeca.y - j] == null)
                    {
                        // Se o lugar ta vazio
                        resultado.Add(new Vector2(i, (int)posPeca.y - j));
                    }
                    else if (tabuleiro[i][(int)posPeca.y - j].name.StartsWith(adv_color))
                    {
                        // Se o lugar possui uma peça preta pode mover, mas se sabe as posições seguintes são invalidas
                        resultado.Add(new Vector2(i, (int)posPeca.y - j));
                        parouDir = true;
                    }
                    else
                    {
                        parouDir = true;
                    }
                }
                j++;
            }
            else
            {
                // parouEsq && parouDir
                break;
            }
        }
        parouDir = false; parouEsq = false;
        //Segundo for é para os bispos brancos descerem no tabuleiro
        j = 1;
        for (int i = (int)posPeca.x - 1; i >= 0; i--)
        {
            if (!parouDir || !parouEsq)
            {
                // Se entrou aqui ainda da para descer para algum lado

                // Os 'ifs' abaixo são pra saber se saiu do tabuleiro
                if ((int)posPeca.y + j >= tabuleiro.Length)
                {
                    parouEsq = true;
                }
                if ((int)posPeca.y - j < 0)
                {
                    parouDir = true;
                }
                if (!parouEsq)
                {
                    // Se entrou aqui ainda da pra descer pra esquerda
                    if (tabuleiro[i][(int)posPeca.y + j] == null)
                    {
                        // Se o lugar ta vazio
                        resultado.Add(new Vector2(i, (int)posPeca.y + j));
                    }
                    else if (tabuleiro[i][(int)posPeca.y + j].name.StartsWith(adv_color))
                    {
                        // Se o lugar possui uma peça preta pode mover, mas se sabe as posições seguintes são invalidas
                        resultado.Add(new Vector2(i, (int)posPeca.y + j));
                        parouEsq = true;
                    }
                    else
                    {
                        parouEsq = true;
                    }
                }
                if (!parouDir)
                {
                    // Se entrou aqui ainda da pra descer pra direita
                    if (tabuleiro[i][(int)posPeca.y - j] == null)
                    {
                        // Se o lugar ta vazio
                        resultado.Add(new Vector2(i, (int)posPeca.y - j));
                    }
                    else if (tabuleiro[i][(int)posPeca.y - j].name.StartsWith(adv_color))
                    {
                        // Se o lugar possui uma peça preta pode mover, mas se sabe as posições seguintes são invalidas
                        resultado.Add(new Vector2(i, (int)posPeca.y - j));
                        parouDir = true;
                    }
                    else
                    {
                        parouDir = true;
                    }
                }
                j++;
            }
            else
            {
                // parouEsq && parouDir
                break;
            }
        }
        return(resultado);
    }
Пример #16
0
    private System.Collections.Generic.List <Vector2> knight_moves(GameObject[][] tabuleiro, string adv_color, Vector2 posPeca, System.Collections.Generic.List <Vector2> resultado)
    {
        int xPeca = (int)posPeca.x, yPeca = (int)posPeca.y;

        //Debug.Log(peca.name + ": (" + xPeca + "," + yPeca + ")");
        for (int i = 1; i < 3; i++)
        {
            for (int j = 1; j < 3; j++)
            {
                if (i == j)
                {
                    continue;
                }
                if (xPeca + i < tabuleiro.Length)
                {
                    // Pode subir
                    if (yPeca + j < tabuleiro.Length)
                    {
                        // Pode ir para a esquerda da matriz
                        if ((tabuleiro[xPeca + i][yPeca + j] == null) ||
                            tabuleiro[xPeca + i][yPeca + j].name.StartsWith(adv_color))
                        {
                            // Se a peça clicada é branca e a posição desejada contem uma peça preta ou nenhuma peça
                            resultado.Add(new Vector2(xPeca + i, yPeca + j));
                        }
                    }
                    if (yPeca - j >= 0)
                    {
                        // Pode ir para a direita da matriz
                        if ((tabuleiro[xPeca + i][yPeca - j] == null) ||
                            tabuleiro[xPeca + i][yPeca - j].name.StartsWith(adv_color))
                        {
                            // Se a peça clicada é branca e a posição desejada contem uma peça preta ou nenhuma peça
                            resultado.Add(new Vector2(xPeca + i, yPeca - j));
                        }
                    }
                }
                if (xPeca - i >= 0)
                {
                    // Pode descer!! LEMBRANDO: SEMPRE EM RELAÇÃO A MATRIZ
                    if (yPeca + j < tabuleiro.Length)
                    {
                        // Pode ir para a esquerda da matriz
                        if ((tabuleiro[xPeca - i][yPeca + j] == null) ||
                            tabuleiro[xPeca - i][yPeca + j].name.StartsWith(adv_color))
                        {
                            // Se a peça clicada é branca e a posição desejada contem uma peça preta ou nenhuma peça
                            resultado.Add(new Vector2(xPeca - i, yPeca + j));
                        }
                    }
                    if (yPeca - j >= 0)
                    {
                        // Pode ir para a direita da matriz
                        if ((tabuleiro[xPeca - i][yPeca - j] == null) ||
                            tabuleiro[xPeca - i][yPeca - j].name.StartsWith(adv_color))
                        {
                            // Se a peça clicada é branca e a posição desejada contem uma peça preta ou nenhuma peça
                            resultado.Add(new Vector2(xPeca - i, yPeca - j));
                        }
                    }
                }
            }
        }
        return(resultado);
    }
Пример #17
0
    private System.Collections.Generic.List <Vector2> rook_moves(GameObject[][] tabuleiro, string adv_color, Vector2 posPeca, System.Collections.Generic.List <Vector2> resultado)
    {
        // Os 2 'for' seguintes são para subir e descer no tabuleiro
        for (int i = (int)posPeca.x + 1; i < tabuleiro.Length; i++)
        {
            if (tabuleiro[i][(int)posPeca.y] == null)
            {
                //Se o lugar ta vazio pode mover
                resultado.Add(new Vector2(i, (int)posPeca.y));
            }
            else if (tabuleiro[i][(int)posPeca.y].name.StartsWith(adv_color))
            {
                // Se o lugar possui uma peça preta pode mover, mas se sabe que a posições seguintes são invalidas
                resultado.Add(new Vector2(i, (int)posPeca.y));
                break;
            }
            else
            {
                // Se o lugar não ta vazio e nem é uma peça preta significa que é uma peça branca, logo não pode mover
                break;
            }
        }
        for (int i = (int)posPeca.x - 1; i >= 0; i--)
        {
            if (tabuleiro[i][(int)posPeca.y] == (null))
            {
                // Se o lugar ta vazio pode mover
                resultado.Add(new Vector2(i, (int)posPeca.y));
            }
            else if (tabuleiro[i][(int)posPeca.y].name.StartsWith(adv_color))
            {
                // Se o lugar possui uma peça preta pode mover, mas se sabe que as posições seguintes são invalidas
                resultado.Add(new Vector2(i, (int)posPeca.y));
                break;
            }
            else
            {
                // Se o lugar não ta vazio e nem é uma peça preta significa que é uma peça branca, logo não pode mover
                break;
            }
        }

        // Os proximos dois 'for' são para os movimentos laterais
        for (int i = (int)posPeca.y + 1; i < tabuleiro[(int)posPeca.x].Length; i++)
        {
            if (tabuleiro[(int)posPeca.x][i] == (null))
            {
                //Se o lugar ta vazio pode mover
                resultado.Add(new Vector2((int)posPeca.x, i));
            }
            else if (tabuleiro[(int)posPeca.x][i].name.StartsWith(adv_color))
            {
                // Se o lugar possui uma peça preta pode mover, mas se sabe que as posições seguintes são invalidas
                resultado.Add(new Vector2((int)posPeca.x, i));
                break;
            }
            else
            {
                // Se o lugar não ta vazio e nem é uma peça preta significa que é uma peça branca, logo não pode mover
                break;
            }
        }
        for (int i = (int)posPeca.y - 1; i >= 0; i--)
        {
            if (tabuleiro[(int)posPeca.x][i] == (null))
            {
                //Se o lugar ta vazio pode mover
                resultado.Add(new Vector2((int)posPeca.x, i));
            }
            else if (tabuleiro[(int)posPeca.x][i].name.StartsWith(adv_color))
            {
                // Se o lugar possui uma peça preta pode mover, mas se sabe que as posições seguintes são invalidas
                resultado.Add(new Vector2((int)posPeca.x, i));
                break;
            }
            else
            {
                // Se o lugar não ta vazio e nem é uma peça preta significa que é uma peça branca, logo não pode mover
                break;
            }
        }
        return(resultado);
    }
Пример #18
0
    private System.Collections.Generic.List <Vector2> king_moves(GameObject[][] tabuleiro, string color, string adv_color, Vector2 posPeca, System.Collections.Generic.List <Vector2> resultado, bool definitivo)
    {
        int xPeca = (int)posPeca.x, yPeca = (int)posPeca.y;

        if (xPeca + 1 < tabuleiro.Length)
        {
            // Pode subir
            if (tabuleiro[xPeca + 1][yPeca] == null ||
                (tabuleiro[xPeca + 1][yPeca].name.StartsWith(adv_color)))
            {
                // Para cima na matriz está vazio ou contem peça inimiga
                resultado.Add(new Vector2(xPeca + 1, yPeca));
            }
            if (yPeca + 1 < tabuleiro.Length &&
                (tabuleiro[xPeca + 1][yPeca + 1] == null ||
                 (tabuleiro[xPeca + 1][yPeca + 1].name.StartsWith(adv_color))))
            {
                // Para cima e para esquerda em relação a matriz está vazio ou contem peça inimiga
                resultado.Add(new Vector2(xPeca + 1, yPeca + 1));
            }
            if (yPeca - 1 >= 0 &&
                (tabuleiro[xPeca + 1][yPeca - 1] == null ||
                 (tabuleiro[xPeca + 1][yPeca - 1].name.StartsWith(adv_color))))
            {
                // Para cima e para direita em relação a matriz está vazio ou contem peça inimiga
                resultado.Add(new Vector2(xPeca + 1, yPeca - 1));
            }
        }
        if (xPeca - 1 >= 0)
        {
            // Pode descer
            if (tabuleiro[xPeca - 1][yPeca] == null ||
                (tabuleiro[xPeca - 1][yPeca].name.StartsWith(adv_color)))
            {
                // Para baixo na matriz está vazio ou contem peça inimiga
                resultado.Add(new Vector2(xPeca - 1, yPeca));
            }
            if (yPeca + 1 < tabuleiro.Length &&
                (tabuleiro[xPeca - 1][yPeca + 1] == null ||
                 (tabuleiro[xPeca - 1][yPeca + 1].name.StartsWith(adv_color))))
            {
                // Para baixo e para esquerda em relação a matriz está vazio ou contem peça inimiga
                resultado.Add(new Vector2(xPeca - 1, yPeca + 1));
            }
            if (yPeca - 1 >= 0 &&
                (tabuleiro[xPeca - 1][yPeca - 1] == null ||
                 (tabuleiro[xPeca - 1][yPeca - 1].name.StartsWith(adv_color))))
            {
                // Para baixo e para direita em relação a matriz está vazio ou contem peça inimiga
                resultado.Add(new Vector2(xPeca - 1, yPeca - 1));
            }
        }
        if (yPeca + 1 < tabuleiro.Length &&
            (tabuleiro[xPeca][yPeca + 1] == null ||
             (tabuleiro[xPeca][yPeca + 1].name.StartsWith(adv_color))))
        {
            // Para esquerda em relação a matriz está vazio ou contem peça inimiga
            resultado.Add(new Vector2(xPeca, yPeca + 1));
        }
        if (yPeca - 1 >= 0 &&
            (tabuleiro[xPeca][yPeca - 1] == null ||
             (tabuleiro[xPeca][yPeca - 1].name.StartsWith(adv_color))))
        {
            // Para direita em relação a matriz está vazio ou contem peça inimiga
            resultado.Add(new Vector2(xPeca, yPeca - 1));
        }
        return(resultado);
    }
Пример #19
0
    ClaimsPrincipal ISecurityTokenValidator.ValidateToken(string securityToken, TokenValidationParameters validationParameters, out SecurityToken validatedToken)
    {
        JwtSecurityTokenHandler tokenHandler = new JwtSecurityTokenHandler();

        //try
        //{
        //Default
        //tokenHandler.ValidateToken(securityToken, validationParameters, out validatedToken);
        //validatedToken = new JwtSecurityToken("jwtEncodedString");

        // var clienturl = "";
        // clienturl = Request.Headers["myOrigin"];
        // //read key from db
        // var customerdata = (from ev in _objdb.TbGeCustomer
        //     where ev.Url == clienturl.ToString()
        //     select ev).ToList();
        // key = customerdata[0].EncryptKey;

        //Custom Check For AuthToken
        //     string tokenData = GlobalESS.Globalfunction.DecryptToken(securityToken, true, this.key);
        //     GlobalESS.TokenData _tokenData = GlobalESS.Globalfunction.GetTokenDataNotUseJWT(tokenData);
        //     double expireTime = this.expiretimespan;

        //     DateTime issueDate = _tokenData.TicketExpireDate.AddMinutes(-expireTime);
        //     DateTime NowDate = System.DateTime.UtcNow;
        //     if (issueDate > NowDate || _tokenData.TicketExpireDate < NowDate)
        //     {
        //         throw new ArgumentException("Token Expire");
        //     }
        // }
        // catch (Exception ex)
        // {
        //     System.Console.WriteLine(ex.Message);
        //     //throw;
        // }

        ClaimsPrincipal principal = null;

        // SecurityToken validToken = null;
        validatedToken = null;


        System.Collections.Generic.List <System.Security.Claims.Claim> ls =
            new System.Collections.Generic.List <System.Security.Claims.Claim>();

        ls.Add(
            new System.Security.Claims.Claim(
                System.Security.Claims.ClaimTypes.Name, "Globalwave"
                , System.Security.Claims.ClaimValueTypes.String
                )
            );

        //

        System.Security.Claims.ClaimsIdentity id = new System.Security.Claims.ClaimsIdentity("authenticationType");
        id.AddClaims(ls);

        principal = new System.Security.Claims.ClaimsPrincipal(id);

        return(principal);

        throw new NotImplementedException();
    }
Пример #20
0
    public bool MakeGBCommand(int nSN, string strMobile, ushort CmdID, byte[] Content, out byte[] buff)
    {
        buff = null;
        try
        {
            System.Collections.Generic.List <byte> lstByte = new System.Collections.Generic.List <byte>();
            byte[] temp;
            //主信令
            temp = BitConverter.GetBytes(CmdID);
            lstByte.Add(temp[1]);
            lstByte.Add(temp[0]);

            ushort nLen = 0;
            //后面包长
            if ((Content == null) || (Content.Length < 1))
            {
                nLen = 0;
            }
            else
            {
                nLen = (ushort)Content.Length;
            }
            temp = BitConverter.GetBytes(nLen);
            lstByte.Add(temp[1]);
            lstByte.Add(temp[0]);

            //手机号码
            strMobile = strMobile.PadLeft(12, '0');

            int nPos = 0;
            for (int i = 0; i < 6; i++)
            {
                lstByte.Add(Convert.ToByte(strMobile.Substring(nPos, 2), 16));
                nPos += 2;
            }

            //流水号
            lstByte.Add((byte)((nSN >> 8) & 0x000000ff));
            lstByte.Add((byte)(nSN & 0x000000ff));

            //附加内容
            if (Content != null)
            {
                for (int i = 0; i < Content.Length; i++)
                {
                    lstByte.Add(Content[i]);
                }
            }

            //校验
            temp = lstByte.ToArray();
            byte bXorValue = GetXorValue(temp, 0, temp.Length - 1);
            lstByte.Add(bXorValue);

            buff = lstByte.ToArray();

            //转义
            lstByte.Clear();
            lstByte.Add(0x7E);
            for (int j = 0; j < buff.Length; j++)
            {
                switch (buff[j])
                {
                case 0x7E:
                    lstByte.Add(0x7D);
                    lstByte.Add(0x02);
                    break;

                case 0x7D:
                    lstByte.Add(0x7D);
                    lstByte.Add(0x01);
                    break;

                default:
                    lstByte.Add(buff[j]);
                    break;
                }
            }

            lstByte.Add(0x7E);
            buff = lstByte.ToArray();

            return(true);
        }
        catch (Exception ex)
        {
            return(false);
        }
    }
Пример #21
0
    //

    /*public void returnHex(SendMessageContext context)
     * {
     *      context.returnGameObject = Hex;
     * }*/

    public int MovePath(GameObject obj1, GameObject obj2)
    {
        //listPath.Clear();

        if (obj2.GetComponent <Hex>().currentStat != 2)
        {
            return(-1);
        }

        System.Collections.Queue queuePath = new System.Collections.Queue();

        queuePath.Enqueue(obj1);

        bool flag = false;

        while (flag != true)
        {
            int count = queuePath.Count;
            for (int i = 0; i < count; i++)
            {
                GameObject tempobj = (GameObject)queuePath.Dequeue();

                if (tempobj != obj2)
                {
                    for (int j = 0; j < 6; j++)
                    {
                        GameObject neighbor = tempobj.GetComponent <Hex>().neighbor[j];
                        if ((neighbor != null) &&
                            (neighbor.GetComponent <Hex>().LabelObject == null) &&
                            (listHexToMove.Contains(neighbor)))
                        {
                            neighbor.GetComponent <Hex>().LabelObject = tempobj;
                            queuePath.Enqueue(neighbor);
                        }
                    }
                }
                else
                {
                    flag = true;
                    break;
                }
            }
        }

        queuePath.Clear();

        listPath.Add(obj2);
        obj2.GetComponent <Hex>().currentStat = 3;

        while (obj2 != obj1)
        {
            obj2 = obj2.GetComponent <Hex>().LabelObject;
            obj2.GetComponent <Hex>().currentStat = 3;
            listPath.Add(obj2);
        }

        listPath.Reverse();

        foreach (GameObject obj in listHexToMove)
        {
            obj.GetComponent <Hex>().LabelObject = null;
        }

        return(listPath.Count - 1);
    }
Пример #22
0
    public Settings(Setting[] settingsL)
    {
        names    = new System.Collections.Generic.List <string>();
        settings = new System.Collections.Generic.List <string>();
        types    = new System.Collections.Generic.List <Setting.SettingType> ();

        this.settingsL = settingsL;
        if (this.settingsL != null)
        {
            foreach (Setting s in this.settingsL)
            {
                names.Add(s.Name);
                switch (s.Type)
                {
                case Setting.SettingType.BOOLEAN: {
                    settings.Add(s._VAL_Bool.ToString());
                    break;
                }

                case Setting.SettingType.COLOR: {
                    settings.Add(s._VAL_Color.ToString());
                    break;
                }

                case Setting.SettingType.FLOAT: {
                    settings.Add(s._VAL_Float.ToString());
                    break;
                }

                case Setting.SettingType.INTEGER: {
                    settings.Add(s._VAL_Int.ToString());
                    break;
                }

                case Setting.SettingType.QUATERNION: {
                    settings.Add(s._VAL_Quaternion.ToString());
                    break;
                }

                case Setting.SettingType.STRING: {
                    settings.Add(s._VAL_String.ToString());
                    break;
                }

                case Setting.SettingType.TIME: {
                    settings.Add(s._VAL_DateTime.ToString());
                    break;
                }

                case Setting.SettingType.VECTOR2: {
                    settings.Add(s._VAL_Vector2.ToString());
                    break;
                }

                case Setting.SettingType.VECTOR3: {
                    settings.Add(s._VAL_Vector3.ToString());
                    break;
                }

                case Setting.SettingType.VECTOR4: {
                    settings.Add(s._VAL_Vector4.ToString());
                    break;
                }

                default: {
                    break;
                }
                }
                types.Add(s.Type);
            }
        }
    }
Пример #23
0
 public void SetUpgradeDialogNextAttr(string attr, int id)
 {
     m_listActSetNextAttr.Add(MFUIUtils.SafeDoAction(WingUIUpgradeDialogViewManager.Instance, () =>
                                                     { WingUIUpgradeDialogViewManager.Instance.SetUpgradeDialogNextAttr(attr, id); }));
 }
Пример #24
0
    /// <summary>
    /// Sets a specific settings value based on a key
    /// (If setting does not already exist, it will be created)
    /// </summary>
    /// <param name="name">The setting's name</param>
    /// <param name="val">The value to set</param>
    /// <returns>True if setting set, else false. (Will return false if canceled with EventHandler)</returns>
    public bool SetSetting(string name, SACObject val, Setting.SettingType type)
    {
        if (GetSettingValue(name) != null)
        {
            foreach (SACEventHandler handler in SettingsAndControls.EventHandlers)
            {
                SACEventHandler.SACChangeSettingEvent e = handler.OnSettingChange(new SACEventHandler.SACChangeSettingEvent(SettingsAndControls.LastLoadedSettings, SettingsAndControls.Settings, SettingsAndControls.Settings.names.IndexOf(name)));
                if (e.IsCanceled())
                {
                    return(false);
                }
            }
        }
        else
        {
            foreach (SACEventHandler handler in SettingsAndControls.EventHandlers)
            {
                SACEventHandler.SACAddSettingEvent e = handler.OnSettingAdd(new SACEventHandler.SACAddSettingEvent(new Setting(name, val, type)));
                if (e.IsCanceled())
                {
                    return(false);
                }
            }
        }
        int  i = 0;
        bool d = false;

        foreach (string str in names)
        {
            if (name == str)
            {
                d = true;
                break;
            }
            i++;
        }

        if (d)
        {
            switch (type)
            {
            case Setting.SettingType.BOOLEAN: {
                settings[i] = ((SACBool)val).ToString();
                break;
            }

            case Setting.SettingType.COLOR: {
                settings[i] = ((SACColor)val).ToString();
                break;
            }

            case Setting.SettingType.FLOAT: {
                settings[i] = ((SACFloat)val).ToString();
                break;
            }

            case Setting.SettingType.INTEGER: {
                settings[i] = ((SACInt)val).ToString();
                break;
            }

            case Setting.SettingType.QUATERNION: {
                settings[i] = ((SACQuaternion)val).ToString();
                break;
            }

            case Setting.SettingType.STRING: {
                settings[i] = ((SACString)val).ToString();
                break;
            }

            case Setting.SettingType.TIME: {
                settings[i] = ((SACDate)val).ToString();
                break;
            }

            case Setting.SettingType.VECTOR2: {
                settings[i] = ((SACVector2)val).ToString();
                break;
            }

            case Setting.SettingType.VECTOR3: {
                settings[i] = ((SACVector3)val).ToString();
                break;
            }

            case Setting.SettingType.VECTOR4: {
                settings[i] = ((SACVector4)val).ToString();
                break;
            }

            default: {
                break;
            }
            }
            types[i] = type;
        }
        else
        {
            names.Add(name);
            switch (type)
            {
            case Setting.SettingType.BOOLEAN: {
                settings.Add(((SACBool)val).ToString());
                break;
            }

            case Setting.SettingType.COLOR: {
                settings.Add(((SACColor)val).ToString());
                break;
            }

            case Setting.SettingType.FLOAT: {
                settings.Add(((SACFloat)val).ToString());
                break;
            }

            case Setting.SettingType.INTEGER: {
                settings.Add(((SACInt)val).ToString());
                break;
            }

            case Setting.SettingType.QUATERNION: {
                settings.Add(((SACQuaternion)val).ToString());
                break;
            }

            case Setting.SettingType.STRING: {
                settings.Add(((SACString)val).ToString());
                break;
            }

            case Setting.SettingType.TIME: {
                settings.Add(((SACDate)val).ToString());
                break;
            }

            case Setting.SettingType.VECTOR2: {
                settings.Add(((SACVector2)val).ToString());
                break;
            }

            case Setting.SettingType.VECTOR3: {
                settings.Add(((SACVector3)val).ToString());
                break;
            }

            case Setting.SettingType.VECTOR4: {
                settings.Add(((SACVector4)val).ToString());
                break;
            }

            default: {
                break;
            }
            }
            ;
            types.Add(type);
        }

        return(true);
    }
Пример #25
0
    public override void GenerateMaze()
    {
        Direction[] movesAvailable      = new Direction[4];
        int         movesAvailableCount = 0;

        mCellsToVisit.Add(new CellToVisit(Random.Range(0, RowCount), Random.Range(0, ColumnCount), Direction.Start));

        while (mCellsToVisit.Count > 0)
        {
            movesAvailableCount = 0;
            CellToVisit ctv = mCellsToVisit[GetCellInRange(mCellsToVisit.Count - 1)];

            //check move right
            if (ctv.Column + 1 < ColumnCount && !GetMazeCell(ctv.Row, ctv.Column + 1).IsVisited&& !IsCellInList(ctv.Row, ctv.Column + 1))
            {
                movesAvailable[movesAvailableCount] = Direction.Right;
                movesAvailableCount++;
            }
            else if (!GetMazeCell(ctv.Row, ctv.Column).IsVisited&& ctv.MoveMade != Direction.Left)
            {
                GetMazeCell(ctv.Row, ctv.Column).WallRight = true;
                if (ctv.Column + 1 < ColumnCount)
                {
                    GetMazeCell(ctv.Row, ctv.Column + 1).WallLeft = true;
                }
            }
            //check move forward
            if (ctv.Row + 1 < RowCount && !GetMazeCell(ctv.Row + 1, ctv.Column).IsVisited&& !IsCellInList(ctv.Row + 1, ctv.Column))
            {
                movesAvailable[movesAvailableCount] = Direction.Front;
                movesAvailableCount++;
            }
            else if (!GetMazeCell(ctv.Row, ctv.Column).IsVisited&& ctv.MoveMade != Direction.Back)
            {
                GetMazeCell(ctv.Row, ctv.Column).WallFront = true;
                if (ctv.Row + 1 < RowCount)
                {
                    GetMazeCell(ctv.Row + 1, ctv.Column).WallBack = true;
                }
            }
            //check move left
            if (ctv.Column > 0 && ctv.Column - 1 >= 0 && !GetMazeCell(ctv.Row, ctv.Column - 1).IsVisited&& !IsCellInList(ctv.Row, ctv.Column - 1))
            {
                movesAvailable[movesAvailableCount] = Direction.Left;
                movesAvailableCount++;
            }
            else if (!GetMazeCell(ctv.Row, ctv.Column).IsVisited&& ctv.MoveMade != Direction.Right)
            {
                GetMazeCell(ctv.Row, ctv.Column).WallLeft = true;
                if (ctv.Column > 0 && ctv.Column - 1 >= 0)
                {
                    GetMazeCell(ctv.Row, ctv.Column - 1).WallRight = true;
                }
            }
            //check move backward
            if (ctv.Row > 0 && ctv.Row - 1 >= 0 && !GetMazeCell(ctv.Row - 1, ctv.Column).IsVisited&& !IsCellInList(ctv.Row - 1, ctv.Column))
            {
                movesAvailable[movesAvailableCount] = Direction.Back;
                movesAvailableCount++;
            }
            else if (!GetMazeCell(ctv.Row, ctv.Column).IsVisited&& ctv.MoveMade != Direction.Front)
            {
                GetMazeCell(ctv.Row, ctv.Column).WallBack = true;
                if (ctv.Row > 0 && ctv.Row - 1 >= 0)
                {
                    GetMazeCell(ctv.Row - 1, ctv.Column).WallFront = true;
                }
            }
            bool inUpRightQuad = ctv.Row > RowCount / 2 && ctv.Column > ColumnCount / 2;
            if (!GetMazeCell(ctv.Row, ctv.Column).IsVisited&& movesAvailableCount == 0 && goalNotPlace && inUpRightQuad)
            {
                GetMazeCell(ctv.Row, ctv.Column).IsGoal = true;
                goalNotPlace = false;
            }

            GetMazeCell(ctv.Row, ctv.Column).IsVisited = true;

            if (movesAvailableCount > 0)
            {
                switch (movesAvailable[Random.Range(0, movesAvailableCount)])
                {
                case Direction.Start:
                    break;

                case Direction.Right:
                    mCellsToVisit.Add(new CellToVisit(ctv.Row, ctv.Column + 1, Direction.Right));
                    break;

                case Direction.Front:
                    mCellsToVisit.Add(new CellToVisit(ctv.Row + 1, ctv.Column, Direction.Front));
                    break;

                case Direction.Left:
                    mCellsToVisit.Add(new CellToVisit(ctv.Row, ctv.Column - 1, Direction.Left));
                    break;

                case Direction.Back:
                    mCellsToVisit.Add(new CellToVisit(ctv.Row - 1, ctv.Column, Direction.Back));
                    break;
                }
            }
            else
            {
                mCellsToVisit.Remove(ctv);
            }
        }
    }
Пример #26
0
    void LoadLevel (int number)
    {
        currentLevel = number;

        //GODOT: how on earth do I load a text file?
        //var resource = GD.Load($"res://Levels/{number}.txt");
        //this took 30mins to figure out. every operation is different than the
        //C# BCL version and the docs are not helpful
        var f = new File();
        f.Open($"res://Levels/{number}.txt", (int)File.ModeFlags.Read);
        var lines = new System.Collections.Generic.List<string>();
        while(!f.EofReached())
        {
            lines.Add(f.GetLine());
        }
        //var lines = System.IO.File.ReadAllLines(System.IO.Path.Combine("Levels", $"{number}.txt"));

        var boardDef = lines[0].Split('|');
        int boardSize = int.Parse(boardDef[0]);
        if (boardDef.Length == 6)
        {
            TileColor = new Color(boardDef[1]);

            if (string.IsNullOrEmpty(boardDef[2]))
            {
                StaticTileColor = TileColor.Darkened(0.2f);
            }
            else
            {
                StaticTileColor = new Color(boardDef[2]);
            }

            BoardColor = new Color(boardDef[3]);

            if (string.IsNullOrEmpty(boardDef[4]))
            {
                BackgroundColor = Colors.Black;
            }
            else
            {
                BackgroundColor = new Color(boardDef[4]);
            }

            LineHighlightColor = new Color(boardDef[5]);
        }
        else
        {
            TileColor = new Color("e017c2");
            StaticTileColor = TileColor.Darkened(0.2f);
            BoardColor = new Color("bdf0ec");
            BackgroundColor = Colors.Black;
            LineHighlightColor = Colors.Yellow;
        }

        VisualServer.SetDefaultClearColor(BackgroundColor);

        CreateLevel(boardSize);

        for (int i = 1; i < lines.Count; i++)
        {
            var line = lines[i];
            if (string.IsNullOrWhiteSpace(line))
            {
                continue;
            }

            int commaIdx = line.IndexOf(',');
            int q = int.Parse(line.Substring(0,commaIdx));

            var pipeIdx = line.IndexOf('|');
            int r = int.Parse(line.Substring(commaIdx + 1, pipeIdx - commaIdx - 1));


            int[] desc = new int[6];
            for (int j = 0; j < 6; j++)
            {
                desc[j] = line[pipeIdx+ 1+j] - '0';
            }

            //offset due to the map we're using to figure out positions
            int offset = Math.Max(0, 4 - boardSize);
            var coord = new HexCoord(q, r - offset);
            var tile = new PuzzleTileHex { LineDescriptions = desc, Position = coord.Position() };
            tile.IsStatic = true;
            map.SetCell(new CellInfo(coord, tile));
            board.AddChild(tile);
            tile.CalculatePaths(this, coord);
        }

        var c = TileColor;
        c.a = 0.6f;
        hexCursor.Modulate = c;

        Rescale();
    }
Пример #27
0
    // Use this for initialization
    IEnumerator Start()
    {
        string cd           = Directory.GetCurrentDirectory();
        string modDirectory = cd + "\\Mods\\";

        string[] modSubDirectories;

        //Debug.Log("Current Directory:  " + cd);

        //Debug.Log("Contents:  " + System.String.Join(", ", Directory.GetFiles(cd)));
        //Debug.Log("*.png Contents:  " + System.String.Join(", ", Directory.GetFiles(cd, "*.png")));

        if (!Directory.Exists(modDirectory))
        {
            Directory.CreateDirectory(modDirectory);
        }
        else
        {
            Debug.Log("Mod Directory:  " + modDirectory);
            Debug.Log("Mod Folders: " + System.String.Join(", ", Directory.GetDirectories(modDirectory)));

            modSubDirectories = Directory.GetDirectories(modDirectory);

            foreach (string currentModDir in modSubDirectories)
            {
                Debug.Log("Checking for assets in:  " + currentModDir);
                Debug.Log("Contents:  " + System.String.Join(", ", Directory.GetFiles(currentModDir)));
                Debug.Log("*.png Contents:  " + System.String.Join(", ", Directory.GetFiles(currentModDir, "*.png")));
                if (File.Exists(currentModDir + "\\thumb.png"))
                {
                    // Load the thumbnail and do stuff with it.
                    Debug.Log("Found a thumbnail!");
                }
                if (File.Exists(currentModDir + "\\mod"))
                {
                    Debug.Log("Mod file appears to exist.");
                    string path = currentModDir + "\\mod";

                    {
                        Debug.Log("Loading mod at: " + path);
                        WWW www = new WWW("file://" + path);
                        //www.LoadFromCacheOrDownload(path, "");
                        yield return(www);

                        // while (!www.isDone) { }

                        TextAsset[] tas = www.assetBundle.LoadAllAssets <TextAsset>();
                        System.Collections.Generic.List <string> tasList = new System.Collections.Generic.List <string>();
                        foreach (TextAsset ta in tas)
                        {
                            tasList.Add(ta.name);
                        }

                        Debug.Log("TextAssets loaded: " + string.Join(", ", tasList.ToArray()));

                        // Load the TextAsset object
                        TextAsset txt = www.assetBundle.LoadAsset <TextAsset>("ModAssembly.dll.bytes");
                        Debug.Log("txt.name: " + txt.name);
                        Debug.Log(txt ? "Found ModAssembly. **" + txt.name : "NOPE!");
                        txt = www.assetBundle.LoadAsset <TextAsset>("ModAssembly");
                        Debug.Log(txt ? "Found ModAssembly. Applying to ModMain object." : "NOPE!");

                        // Load the assembly and get a type (class) from it
                        if (txt)
                        {
                            Debug.Log("Found ModAssembly. Applying to ModMain object.");
                            var        assembly = System.Reflection.Assembly.Load(txt.bytes);
                            var        type     = assembly.GetType("ModMainBehavior");
                            GameObject go       = Instantiate(www.assetBundle.LoadAsset <GameObject>("ModMain"));
                            go.AddComponent(type);
                        }
                        else
                        {
                            Debug.Log("Did not find Assembly file.");
                            GameObject go = Instantiate(www.assetBundle.LoadAsset <GameObject>("ModMain"));
                        }



                        GameObject[] gos = www.assetBundle.LoadAllAssets <GameObject>();
                        System.Collections.Generic.List <string> gosList = new System.Collections.Generic.List <string>();
                        foreach (GameObject g in gos)
                        {
                            gosList.Add(g.name);
                        }

                        Debug.Log("Assets loaded: " + string.Join(", ", gosList.ToArray()));
                    }
                }
            }
        }

        if (!Directory.Exists(modDirectory))
        {
            Directory.CreateDirectory(modDirectory);
        }
    }
    private void AddTempFields(ref DataSet dsTemp)
    {
        System.Collections.Generic.List <string> strFields = new System.Collections.Generic.List <string>();

        strFields.Add("strHypertensionResolvedDate");
        strFields.Add("strDiabetesResolvedDate");
        strFields.Add("strLipidsResolvedDate");
        strFields.Add("strAsthmaResolvedDate");
        strFields.Add("strRefluxResolvedDate");
        strFields.Add("strSleepResolvedDate");
        strFields.Add("strFertilityResolvedDate");
        strFields.Add("strIncontinenceResolvedDate");
        strFields.Add("strBackResolvedDate");
        strFields.Add("strArthritisResolvedDate");
        strFields.Add("strCVDLevelResolvedDate");

        foreach (string strField in strFields)
        {
            DataColumn dcTemp = new DataColumn();
            dcTemp.DataType   = Type.GetType("System.String");
            dcTemp.ColumnName = strField;
            dsTemp.Tables[0].Columns.Add(dcTemp);
        }

        foreach (DataRow dRow in dsTemp.Tables[0].Rows)
        {
            dRow["strHypertensionResolvedDate"] = Convert.ToDateTime(dRow["HypertensionResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["HypertensionResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strDiabetesResolvedDate"]     = Convert.ToDateTime(dRow["DiabetesResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["DiabetesResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strLipidsResolvedDate"]       = Convert.ToDateTime(dRow["LipidsResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["LipidsResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strAsthmaResolvedDate"]       = Convert.ToDateTime(dRow["AsthmaResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["AsthmaResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strRefluxResolvedDate"]       = Convert.ToDateTime(dRow["RefluxResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["RefluxResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strSleepResolvedDate"]        = Convert.ToDateTime(dRow["SleepResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["SleepResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strFertilityResolvedDate"]    = Convert.ToDateTime(dRow["FertilityResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["FertilityResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strIncontinenceResolvedDate"] = Convert.ToDateTime(dRow["IncontinenceResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["IncontinenceResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strBackResolvedDate"]         = Convert.ToDateTime(dRow["BackResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["BackResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strArthritisResolvedDate"]    = Convert.ToDateTime(dRow["ArthritisResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["ArthritisResolvedDate"].ToString()).ToShortDateString() : "";
            dRow["strCVDLevelResolvedDate"]     = Convert.ToDateTime(dRow["CVDLevelResolvedDate"].ToString()).ToShortDateString().IndexOf("1900") == -1 ? Convert.ToDateTime(dRow["CVDLevelResolvedDate"].ToString()).ToShortDateString() : "";
        }
        dsTemp.AcceptChanges();
    }