uint.ToString()

Here are the examples of the csharp api uint.ToString() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

848 Examples 7

19 View Source File : EditorHandsInput.cs
License : MIT License
Project Creator : anderm

public bool GetFingerState(uint handId)
        {
            if (handId >= editorHandsData.Length)
            {
                var message = string.Format("GetFingerState called with invalid hand ID {0}.", handId.ToString());
                throw new ArgumentException(message, "handId");
            }

            return editorHandsData[handId].IsFingerDown;
        }

19 View Source File : TraceLoggerPlus.cs
License : GNU General Public License v3.0
Project Creator : ASCOMInitiative

public void LogMessage(uint instance, string prefix, string message)
        {
            LogMessage(prefix + " " + instance.ToString(), message);
        }

19 View Source File : ConversionTablePlugin.cs
License : GNU General Public License v2.0
Project Creator : afrantzis

void Update32bit(DataView dv)
	{
		long offset = dv.CursorOffset;

		// make sure offset is valid
		if (offset < dv.Buffer.Size - 3 && offset >= 0) {
			int val = 0;

			// create value according to endianess
			if (littleEndian) {
				val += dv.Buffer[offset+3] << 24;
				val += dv.Buffer[offset+2] << 16;
				val += dv.Buffer[offset+1] << 8;
				val += dv.Buffer[offset];
			}
			else {
				val += dv.Buffer[offset] << 24;
				val += dv.Buffer[offset+1] << 16;
				val += dv.Buffer[offset+2] << 8;
				val += dv.Buffer[offset+3];
			}

			uint uval = (uint)val;

			// set signed
			Signed32bitEntry.Text = val.ToString();

			// set unsigned
			if (unsignedAsHex)
				Unsigned32bitEntry.Text = string.Format("0x{0:x}", uval);
			else
				Unsigned32bitEntry.Text = uval.ToString();
		}
		else {
			Clear32bit();
		}
	}

19 View Source File : WindowUtils.cs
License : MIT License
Project Creator : AlexanderPro

public static WindowInformation GetWindowInformation(IntPtr hWnd)
        {
            var text = GetWindowText(hWnd);
            var wmText = GetWmGettext(hWnd);
            var clreplacedName = GetClreplacedName(hWnd);
            var realWindowClreplaced = RealGetWindowClreplaced(hWnd);
            var hWndParent = NativeMethods.GetParent(hWnd);
            var size = GetWindowSize(hWnd);
            var clientSize = GetWindowClientSize(hWnd);
            var isVisible = NativeMethods.IsWindowVisible(hWnd);
            var placement = GetWindowPlacement(hWnd);
            var threadId = NativeMethods.GetWindowThreadProcessId(hWnd, out var processId);
            var process = GetProcessByIdSafely(processId);

            var gwlStyle = NativeMethods.GetWindowLong(hWnd, NativeConstants.GWL_STYLE);
            var gwlExstyle = NativeMethods.GetWindowLong(hWnd, NativeConstants.GWL_EXSTYLE);
            var gwlUserData = NativeMethods.GetWindowLong(hWnd, NativeConstants.GWL_USERDATA);
            var gclStyle = NativeMethods.GetClreplacedLong(hWnd, NativeConstants.GCL_STYLE);
            var gclWndproc = NativeMethods.GetClreplacedLong(hWnd, NativeConstants.GCL_WNDPROC);
            var dwlDlgproc = NativeMethods.GetClreplacedLong(hWnd, NativeConstants.DWL_DLGPROC);
            var dwlUser = NativeMethods.GetClreplacedLong(hWnd, NativeConstants.DWL_USER);

            var windowDetailes = new Dictionary<string, string>();
            windowDetailes.Add("GetWindowText", text);
            windowDetailes.Add("WM_GETTEXT", wmText);
            windowDetailes.Add("GetClreplacedName", clreplacedName);
            windowDetailes.Add("RealGetClreplacedName", realWindowClreplaced);
            try
            {
                windowDetailes.Add("Font Name", GetFontName(hWnd));
            }
            catch
            {
            }

            windowDetailes.Add("Window Handle", $"0x{hWnd.ToInt64():X}");
            windowDetailes.Add("Parent Window Handle", hWndParent == IntPtr.Zero ? "-" : $"0x{hWndParent.ToInt64():X}");
            windowDetailes.Add("Is Window Visible", isVisible.ToString());
            windowDetailes.Add("Window Placement (showCmd)", placement.showCmd.ToString());
            windowDetailes.Add("Window Size", $"{size.Width}x{size.Height}");
            windowDetailes.Add("Window Client Size", $"{clientSize.Width}x{clientSize.Height}");

            try
            {
                var bounds = GetFrameBounds(hWnd);
                windowDetailes.Add("Window Extended Frame Bounds", $"{bounds.Top} {bounds.Right} {bounds.Bottom} {bounds.Left}");
            }
            catch
            {
            }

            try
            {
                windowDetailes.Add("Instance", $"0x{process.Modules[0].BaseAddress.ToInt64():X}");
            }
            catch
            {
            }
            
            windowDetailes.Add("GCL_WNDPROC", $"0x{gclWndproc:X}");
            windowDetailes.Add("DWL_DLGPROC", $"0x{dwlDlgproc:X}");
            windowDetailes.Add("GWL_STYLE", $"0x{gwlStyle:X}");
            windowDetailes.Add("GCL_STYLE", $"0x{gclStyle:X}");
            windowDetailes.Add("GWL_EXSTYLE", $"0x{gwlExstyle:X}");
            
            try
            {
                var windowInfo = new WINDOW_INFO();
                windowInfo.cbSize = Marshal.SizeOf(windowInfo);
                if (NativeMethods.GetWindowInfo(hWnd, ref windowInfo))
                {
                    windowDetailes.Add("WindowInfo.ExStyle", $"0x{windowInfo.dwExStyle:X}");
                }
            }
            catch
            {
            }
            
            try
            {
                uint key;
                Byte alpha;
                uint flags;
                var result = NativeMethods.GetLayeredWindowAttributes(hWnd, out key, out alpha, out flags);
                var layeredWindow = (LayeredWindow)flags;
                windowDetailes.Add("LWA_ALPHA", layeredWindow.HasFlag(LayeredWindow.LWA_ALPHA) ? "+" : "-");
                windowDetailes.Add("LWA_COLORKEY", layeredWindow.HasFlag(LayeredWindow.LWA_COLORKEY) ? "+" : "-");
            }
            catch
            {
            }
            
            windowDetailes.Add("GWL_USERDATA", $"0x{gwlUserData:X}");
            windowDetailes.Add("DWL_USER", $"0x{dwlUser:X}");

            var processDetailes = new Dictionary<string, string>();
            try
            {
                try
                {
                    processDetailes.Add("Full Path", process.MainModule.FileName);
                }
                catch
                {
                    var fileNameBuilder = new StringBuilder(1024);
                    var bufferLength = (uint)fileNameBuilder.Capacity + 1;
                    var fullPath = NativeMethods.QueryFullProcessImageName(process.Handle, 0, fileNameBuilder, ref bufferLength) ? fileNameBuilder.ToString() : "";
                    processDetailes.Add("Full Path", fullPath);
                }
            }
            catch
            {
            }

            var processInfo = (WmiProcessInfo)null;
            try
            {
                processInfo = GetWmiProcessInfo(processId);
                processDetailes.Add("Command Line", processInfo.CommandLine);
            }
            catch
            {
            }

            try
            {
                processDetailes.Add("Started at", $"{process.StartTime:dd.MM.yyyy HH:mm:ss}");
            }
            catch
            {
            }

            try
            {
                processDetailes.Add("Owner", processInfo.Owner);
            }
            catch
            {
            }

            processDetailes.Add("Process Id", processId.ToString());
            try
            {
                var parentProcess = process.GetParentProcess();
                processDetailes.Add("Parent Process Id", parentProcess.Id.ToString());
                processDetailes.Add("Parent", Path.GetFileName(parentProcess.MainModule.FileName));
            }
            catch
            {
            }
            
            processDetailes.Add("Thread Id", threadId.ToString());

            try
            {
                processDetailes.Add("Priority", process.GetProcessPriority().ToString());
            }
            catch
            {
            }

            
            try
            {
                processDetailes.Add("Threads", processInfo.ThreadCount.ToString());
                processDetailes.Add("Handles", processInfo.HandleCount.ToString());
                processDetailes.Add("Working Set Size", processInfo.WorkingSetSize.ToString());
                processDetailes.Add("Virtual Size", processInfo.VirtualSize.ToString());
            }
            catch
            {
            }
            
            try
            {
                var fileVersionInfo = process.MainModule.FileVersionInfo;
                processDetailes.Add("Product Name", fileVersionInfo.ProductName);
                processDetailes.Add("Copyright", fileVersionInfo.LegalCopyright);
                processDetailes.Add("File Version", fileVersionInfo.FileVersion);
                processDetailes.Add("Product Version", fileVersionInfo.ProductVersion);
            }
            catch
            {
            }

            return new WindowInformation(windowDetailes, processDetailes);
        }

