Exemplo n.º 1
0
        public void UpdateGamesProperties()
        {
            var steam = new Steam(_db.GetAll().steamKey, _db.GetAll().steamId);

            try
            {
                var allSteamGames = Steam.GetFromSteam().Result.response.games;

                foreach (var steamGame in allSteamGames)
                {
                    var gameFound = games.Find(g => g.Name == steamGame.name && g.Store == "Steam");
                    if (gameFound != null)
                    {
                        games[games.IndexOf(gameFound)].PlayedTime = steamGame.playtime_forever;
                        //games[games.IndexOf(gameFound)].SteamOriginalImageURL = steamGame.img_logo_url + ".jpg";
                    }
                }
                int id = 1;
                foreach (var savedGame in games)
                {
                    savedGame.GameID = id++;
                }

                // _db.SaveJson(games, @"docs/games/games.json");
                // return Ok();
            }
            catch (Exception error)
            {
                // return StatusCode(500, error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handle a modified breakpoint event. Only handles address changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void BreakpointModified(object sender, EventArgs args)
        {
            MICore.Debugger.ResultEventArgs res = args as MICore.Debugger.ResultEventArgs;
            MICore.ResultValue bkpt             = res.Results.Find("bkpt");
            string             bkptId           = null;

            //
            // =breakpoint-modified,
            //    bkpt ={number="2",type="breakpoint",disp="keep",enabled="y",addr="<MULTIPLE>",times="0",original-location="main.cpp:220"},
            //          { number="2.1",enabled="y",addr="0x9c2149a9",func="Foo::bar<int>(int)",file="main.cpp",fullname="C:\\\\...\\\\main.cpp",line="220",thread-groups=["i1"]},
            //          { number="2.2",enabled="y",addr="0x9c2149f2",func="Foo::bar<float>(float)",file="main.cpp",fullname="C:\\\\...\\\\main.cpp",line="220",thread-groups=["i1"]}
            // note: the ".x" part of the breakpoint number never appears in stopping events, that is, when executing at one of these addresses
            //       the stopping event delivered contains bkptno="2"
            if (bkpt is MICore.ValueListValue)
            {
                MICore.ValueListValue list = bkpt as MICore.ValueListValue;
                bkptId = list.Content[0].FindString("number"); // 0 is the "<MULTIPLE>" entry
            }
            else
            {
                bkptId = bkpt.FindString("number");
            }
            AD7PendingBreakpoint pending = _pendingBreakpoints.Find((p) => { return(p.BreakpointId == bkptId); });

            if (pending == null)
            {
                return;
            }
            var bindList = pending.PendingBreakpoint.BindAddresses(bkpt);

            RebindAddresses(pending, bindList);
        }
Exemplo n.º 3
0
        static int Main(string[] args)
        {
            if (args.Length > 0)
            {
                string ProgramName = args[0];
                if (ProgramName == "-")
                {
                    PrintUsage(); return(-1);
                }
                List <string> ProgramArguments = new List <string>(args.Length - 1);
                for (int i = 1; i < args.Length; ++i)
                {
                    ProgramArguments.Add(args[i]);
                }

                var kvp = ProgramList.Find(x => x.Key.Equals(ProgramName));
                if (kvp.Value != null)
                {
                    return(kvp.Value(ProgramArguments));
                }
                else
                {
                    PrintUsage(args[0]);
                }
            }
            else
            {
                PrintUsage();
            }
            return(-1);
        }
Exemplo n.º 4
0
        static int _m_Find(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.List <string> gen_to_be_invoked = (System.Collections.Generic.List <string>)translator.FastGetCSObj(L, 1);



                {
                    System.Predicate <string> _match = translator.GetDelegate <System.Predicate <string> >(L, 2);

                    string gen_ret = gen_to_be_invoked.Find(
                        _match);
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Exemplo n.º 5
0
        public async void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            try
            {
                IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
                if (view == null)
                {
                    return;
                }
                view.Closed += OnViewClosed;
                var buffer = view.TextBuffer;
                if (buffer == null)
                {
                    return;
                }
                string ffn = await buffer.GetFFN();

                if (ffn == null)
                {
                    return;
                }
                var grammar_description = LanguageServer.GrammarDescriptionFactory.Create(ffn);
                if (grammar_description == null)
                {
                    return;
                }
                var document = Workspaces.Workspace.Instance.FindDocument(ffn);
                if (document == null)
                {
                    var name    = "Miscellaneous Files";
                    var project = Workspaces.Workspace.Instance.FindProject(name);
                    if (project == null)
                    {
                        project = new Workspaces.Project(name, name, name);
                        Workspaces.Workspace.Instance.AddChild(project);
                    }
                    document = new Workspaces.Document(ffn, ffn);
                    project.AddDocument(document);
                }
                Workspaces.Loader.LoadAsync().Wait();
                var content_type = buffer.ContentType;
                System.Collections.Generic.List <IContentType> content_types = ContentTypeRegistryService.ContentTypes.ToList();
                var new_content_type     = content_types.Find(ct => ct.TypeName == "Antlr");
                var type_of_content_type = new_content_type.GetType();
                var assembly             = type_of_content_type.Assembly;
                buffer.ChangeContentType(new_content_type, null);
                if (!PreviousContentType.ContainsKey(ffn))
                {
                    PreviousContentType[ffn] = content_type;
                }
                var to_do = LanguageServer.Module.Compile();
                var att   = buffer.Properties.GetOrCreateSingletonProperty(() => new AntlrVSIX.AggregateTagger.AntlrClassifier(buffer));
                att.Raise();
            }
            catch (Exception e)
            {
                Logger.Log.Notify(e.ToString());
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Finds the application error with the specified <paramref name="appErrorId"/>.
        /// </summary>
        /// <param name="appErrorId">The value that uniquely identifies the application error (<see cref="IAppError.AppErrorId"/>).</param>
        /// <returns>Returns an IAppError.</returns>
        public IAppError FindById(int appErrorId)
        {
            // We know appErrors is actually a List<IAppError> because we specified it in the constructor.
            System.Collections.Generic.List <IAppError> appErrors = (System.Collections.Generic.List <IAppError>)Items;

            return(appErrors.Find(delegate(IAppError appError)
            {
                return (appError.AppErrorId == appErrorId);
            }));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 搜索指定名称的元素。
        /// </summary>
        /// <param name="name">名称,为null或emtpy,直接返回null。</param>
        /// <returns></returns>
        public IParameterInfo Find(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            StringComparison comparison = _ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;

            return(_list.Find(p => string.Equals(p.Name, name, comparison)));
        }
Exemplo n.º 8
0
        public async void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            try
            {
                IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
                if (view == null)
                {
                    return;
                }

                view.Closed += OnViewClosed;
                Microsoft.VisualStudio.Text.ITextBuffer buffer = view.TextBuffer;
                if (buffer == null)
                {
                    return;
                }

                string ffn = await buffer.GetFFN();

                if (ffn == null)
                {
                    return;
                }

                if (!(Path.GetExtension(ffn) == ".g4" || Path.GetExtension(ffn) == ".g"))
                {
                    return;
                }

                if (!Options.Option.GetBoolean("OverrideAntlrPluggins"))
                {
                    return;
                }

                IContentType content_type = buffer.ContentType;
                System.Collections.Generic.List <IContentType> content_types = ContentTypeRegistryService.ContentTypes.ToList();
                IContentType new_content_type       = content_types.Find(ct => ct.TypeName == "Antlr");
                Type         type_of_content_type   = new_content_type.GetType();
                System.Reflection.Assembly assembly = type_of_content_type.Assembly;
                buffer.ChangeContentType(new_content_type, null);
                if (!PreviousContentType.ContainsKey(ffn))
                {
                    PreviousContentType[ffn] = content_type;
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 9
0
 static public int Find(IntPtr l)
 {
     try {
         System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l);
         System.Predicate <WWWRequest> a1;
         checkDelegate(l, 2, out a1);
         var ret = self.Find(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 10
0
        public Sys.Model.Database.Aplicativos.Client Insert(Sys.Model.Database.Aplicativos.Client model)
        {
            List <IDbDataParameter> listOfParameters = new System.Collections.Generic.List <IDbDataParameter>();
            SqlParameter            parameter        = null;

            parameter = new System.Data.SqlClient.SqlParameter("@UNIQ_KEY", SqlDbType.VarChar)
            {
                Direction = ParameterDirection.Input,
                Value     = model.UniqueKey
            };
            listOfParameters.Add(parameter);

            parameter = new System.Data.SqlClient.SqlParameter("@NOME", SqlDbType.VarChar)
            {
                Direction = ParameterDirection.Input,
                Value     = model.Name
            };
            listOfParameters.Add(parameter);

            parameter = new System.Data.SqlClient.SqlParameter("@DESC", SqlDbType.VarChar)
            {
                Direction = ParameterDirection.Input,
                Value     = model.Descrition
            };
            listOfParameters.Add(parameter);

            parameter = new System.Data.SqlClient.SqlParameter("@ATV", SqlDbType.Bit)
            {
                Direction = ParameterDirection.Input,
                Value     = model.Active
            };
            listOfParameters.Add(parameter);

            parameter = new System.Data.SqlClient.SqlParameter("@DT_CAD", SqlDbType.DateTime)
            {
                Direction = ParameterDirection.Input,
                Value     = model.DateRegister
            };

            listOfParameters.Add(parameter);

            ExecuteQuery("[Aplicativos].[Pr_CLIT_INSERT]", listOfParameters);

            model.UniqueKey = listOfParameters.Find(p => p.ParameterName.Equals("@UNIQ_KEY")).Value as string;

            return(model);
        }
Exemplo n.º 11
0
        public override void Initialize()
        {
            base.Initialize();

            string configfilepath        = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
            string configFolder          = Path.GetDirectoryName(configfilepath);
            string messageProviderFolder = configFolder + "\\" + eXtensibleWebApiConfig.MessageProviderFolder;

            if (Directory.Exists(messageProviderFolder))
            {
                List <string> files = new System.Collections.Generic.List <string>(Directory.GetFiles(messageProviderFolder));
                var           found = files.Find(x => x.StartsWith("messageprovider.", StringComparison.OrdinalIgnoreCase) && x.EndsWith(".xml", StringComparison.OrdinalIgnoreCase));
                if (found != null)
                {
                    IsInitialized = true;
                }
            }
        }
Exemplo n.º 12
0
 public static void Update(int ID, string Name, IPAddress IP, string Serial, string Ver)
 {
     if (Players.Find(x => x.ID == ID) != null)
     {
         Players.RemoveAt(Players.FindIndex(x => x.ID == ID));
         Players.Add(new BPlayer()
         {
             ID = ID, Name = Name, IP = IP, Serial = Serial, GameVersion = Ver
         });
     }
     else
     {
         Players.Add(new BPlayer()
         {
             ID = ID, Name = Name, IP = IP, Serial = Serial, GameVersion = Ver
         });
     }
 }
Exemplo n.º 13
0
    public static bool IsPointerOverUIObject(this EventSystem current, Vector3 pointerPosition, LayerMask?layerMask = null)
    {
        PointerEventData eventDataCurrentPosition = new PointerEventData(current);

        eventDataCurrentPosition.position = new Vector2(pointerPosition.x, pointerPosition.y);
        System.Collections.Generic.List <RaycastResult> results = new System.Collections.Generic.List <RaycastResult>();
        if (EventSystem.current != null)
        {
            EventSystem.current.RaycastAll(eventDataCurrentPosition, results);
        }
        if (layerMask != null)
        {
            LayerMask mask = layerMask.GetValueOrDefault();
            return(results.Find(x => mask == (mask | (1 << x.gameObject.layer))).isValid);
        }
        else
        {
            return(results.Count > 0);
        }
    }
Exemplo n.º 14
0
        public async void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            try
            {
                IWpfTextView view = AdaptersFactory.GetWpfTextView(textViewAdapter);
                if (view == null)
                {
                    return;
                }
                view.Closed += OnViewClosed;
                var buffer = view.TextBuffer;
                if (buffer == null)
                {
                    return;
                }
                string ffn = await buffer.GetFFN();

                if (ffn == null)
                {
                    return;
                }
                if (!(Path.GetExtension(ffn) == ".cpp"))
                {
                    return;
                }
                var content_type = buffer.ContentType;
                System.Collections.Generic.List <IContentType> content_types = ContentTypeRegistryService.ContentTypes.ToList();
                var new_content_type     = content_types.Find(ct => ct.TypeName == "clangd");
                var type_of_content_type = new_content_type.GetType();
                var assembly             = type_of_content_type.Assembly;
                buffer.ChangeContentType(new_content_type, null);
                if (!PreviousContentType.ContainsKey(ffn))
                {
                    PreviousContentType[ffn] = content_type;
                }
            }
            catch (Exception e)
            {
            }
        }
Exemplo n.º 15
0
        public void AddDonatedTroop(long did, int id, int value, int level)
        {
            DonationSlot donationSlot = m_vUnitDonation.Find((Predicate <DonationSlot>)(t =>
            {
                if (t.ID == id)
                {
                    return(t.UnitLevel == level);
                }
                return(false);
            }));

            if (donationSlot != null)
            {
                int index = m_vUnitDonation.IndexOf(donationSlot);
                donationSlot.Count          = donationSlot.Count + value;
                this.m_vUnitDonation[index] = donationSlot;
            }
            else
            {
                this.m_vUnitDonation.Add(new DonationSlot(did, id, value, level));
            }
        }
Exemplo n.º 16
0
        static int _m_Find(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.Collections.Generic.List <object> __cl_gen_to_be_invoked = (System.Collections.Generic.List <object>)translator.FastGetCSObj(L, 1);


            try {
                {
                    System.Predicate <object> match = translator.GetDelegate <System.Predicate <object> >(L, 2);

                    object __cl_gen_ret = __cl_gen_to_be_invoked.Find(match);
                    translator.PushAny(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static StackObject *Find_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Predicate <global::UITool_Attribute> @match = (System.Predicate <global::UITool_Attribute>) typeof(System.Predicate <global::UITool_Attribute>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.List <global::UITool_Attribute> instance_of_this_method = (System.Collections.Generic.List <global::UITool_Attribute>) typeof(System.Collections.Generic.List <global::UITool_Attribute>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Find(@match);

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        public static void Load(SPCRJointDynamicsController SPCRJointDynamicsContoller)
        {
            SPCRJointDynamicsControllerSave spcrJointDynamicsSave = LoadBinary();

            if (spcrJointDynamicsSave == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(SPCRJointDynamicsContoller.Name))
            {
                SPCRJointDynamicsContoller.Name = spcrJointDynamicsSave.name;
            }

            GameObject RootGameObject = GameObject.Find(spcrJointDynamicsSave.rootTransformName);

            if (RootGameObject != null)
            {
                SPCRJointDynamicsContoller._RootTransform = RootGameObject.transform;
            }

            globalUniqueIdList = GetGlobalUniqueIdComponentList();

            if (spcrJointDynamicsSave.spcrChildJointDynamicsPointList != null)
            {
                for (int i = 0; i < spcrJointDynamicsSave.spcrChildJointDynamicsPointList.Length; i++)
                {
                    SPCRJointDynamicsPoint point      = (SPCRJointDynamicsPoint)globalUniqueIdList.Find(obj => obj.GetType() == typeof(SPCRJointDynamicsPoint) && ((SPCRJointDynamicsPoint)obj).UniqueGUIID.Equals(spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].RefUniqueID));
                    SPCRJointDynamicsPoint ChildPoint = (SPCRJointDynamicsPoint)globalUniqueIdList.Find(obj => obj.GetType() == typeof(SPCRJointDynamicsPoint) && ((SPCRJointDynamicsPoint)obj).UniqueGUIID.Equals(spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].refChildID));
                    if (point != null)
                    {
                        point._Mass                   = spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].mass;
                        point._RefChildPoint          = ChildPoint;
                        point._IsFixed                = spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].IsFixed;
                        point._BoneAxis               = spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].BoneAxis.ToUnityVector3();
                        point._Depth                  = spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].Depth;
                        point._Index                  = spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].Index;
                        point._UseForSurfaceCollision = spcrJointDynamicsSave.spcrChildJointDynamicsPointList[i].UseForSurfaceCollision;
                    }
                }
            }

            if (spcrJointDynamicsSave.spcrChildJointDynamicsColliderList != null)
            {
                List <SPCRJointDynamicsCollider> colliderTable = new List <SPCRJointDynamicsCollider>();
                for (int i = 0; i < spcrJointDynamicsSave.spcrChildJointDynamicsColliderList.Length; i++)
                {
                    SPCRJointDynamicsCollider point = (SPCRJointDynamicsCollider)globalUniqueIdList.Find(obj => obj.GetType() == typeof(SPCRJointDynamicsCollider) && ((SPCRJointDynamicsCollider)obj).UniqueGUIID.Equals(spcrJointDynamicsSave.spcrChildJointDynamicsColliderList[i].RefUniqueId));
                    if (point == null)
                    {
                        point = CreateNewCollider(spcrJointDynamicsSave.spcrChildJointDynamicsColliderList[i]);
                    }
                    point.RadiusRaw             = spcrJointDynamicsSave.spcrChildJointDynamicsColliderList[i].Radius;
                    point.HeightRaw             = spcrJointDynamicsSave.spcrChildJointDynamicsColliderList[i].Height;
                    point.FrictionRaw           = spcrJointDynamicsSave.spcrChildJointDynamicsColliderList[i].Friction;
                    point._SurfaceColliderForce = spcrJointDynamicsSave.spcrChildJointDynamicsColliderList[i].ForceType;

                    if (!colliderTable.Contains(point))
                    {
                        colliderTable.Add(point);
                    }
                }
                if (colliderTable.Count > 0)
                {
                    SPCRJointDynamicsContoller._ColliderTbl = colliderTable.ToArray();
                }
            }

            if (spcrJointDynamicsSave.spcrChildJointDynamicsPointGtabberList != null)
            {
                List <SPCRJointDynamicsPointGrabber> grabberList = new List <SPCRJointDynamicsPointGrabber>();
                for (int i = 0; i < spcrJointDynamicsSave.spcrChildJointDynamicsPointGtabberList.Length; i++)
                {
                    SPCRJointDynamicsPointGrabber point = (SPCRJointDynamicsPointGrabber)globalUniqueIdList.Find(obj => obj.GetType() == typeof(SPCRJointDynamicsPointGrabber) && ((SPCRJointDynamicsPointGrabber)obj).UniqueGUIID.Equals(spcrJointDynamicsSave.spcrChildJointDynamicsPointGtabberList[i].RefUniqueGUIID));
                    if (point == null)
                    {
                        point = CreateNewGrabber(spcrJointDynamicsSave.spcrChildJointDynamicsPointGtabberList[i]);
                    }
                    point.IsEnabled = spcrJointDynamicsSave.spcrChildJointDynamicsPointGtabberList[i].IsEnabled;
                    point.RadiusRaw = spcrJointDynamicsSave.spcrChildJointDynamicsPointGtabberList[i].Radius;
                    point.Force     = spcrJointDynamicsSave.spcrChildJointDynamicsPointGtabberList[i].Force;

                    grabberList.Add(point);
                }
                if (grabberList.Count > 0)
                {
                    SPCRJointDynamicsContoller._PointGrabberTbl = grabberList.ToArray();
                }
            }

            if (spcrJointDynamicsSave.RootPointTbl != null)
            {
                List <SPCRJointDynamicsPoint> pointList = new List <SPCRJointDynamicsPoint>();
                for (int i = 0; i < spcrJointDynamicsSave.RootPointTbl.Length; i++)
                {
                    SPCRJointDynamicsPoint point = (SPCRJointDynamicsPoint)globalUniqueIdList.Find(obj => obj.GetType() == typeof(SPCRJointDynamicsPoint) && ((SPCRJointDynamicsPoint)obj).UniqueGUIID.Equals(spcrJointDynamicsSave.RootPointTbl[i]));
                    if (point == null)
                    {
                        continue;
                    }
                    pointList.Add(point);
                }
                if (pointList.Count > 0)
                {
                    SPCRJointDynamicsContoller._RootPointTbl = pointList.ToArray();
                }
            }
            else
            {
                SPCRJointDynamicsContoller._RootPointTbl = new SPCRJointDynamicsPoint[0];
            }

            SPCRJointDynamicsContoller._Relaxation = spcrJointDynamicsSave.Relaxation;
            SPCRJointDynamicsContoller._SubSteps   = spcrJointDynamicsSave.SubSteps;

            //@SPCRJointDynamicsContoller._IsEnablePointCollision = spcrJointDynamicsSave.IsEnablePointCollision;
            //@SPCRJointDynamicsContoller._DetailHitDivideMax = spcrJointDynamicsSave.DetailHitDivideMax;

            SPCRJointDynamicsContoller._IsCancelResetPhysics     = spcrJointDynamicsSave.IsCancelResetPhysics;
            SPCRJointDynamicsContoller._IsEnableSurfaceCollision = spcrJointDynamicsSave.IsEnableSurfaceCollision;
            SPCRJointDynamicsContoller._SurfaceCollisionDivision = spcrJointDynamicsSave.SurfaceCollisionDivision;

            SPCRJointDynamicsContoller._MassScaleCurve    = GetAnimCurve(spcrJointDynamicsSave.MassScaleCurve);
            SPCRJointDynamicsContoller._GravityScaleCurve = GetAnimCurve(spcrJointDynamicsSave.GravityScaleCurve);
            SPCRJointDynamicsContoller._ResistanceCurve   = GetAnimCurve(spcrJointDynamicsSave.ResistanceCurve);
            SPCRJointDynamicsContoller._HardnessCurve     = GetAnimCurve(spcrJointDynamicsSave.HardnessCurve);
            SPCRJointDynamicsContoller._FrictionCurve     = GetAnimCurve(spcrJointDynamicsSave.FrictionCurve);

            SPCRJointDynamicsContoller._AllShrinkScaleCurve  = GetAnimCurve(spcrJointDynamicsSave.AllShrinkScaleCurve);
            SPCRJointDynamicsContoller._AllStretchScaleCurve = GetAnimCurve(spcrJointDynamicsSave.AllStretchScaleCurve);
            SPCRJointDynamicsContoller._StructuralShrinkVerticalScaleCurve    = GetAnimCurve(spcrJointDynamicsSave.StructuralShrinkVerticalScaleCurve);
            SPCRJointDynamicsContoller._StructuralStretchVerticalScaleCurve   = GetAnimCurve(spcrJointDynamicsSave.StructuralStretchVerticalScaleCurve);
            SPCRJointDynamicsContoller._StructuralShrinkHorizontalScaleCurve  = GetAnimCurve(spcrJointDynamicsSave.StructuralShrinkHorizontalScaleCurve);
            SPCRJointDynamicsContoller._StructuralStretchHorizontalScaleCurve = GetAnimCurve(spcrJointDynamicsSave.StructuralStretchHorizontalScaleCurve);
            SPCRJointDynamicsContoller._ShearShrinkScaleCurve              = GetAnimCurve(spcrJointDynamicsSave.ShearShrinkScaleCurve);
            SPCRJointDynamicsContoller._ShearStretchScaleCurve             = GetAnimCurve(spcrJointDynamicsSave.ShearStretchScaleCurve);
            SPCRJointDynamicsContoller._BendingShrinkVerticalScaleCurve    = GetAnimCurve(spcrJointDynamicsSave.BendingShrinkVerticalScaleCurve);
            SPCRJointDynamicsContoller._BendingStretchVerticalScaleCurve   = GetAnimCurve(spcrJointDynamicsSave.BendingStretchVerticalScaleCurve);
            SPCRJointDynamicsContoller._BendingShrinkHorizontalScaleCurve  = GetAnimCurve(spcrJointDynamicsSave.BendingShrinkHorizontalScaleCurve);
            SPCRJointDynamicsContoller._BendingStretchHorizontalScaleCurve = GetAnimCurve(spcrJointDynamicsSave.BendingStretchHorizontalScaleCurve);

            SPCRJointDynamicsContoller._Gravity   = spcrJointDynamicsSave.Gravity.ToUnityVector3();
            SPCRJointDynamicsContoller._WindForce = spcrJointDynamicsSave.WindForce.ToUnityVector3();

            SPCRJointDynamicsContoller._RootSlideLimit  = spcrJointDynamicsSave.RootSlideLimit;
            SPCRJointDynamicsContoller._RootRotateLimit = spcrJointDynamicsSave.RootRotateLimit;

            SPCRJointDynamicsContoller._StructuralShrinkVertical    = spcrJointDynamicsSave.StructuralShrinkVertical;
            SPCRJointDynamicsContoller._StructuralStretchVertical   = spcrJointDynamicsSave.StructuralStretchVertical;
            SPCRJointDynamicsContoller._StructuralShrinkHorizontal  = spcrJointDynamicsSave.StructuralShrinkHorizontal;
            SPCRJointDynamicsContoller._StructuralStretchHorizontal = spcrJointDynamicsSave.StructuralStretchHorizontal;
            SPCRJointDynamicsContoller._ShearShrink              = spcrJointDynamicsSave.ShearShrink;
            SPCRJointDynamicsContoller._ShearStretch             = spcrJointDynamicsSave.ShearStretch;
            SPCRJointDynamicsContoller._BendingShrinkVertical    = spcrJointDynamicsSave.BendingShrinkVertical;
            SPCRJointDynamicsContoller._BendingStretchVertical   = spcrJointDynamicsSave.BendingStretchVertical;
            SPCRJointDynamicsContoller._BendingShrinkHorizontal  = spcrJointDynamicsSave.BendingShrinkHorizontal;
            SPCRJointDynamicsContoller._BendingStretchHorizontal = spcrJointDynamicsSave.BendingStretchHorizontal;

            SPCRJointDynamicsContoller._IsAllStructuralShrinkVertical    = spcrJointDynamicsSave.IsAllStructuralShrinkVertical;
            SPCRJointDynamicsContoller._IsAllStructuralStretchVertical   = spcrJointDynamicsSave.IsAllStructuralStretchVertical;
            SPCRJointDynamicsContoller._IsAllStructuralShrinkHorizontal  = spcrJointDynamicsSave.IsAllStructuralShrinkHorizontal;
            SPCRJointDynamicsContoller._IsAllStructuralStretchHorizontal = spcrJointDynamicsSave.IsAllStructuralStretchHorizontal;
            SPCRJointDynamicsContoller._IsAllShearShrink              = spcrJointDynamicsSave.IsAllShearShrink;
            SPCRJointDynamicsContoller._IsAllShearStretch             = spcrJointDynamicsSave.IsAllShearStretch;
            SPCRJointDynamicsContoller._IsAllBendingShrinkVertical    = spcrJointDynamicsSave.IsAllBendingShrinkVertical;
            SPCRJointDynamicsContoller._IsAllBendingStretchVertical   = spcrJointDynamicsSave.IsAllBendingStretchVertical;
            SPCRJointDynamicsContoller._IsAllBendingShrinkHorizontal  = spcrJointDynamicsSave.IsAllBendingShrinkHorizontal;
            SPCRJointDynamicsContoller._IsAllBendingStretchHorizontal = spcrJointDynamicsSave.IsAllBendingStretchHorizontal;

            SPCRJointDynamicsContoller._IsCollideStructuralVertical   = spcrJointDynamicsSave.IsCollideStructuralVertical;
            SPCRJointDynamicsContoller._IsCollideStructuralHorizontal = spcrJointDynamicsSave.IsCollideStructuralHorizontal;
            SPCRJointDynamicsContoller._IsCollideShear = spcrJointDynamicsSave.IsCollideShear;

            SPCRJointDynamicsContoller._IsLoopRootPoints              = spcrJointDynamicsSave.IsLoopRootPoints;
            SPCRJointDynamicsContoller._IsComputeStructuralVertical   = spcrJointDynamicsSave.IsComputeStructuralVertical;
            SPCRJointDynamicsContoller._IsComputeStructuralHorizontal = spcrJointDynamicsSave.IsComputeStructuralHorizontal;
            SPCRJointDynamicsContoller._IsComputeShear             = spcrJointDynamicsSave.IsComputeShear;
            SPCRJointDynamicsContoller._IsComputeBendingVertical   = spcrJointDynamicsSave.IsComputeBendingVertical;
            SPCRJointDynamicsContoller._IsComputeBendingHorizontal = spcrJointDynamicsSave.IsComputeBendingHorizontal;

            SPCRJointDynamicsContoller._IsDebugDraw_StructuralVertical   = spcrJointDynamicsSave.IsDebugDraw_StructuralVertical;
            SPCRJointDynamicsContoller._IsDebugDraw_StructuralHorizontal = spcrJointDynamicsSave.IsDebugDraw_StructuralHorizontal;
            SPCRJointDynamicsContoller._IsDebugDraw_Shear                 = spcrJointDynamicsSave.IsDebugDraw_Shear;
            SPCRJointDynamicsContoller._IsDebugDraw_BendingVertical       = spcrJointDynamicsSave.IsDebugDraw_BendingVertical;
            SPCRJointDynamicsContoller._IsDebugDraw_BendingHorizontal     = spcrJointDynamicsSave.IsDebugDraw_BendingHorizontal;
            SPCRJointDynamicsContoller._IsDebugDraw_SurfaceFace           = spcrJointDynamicsSave.IsDebugDraw_SurfaceFace;
            SPCRJointDynamicsContoller._Debug_SurfaceNormalLength         = spcrJointDynamicsSave.Debug_SurfaceNoramlLength;
            SPCRJointDynamicsContoller._IsDebugDraw_RuntimeColliderBounds = spcrJointDynamicsSave.IsDebugDraw_RuntimeColliderBounds;

            if (spcrJointDynamicsSave.ConstraintTable != null)
            {
                SPCRJointDynamicsContoller.ConstraintTable = new SPCRJointDynamicsJob.Constraint[spcrJointDynamicsSave.ConstraintTable.Length][];
                for (int i = 0; i < spcrJointDynamicsSave.ConstraintTable.Length; i++)
                {
                    SPCRJointDynamicsContoller.ConstraintTable[i] = new SPCRJointDynamicsJob.Constraint[spcrJointDynamicsSave.ConstraintTable[i].Length];
                    for (int j = 0; j < spcrJointDynamicsSave.ConstraintTable[i].Length; j++)
                    {
                        SPCRJointDynamicsContoller.ConstraintTable[i][j] = spcrJointDynamicsSave.ConstraintTable[i][j].ConvertToJobConstraint();
                    }
                }
            }

            SPCRJointDynamicsContoller.MaxPointDepth = spcrJointDynamicsSave.MaxPointDepth;

            SPCRJointDynamicsContoller._UseLimitAngles  = spcrJointDynamicsSave.UseLimitAngles;
            SPCRJointDynamicsContoller._LimitAngle      = spcrJointDynamicsSave.LimitAngle;
            SPCRJointDynamicsContoller._LimitFromRoot   = spcrJointDynamicsSave.LimitFromRoot;
            SPCRJointDynamicsContoller._LimitPowerCurve = GetAnimCurve(spcrJointDynamicsSave.LimitPowerCurve);

            globalUniqueIdList.Clear();
        }
Exemplo n.º 19
0
        /// <summary>
        /// Creates Compound commands if necessary
        /// </summary>
        /// <param name="commands"></param>
        private Command[] OptimizeCommands(SyncEngine engine, IList<Entity> commands)
        {
            if (commands == null)
                throw new ArgumentNullException("commands");

            if (commands.Count == 0)
                return new Command[0];

            HashedList<Command> optimizedCommands = new HashedList<Command>();

            System.Collections.Generic.List<CompoundCreateCommand> createdCommands = new System.Collections.Generic.List<CompoundCreateCommand>();

            int j;

            for (int i = 0; i < commands.Count; i++)
            {
                Entity e = commands[i];

                string currentId = e.GetString(SyncUtils.PARENTID);
                int transaction = e.GetInt32(SyncUtils.TRANSACTION);

                switch (e.Type)
                {
                    case SyncUtils.CREATE_ENTITY:

                        string createType = e.GetString(SyncUtils.TYPE);

                        j = i + 1;

                        CompoundCreateCommand ccc = new CompoundCreateCommand(currentId, createType, new List<AttributeCommand>());

                        CompoundCreateCommand actual = createdCommands.Find(delegate(CompoundCreateCommand toFind)
                        {
                            return toFind.ClientId == ccc.ClientId &&
                                toFind.ParentId == ccc.ParentId &&
                                toFind.Type == ccc.Type;
                        });

                        if (actual == null)
                        {
                            createdCommands.Add(ccc);
                            optimizedCommands.Add(ccc);

                            while (j < commands.Count)
                            {

                                string subType = commands[j].GetString(SyncUtils.PARENTTYPE);
                                string subId = commands[j].GetString(SyncUtils.PARENTID);
                                int subTransaction = commands[j].GetInt32(SyncUtils.TRANSACTION);
                                string subCommand = commands[j].Type;

                                if (commands[j].Type == SyncUtils.CREATE_ATTRIBUTE && subId == currentId && subType == createType)
                                {
                                    if (subTransaction != transaction)
                                        break;

                                    ccc.InnerCommands.Add((AttributeCommand)engine.CreateCommand(commands[j]));
                                    commands.RemoveAt(j);
                                }
                                else
                                {
                                    j++;
                                }
                            }
                        }
                        else
                        {
                            optimizedCommands.Remove(actual);
                            optimizedCommands.Add(ccc);

                            createdCommands.Remove(actual);
                            createdCommands.Add(ccc);
                        }

                        break;

                    case SyncUtils.UPDATE_ATTRIBUTE:

                        string updateType = e.GetString(SyncUtils.PARENTTYPE);

                        j = i + 1;

                        CompoundUpdateCommand cuc = new CompoundUpdateCommand(currentId, updateType, new List<AttributeCommand>());
                        cuc.InnerCommands.Add((AttributeCommand)engine.CreateCommand(commands[i]));
                        optimizedCommands.Add(cuc);

                        while (j < commands.Count)
                        {
                            string subType = commands[j].GetString(SyncUtils.PARENTTYPE);
                            string subId = commands[j].GetString(SyncUtils.PARENTID);
                            int subTransaction = commands[j].GetInt32(SyncUtils.TRANSACTION);
                            string subCommand = commands[j].Type;

                            if (commands[j].Type == SyncUtils.UPDATE_ATTRIBUTE && subId == currentId && subType == updateType)
                            {
                                if (subTransaction != transaction)
                                    break;

                                cuc.InnerCommands.Add((AttributeCommand)engine.CreateCommand(commands[j]));
                                commands.RemoveAt(j);
                            }
                            else
                            {
                                j++;
                            }
                        }

                        break;

                    default:
                        optimizedCommands.Add(engine.CreateCommand(e));
                        break;

                }
            }

            Command[] result = new Command[optimizedCommands.Count];
            for (int i = 0; i < result.Length; i++)
                result[i] = (Command)optimizedCommands[i];

            return result;
        }
Exemplo n.º 20
0
 public virtual T Find(Predicate <T> match)
 {
     return(list.Find(match));
 }
Exemplo n.º 21
0
    private void SaveDefaults()
    {
        string newTags = "";
            if (! (Request.Form["newTags"] == null))
            {
                newTags = Request.Form["newTags"].Trim();
            }

            string[] newTagsArray = newTags.Split(";".ToCharArray());
            System.Collections.Generic.List<string> newTagsList = new System.Collections.Generic.List<string>(newTagsArray);

            Hashtable originalTagHT = new Hashtable();
            string orginalTagList;
            orginalTagList = Request.Form["originalTags"].Trim();

            //loop through existing default tags and make sure they havent been removed - if so delete them
            //also - build up a hashtable of original default tags so we can reference them later
            //both tag lists are stored in following format:  <TagText>~<LanguageID>;<TagText>~<LanguageID>;
            string[] origTagsArray = orginalTagList.Split(";".ToCharArray());
            foreach (string tag in origTagsArray)
            {
                chkTag = tag;
                originalTagHT.Add(tag, "");
                string tagMatch = (string) (newTagsList.Find(FindTagByName));

                if (string.IsNullOrEmpty(tagMatch))
                {
                    m_tagApi.RemoveTagAsDefault(tag, m_containerPage.ContentLanguage, defaultTagObjectType);
                }
            }

            // loop throug tagdata stored in newtags field
            foreach (string tag in newTagsList)
            {
                m_tagApi.SaveTagAsDefault(tag, m_containerPage.ContentLanguage, defaultTagObjectType);
            }
    }
Exemplo n.º 22
0
        public void ProcessIFValidRequest(System.Data.DataTable Data)
        {
            try
            {
                string        workstation, apppath, appname, tokentocompare;
                DateTime      date        = DateTime.Now;
                string        salt        = "SerenityNow1972";
                string        sep         = "<>";
                string        input       = "";
                string        MyToken     = "";
                string        ProgramHash = "";
                StringBuilder sb          = null;
                System.Collections.Generic.List <string> vals;
                foreach (System.Data.DataRow row in Data.Rows)
                {
                    sb = new StringBuilder();

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

                    vals.Add(salt);

                    NRCAN_UserID = row["Username"].ToString();
                    vals.Add(NRCAN_UserID);

                    workstation = row["Workstation"].ToString();
                    vals.Add(workstation);

                    apppath = row["AppPath"].ToString();
                    vals.Add(apppath);
                    date = DateTime.Parse(row["RequestedDate"].ToString());
                    string reqdate = date.ToString("yyyy-MM-dd HH:mm:ss");
                    vals.Add(reqdate);

                    appname = row["AppName"].ToString();
                    id      = row["id"].ToString();

                    WriteToFile("Processing Request " + id);
                    AddDebugLogs(connection, Logs.debug, "Processing request " + id + " on " + workstation);


                    sb.Append("Username: "******", Workstation: " + workstation);
                    sb.Append(", Application Name: " + appname);
                    sb.Append(", Application Path: " + apppath);
                    sb.Append(", Requested Date: " + reqdate);
                    input = string.Join(sep, vals);
                    sb.Append(", MD5 Hash Algorithm Value: " + input);
                    MyToken = MD5(input);
                    sb.Append(", MD5 Hash Value: " + MyToken);
                    tokentocompare = row["token"].ToString();
                    sb.Append(", Token In Database: " + tokentocompare);

                    //GET THE HASH OF PROGRAM
                    ProgramHash = GetSHAHashFromFile(apppath);
                    sb.Append(", SHA256 Hash: " + ProgramHash);
                    //CHECK THAT THIS PROGRAM HASH DOESN'T MATCH THE BLACK LISTED HASH
                    BlackListedHashes program = BLPrograms.Find((x => x.SHA256Hash.Equals(ProgramHash)));
                    //NULL MEANS GOOD ELSE POSSIBLE HACK ATTEMP
                    if (program == null)
                    {
                        sb.Append(", Message: Successful validation against blacklisted program hashes");
                        //IF TOKEN MATCHD THEN GO AHEAD AND ELEVATE THE PROCESS, ELSE DIDN'T MATCH PROBABLY AN HACK ATTEMPT OR SOME OTHER ERROR HAPPENED
                        if (MyToken.Equals(tokentocompare))
                        {
                            sb.Append(", Message: MD5 hash validation was successful");
                            // launch the application
                            ApplicationLoader.PROCESS_INFORMATION procInfo;
                            ApplicationLoader.StartProcessAndBypassUAC(apppath, out procInfo);
                            //ONCE THE APPLICATIOIN HAS BEEN LAUNCHED UPDATE THE RECORD
                            string query = "Update ElevateProcess Set Status = 'closed' where id = " + id;
                            command = new MySqlCommand(query, connection);
                            command.ExecuteNonQuery();
                            AddLogs(connection, Logs.info, id, " process spawned successfully on " + workstation);
                            WriteToFile("Request " + id.ToLower() + " Successfully processed");
                            connection.Close();
                            break;
                        }
                        else
                        {
                            sb.Append(", Message: MD5 hash validation failed");
                            MD5HashNotFound = true;
                            AddLogs(connection, Logs.error, id, "MD5 hash mismatch (possible hack attempt), Client Name: " + NRCAN_UserID + " , Application Name: " + appname + " , Application Path: " + apppath);
                            break;
                        }
                    }
                    else
                    {
                        sb.Append(", Message: SHA256 validation failed, this is a blacklisted application");
                        BlackListedAppRequested = true;
                        AddLogs(connection, Logs.error, id, "Client " + NRCAN_UserID + " requested a black listed app, Application Name: " + appname + " , Application Path: " + apppath);
                        break;
                    }
                }
                //ADD DEBUG INFO
                if (debug && sb != null)
                {
                    AddLogs(connection, Logs.debug, id, sb.ToString());
                }
            }
            catch (Exception ex)
            {
                AddLogs(connection, Logs.error, id, ex.Message);
                WriteToFile(ex.Message);
            }
        }
Exemplo n.º 23
0
 public Player GetPlayer(EntityId id)
 {
     return(_players.Find(p => p.entityId == id));
 }