public override void DeserializeBody(BinaryReader br) { Ttl = (TLAccountDaysTTL)ObjectUtils.DeserializeObject(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (TLAffectedMessages)ObjectUtils.DeserializeObject(br); }
public override void SerializeBody(BinaryWriter bw) { bw.Write(Constructor); ObjectUtils.SerializeObject(Id, bw); }
public override void deserializeResponse(BinaryReader br) { Response = (Messages.TLAbsSentEncryptedMessage)ObjectUtils.DeserializeObject(br); }
public void Dispose() { ObjectUtils.DisposeQuietly(this.Timer); }
public override void SerializeBody(BinaryWriter bw) { bw.Write(this.Constructor); ObjectUtils.SerializeObject(this.ExceptIds, bw); }
static WorkspaceModule() { workspaceTypes = ObjectUtils.GetImplementationsOfInterface(typeof(IWorkspace)).ToList(); }
public override void DeserializeBody(BinaryReader br) { Peer = (TLInputEncryptedChat)ObjectUtils.DeserializeObject(br); RandomId = br.ReadInt64(); Data = BytesUtil.Deserialize(br); }
public override void DeserializeBody(BinaryReader br) { Id = (TLVector <TLAbsInputUser>)ObjectUtils.DeserializeVector <TLAbsInputUser>(br); }
public static void _ReloadSettingsAndRoutes() { GenUtils.LogMsg("status", "webrole _ReloadRoutes", null); bool new_routes = false; try { var settings = GenUtils.GetSettingsFromAzureTable(); if (settings.Keys.Count == 0) { GenUtils.PriorityLogMsg("exception", "ReloadSettings: no settings!", null); } else { ElmcityController.settings = settings; } } catch (Exception e0) { var msg = "_ReloadSettingsAndRoutes: settings"; GenUtils.PriorityLogMsg("exception", msg, e0.Message); } try { var themes = Utils.GetThemesDict(); if (ObjectUtils.DictOfDictStrEqualsDictOfDictStr(themes, ElmcityController.themes) == false) { GenUtils.LogMsg("status", "_ReloadSettingsAndRoutes", "reloading themes"); lock (ElmcityController.themes) { ElmcityController.themes = themes; } } } catch (Exception e2) { var msg = "_ReloadSettingsAndRoutes: themes"; GenUtils.PriorityLogMsg("exception", msg, e2.Message); } return; try { var new_wrd = WebRoleData.GetWrd(); if (new_wrd == null || wrd.IsConsistent() == false) { GenUtils.PriorityLogMsg("warning", "null or inconsistent WebRoleData!", null); return; } if (new_wrd.ready_ids.Count != ElmcityApp.wrd.ready_ids.Count) // did # of hubs change? either on initial load or subsequently { new_routes = true; // force rebuild of route map GenUtils.LogMsg("status", "Reload: found a new hub", null); WebRoleData.SaveTimestampedWrd(ElmcityApp.wrd); lock (ElmcityApp.wrd) { ElmcityApp.wrd = new_wrd; // update WebRoleData (todo: rewarm caches affected) } } foreach (var id in ElmcityApp.wrd.ready_ids) // did any hub's renderer change? { var cached_renderer = ElmcityApp.wrd.renderers[id]; var current_renderer = Utils.AcquireRenderer(id); if (cached_renderer.timestamp != current_renderer.timestamp) // timestamp changed { if (!Utils.RenderersAreEqual(cached_renderer, current_renderer, except_keys: new List <string>() { "timestamp" })) { GenUtils.LogMsg("status", "Reload: new renderer for " + id, null); lock (ElmcityApp.wrd) { ElmcityApp.wrd.renderers[id] = current_renderer; // update the renderer if (ElmcityApp.home_controller != null) // skip this if we found a change on startup, controller not ready { var cache = new AspNetCache(ElmcityApp.home_controller.HttpContext.Cache); var url = Utils.MakeBaseZonelessUrl(id); cache.Remove(url); // flush cached objects for id var obj = HttpUtils.FetchUrl(new Uri(url)); // rewarm cache } } } } } } catch (Exception e1) { GenUtils.PriorityLogMsg("exception", "_ReloadSettingsAndRoutes: cannot check/update wrd", e1.Message + e1.StackTrace); } if (new_routes) { var existing_routes = RouteTable.Routes; var route_count = existing_routes.Count; try { GenUtils.LogMsg("status", "_ReloadSettingsAndRoutes: registering " + route_count + " routes", null); lock (RouteTable.Routes) { var route_count_old = RouteTable.Routes.Count; GenUtils.PriorityLogMsg("info", RouteTable.Routes.Count + " routes before reload", null); RouteTable.Routes.Clear(); ElmcityApp.RegisterRoutes(RouteTable.Routes, ElmcityApp.wrd); GenUtils.PriorityLogMsg("info", RouteTable.Routes.Count + " routes registered", null); var route_count_new = RouteTable.Routes.Count; if (route_count_new < route_count_old) { GenUtils.PriorityLogMsg("warning", "route count was " + route_count_old + ", is " + route_count_new, null); } } } catch (Exception e3) { GenUtils.PriorityLogMsg("exception", "_ReloadSettingsAndRoutes: registering " + route_count + " routes", e3.Message + e3.StackTrace); ElmcityApp.RegisterRoutes(existing_routes, ElmcityApp.wrd); } } }
void OnDestroy() { ObjectUtils.Destroy(m_BlockSelectCube); this.ClearFeedbackRequests(); }
public override void deserializeResponse(BinaryReader br) { Response = (TLAbsUpdates)ObjectUtils.DeserializeObject(br); }
public override void DeserializeBody(BinaryReader br) { channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br); user_id = (TLAbsInputUser)ObjectUtils.DeserializeObject(br); kicked = BoolUtil.Deserialize(br); }
public override void deserializeResponse(BinaryReader br) { Response = (TLNearestDc)ObjectUtils.DeserializeObject(br); }
public override void DeserializeBody(BinaryReader br) { this.Flags = br.ReadInt32(); this.Pinned = (this.Flags & 1) != 0; this.Peer = (TLAbsInputPeer)ObjectUtils.DeserializeObject(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { this.ExceptIds = (TLVector <int>)ObjectUtils.DeserializeVector <int>(br); }
public override void DeserializeBody(BinaryReader br) { category = (TLAbsTopPeerCategory)ObjectUtils.DeserializeObject(br); peer = (TLAbsInputPeer)ObjectUtils.DeserializeObject(br); }
public override void DeserializeResponse(BinaryReader br) { this.Response = (Messages.TLAbsChats)ObjectUtils.DeserializeObject(br); }
void OnDisable() { Camera.onPostRender -= RenderMiniWorld; ObjectUtils.Destroy(m_MiniCamera.gameObject); }
public override void DeserializeBody(BinaryReader br) { peer = (TLAbsInputEncryptedChat)ObjectUtils.DeserializeObject(br); random_id = br.ReadInt64(); data = BytesUtil.Deserialize(br); }
static void GenerateLODs(GameObject go) { // A NOP to make sure we have an instance before launching into threads that may need to execute on the main thread MonoBehaviourHelper.ExecuteOnMainThread(() => {}); var meshFilters = go.GetComponentsInChildren <MeshFilter>(); if (meshFilters.Length > 0) { var lodGroup = go.GetComponent <LODGroup>(); if (!lodGroup) { lodGroup = go.AddComponent <LODGroup>(); } var lods = new LOD[maxLOD + 1]; var lod0 = lods[0]; lod0.renderers = go.GetComponentsInChildren <MeshRenderer>(); lod0.screenRelativeTransitionHeight = 0.5f; lods[0] = lod0; var meshes = new List <Mesh>(); for (int l = 1; l <= maxLOD; l++) { var lodRenderers = new List <MeshRenderer>(); foreach (var mf in meshFilters) { var sharedMesh = mf.sharedMesh; if (!sharedMesh) { Debug.LogWarning("AutoLOD: Missing mesh " + mf.name, mf); continue; } var lodTransform = EditorUtility.CreateGameObjectWithHideFlags(string.Format("{0} LOD{1}", sharedMesh.name, l), k_DefaultHideFlags, typeof(MeshFilter), typeof(MeshRenderer)).transform; lodTransform.SetParent(mf.transform, false); var lodMF = lodTransform.GetComponent <MeshFilter>(); var lodRenderer = lodTransform.GetComponent <MeshRenderer>(); lodRenderers.Add(lodRenderer); EditorUtility.CopySerialized(mf, lodMF); EditorUtility.CopySerialized(mf.GetComponent <MeshRenderer>(), lodRenderer); var simplifiedMesh = new Mesh(); simplifiedMesh.name = sharedMesh.name + string.Format(" LOD{0}", l); lodMF.sharedMesh = simplifiedMesh; meshes.Add(simplifiedMesh); var worker = new BackgroundWorker(); var index = l; var inputMesh = sharedMesh.ToWorkingMesh(); var outputMesh = simplifiedMesh.ToWorkingMesh(); var meshSimplifier = (IMeshSimplifier)Activator.CreateInstance(meshSimplifierType); worker.DoWork += (sender, args) => { meshSimplifier.Simplify(inputMesh, outputMesh, Mathf.Pow(0.5f, index)); args.Result = outputMesh; }; worker.RunWorkerCompleted += (sender, args) => { var resultMesh = (WorkingMesh)args.Result; resultMesh.ApplyToMesh(simplifiedMesh); simplifiedMesh.RecalculateBounds(); }; worker.RunWorkerAsync(); } var lod = lods[l]; lod.renderers = lodRenderers.ToArray(); lod.screenRelativeTransitionHeight = l == maxLOD ? 0.01f : Mathf.Pow(0.5f, l + 1); lods[l] = lod; } lodGroup.ForceLOD(0); lodGroup.SetLODs(lods.ToArray()); lodGroup.RecalculateBounds(); lodGroup.ForceLOD(-1); var prefab = PrefabUtility.GetPrefabParent(go); if (prefab) { var lodsAssetPath = GetLODAssetPath(prefab); if (File.Exists(lodsAssetPath)) { meshes.ForEach(m => AssetDatabase.AddObjectToAsset(m, lodsAssetPath)); } else { ObjectUtils.CreateAssetFromObjects(meshes.ToArray(), lodsAssetPath); } } } }
public override void DeserializeBody(BinaryReader br) { count = br.ReadInt32(); photos = (TLVector <TLAbsPhoto>)ObjectUtils.DeserializeVector <TLAbsPhoto>(br); users = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }
static void PreferencesGUI() { EditorGUILayout.BeginVertical(); EditorGUILayout.Space(); #if UNITY_2017_3_OR_NEWER // Max execution time { var label = "Max Execution Time (ms)"; if (maxExecutionTime == 0) { EditorGUILayout.BeginHorizontal(); if (!EditorGUILayout.Toggle(label, true)) { maxExecutionTime = 1; } GUILayout.Label("Infinity"); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } else { EditorGUI.BeginChangeCheck(); var maxTime = EditorGUILayout.IntSlider(label, maxExecutionTime, 0, 15); if (EditorGUI.EndChangeCheck()) { maxExecutionTime = maxTime; } } } // Mesh simplifier { var type = meshSimplifierType; if (type != null) { var meshSimplifiers = ObjectUtils.GetImplementationsOfInterface(typeof(IMeshSimplifier)).ToList(); var displayedOptions = meshSimplifiers.Select(t => t.Name).ToArray(); EditorGUI.BeginChangeCheck(); var selected = EditorGUILayout.Popup("Default Mesh Simplifier", Array.IndexOf(displayedOptions, type.Name), displayedOptions); if (EditorGUI.EndChangeCheck()) { meshSimplifierType = meshSimplifiers[selected]; } } else { EditorGUILayout.HelpBox("No IMeshSimplifiers found!", MessageType.Warning); } } // Batcher { var type = batcherType; if (type != null) { var batchers = ObjectUtils.GetImplementationsOfInterface(typeof(IBatcher)).ToList(); var displayedOptions = batchers.Select(t => t.Name).ToArray(); EditorGUI.BeginChangeCheck(); var selected = EditorGUILayout.Popup("Default Batcher", Array.IndexOf(displayedOptions, type.Name), displayedOptions); if (EditorGUI.EndChangeCheck()) { batcherType = batchers[selected]; } } else { EditorGUILayout.HelpBox("No IBatchers found!", MessageType.Warning); } } // Max LOD { var maxLODValues = Enumerable.Range(0, LODData.MaxLOD + 1).ToArray(); EditorGUI.BeginChangeCheck(); int maxLODGenerated = EditorGUILayout.IntPopup("Maximum LOD Generated", maxLOD, maxLODValues.Select(v => v.ToString()).ToArray(), maxLODValues); if (EditorGUI.EndChangeCheck()) { maxLOD = maxLODGenerated; } } // Control LOD0 maximum poly count { EditorGUI.BeginChangeCheck(); var maxPolyCount = EditorGUILayout.IntField("Initial LOD Max Poly Count", initialLODMaxPolyCount); if (EditorGUI.EndChangeCheck()) { initialLODMaxPolyCount = maxPolyCount; } } // Generate LODs on import { EditorGUI.BeginChangeCheck(); var generateLODsOnImport = EditorGUILayout.Toggle("Generate on Import", generateOnImport); if (EditorGUI.EndChangeCheck()) { generateOnImport = generateLODsOnImport; } } // Use SceneLOD? { EditorGUI.BeginChangeCheck(); var enabled = EditorGUILayout.Toggle("Scene LOD", sceneLODEnabled); if (EditorGUI.EndChangeCheck()) { sceneLODEnabled = enabled; } if (sceneLODEnabled) { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); var showBounds = EditorGUILayout.Toggle("Show Volume Bounds", showVolumeBounds); if (EditorGUI.EndChangeCheck()) { showVolumeBounds = showBounds; } var sceneLOD = SceneLOD.instance; EditorGUILayout.HelpBox(string.Format("Coroutine Queue: {0}\nCurrent Execution Time: {1:0.00} s", sceneLOD.coroutineQueueRemaining, sceneLOD.coroutineCurrentExecutionTime * 0.001f), MessageType.None); // Force more frequent updating var mouseOverWindow = EditorWindow.mouseOverWindow; if (mouseOverWindow) { mouseOverWindow.Repaint(); } EditorGUI.indentLevel--; } } #else EditorGUILayout.HelpBox("AutoLOD requires Unity 2017.3 or a later version", MessageType.Warning); #endif EditorGUILayout.EndVertical(); }
public override void DeserializeBody(BinaryReader br) { Id = ObjectUtils.DeserializeVector <int>(br); }
/* * Returns a list of agents that have an active ping and the same version info * * A requested Version of 0.0.0.0 will return all agents */ public static List <AgentInfo> GetAvailableAgents(Hashtable RequestedConfiguration) { // Validate the requested configuration if (RequestedConfiguration.ContainsKey("Version") == false) { return(null); } AgentInfo RequestingAgent; IPAddress MyAddressFromRequestingAgentPOV; // If the requestor is Blocked, ignore the request if (!RequestedConfiguration.ContainsKey("RequestingAgentName")) { return(null); } // If the requesting agent is not an approved state, block this request string RequestingAgentName = RequestedConfiguration["RequestingAgentName"] as string; if ((Agents.TryGetValue(RequestingAgentName, out RequestingAgent) && ((RequestingAgent.State != AgentState.Available) && (RequestingAgent.State != AgentState.Working) && (RequestingAgent.State != AgentState.Busy)))) { return(null); } var BestInt = NetworkUtils.GetBestInterface(RequestingAgent.Configuration["IPAddress"] as IPAddress); MyAddressFromRequestingAgentPOV = NetworkUtils.GetInterfaceIPv4Address(BestInt); // Extract the requested configuration Version RequestedVersion = RequestedConfiguration["Version"] as Version; List <AgentInfo> AliveAgents = new List <AgentInfo>(); lock ( Agents ) { foreach (AgentInfo Agent in Agents.Values) { // Only match against major and minor versions bool VersionMatch = (RequestedVersion.Major < Agent.Version.Major) || ((RequestedVersion.Major == Agent.Version.Major) && (RequestedVersion.Minor <= Agent.Version.Minor)); bool StateMatch = (Agent.State == AgentState.Available) || (Agent.State == AgentState.Working) || (Agent.State == AgentState.Busy); // If there is no group name, everything matches, otherwise // the group names must match bool GroupMatch = true; if ((RequestedConfiguration.ContainsKey("GroupName")) && (Agent.Configuration.ContainsKey("GroupName"))) { string RequestedGroupName = RequestedConfiguration["GroupName"] as string; string AgentGroupName = Agent.Configuration["GroupName"] as string; GroupMatch = (RequestedGroupName == AgentGroupName); } // If all conditions are met, we match if (VersionMatch && StateMatch && GroupMatch) { if (MyAddressFromRequestingAgentPOV != IPAddress.Loopback && (Agent.Configuration["IPAddress"] as IPAddress).Equals(IPAddress.Loopback)) { var NewAgentInfo = ObjectUtils.Duplicate(Agent); NewAgentInfo.Configuration["IPAddress"] = MyAddressFromRequestingAgentPOV; AliveAgents.Add(NewAgentInfo); } else { AliveAgents.Add(Agent); } } } // If the requesting agent is asking for assignment, do it now that we have the right set bool ValidRequestForAssignment = false; if (RequestedConfiguration.ContainsKey("RequestAssignmentFor")) { // If the requesting agent is not an approved state, block this request ValidRequestForAssignment = (RequestingAgent.State == AgentState.Available) || (RequestingAgent.State == AgentState.Working) || (RequestingAgent.State == AgentState.Busy); } if (ValidRequestForAssignment) { // Assign all Available agents to this requesting agent and bin the Working ones Int32 NewlyAssignedCount = 0; Int32 AlreadyAssignedCount = 0; Dictionary <string, List <AgentInfo> > AssignedToBins = new Dictionary <string, List <AgentInfo> >(); foreach (AgentInfo Agent in AliveAgents) { if (Agent.State == AgentState.Available) { Agent.Configuration["AssignedTo"] = RequestingAgent.Name; Agent.Configuration["AssignedTime"] = DateTime.UtcNow; NewlyAssignedCount++; } else if (Agent.State == AgentState.Working) { // Collect the already assigned agents string AssignedTo = Agent.Configuration["AssignedTo"] as string; if (AssignedTo != Agent.Name) { List <AgentInfo> AgentBin; if (!AssignedToBins.TryGetValue(AssignedTo, out AgentBin)) { AgentBin = new List <AgentInfo>(); AssignedToBins[AssignedTo] = AgentBin; } AgentBin.Add(Agent); AlreadyAssignedCount++; } } } // If the ratio of assigned agents is already 1:1, there's nothing more // we can do, regardless of how many we got previously if (AlreadyAssignedCount != AssignedToBins.Count) { // As long as reassigning an agent would not push us above the average, do it while ((NewlyAssignedCount + 1) <= (( float )(AlreadyAssignedCount - 1) / ( float )AssignedToBins.Count)) { // Search for the largest bin to reassign an agent from List <AgentInfo> LargestBin = null; Int32 LargestBinCount = 0; foreach (List <AgentInfo> Bin in AssignedToBins.Values) { if (LargestBinCount < Bin.Count) { LargestBinCount = Bin.Count; LargestBin = Bin; } } // Search for the newest WorkingTime DateTime MaxWorkingTime = ( DateTime )LargestBin[0].Configuration["WorkingTime"]; Int32 ReassignedAgentIndex = 0; for (Int32 i = 1; i < LargestBin.Count; i++) { DateTime NextWorkingTime = ( DateTime )LargestBin[i].Configuration["WorkingTime"]; if (MaxWorkingTime < NextWorkingTime) { MaxWorkingTime = NextWorkingTime; ReassignedAgentIndex = i; } } AgentInfo ReassignedAgent = LargestBin[ReassignedAgentIndex]; LargestBin.RemoveAt(ReassignedAgentIndex); // Reassigned and adjust the counts ReassignedAgent.Configuration["AssignedTo"] = RequestingAgent.Name; ReassignedAgent.Configuration["AssignedTime"] = DateTime.UtcNow; AlreadyAssignedCount--; NewlyAssignedCount++; } } // Resort the list -> (Available, Busy, Other (Working)) AliveAgents.Sort(AliveAgentSorter); } } return(AliveAgents); }
public override void DeserializeBody(BinaryReader br) { Id = (TLAbsInputUser)ObjectUtils.DeserializeObject(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (Messages.TLAbsFoundStickerSets)ObjectUtils.DeserializeObject(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (TLLink)ObjectUtils.DeserializeObject(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (Updates.TLAbsChannelDifference)ObjectUtils.DeserializeObject(br); }