19 View Source File : AgoraMultiChannel.cs
License : MIT License
Project Creator : AgoraIO

private void makeVideoView(string channelId, uint uid)
    {
        string objName = channelId + "_" + uid.ToString();
        GameObject go = GameObject.Find(objName);
        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and replacedign to this new user
        VideoSurface videoSurface = makeImageSurface(objName);
        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForMultiChannelUser(channelId, uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
        }
    }

19 View Source File : Form_SteamID64_Editor.cs
License : MIT License
Project Creator : Aemony

private void ReadSteamID()
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDoreplacedents) + "\\My Games\\NieR_Automata";
            dlg.Filter = "Data files (*.dat)|*.dat";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                filePath = dlg.FileName;

                if (filePath.Contains("SlotData"))
                {
                    // SlotData files stores the SteamID64 in offset 04-11, GameData and SystemData files stores the SteamID64 in offset 00-07
                    fileOffset = 4;
                }
                else
                {
                    fileOffset = 0;
                }
                
                try {
                    using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                    {
                        stream.Position = fileOffset;
                        stream.Read(byteSteamID64, 0, 8);
                    }


                    // Convert to proper IDs.
                    // SteamID64 is stored as Little-Endian in the files, but as Intel is little-endian as well no reversal is needed
                    steamID3 = BitConverter.ToUInt32(byteSteamID64, 0);
                    textBoxSteamID3.Text = steamID3.ToString();

                    steamID64 = BitConverter.ToUInt64(byteSteamID64, 0);
                    textBoxSteamID64.Text = steamID64.ToString();
#if DEBUG
                    Console.WriteLine("Read: " + BitConverter.ToString(byteSteamID64));
                    Console.WriteLine("SteamID3: " + steamID3.ToString());
                    Console.WriteLine("SteamID64: " + steamID64.ToString());
#endif

                    // Misc
                    textBoxWorkingFile.Text = filePath;
                    textBoxWorkingFile.SelectionStart = textBoxWorkingFile.TextLength;
                    toolStripStatusLabel1.Text = "Read from " + Path.GetFileName(filePath) + ": " + BitConverter.ToString(byteSteamID64);
                    lastStatus = toolStripStatusLabel1.Text;

                    // Check if a new ID is already written, and if so, enable the button
                    if (String.IsNullOrWhiteSpace(textBoxSteamID64_New.Text) == false && String.IsNullOrWhiteSpace(filePath) == false && textBoxSteamID64_New.Text != textBoxSteamID64.Text)
                    {
                        buttonUpdate.Enabled = true;
                    }
                    else
                    {
                        buttonUpdate.Enabled = false;
                    }
                } catch (Exception ex)
                {
                    throw ex;
                }
            }

        }

19 View Source File : HubListener.cs
License : MIT License
Project Creator : andruzzzhka

private static bool CompareVersions(uint clientVersion, uint serverVersion)
        {
            string client = clientVersion.ToString();
            string server = serverVersion.ToString();

            return (client.Substring(0, client.Length - 1)) != (server.Substring(0, server.Length - 1));
        }

19 View Source File : GameController.cs
License : MIT License
Project Creator : absurd-joy

public void AddPowerballs(uint count)
		{
			m_powerBallcount += count;
			m_ballCountText.text = "x" + m_powerBallcount.ToString();
		}

19 View Source File : ConsoleImpl.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : aura-systems

public static void WriteLine(uint aInt) => WriteLine(aInt.ToString());

19 View Source File : MutationCache.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

public static MutationFilter GetMutation(uint mutationId)
        {
            var mutationId_str = mutationId.ToString();

            if (!tSysMutationFilters.TryGetValue(mutationId_str, out var tSysMutationFilter))
            {
                tSysMutationFilter = BuildMutation(mutationId);

                if (tSysMutationFilter != null)
                    tSysMutationFilters.TryAdd(mutationId_str, tSysMutationFilter);
            }
            return tSysMutationFilter;
        }

19 View Source File : ProxmoxApi.cs
License : MIT License
Project Creator : AlexanderFroemmgen

private bool ExecutePost(string urlExtension, string contentStr = "")
        {
            var cookieContainer = new CookieContainer();
            using (var httpClientHandler = new HttpClientHandler() { CookieContainer = cookieContainer })
            {
                httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
                using (var client = new HttpClient(httpClientHandler))
                {
                    HttpContent content = null;
                    if (contentStr == "")
                    {
                        content = new StringContent("");
                    }
                    else
                    {
                        content = new StringContent(contentStr, Encoding.UTF8, "application/x-www-form-urlencoded");
                    }
                    content.Headers.Add("CSRFPreventionToken", _csrfpt);
                    cookieContainer.Add(new Uri("https://" + _server + ":" + _port.ToString()), new Cookie("PVEAuthCookie", _ticket));

                    var result = client.PostAsync(_baseurl + urlExtension, content).Result;
                    if (result.IsSuccessStatusCode)
                    {
                        string strResult = result.Content.ReadreplacedtringAsync().Result;
                        var obj = JObject.Parse(strResult)["data"];
                        return true;
                    }
                    else
                    {
                        Console.WriteLine("Proxmox request failed: " + result.ReasonPhrase);
                        return false;
                    }
                }
            }
        }

19 View Source File : DesktopScreenShare.cs
License : MIT License
Project Creator : AgoraIO

private void DestroyVideoView(uint uid)
    {
        var go = GameObject.Find(uid.ToString());
        if (!ReferenceEquals(go, null))
        {
            Destroy(go);
        }
    }

19 View Source File : AssetManager.cs
License : MIT License
Project Creator : Adsito

public static string ToPath(uint i)
	{
		if ((int)i == 0)
			return i.ToString();
		if (IDLookup.TryGetValue(i, out string str))
			return str;
		return i.ToString();
	}

19 View Source File : UInt24.cs
License : MIT License
Project Creator : amerkoleci

public override string ToString()
        {
            return ((uint)this).ToString();
        }

19 View Source File : Util.cs
License : MIT License
Project Creator : 499116344

public static void TalkQQ(uint uin)
        {
            TalkQQ(uin.ToString());
        }

19 View Source File : EditorHandsInput.cs
License : MIT License
Project Creator : anderm

public bool GetFingerUp(uint handId)
        {
            if (handId >= editorHandsData.Length)
            {
                var message = string.Format("GetFingerUp called with invalid hand ID {0}.", handId.ToString());
                throw new ArgumentException(message, "handId");
            }

            return !editorHandsData[handId].IsFingerDown && editorHandsData[handId].FingerStateChanged;
        }

19 View Source File : ClusterViewer.cs
License : MIT License
Project Creator : aerosoul94

private void DataMap_CellHovered(object sender, EventArgs e)
        {
            var cellHoveredEventArgs = e as CellHoveredEventArgs;

            if (cellHoveredEventArgs != null)
            {
                var clusterIndex = CellToClusterIndex(cellHoveredEventArgs.Index);

                Debug.WriteLine($"Cluster Index: {clusterIndex}");

                var occupants = integrityreplacedyzer.GetClusterOccupants(clusterIndex);

                string toolTipMessage = "Cluster Index: " + clusterIndex.ToString() + Environment.NewLine;
                toolTipMessage += "Cluster Address: 0x" + volume.ClusterToPhysicalOffset(clusterIndex).ToString("X");

                if (clusterIndex == volume.RootDirFirstCluster)
                {
                    toolTipMessage += Environment.NewLine + Environment.NewLine;
                    toolTipMessage += " Type: Root Directory";
                }
                else if (occupants == null)
                {
                    // TODO: something is off
                    Debug.WriteLine("Something is wrong.");
                }
                else if (occupants.Count > 0)
                {
                    toolTipMessage += Environment.NewLine;

                    int index = 1;
                    foreach (var occupant in occupants)
                    {
                        toolTipMessage += BuildToolTipMessage(index, occupant.GetDirent(), occupant.IsDeleted);
                        index++;
                    }
                }

                toolTip1.SetToolTip(this.dataMap, toolTipMessage);
            }
            else
            {
                toolTip1.SetToolTip(this.dataMap, "");
            }
        }

19 View Source File : ServerConfigurationForm.cs
License : GNU General Public License v3.0
Project Creator : ASCOMInitiative

private void BtnGetRemoteConfiguration_Click(object sender, EventArgs e)
        {
            TL.LogMessage("GetConfiguration", "Start of btnGetRemoteConfgiuration_Click");
            try
            {
                int clientNumber = 0;
                TL.LogMessage("GetConfiguration", "Connecting to device: " + ipAddressString + ":" + portNumber.ToString());

                string clientHostAddress = string.Format("{0}://{1}:{2}", serviceType, ipAddressString, portNumber.ToString());
                TL.LogMessage("GetConfiguration", "Client host address: " + clientHostAddress);

                RestClient client = new RestClient(clientHostAddress)
                {
                    PreAuthenticate = true
                };
                TL.LogMessage("GetConfiguration", "Creating Authenticator");
                client.Authenticator = new HttpBasicAuthenticator(userName, preplacedword);
                TL.LogMessage("GetConfiguration", "Setting timeout");
                RemoteClientDriver.SetClientTimeout(client, 10);

                string managementUri = string.Format("{0}{1}/{2}", SharedConstants.REMOTE_SERVER_MANAGEMENT_URL_BASE, SharedConstants.API_VERSION_V1, SharedConstants.REMOTE_SERVER_MANGEMENT_GET_CONFIGURATION);
                RestRequest request = new RestRequest(managementUri.ToLowerInvariant(), Method.GET)
                {
                    RequestFormat = DataFormat.Json
                };

                request.AddParameter(SharedConstants.CLIENTID_PARAMETER_NAME, clientNumber.ToString());
                uint transaction = RemoteClientDriver.TransactionNumber();
                request.AddParameter(SharedConstants.CLIENTTRANSACTION_PARAMETER_NAME, transaction.ToString());

                TL.LogMessage("GetConfiguration", "Client Txn ID: " + transaction.ToString() + ", Sending command to remote server");
                IRestResponse response = client.Execute(request);
                string responseContent;
                if (response.Content.Length > 100) responseContent = response.Content.Substring(0, 100);
                else responseContent = response.Content;
                TL.LogMessage("GetConfiguration", string.Format("Response Status: '{0}', Response: {1}", response.StatusDescription, responseContent));

                if ((response.ResponseStatus == ResponseStatus.Completed) & (response.StatusCode == System.Net.HttpStatusCode.OK))
                {
                    ConfigurationResponse configurationResponse = JsonConvert.DeserializeObject<ConfigurationResponse>(response.Content);
                    ConcurrentDictionary<string, ConfiguredDevice> configuration = configurationResponse.Value;
                    TL.LogMessage("GetConfiguration", "Number of device records: " + configuration.Count);

                    using (Profile profile = new Profile())
                    {
                        foreach (string deviceType in profile.RegisteredDeviceTypes)
                        {
                            TL.LogMessage("GetConfiguration", "Adding item: " + deviceType);
                            registeredDeviceTypes.Add(deviceType); // Remember the device types on this system
                        }

                        foreach (ServedDeviceClient item in this.Controls.OfType<ServedDeviceClient>())
                        {
                            TL.LogMessage(0, 0, 0, "GetConfiguration", "Starting Init");
                            item.InitUI(this, TL);
                            TL.LogMessage(0, 0, 0, "GetConfiguration", "Completed Init");
                            item.DeviceType = configuration[item.Name].DeviceType;
                            item.ProgID = configuration[item.Name].ProgID;
                            item.DeviceNumber = configuration[item.Name].DeviceNumber;
                            TL.LogMessage("GetConfiguration", "Completed");
                        }
                        TL.LogMessage("GetConfiguration", "Before RecalculateDevice Numbers");

                        RecalculateDeviceNumbers();
                        TL.LogMessage("GetConfiguration", "After RecalculateDevice Numbers");
                    }

                    // Handle exceptions received from the driver by the remote server
                    if (configurationResponse.DriverException != null)
                    {
                        TL.LogMessageCrLf("GetConfiguration", string.Format("Exception Message: {0}, Exception Number: 0x{1}", configurationResponse.ErrorMessage, configurationResponse.ErrorNumber.ToString("X8")));
                    }
                }
                else
                {
                    if (response.ErrorException != null)
                    {
                        TL.LogMessageCrLf("GetConfiguration", "RestClient exception: " + response.ErrorMessage + "\r\n " + response.ErrorException.ToString());
                        // throw new ASCOM.DriverException(string.Format("Communications exception: {0} - {1}", response.ErrorMessage, response.ResponseStatus), response.ErrorException);
                    }
                    else
                    {
                        TL.LogMessage("GetConfiguration" + " Error", string.Format("RestRequest response status: {0}, HTTP response code: {1}, HTTP response description: {2}", response.ResponseStatus.ToString(), response.StatusCode, response.StatusDescription));
                        // throw new ASCOM.DriverException("ServerConfigurationForm Error - Status: " + response.ResponseStatus + " " + response.StatusDescription);
                    }
                }
            }
            catch (Exception ex)
            {
                TL.LogMessage("GetConfiguration", "Exception: " + ex.ToString());
            }

            TL.LogMessage("GetConfiguration", "End of btnGetRemoteConfgiuration_Click");
        }

19 View Source File : MetaRequest.cs
License : MIT License
Project Creator : 0x0ade

public override void Write(DataContext ctx, MetaTypeWrap data) {
            data["ID"] = ID.ToString();
        }

19 View Source File : ConsoleImpl.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : aura-systems

public static void Write(uint aInt) => Write(aInt.ToString());

19 View Source File : HelloVideoTokenAgora.cs
License : MIT License
Project Creator : AgoraIO

private void DestroyVideoView(uint uid)
    {
        GameObject go = GameObject.Find(uid.ToString());
        if (!ReferenceEquals(go, null))
        {
            Object.Destroy(go);
        }
    }

19 View Source File : HelloVideoTokenAgora.cs
License : MIT License
Project Creator : AgoraIO

private void makeVideoView(uint uid)
    {
        GameObject go = GameObject.Find(uid.ToString());
        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and replacedign to this new user
        VideoSurface videoSurface = makeImageSurface(uid.ToString());
        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
        }
    }

19 View Source File : Rational.cs
License : MIT License
Project Creator : 0xC0000054

public override string ToString()
        {
            return this.Numerator.ToString() + "/" + this.Denominator.ToString();
        }

19 View Source File : RtmpStreaming.cs
License : MIT License
Project Creator : AgoraIO

private void makeVideoView(uint uid)
    {
        GameObject go = GameObject.Find(uid.ToString());
        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and replacedign to this new user
        VideoSurface videoSurface = makeImageSurface(uid.ToString());
        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
        }
    }

19 View Source File : NetworkSession.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

private void DoRequestForRetransmission(uint rcvdSeq)
        {
            var desiredSeq = lastReceivedPacketSequence + 1;
            List<uint> needSeq = new List<uint>();
            needSeq.Add(desiredSeq);
            uint bottom = desiredSeq + 1;
            if (rcvdSeq < bottom || rcvdSeq - bottom > CryptoSystem.MaximumEffortLevel)
            {
                session.Terminate(SessionTerminationReason.AbnormalSequenceReceived);
                return;
            }
            uint seqIdCount = 1;
            for (uint a = bottom; a < rcvdSeq; a++)
            {
                if (!outOfOrderPackets.ContainsKey(a))
                {
                    needSeq.Add(a);
                    seqIdCount++;
                    if (seqIdCount >= MaxNumNakSeqIds)
                    {
                        break;
                    }
                }
            }

            ServerPacket reqPacket = new ServerPacket();
            byte[] reqData = new byte[4 + (needSeq.Count * 4)];
            MemoryStream msReqData = new MemoryStream(reqData, 0, reqData.Length, true, true);
            msReqData.Write(BitConverter.GetBytes((uint)needSeq.Count), 0, 4);
            needSeq.ForEach(k => msReqData.Write(BitConverter.GetBytes(k), 0, 4));
            reqPacket.Data = msReqData;
            reqPacket.Header.Flags = PacketHeaderFlags.RequestRetransmit;

            EnqueueSend(reqPacket);

            LastRequestForRetransmitTime = DateTime.UtcNow;
            packetLog.DebugFormat("[{0}] Requested retransmit of {1}", session.LoggingIdentifier, needSeq.Select(k => k.ToString()).Aggregate((a, b) => a + ", " + b));
            NetworkStatistics.S2C_RequestsForRetransmit_Aggregate_Increment();
        }

19 View Source File : ProxmoxApi.cs
License : MIT License
Project Creator : AlexanderFroemmgen

public bool Login(string server, uint port, string username, string preplacedword, string realm)
        {
            _server = server;
            _port = port;
            _baseurl = "https://" + server + ":" + port.ToString() + "/api2/json/";
            using (var httpClientHandler = new HttpClientHandler())
            {
                httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
                using (var client = new HttpClient(httpClientHandler))
                {
                    var result = client.PostAsync(_baseurl + $"access/ticket?username={username}&preplacedword={preplacedword}&realm={realm}", new StringContent("")).Result;
                    if (result.IsSuccessStatusCode)
                    {
                        string strResult = result.Content.ReadreplacedtringAsync().Result;
                        var obj = JObject.Parse(strResult)["data"];
                        _ticket = obj["ticket"].ToString();
                        _csrfpt = obj["CSRFPreventionToken"].ToString();
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }

19 View Source File : DesktopScreenShare.cs
License : MIT License
Project Creator : AgoraIO

private void makeVideoView(uint uid)
    {
        var go = GameObject.Find(uid.ToString());
        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and replacedign to this new user
        var videoSurface = makeImageSurface(uid.ToString());
        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
            videoSurface.EnableFilpTextureApply(true, false);
        }
    }

19 View Source File : Helper.cs
License : MIT License
Project Creator : adamped

public static string toRadixString(this uint value, int places) => value.ToString();

19 View Source File : ProxmoxApi.cs
License : MIT License
Project Creator : AlexanderFroemmgen

private JToken ExecuteGet(string urlExtension)
        {
            var cookieContainer = new CookieContainer();
            using (var httpClientHandler = new HttpClientHandler() { CookieContainer = cookieContainer })
            {
                httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
                using (var client = new HttpClient(httpClientHandler))
                {
                    cookieContainer.Add(new Uri("https://" + _server + ":" + _port.ToString()), new Cookie("PVEAuthCookie", _ticket));
                    client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("CSRFPreventionToken", _csrfpt);
                    var result = client.GetAsync(_baseurl + urlExtension).Result;
                    string strResult = result.Content.ReadreplacedtringAsync().Result;
                    var obj = JObject.Parse(strResult)["data"];
                    return obj;
                }
            }
        }

19 View Source File : MapSchemaStringBuilder.cs
License : MIT License
Project Creator : 1996v

public void AppendValOffset(long position, uint value)
        {
            sb.Append("ValOffset(" + value.ToString() + ")");
            sb.Append(" ");
        }

19 View Source File : QuikDdeServer.cs
License : Apache License 2.0
Project Creator : AlexWan

private void TransactionReplyCallback(int nTransactionResult, int transactionExtendedErrorCode,
           int transactionReplyCode, uint dwTransId, ulong dOrderNum, string transactionReplyMessage, IntPtr pTransReplyDescriptor)
        {
            try
            {
                Order order = GetOrderFromUserId(dwTransId.ToString());

                if (order == null)
                {
                    order = new Order();
                    order.NumberUser = Convert.ToInt32(dwTransId);
                }

                if (dOrderNum != 0)
                {
                    order.NumberMarket = dOrderNum.ToString(new CultureInfo("ru-RU"));
                }

                if (transactionReplyCode == 6)
                {
                    order.State = OrderStateType.Fail;

                    SendLogMessage(dwTransId + OsLocalization.Market.Message89 + transactionReplyMessage, LogMessageType.System);

                    if (MyOrderEvent != null)
                    {
                        MyOrderEvent(order);
                    }
                }
                else
                {
                    if (order.NumberMarket == "0" || dOrderNum == 0)
                    {
                        return;
                    }
                    order.State = OrderStateType.Activ;
                    if (MyOrderEvent  != null)
                    {
                        MyOrderEvent(order);
                    }
                }
            }
            catch (Exception erorr)
            {
                SendLogMessage(erorr.ToString(), LogMessageType.Error);
            }
        }

19 View Source File : Functions.cs
License : MIT License
Project Creator : Adsito

public static void DisplayPrefabID(uint prefabID)
        {
            Elements.BeginToolbarHorizontal();
            if (Elements.ToolbarButton(ToolTips.prefabID))
                CopyText(prefabID.ToString());
            Elements.ToolbarLabel(new GUIContent(prefabID.ToString(), prefabID.ToString()));
            Elements.EndToolbarHorizontal();
        }

19 View Source File : EditorHandsInput.cs
License : MIT License
Project Creator : anderm

public Vector3 GetHandDelta(uint handId)
        {
            if (handId >= editorHandsData.Length)
            {
                string message = string.Format("GetHandDelta called with invalid hand ID {0}.", handId.ToString());
                throw new ArgumentException(message, "handId");
            }

            return editorHandsData[handId].HandDelta;
        }

19 View Source File : MetaRef.cs
License : MIT License
Project Creator : 0x0ade

public override void Write(DataContext ctx, MetaTypeWrap data) {
            data["ID"] = ID.ToString();
            data["IsAlive"] = IsAlive.ToString();
        }

19 View Source File : EditorHandsInput.cs
License : MIT License
Project Creator : anderm

public bool GetFingerDown(uint handId)
        {
            if (handId >= editorHandsData.Length)
            {
                var message = string.Format("GetFingerDown called with invalid hand ID {0}.", handId.ToString());
                throw new ArgumentException(message, "handId");
            }

            return editorHandsData[handId].IsFingerDown && editorHandsData[handId].FingerStateChanged;
        }

19 View Source File : Form_SteamID64_Editor.cs
License : MIT License
Project Creator : Aemony

private void WriteSteamID()
        {
            steamID64 = Convert.ToUInt64(textBoxSteamID64_New.Text);
            byteSteamID64 = BitConverter.GetBytes(steamID64);
            steamID3 = BitConverter.ToUInt32(byteSteamID64, 0); // Relies on byteSteamID64 having been updated. 

#if DEBUG
            Console.WriteLine("New bytes: " + BitConverter.ToString(byteSteamID64));
            Console.WriteLine("New SteamID3: " + steamID3.ToString());
            Console.WriteLine("New SteamID64: " + steamID64.ToString());
#endif

            // SteamID64 is stored as Little-Endian in the files, but as Intel is little-endian as well no reversal is needed

            try
            {
                // Create a backup first
                File.Copy(filePath, filePath + DateTime.Now.ToString("_yyyy-MM-dd_HH-mm-ss.bak"));

                // Now overwrite the data
                using (Stream stream = File.Open(filePath, FileMode.Open, FileAccess.Write))
                {
                    stream.Position = fileOffset;
                    stream.Write(byteSteamID64, 0, 8);
                }

                textBoxSteamID3.Text = steamID3.ToString();
                textBoxSteamID64.Text = steamID64.ToString();
                toolStripStatusLabel1.Text = "Wrote to " + Path.GetFileName(filePath) + ": " + BitConverter.ToString(byteSteamID64);
                lastStatus = toolStripStatusLabel1.Text;
                buttonUpdate.Enabled = false;

            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

19 View Source File : PlayerInfoDisplay.cs
License : MIT License
Project Creator : andruzzzhka

void Update()
        {
            if (_playerScore != default)
            {
                _progress += Time.deltaTime * Client.Instance.tickrate;
                uint score = (uint)Mathf.Lerp(_previousScore, _currentScore, Mathf.Clamp01(_progress));

                playerScoreText.text = score.ToString();
            }
        }

19 View Source File : DellFanCmd.cs
License : GNU General Public License v3.0
Project Creator : AaronKelley

public static int ProcessCommand(string[] args)
        {
            int returnCode = 0;

            try
            {
                if (args.Length != 1)
                {
                    Usage();
                }
                else
                {
                    // Behavior variables.
                    bool disableEcFanControl = false;
                    bool enableEcFanControl = false;
                    bool setFansToMax = false;
                    bool useAlternateCommand = false;
                    bool setFanLevel = false;
                    bool getFanRpm = false;
                    bool runTest = false;
                    BzhFanIndex fanSelection = BzhFanIndex.Fan1;
                    BzhFanLevel fanLevel = BzhFanLevel.Level0;

                    // Figure out what was requested.
                    if (args[0] == "ec-disable")
                    {
                        disableEcFanControl = true;
                        setFansToMax = true;
                    }
                    else if (args[0] == "ec-disable-nofanchg")
                    {
                        disableEcFanControl = true;
                    }
                    else if (args[0] == "ec-enable")
                    {
                        enableEcFanControl = true;
                    }
                    else if (args[0] == "ec-disable-alt")
                    {
                        disableEcFanControl = true;
                        setFansToMax = true;
                        useAlternateCommand = true;
                    }
                    else if (args[0] == "ec-disable-alt-nofanchg")
                    {
                        disableEcFanControl = true;
                        useAlternateCommand = true;
                    }
                    else if (args[0] == "ec-enable-alt")
                    {
                        enableEcFanControl = true;
                        useAlternateCommand = true;
                    }
                    else if (args[0] == "fan1-level0")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan1;
                        fanLevel = BzhFanLevel.Level0;
                    }
                    else if (args[0] == "fan1-level1")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan1;
                        fanLevel = BzhFanLevel.Level1;
                    }
                    else if (args[0] == "fan1-level2")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan1;
                        fanLevel = BzhFanLevel.Level2;
                    }
                    else if (args[0] == "fan2-level0")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan2;
                        fanLevel = BzhFanLevel.Level0;
                    }
                    else if (args[0] == "fan2-level1")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan2;
                        fanLevel = BzhFanLevel.Level1;
                    }
                    else if (args[0] == "fan2-level2")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan2;
                        fanLevel = BzhFanLevel.Level2;
                    }
                    else if (args[0] == "fan3-level0")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan3;
                        fanLevel = BzhFanLevel.Level0;
                    }
                    else if (args[0] == "fan3-level1")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan3;
                        fanLevel = BzhFanLevel.Level1;
                    }
                    else if (args[0] == "fan3-level2")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan3;
                        fanLevel = BzhFanLevel.Level2;
                    }
                    else if (args[0] == "fan4-level0")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan4;
                        fanLevel = BzhFanLevel.Level0;
                    }
                    else if (args[0] == "fan4-level1")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan4;
                        fanLevel = BzhFanLevel.Level1;
                    }
                    else if (args[0] == "fan4-level2")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan4;
                        fanLevel = BzhFanLevel.Level2;
                    }
                    else if (args[0] == "fan5-level0")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan5;
                        fanLevel = BzhFanLevel.Level0;
                    }
                    else if (args[0] == "fan5-level1")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan5;
                        fanLevel = BzhFanLevel.Level1;
                    }
                    else if (args[0] == "fan5-level2")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan5;
                        fanLevel = BzhFanLevel.Level2;
                    }
                    else if (args[0] == "fan6-level0")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan6;
                        fanLevel = BzhFanLevel.Level0;
                    }
                    else if (args[0] == "fan6-level1")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan6;
                        fanLevel = BzhFanLevel.Level1;
                    }
                    else if (args[0] == "fan6-level2")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan6;
                        fanLevel = BzhFanLevel.Level2;
                    }
                    else if (args[0] == "fan7-level0")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan7;
                        fanLevel = BzhFanLevel.Level0;
                    }
                    else if (args[0] == "fan7-level1")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan7;
                        fanLevel = BzhFanLevel.Level1;
                    }
                    else if (args[0] == "fan7-level2")
                    {
                        setFanLevel = true;
                        fanSelection = BzhFanIndex.Fan7;
                        fanLevel = BzhFanLevel.Level2;
                    }
                    else if (args[0] == "rpm-fan1")
                    {
                        getFanRpm = true;
                        fanSelection = BzhFanIndex.Fan1;
                    }
                    else if (args[0] == "rpm-fan2")
                    {
                        getFanRpm = true;
                        fanSelection = BzhFanIndex.Fan2;
                    }
                    else if (args[0] == "rpm-fan3")
                    {
                        getFanRpm = true;
                        fanSelection = BzhFanIndex.Fan3;
                    }
                    else if (args[0] == "rpm-fan4")
                    {
                        getFanRpm = true;
                        fanSelection = BzhFanIndex.Fan4;
                    }
                    else if (args[0] == "rpm-fan5")
                    {
                        getFanRpm = true;
                        fanSelection = BzhFanIndex.Fan5;
                    }
                    else if (args[0] == "rpm-fan6")
                    {
                        getFanRpm = true;
                        fanSelection = BzhFanIndex.Fan6;
                    }
                    else if (args[0] == "rpm-fan7")
                    {
                        getFanRpm = true;
                        fanSelection = BzhFanIndex.Fan7;
                    }
                    else if (args[0] == "test")
                    {
                        runTest = true;
                    }
                    else if (args[0] == "test-alt")
                    {
                        runTest = true;
                        useAlternateCommand = true;
                    }
                    else
                    {
                        Usage();
                        return -3;
                    }

                    // Execute request.

                    // Load driver first.
                    if (LoadDriver())
                    {
                        if (disableEcFanControl)
                        {
                            // Disable EC fan control.
                            Console.WriteLine("Attempting to disable EC control of the fan...");

                            bool success = DellSmbiosBzh.DisableAutomaticFanControl(useAlternateCommand);

                            if (!success)
                            {
                                Console.Error.WriteLine("Failed.");
                                UnloadDriver();
                                return -1;
                            }

                            Console.WriteLine(" ...Success.");

                            if (setFansToMax)
                            {
                                // Crank the fans up, for safety.
                                Console.WriteLine("Setting fan 1 speed to maximum...");
                                success = DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan1, BzhFanLevel.Level2);
                                if (!success)
                                {
                                    Console.Error.WriteLine("Failed.");
                                }

                                Console.WriteLine("Setting fan 2 speed to maximum...");
                                success = DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan2, BzhFanLevel.Level2);
                                if (!success)
                                {
                                    Console.Error.WriteLine("Failed.  (Maybe your system just has one fan?)");
                                }
                            }
                            else
                            {
                                Console.WriteLine("WARNING: CPU and GPU are not designed to run under load without active cooling.");
                                Console.WriteLine("Make sure that you have alternate fan speed control measures in place.");
                            }
                        }
                        else if (enableEcFanControl)
                        {
                            // Enable EC fan control.
                            Console.WriteLine("Attempting to enable EC control of the fan...");

                            bool success = DellSmbiosBzh.EnableAutomaticFanControl(useAlternateCommand);

                            if (!success)
                            {
                                Console.Error.WriteLine("Failed.");
                                UnloadDriver();
                                return -1;
                            }

                            Console.WriteLine(" ...Success.");
                        }
                        else if (setFanLevel)
                        {
                            // Set the fan to a specific level.
                            Console.WriteLine("Attempting to set the fan level...");
                            bool success = DellSmbiosBzh.SetFanLevel(fanSelection, fanLevel);

                            if (!success)
                            {
                                Console.Error.WriteLine("Failed.");
                                UnloadDriver();
                                return -1;
                            }

                            Console.WriteLine(" ...Success.");
                        }
                        else if (getFanRpm)
                        {
                            // Query the fan RPM.
                            Console.WriteLine("Attempting to query the fan RPM...");
                            uint? result = DellSmbiosBzh.GetFanRpm(fanSelection);

                            if (result == null)
                            {
                                Console.Error.WriteLine("Failed.");
                                UnloadDriver();
                                return -1;
                            }

                            Console.WriteLine(" Result: {0}", result);
                            if (result < int.MaxValue)
                            {
                                returnCode = int.Parse(result.ToString());
                            }
                            else
                            {
                                Console.WriteLine(" (Likely error)");
                                returnCode = -1;
                            }
                        }
                        else if (runTest)
                        {
                            // Test all of the fan levels and report RPMs.

                            uint? rpmIdleFan1;
                            uint? rpmLevel0Fan1;
                            uint? rpmLevel1Fan1;
                            uint? rpmLevel2Fan1;

                            uint? rpmIdleFan2 = null;
                            uint? rpmLevel0Fan2 = null;
                            uint? rpmLevel1Fan2 = null;
                            uint? rpmLevel2Fan2 = null;

                            int sleepInterval = 7500;
                            bool fan2Present = true;

                            // Disable EC fan control.
                            Console.WriteLine("Disabling EC fan control...");
                            DellSmbiosBzh.DisableAutomaticFanControl(useAlternateCommand);

                            // Query current idle fan levels.
                            rpmIdleFan1 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan1);
                            DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan1, BzhFanLevel.Level0);

                            rpmIdleFan2 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan2);
                            bool success = DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan2, BzhFanLevel.Level0);

                            if (!success)
                            {
                                // No fan 2?
                                fan2Present = false;
                                Console.WriteLine("Looks like fan 2 is not present, system only has one fan?");
                            }

                            // Measure fan 1.
                            Console.WriteLine("Measuring: Fan 1, level 0...");
                            Thread.Sleep(sleepInterval);
                            rpmLevel0Fan1 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan1);

                            Console.WriteLine("Measuring: Fan 1, level 1..."); 
                            DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan1, BzhFanLevel.Level1);
                            Thread.Sleep(sleepInterval);
                            rpmLevel1Fan1 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan1);

                            Console.WriteLine("Measuring: Fan 1, level 2..."); 
                            DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan1, BzhFanLevel.Level2);
                            Thread.Sleep(sleepInterval);
                            rpmLevel2Fan1 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan1);

                            DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan1, BzhFanLevel.Level0);

                            if (fan2Present)
                            {
                                // Measure fan 2.
                                Console.WriteLine("Measuring: Fan 2, level 0...");
                                rpmLevel0Fan2 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan2);

                                Console.WriteLine("Measuring: Fan 2, level 1..."); 
                                DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan2, BzhFanLevel.Level1);
                                Thread.Sleep(sleepInterval);
                                rpmLevel1Fan2 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan2);

                                Console.WriteLine("Measuring: Fan 2, level 2..."); 
                                DellSmbiosBzh.SetFanLevel(BzhFanIndex.Fan2, BzhFanLevel.Level2);
                                Thread.Sleep(sleepInterval);
                                rpmLevel2Fan2 = DellSmbiosBzh.GetFanRpm(BzhFanIndex.Fan2);
                            }

                            // Enable EC fan control.
                            Console.WriteLine("Enabling EC fan control...");
                            DellSmbiosBzh.EnableAutomaticFanControl(useAlternateCommand);

                            Console.WriteLine("Test procedure is finished.");
                            Console.WriteLine();
                            Console.WriteLine();

                            // Output results.
                            Console.WriteLine("Fan 1 initial speed: {0}", rpmIdleFan1);
                            if (fan2Present)
                            {
                                Console.WriteLine("Fan 2 initial speed: {0}", rpmIdleFan2);
                            }
                            Console.WriteLine();

                            Console.WriteLine("Fan 1 level 0 speed: {0}", rpmLevel0Fan1);
                            Console.WriteLine("Fan 1 level 1 speed: {0}", rpmLevel1Fan1);
                            Console.WriteLine("Fan 1 level 2 speed: {0}", rpmLevel2Fan1);
                            Console.WriteLine();

                            if (fan2Present)
                            {
                                Console.WriteLine("Fan 2 level 0 speed: {0}", rpmLevel0Fan2);
                                Console.WriteLine("Fan 2 level 1 speed: {0}", rpmLevel1Fan2);
                                Console.WriteLine("Fan 2 level 2 speed: {0}", rpmLevel2Fan2);
                                Console.WriteLine();
                            }
                        }

                        // Unload driver.
                        UnloadDriver();
                    }
                }
            }
            catch (DllNotFoundException)
            {
                Console.Error.WriteLine("Unable to load DellSmbiosBzh.dll");
                Console.Error.WriteLine("Make sure that the file is present.  If it is, install the required Visual C++ redistributable:");
                Console.Error.WriteLine("https://aka.ms/vs/16/release/vc_redist.x64.exe");
                returnCode = -1;
            }
            catch (Exception exception)
            {
                Console.Error.WriteLine("Error: {0}", exception.Message);
                Console.Error.WriteLine(exception.StackTrace);
                returnCode = -1;
                UnloadDriver();
            }

            return returnCode;
        }

19 View Source File : ServerConfigurationForm.cs
License : GNU General Public License v3.0
Project Creator : ASCOMInitiative

private void BtnReloadConfiguration_Click(object sender, EventArgs e)
        {
            TL.LogMessage("Reload", "Start of BtnReloadConfiguration_Click");
            try
            {
                int clientNumber = 0;
                TL.LogMessage("Reload", "Connecting to device: " + ipAddressString + ":" + portNumber.ToString());

                string clientHostAddress = string.Format("{0}://{1}:{2}", serviceType, ipAddressString, portNumber.ToString());
                TL.LogMessage("Reload", "Client host address: " + clientHostAddress);

                RestClient client = new RestClient(clientHostAddress)
                {
                    PreAuthenticate = true
                };
                TL.LogMessage("Reload", "Creating Authenticator");
                client.Authenticator = new HttpBasicAuthenticator(userName, preplacedword);
                TL.LogMessage("Reload", "Setting timeout");
                RemoteClientDriver.SetClientTimeout(client, 10);

                string managementUri = string.Format("{0}{1}/{2}", SharedConstants.REMOTE_SERVER_MANAGEMENT_URL_BASE, SharedConstants.API_VERSION_V1, SharedConstants.REMOTE_SERVER_MANGEMENT_GET_CONFIGURATION);
                RestRequest request = new RestRequest(managementUri.ToLowerInvariant(), Method.GET)
                {
                    RequestFormat = DataFormat.Json
                };

                request.AddParameter(SharedConstants.CLIENTID_PARAMETER_NAME, clientNumber.ToString());
                uint transaction = RemoteClientDriver.TransactionNumber();
                request.AddParameter(SharedConstants.CLIENTTRANSACTION_PARAMETER_NAME, transaction.ToString());

                TL.LogMessage("Reload", "Client Txn ID: " + transaction.ToString() + ", Sending command to remote server");
                IRestResponse response = client.Execute(request);
                string responseContent;
                if (response.Content.Length > 100) responseContent = response.Content.Substring(0, 100);
                else responseContent = response.Content;
                TL.LogMessage("Reload", string.Format("Response Status: '{0}', Response: {1}", response.StatusDescription, responseContent));

                if ((response.ResponseStatus == ResponseStatus.Completed) & (response.StatusCode == System.Net.HttpStatusCode.OK))
                {
                    ConfigurationResponse configurationResponse = JsonConvert.DeserializeObject<ConfigurationResponse>(response.Content);
                    ConcurrentDictionary<string, ConfiguredDevice> configuration = configurationResponse.Value;
                    TL.LogMessage("Reload", "Number of device records: " + configuration.Count);

                    // Handle exceptions received from the driver by the remote server
                    if (configurationResponse.DriverException != null)
                    {
                        TL.LogMessageCrLf("Reload", string.Format("Exception Message: {0}, Exception Number: 0x{1}", configurationResponse.ErrorMessage, configurationResponse.ErrorNumber.ToString("X8")));
                    }
                }
                else
                {
                    if (response.ErrorException != null)
                    {
                        TL.LogMessageCrLf("Reload", "RestClient exception: " + response.ErrorMessage + "\r\n " + response.ErrorException.ToString());
                        // throw new ASCOM.DriverException(string.Format("Communications exception: {0} - {1}", response.ErrorMessage, response.ResponseStatus), response.ErrorException);
                    }
                    else
                    {
                        TL.LogMessage("Reload" + " Error", string.Format("RestRequest response status: {0}, HTTP response code: {1}, HTTP response description: {2}", response.ResponseStatus.ToString(), response.StatusCode, response.StatusDescription));
                        // throw new ASCOM.DriverException("ServerConfigurationForm Error - Status: " + response.ResponseStatus + " " + response.StatusDescription);
                    }
                }
            }
            catch (Exception ex)
            {
                TL.LogMessage("Reload", "Exception: " + ex.ToString());
            }

            TL.LogMessage("Reload", "End of BtnReloadConfiguration_Click");

        }

19 View Source File : ClusterChainDialog.cs
License : MIT License
Project Creator : aerosoul94

private void AddCluster(uint cluster)
        {
            var address = volume.ClusterToPhysicalOffset(cluster);

            ListViewItem item = new ListViewItem(new string[] { $"0x{address.ToString("X")}", cluster.ToString() });

            item.Tag = cluster;

            listView1.Items.Add(item);
        }

19 View Source File : TraceLoggerPlus.cs
License : GNU General Public License v3.0
Project Creator : ASCOMInitiative

public void LogMessageCrLf(uint instance, string prefix, string message)
        {
            LogMessage(prefix + " " + instance.ToString(), message);
        }

19 View Source File : MetaBoundRef.cs
License : MIT License
Project Creator : 0x0ade

public override void Write(DataContext ctx, MetaTypeWrap data) {
            data["Type"] = TypeBoundTo;
            data["ID"] = ID.ToString();
            data["IsAlive"] = IsAlive.ToString();
        }

19 View Source File : Conversion.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : aura-systems

public static string D2(uint number)
        {
            if (number < 10)
            {
                return "0" + number;
            }
            else
            {
                return number.ToString();
            }
        }

19 View Source File : PlayerViewControllerBase.cs
License : MIT License
Project Creator : AgoraIO

protected virtual void OnUserJoined(uint uid, int elapsed)
    {
        Debug.Log("onUserJoined: uid = " + uid + " elapsed = " + elapsed);

        // find a game object to render video stream from 'uid'
        GameObject go = GameObject.Find(uid.ToString());
        if (!ReferenceEquals(go, null))
        {
            return; // reuse
        }

        // create a GameObject and replacedign to this new user
        VideoSurface videoSurface = makeImageSurface(uid.ToString());
        if (!ReferenceEquals(videoSurface, null))
        {
            // configure videoSurface
            videoSurface.SetForUser(uid);
            videoSurface.SetEnable(true);
            videoSurface.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
            videoSurface.SetGameFps(30);
            videoSurface.EnableFilpTextureApply(enableFlipHorizontal: true, enableFlipVertical: false);
            UserVideoDict[uid] = videoSurface;
            Vector2 pos = AgoraUIUtils.GetRandomPosition(100);
            videoSurface.transform.localPosition = new Vector3(pos.x, pos.y, 0);
        }
    }

19 View Source File : UsageServiceClient.cs
License : MIT License
Project Creator : ABTSoftware

private string GetAuthHeader(string username)
        {
            // Get salt
            RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
            byte[] four_bytes = new byte[4];
            rng.GetBytes(four_bytes);
            var salt = BitConverter.ToUInt32(four_bytes, 0).ToString();
            // Get timestamp
            string timestamp = DateTime.UtcNow.ToString("o");
            // create signature
            string rawSig = (username ?? "") + timestamp + salt;
            var encoding = new System.Text.UTF8Encoding();
            byte[] keyByte = encoding.GetBytes(secretKey);
            byte[] messageBytes = encoding.GetBytes(rawSig);
            string signature;
            // hash and base64 encode 
            using (var sha256 = new HMACSHA256(keyByte))
            {
                byte[] hashMessage = sha256.ComputeHash(messageBytes);
                signature = Convert.ToBase64String(hashMessage);
            }
            // build auth header
            return timestamp + "," + salt + "," + signature;
        }

19 View Source File : DataPlayerInfo.cs
License : MIT License
Project Creator : 0x0ade

public override void Write(DataContext ctx, MetaTypeWrap data) {
            data["ID"] = (Player?.ID ?? uint.MaxValue).ToString();
        }

19 View Source File : MetaOrderedUpdate.cs
License : MIT License
Project Creator : 0x0ade

public override void Write(DataContext ctx, MetaTypeWrap data) {
            data["ID"] = ID.ToString();
            data["UpdateID"] = UpdateID.ToString();
        }

19 View Source File : HeifItemId.cs
License : GNU Lesser General Public License v3.0
Project Creator : 0xC0000054

public override string ToString()
        {
            return this.value.ToString();
        }

19 View Source File : PacketHeaderOptional.cs
License : GNU Affero General Public License v3.0
Project Creator : ACEmulator

public override string ToString()
        {
            if (Size == 0 || !IsValid)
            {
                return string.Empty;
            }

            string nice = "";
            if (Header.HasFlag(PacketHeaderFlags.Flow))
            {
                nice = $" {FlowBytes} Interval: {FlowInterval}";
            }
            if (RetransmitData != null)
            {
                nice += $" requesting {RetransmitData.DefaultIfEmpty().Select(t => t.ToString()).Aggregate((a, b) => a + "," + b)}";
            }
            if (Header.HasFlag(PacketHeaderFlags.AckSequence))
            {
                nice += $" AckSeq: {AckSequence}";
            }
            return nice.Trim();
        }

19 View Source File : AgoraScreenShare.cs
License : MIT License
Project Creator : AgoraIO

private void DestroyVideoView(uint uid)
    {
        GameObject go = GameObject.Find(uid.ToString());
        if (!ReferenceEquals(go, null))
        {
            Destroy(go);
        }
    }

See More Examples