System.Action.Invoke(string)

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

2521 Examples 7

19 Source : FreeSqlCloud.cs
with MIT License
from 2881099

internal void _distributedTraceCall(string log)
        {
            DistributeTrace?.Invoke($"{DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")} 【{DistributeKey}】{log}");
        }

19 Source : Machine.cs
with MIT License
from 3RD-Dimension

public void Connect()
        {
            if (Connected)
                throw new Exception("Can't Connect: Already Connected");

            switch (Properties.Settings.Default.ConnectionType)
            {
                case ConnectionType.Serial:
                    SerialPort port = new SerialPort(Properties.Settings.Default.SerialPortName, Properties.Settings.Default.SerialPortBaud);
                    port.DtrEnable = Properties.Settings.Default.SerialPortDTR;
                    port.Open();
                    Connection = port.BaseStream;
                    break;
                default:
                    throw new Exception("Invalid Connection Type");
            }

            if (Properties.Settings.Default.LogTraffic)
            {
                try
                {
                    Log = new StreamWriter(Constants.LogFile);
                }
                catch (Exception e)
                {
                    NonFatalException("could not open logfile: " + e.Message);
                }
            }

            Connected = true;

            ToSend.Clear();
            ToSendPriority.Clear();
            Sent.Clear();
            ToSendMacro.Clear();

            Mode = OperatingMode.Manual;

            if (PositionUpdateReceived != null)
                PositionUpdateReceived.Invoke();

            WorkerThread = new Thread(Work);
            WorkerThread.Priority = ThreadPriority.AboveNormal;
            WorkerThread.Start();
        }

19 Source : Machine.cs
with MIT License
from 3RD-Dimension

private void ParseStatus(string line)
        {
            MatchCollection statusMatch = StatusEx.Matches(line);

            if (statusMatch.Count == 0)
            {
                NonFatalException.Invoke(string.Format("Received Bad Status: '{0}'", line));
                return;
            }

            bool posUpdate = false;
            bool overrideUpdate = false;
            bool pinStateUpdate = false;
            bool resetPins = true;

            foreach (Match m in statusMatch)
            {
                if (m.Index == 1)
                {
                    Status = m.Groups[1].Value;
                    continue;
                }

                if (m.Groups[1].Value == "Ov")
                {
                    try
                    {
                        string[] parts = m.Groups[2].Value.Split(',');
                        FeedOverride = int.Parse(parts[0]);
                        RapidOverride = int.Parse(parts[1]);
                        SpindleOverride = int.Parse(parts[2]);
                        overrideUpdate = true;
                    }
                    catch { NonFatalException.Invoke(string.Format("Received Bad Status: '{0}'", line)); }
                }

                else if (m.Groups[1].Value == "WCO")
                {
                    try
                    {
                        string OffsetString = m.Groups[2].Value;

                        if (Properties.Settings.Default.IgnoreAdditionalAxes)
                        {
                            string[] parts = OffsetString.Split(',');
                            if (parts.Length > 3)
                            {
                                Array.Resize(ref parts, 3);
                                OffsetString = string.Join(",", parts);
                            }
                        }

                        WorkOffset = Vector3.Parse(OffsetString);
                        posUpdate = true;
                    }
                    catch { NonFatalException.Invoke(string.Format("Received Bad Status: '{0}'", line)); }
                }

                else if (SyncBuffer && m.Groups[1].Value == "Bf")
                {
                    try
                    {
                        int availableBytes = int.Parse(m.Groups[2].Value.Split(',')[1]);
                        int used = Properties.Settings.Default.ControllerBufferSize - availableBytes;

                        if (used < 0)
                            used = 0;

                        BufferState = used;
                        RaiseEvent(Info, $"Buffer State Synced ({availableBytes} bytes free)");
                    }
                    catch { NonFatalException.Invoke(string.Format("Received Bad Status: '{0}'", line)); }
                }

                else if (m.Groups[1].Value == "Pn")
                {
                    resetPins = false;

                    string states = m.Groups[2].Value;

                    bool stateX = states.Contains("X");
                    if (stateX != PinStateLimitX)
                        pinStateUpdate = true;
                    PinStateLimitX = stateX;

                    bool stateY = states.Contains("Y");
                    if (stateY != PinStateLimitY)
                        pinStateUpdate = true;
                    PinStateLimitY = stateY;

                    bool stateZ = states.Contains("Z");
                    if (stateZ != PinStateLimitZ)
                        pinStateUpdate = true;
                    PinStateLimitZ = stateZ;

                    bool stateP = states.Contains("P");
                    if (stateP != PinStateProbe)
                        pinStateUpdate = true;
                    PinStateProbe = stateP;
                }

                else if (m.Groups[1].Value == "F")
                {
                    try
                    {
                        FeedRateRealtime = double.Parse(m.Groups[2].Value, Constants.DecimalParseFormat);
                        posUpdate = true;
                    }
                    catch { NonFatalException.Invoke(string.Format("Received Bad Status: '{0}'", line)); }
                }

                else if (m.Groups[1].Value == "FS")
                {
                    try
                    {
                        string[] parts = m.Groups[2].Value.Split(',');
                        FeedRateRealtime = double.Parse(parts[0], Constants.DecimalParseFormat);
                        SpindleSpeedRealtime = double.Parse(parts[1], Constants.DecimalParseFormat);
                        posUpdate = true;
                    }
                    catch { NonFatalException.Invoke(string.Format("Received Bad Status: '{0}'", line)); }
                }
            }

            SyncBuffer = false; //only run this immediately after button press

            //run this later to catch work offset changes before parsing position
            Vector3 NewMachinePosition = MachinePosition;

            foreach (Match m in statusMatch)
            {
                if (m.Groups[1].Value == "MPos" || m.Groups[1].Value == "WPos")
                {
                    try
                    {
                        string PositionString = m.Groups[2].Value;

                        if (Properties.Settings.Default.IgnoreAdditionalAxes)
                        {
                            string[] parts = PositionString.Split(',');
                            if (parts.Length > 3)
                            {
                                Array.Resize(ref parts, 3);
                                PositionString = string.Join(",", parts);
                            }
                        }

                        NewMachinePosition = Vector3.Parse(PositionString);

                        if (m.Groups[1].Value == "WPos")
                            NewMachinePosition += WorkOffset;

                        if (NewMachinePosition != MachinePosition)
                        {
                            posUpdate = true;
                            MachinePosition = NewMachinePosition;
                        }
                    }
                    catch { NonFatalException.Invoke(string.Format("Received Bad Status: '{0}'", line)); }
                }

            }

            if (posUpdate && Connected && PositionUpdateReceived != null)
                PositionUpdateReceived.Invoke();

            if (overrideUpdate && Connected && OverrideChanged != null)
                OverrideChanged.Invoke();

            if (resetPins)  //no pin state received in status -> all zero
            {
                pinStateUpdate = PinStateLimitX | PinStateLimitY | PinStateLimitZ | PinStateProbe;  //was any pin set before

                PinStateLimitX = false;
                PinStateLimitY = false;
                PinStateLimitZ = false;
                PinStateProbe = false;
            }

            if (pinStateUpdate && Connected && PinStateChanged != null)
                PinStateChanged.Invoke();

            if (Connected && StatusReceived != null)
                StatusReceived.Invoke(line);
        }

19 Source : WorkOffsetsWindow.xaml.cs
with MIT License
from 3RD-Dimension

private void saveWorkOffset(string selectedOffset)
        {
            
            string Xaxis = "0.000";
            string Yaxis = "0.000";
            string Zaxis = "0.000";

            // 1) Get Selected Offset ie G54-G59.
            // 2) Get values from the selected Offset Textboxes - X, Y, Z
            // 3) Send Command G10 L2 P1  X0.000, Y0.000, Z0.000 - G54=P1....G59=P6
            if (selectedOffset == "G54")
            {
                Xaxis = MachineX_Current.Text;
                Yaxis = MachineY_Current.Text;
                Zaxis = MachineZ_Current.Text;

                G54X.Text = Xaxis;
                G54Y.Text = Yaxis;
                G54Z.Text = Zaxis;

                SendLine.Invoke($"G10 L2 P1 X{Xaxis} Y{Yaxis} Z{Zaxis}");
            }
            else if (selectedOffset == "G55")
            {
                Xaxis = MachineX_Current.Text;
                Yaxis = MachineY_Current.Text;
                Zaxis = MachineZ_Current.Text;

                G55X.Text = Xaxis;
                G55Y.Text = Yaxis;
                G55Z.Text = Zaxis;

                SendLine.Invoke($"G10 L2 P2 X{Xaxis} Y{Yaxis} Z{Zaxis}");
            }
            else if (selectedOffset == "G56")
            {
                Xaxis = MachineX_Current.Text;
                Yaxis = MachineY_Current.Text;
                Zaxis = MachineZ_Current.Text;

                G56X.Text = Xaxis;
                G56Y.Text = Yaxis;
                G56Z.Text = Zaxis;

                SendLine.Invoke($"G10 L2 P3 X{Xaxis} Y{Yaxis} Z{Zaxis}");
            }
            else if (selectedOffset == "G57")
            {
                Xaxis = MachineX_Current.Text;
                Yaxis = MachineY_Current.Text;
                Zaxis = MachineZ_Current.Text;

                G57X.Text = Xaxis;
                G57Y.Text = Yaxis;
                G57Z.Text = Zaxis;

                SendLine.Invoke($"G10 L2 P4 X{Xaxis} Y{Yaxis} Z{Zaxis}");
            }
            else if (selectedOffset == "G58")
            {
                Xaxis = MachineX_Current.Text;
                Yaxis = MachineY_Current.Text;
                Zaxis = MachineZ_Current.Text;

                G58X.Text = Xaxis;
                G58Y.Text = Yaxis;
                G58Z.Text = Zaxis;

                SendLine.Invoke($"G10 L2 P5 X{Xaxis} Y{Yaxis} Z{Zaxis}");
            }
            else if (selectedOffset == "G59")
            {
                Xaxis = MachineX_Current.Text;
                Yaxis = MachineY_Current.Text;
                Zaxis = MachineZ_Current.Text;

                G59X.Text = Xaxis;
                G59Y.Text = Yaxis;
                G59Z.Text = Zaxis;

                SendLine.Invoke($"G10 L2 P6 X{Xaxis} Y{Yaxis} Z{Zaxis}");
            }
            else
            {
                return;
            }

        }

19 Source : WorkOffsetsWindow.xaml.cs
with MIT License
from 3RD-Dimension

private void BtnResetOffset_Click(object sender, RoutedEventArgs e)
        {
            Button b = sender as Button;

            if (b == null)
                return;

            switch (b.Tag as string)
            {
                case "ResetG54":
                    G54X.Text = "0.000";
                    G54Y.Text = "0.000";
                    G54Z.Text = "0.000";
                    SendLine.Invoke($"G10 L2 P1 X0.000 Y0.000 Z0.000");
                    break;
                case "ResetG55":
                    G55X.Text = "0.000";
                    G55Y.Text = "0.000";
                    G55Z.Text = "0.000";
                    SendLine.Invoke($"G10 L2 P2 X0.000 Y0.000 Z0.000");
                    break;
                case "ResetG56":
                    G56X.Text = "0.000";
                    G56Y.Text = "0.000";
                    G56Z.Text = "0.000";
                    SendLine.Invoke($"G10 L2 P3 X0.000 Y0.000 Z0.000");
                    break;
                case "ResetG57":
                    G57X.Text = "0.000";
                    G57Y.Text = "0.000";
                    G57Z.Text = "0.000";
                    SendLine.Invoke($"G10 L2 P4 X0.000 Y0.000 Z0.000");
                    break;
                case "ResetG58":
                    G58X.Text = "0.000";
                    G58Y.Text = "0.000";
                    G58Z.Text = "0.000";
                    SendLine.Invoke($"G10 L2 P5 X0.000 Y0.000 Z0.000");
                    break;
                case "ResetG59":
                    G59X.Text = "0.000";
                    G59Y.Text = "0.000";
                    G59Z.Text = "0.000";
                    SendLine.Invoke($"G10 L2 P6 X0.000 Y0.000 Z0.000");
                    break;
            }
        }

19 Source : WorkOffsetsWindow.xaml.cs
with MIT License
from 3RD-Dimension

private void saveIndividualOffsetAxis(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            string newValue;
                       
            TextBox b = sender as TextBox;

            if (b == null)
                return;

            switch (b.Tag as string)
            {
                // G10 L2 Px Axis+Value
                // G54 Axies
                case "G54X":
                    newValue = G54X.Text;
                    SendLine.Invoke($"G10 L2 P1 X{newValue}");
                    break;
                case "G54Y":
                    newValue = G54Y.Text;
                    SendLine.Invoke($"G10 L2 P1 Y{newValue}");
                    break;
                case "G54Z":
                    newValue = G54Z.Text;
                    SendLine.Invoke($"G10 L2 P1 Z{newValue}");
                    break;
                // G55 Axies
                case "G55X":
                    newValue = G55X.Text;
                    SendLine.Invoke($"G10 L2 P2 X{newValue}");
                    break;
                case "G55Y":
                    newValue = G55Y.Text;
                    SendLine.Invoke($"G10 L2 P2 Y{newValue}");
                    break;
                case "G55Z":
                    newValue = G55Z.Text;
                    SendLine.Invoke($"G10 L2 P2 Z{newValue}");
                    break;
                // G56 Axies
                case "G56X":
                    newValue = G56X.Text;
                    SendLine.Invoke($"G10 L2 P3 X{newValue}");
                    break;
                case "G56Y":
                    newValue = G56Y.Text;
                    SendLine.Invoke($"G10 L2 P3 Y{newValue}");
                    break;
                case "G56Z":
                    newValue = G56Z.Text;
                    SendLine.Invoke($"G10 L2 P3 Z{newValue}");
                    break;
                // G57 Axies
                case "G57X":
                    newValue = G57X.Text;
                    SendLine.Invoke($"G10 L2 P4 X{newValue}");
                    break;
                case "G57Y":
                    newValue = G57Y.Text;
                    SendLine.Invoke($"G10 L2 P4 Y{newValue}");
                    break;
                case "G57Z":
                    newValue = G57Z.Text;
                    SendLine.Invoke($"G10 L2 P4 Z{newValue}");
                    break;
                // G58 Axies
                case "G58X":
                    newValue = G58X.Text;
                    SendLine.Invoke($"G10 L2 P5 X{newValue}");
                    break;
                case "G58Y":
                    newValue = G58Y.Text;
                    SendLine.Invoke($"G10 L2 P5 Y{newValue}");
                    break;
                case "G58Z":
                    newValue = G58Z.Text;
                    SendLine.Invoke($"G10 L2 P5 Z{newValue}");
                    break;
                // G59 Axies
                case "G59X":
                    newValue = G59X.Text;
                    SendLine.Invoke($"G10 L2 P6 X{newValue}");
                    break;
                case "G59Y":
                    newValue = G59Y.Text;
                    SendLine.Invoke($"G10 L2 P6 Y{newValue}");
                    break;
                case "G59Z":
                    newValue = G59Z.Text;
                    SendLine.Invoke($"G10 L2 P6 Z{newValue}");
                    break;
            }
        }

19 Source : Machine.cs
with MIT License
from 3RD-Dimension

private void ReportError(string error)
        {
            if (NonFatalException != null)
                NonFatalException.Invoke(GrblCodeTranslator.ExpandError(error));
        }

19 Source : GrblSettingsWindow.xaml.cs
with MIT License
from 3RD-Dimension

private async void ButtonApply_Click(object sender, RoutedEventArgs e)
        {
            List<Tuple<int, double>> ToSend = new List<Tuple<int, double>>();

            foreach (KeyValuePair<int, double> kvp in CurrentSettings)
            {
                double newval;

                if (!double.TryParse(SettingsBoxes[kvp.Key].Text, System.Globalization.NumberStyles.Float, Util.Constants.DecimalParseFormat, out newval))
                {
                    MessageBox.Show($"Value \"{SettingsBoxes[kvp.Key].Text}\" is invalid for Setting \"{Util.GrblCodeTranslator.Settings[kvp.Key].Item1}\"");
                    return;
                }

                if (newval == kvp.Value)
                    continue;

                ToSend.Add(new Tuple<int, double>(kvp.Key, newval));
            }

            if (SendLine == null)
                return;

            foreach (Tuple<int, double> setting in ToSend)
            {
                SendLine.Invoke($"${setting.Item1}={setting.Item2.ToString(Util.Constants.DecimalOutputFormat)}");
                CurrentSettings[setting.Item1] = setting.Item2;
                await Task.Delay(Properties.Settings.Default.SettingsSendDelay);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Upload(string url, string field, byte[] bytes, string name, string mime, Action<bool> complete = null, Action<string> error = null)
        {
            WWWForm form = new WWWForm();
            form.AddBinaryData(field, bytes, name, mime);
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Post(url, form);
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(true);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                byte[] bytes = webRequest.downloadHandler.data;
                complete?.Invoke(bytes);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<Texture2D> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerTexture download = new DownloadHandlerTexture(true);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.texture);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<Texture2D, byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerTexture download = new DownloadHandlerTexture(true);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.texture, download.data);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, AudioType type, Action<AudioClip> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerAudioClip download = new DownloadHandlerAudioClip(webRequest.url, type);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.audioClip);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, AudioType type, Action<AudioClip, byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerAudioClip download = new DownloadHandlerAudioClip(webRequest.url, type);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.audioClip, download.data);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<replacedetBundle> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerreplacedetBundle download = new DownloadHandlerreplacedetBundle(webRequest.url, uint.MaxValue);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.replacedetBundle);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<replacedetBundle, byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerreplacedetBundle download = new DownloadHandlerreplacedetBundle(webRequest.url, uint.MaxValue);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.result == UnityWebRequest.Result.ConnectionError || webRequest.result == UnityWebRequest.Result.ProtocolError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.replacedetBundle, download.data);
            }
        }

19 Source : Machine.cs
with MIT License
from 3RD-Dimension

private void ParseProbe(string line)
        {
            if (ProbeFinished == null)
                return;

            Match probeMatch = ProbeEx.Match(line);

            Group pos = probeMatch.Groups["Pos"];
            Group success = probeMatch.Groups["Success"];

            if (!probeMatch.Success || !(pos.Success & success.Success))
            {
                NonFatalException.Invoke($"Received Bad Probe: '{line}'");
                return;
            }

            string PositionString = pos.Value;

            if (Properties.Settings.Default.IgnoreAdditionalAxes)
            {
                string[] parts = PositionString.Split(',');
                if (parts.Length > 3)
                {
                    Array.Resize(ref parts, 3);
                    PositionString = string.Join(",", parts);
                }
            }

            Vector3 ProbePos = Vector3.Parse(PositionString);
            LastProbePosMachine = ProbePos;

            ProbePos -= WorkOffset;

            LastProbePosWork = ProbePos;

            bool ProbeSuccess = success.Value == "1";

            ProbeFinished.Invoke(ProbePos, ProbeSuccess);
        }

19 Source : AssetBundleManager.cs
with MIT License
from 404Lcc

public void Initreplacedets(byte[] bytes)
        {
            Message?.Invoke("初始化资源");
            FileUtil.Savereplacedet(PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle()), "replacedetBundleConfig.json", bytes);
            localreplacedetBundleConfig = JsonUtil.ToObject<replacedetBundleConfig>(bytes.GetString());
            List<string> keyList = new List<string>();
            keyList.Add(PathUtil.GetPlatformForreplacedetBundle());
            keyList.Add($"{PathUtil.GetPlatformForreplacedetBundle()}.manifest");
            foreach (string item in localreplacedetBundleConfig.replacedetBundleDataDict.Keys)
            {
                keyList.Add($"{item}.unity3d");
            }
            copyCount = keyList.Count;
            //开始拷贝资源
            StartCoroutine(Copyreplacedets(keyList.ToArray()));
        }

19 Source : AssetBundleManager.cs
with MIT License
from 404Lcc

public IEnumerator Copyreplacedets(string[] keys)
        {
            foreach (string item in keys)
            {
                yield return StartCoroutine(WebUtil.Download($"{(Application.platform == RuntimePlatform.Android ? string.Empty : "file://")}{PathUtil.GetPath(PathType.StreamingreplacedetsPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{item}", (byte[] bytes) =>
                {
                    FileUtil.Savereplacedet(PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle()), item, bytes);
                    currentCopyCount += 1;
                    Message?.Invoke($"初始化资源 {currentCopyCount} / {copyCount}");
                    CopyProgress?.Invoke(currentCopyCount, copyCount);
                }));
            }
            //更新资源
            Updatereplacedets(string.Empty);
        }

19 Source : AssetBundleManager.cs
with MIT License
from 404Lcc

public void Updatereplacedets(DownloadData downloadData)
        {
            Message?.Invoke("检测资源中");
            byte[] bytes = FileUtil.Getreplacedet($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/ServerreplacedetBundleConfig.json");
            serverreplacedetBundleConfig = JsonUtil.ToObject<replacedetBundleConfig>(bytes.GetString());
            List<DownloadData> downloadDataList = new List<DownloadData>();
            if (localreplacedetBundleConfig == null)
            {
                foreach (string item in serverreplacedetBundleConfig.replacedetBundleDataDict.Keys)
                {
                    DownloadData data = new DownloadData(item, $"{url}/{PathUtil.GetPlatformForreplacedetBundle()}/{item}.unity3d", $"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{item}.unity3d");
                    data.Complete += DownloadComplete;
                    data.Error += Error;
                    downloadDataList.Add(data);
                }
            }
            else if (localreplacedetBundleConfig.version < serverreplacedetBundleConfig.version)
            {
                foreach (string item in ComputeUpdatereplacedets())
                {
                    DownloadData data = new DownloadData(item, $"{url}/{PathUtil.GetPlatformForreplacedetBundle()}/{item}.unity3d", $"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{item}.unity3d");
                    data.Complete += DownloadComplete;
                    data.Error += Error;
                    downloadDataList.Add(data);
                }
            }
            DownloadData data1 = new DownloadData(PathUtil.GetPlatformForreplacedetBundle(), $"{url}/{PathUtil.GetPlatformForreplacedetBundle()}/{PathUtil.GetPlatformForreplacedetBundle()}", $"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{PathUtil.GetPlatformForreplacedetBundle()}");
            data1.Complete += DownloadComplete;
            data1.Error += Error;
            DownloadData data2 = new DownloadData($"{PathUtil.GetPlatformForreplacedetBundle()}.manifest", $"{url}/{PathUtil.GetPlatformForreplacedetBundle()}/{PathUtil.GetPlatformForreplacedetBundle()}.manifest", $"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{PathUtil.GetPlatformForreplacedetBundle()}.manifest");
            data2.Complete += DownloadComplete;
            data2.Error += Error;
            downloadDataList.Add(data1);
            downloadDataList.Add(data2);
            updateCount = downloadDataList.Count;
            DownloadManager.Instance.DownloadAsync(downloadDataList.ToArray());
        }

19 Source : AssetBundleManager.cs
with MIT License
from 404Lcc

public void DownloadComplete(DownloadData downloadData)
        {
            currentUpdateCount += 1;
            Message?.Invoke($"下载资源中 {currentUpdateCount} / {updateCount}");
            DownloadProgress?.Invoke(currentUpdateCount, updateCount);
            if (currentUpdateCount == updateCount)
            {
                CheckreplacedetsComplete();
            }
        }

19 Source : AssetBundleManager.cs
with MIT License
from 404Lcc

public void CheckreplacedetsComplete()
        {
            Message?.Invoke("检测资源完整性");
            replacedetBundle replacedetBundle = replacedetBundle.LoadFromFile($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{PathUtil.GetPlatformForreplacedetBundle()}");
            replacedetBundleManifest = replacedetBundle.Loadreplacedet<replacedetBundleManifest>("replacedetBundleManifest");
            replacedetBundle.Unload(false);
            List<string> replacedetBundleNameList = new List<string>();
            checkCount = localreplacedetBundleConfig.replacedetBundleDataDict.Count;
            foreach (KeyValuePair<string, replacedetBundleData> item in localreplacedetBundleConfig.replacedetBundleDataDict)
            {
                if (!File.Exists($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{item.Key}.unity3d"))
                {
                    replacedetBundleNameList.Add(item.Key);
                    continue;
                }
                else if (new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/{item.Key}.unity3d").Length != item.Value.fileSize)
                {
                    replacedetBundleNameList.Add(item.Key);
                    continue;
                }
                else if (localreplacedetBundleConfig.replacedetBundleDataDict[item.Key].replacedetBundleHash != replacedetBundleManifest.GetreplacedetBundleHash($"{item.Key}.unity3d").ToString())
                {
                    replacedetBundleNameList.Add(item.Key);
                    continue;
                }
                currentCheckCount += 1;
                CheckProgress?.Invoke(currentCheckCount, checkCount);
            }
            if (replacedetBundleNameList.Count == 0)
            {
                if (isDownload)
                {
                    File.Move($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/ServerreplacedetBundleConfig.json", $"{PathUtil.GetPath(PathType.PersistentDataPath, "Res", PathUtil.GetPlatformForreplacedetBundle())}/replacedetBundleConfig.json");
                }
                Complete?.Invoke();
            }
            else
            {
                Error?.Invoke(null, "资源不完整");
            }
        }

19 Source : Fuzzer.cs
with Apache License 2.0
from 42skillz

private static void LogSeedAndTestInformations(int seed, bool seedWasProvided, string fuzzerName)
        {
            var testName = FindTheNameOfTheTestInvolved();

            if (Log == null)
            {
                throw new FuzzerException(BuildErrorMessageForMissingLogRegistration());
            }

            Log(
                $"----------------------------------------------------------------------------------------------------------------------");
            if (seedWasProvided)
            {
                Log($"--- Fuzzer (\"{fuzzerName}\") instantiated from a provided seed ({seed})");
                Log($"--- from the test: {testName}()");
            }
            else
            {
                Log($"--- Fuzzer (\"{fuzzerName}\") instantiated with the seed ({seed})");
                Log($"--- from the test: {testName}()");
                Log(
                    $"--- Note: you can instantiate another Fuzzer with that very same seed in order to reproduce the exact test conditions");
            }

            Log(
                $"----------------------------------------------------------------------------------------------------------------------");
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Upload(string url, string field, byte[] bytes, string name, string mime, Action<bool> complete = null, Action<string> error = null)
        {
            WWWForm form = new WWWForm();
            form.AddBinaryData(field, bytes, name, mime);
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Post(url, form);
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(true);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                byte[] bytes = webRequest.downloadHandler.data;
                complete?.Invoke(bytes);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<Texture2D> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerTexture download = new DownloadHandlerTexture(true);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.texture);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<Texture2D, byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerTexture download = new DownloadHandlerTexture(true);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.texture, download.data);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, AudioType type, Action<AudioClip> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerAudioClip download = new DownloadHandlerAudioClip(webRequest.url, type);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.audioClip);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, AudioType type, Action<AudioClip, byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerAudioClip download = new DownloadHandlerAudioClip(webRequest.url, type);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.audioClip, download.data);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<replacedetBundle> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerreplacedetBundle download = new DownloadHandlerreplacedetBundle(webRequest.url, uint.MaxValue);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.replacedetBundle);
            }
        }

19 Source : WebUtil.cs
with MIT License
from 404Lcc

public static IEnumerator Download(string url, Action<replacedetBundle, byte[]> complete = null, Action<string> error = null)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);
            DownloadHandlerreplacedetBundle download = new DownloadHandlerreplacedetBundle(webRequest.url, uint.MaxValue);
            webRequest.downloadHandler = download;
            yield return webRequest.SendWebRequest();
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
                error?.Invoke(webRequest.error);
            }
            else
            {
                complete?.Invoke(download.replacedetBundle, download.data);
            }
        }

19 Source : Scenario.cs
with MIT License
from 8T4

private void PrintScenarioResult(ScenarioResult scenarioResult)
        {
            var result = FeatureVariables.Replace(scenarioResult.ToString());
            Console.WriteLine(result);
            RedirectStandardOutput?.Invoke(result);
            Paradigms.Clear();
            MappedParadigms.Clear();
        }

19 Source : PanelChat.cs
with Apache License 2.0
from AantCoder

public void Drow(Rect inRect)
        {
            var iconWidth = 25f;
            var iconWidthSpase = 30f;

            /// -----------------------------------------------------------------------------------------
            /// Список каналов
            ///
            if (SessionClientController.Data.Chats != null)
            {
                lock (SessionClientController.Data.Chats)
                {
                    if (SessionClientController.Data.ChatNotReadPost > 0) SessionClientController.Data.ChatNotReadPost = 0;

                    //Loger.Log("Client " + SessionClientController.Data.Chats.Count);
                    if (lbCannalsHeight == 0)
                    {
                        var textHeight = new DialogControlBase().TextHeight;
                        lbCannalsHeight = (float)Math.Round((decimal)(inRect.height / 2f / textHeight)) * textHeight;
                    }
                    Widgets.Label(new Rect(inRect.x, inRect.y + iconWidthSpase + lbCannalsHeight, 100f, 22f), "OCity_Dialog_Players".Translate());

                    if (lbCannals == null)
                    {
                        //первый запуск
                        lbCannals = new ListBox<string>();
                        lbCannals.Area = new Rect(inRect.x
                            , inRect.y + iconWidthSpase
                            , 100f
                            , lbCannalsHeight);
                        lbCannals.OnClick += (index, text) => DataLastChatsTime = DateTime.MinValue; /*StatusTemp = text;*/
                        lbCannals.SelectedIndex = 0;
                    }

                    if (lbPlayers == null)
                    {
                        //первый запуск
                        lbPlayers = new ListBox<ListBoxPlayerItem>();
                        lbPlayers.OnClick += (index, item) =>
                        {
                        //убираем выделение
                        lbPlayers.SelectedIndex = -1;
                        //вызываем контекстное меню
                        PlayerItemMenu(item);
                        };

                        lbPlayers.Tooltip = (item) => item.Tooltip;
                    }

                    if (PanelLastHeight != inRect.height)
                    {
                        PanelLastHeight = inRect.height;
                        lbPlayers.Area = new Rect(inRect.x
                            , inRect.y + iconWidthSpase + lbCannalsHeight + 22f
                            , 100f
                            , inRect.height - (iconWidthSpase + lbCannalsHeight + 22f));
                    }

                    if (NeedUpdateChat)
                    {
                        lbCannalsLastSelectedIndex = -1;
                        NeedUpdateChat = false;
                    }

                    var nowUpdateChat = DataLastChatsTime != SessionClientController.Data.ChatsTime.Time;
                    if (nowUpdateChat)
                    {
                        Loger.Log("Client UpdateChats nowUpdateChat");
                        DataLastChatsTime = SessionClientController.Data.ChatsTime.Time;
                        lbCannalsLastSelectedIndex = -1; //сброс для обновления содержимого окна
                        NeedUpdateChat = true;
                    }

                    if (nowUpdateChat
                        || DataLastChatsTimeUpdateTime < DateTime.UtcNow.AddSeconds(-5))
                    {
                        DataLastChatsTimeUpdateTime = DateTime.UtcNow;
                        //пишем в лог
                        var updateLogHash = SessionClientController.Data.Chats.Count * 1000000
                            + SessionClientController.Data.Chats.Sum(c => c.Posts.Count);
                        if (updateLogHash != UpdateLogHash)
                        {
                            UpdateLogHash = updateLogHash;
                            Loger.Log("Client UpdateChats chats="
                                + SessionClientController.Data.Chats.Count.ToString()
                                + " players=" + SessionClientController.Data.Players.Count.ToString());
                        }

                        //устанавливаем данные
                        lbCannals.DataSource = SessionClientController.Data.Chats
                            //.OrderBy(c => (c.OwnerMaker ? "2" : "1") + c.Name) нелья просто отсортировать, т.к. потом находим по индексу
                            .Select(c => c.Name)
                            .ToList();
                        if (lbCannalsGoToChat != null)
                        {
                            var lbCannalsGoToChatIndex = lbCannals.DataSource.IndexOf(lbCannalsGoToChat);
                            if (lbCannalsGoToChatIndex >= 0)
                            {
                                lbCannals.SelectedIndex = lbCannalsGoToChatIndex;
                                lbCannalsGoToChat = null;
                            }
                        }

                        //Заполняем список игроков по группами {
                        lbPlayers.DataSource = new List<ListBoxPlayerItem>();
                        var allreadyLogin = new List<string>();
                        Func<string, string, ListBoxPlayerItem> addPl = (login, text) =>
                        {
                            allreadyLogin.Add(login);
                            var n = new ListBoxPlayerItem()
                            {
                                Login = login,
                                Text = text,
                                Tooltip = login
                            };
                            lbPlayers.DataSource.Add(n);
                            return n;
                        };

                        Action<string> addreplaced = (text) =>
                        {
                            if (lbPlayers.DataSource.Count > 0) addPl(null, " ").Groupreplacedle = true;
                            addPl(null, " <i>– " + text + " –</i> ").Groupreplacedle = true;
                        };

                        Func<string, bool> isOnline = (login) => login == SessionClientController.My.Login
                            || SessionClientController.Data.Players.ContainsKey(login) && SessionClientController.Data.Players[login].Online;
                        Func<bool, string, string> frameOnline = (online, txt) =>
                            online
                            ? "<b>" + txt + "</b>"
                            : "<color=#888888ff>" + txt + "</color>";

                        if (lbCannals.SelectedIndex > 0 && SessionClientController.Data.Chats.Count > lbCannals.SelectedIndex)
                        {
                            var selectCannal = SessionClientController.Data.Chats[lbCannals.SelectedIndex];

                            // в чате создатель
                            addreplaced("OCity_Dialog_Exchenge_Chat".Translate());
                            var n = addPl(selectCannal.OwnerLogin
                                , frameOnline(isOnline(selectCannal.OwnerLogin), "★ " + selectCannal.OwnerLogin));
                            n.Tooltip += "OCity_Dialog_ChennelOwn".Translate();
                            n.InChat = true;

                            // в чате
                            var offlinePartyLogin = new List<string>();
                            for (int i = 0; i < selectCannal.PartyLogin.Count; i++)
                            {
                                var lo = selectCannal.PartyLogin[i];
                                if (lo != "system" && lo != selectCannal.OwnerLogin)
                                {
                                    if (isOnline(lo))
                                    {
                                        n = addPl(lo, frameOnline(true, lo));
                                        n.Tooltip += "OCity_Dialog_ChennelUser".Translate();
                                        n.InChat = true;
                                    }
                                    else
                                        offlinePartyLogin.Add(lo);
                                }
                            }

                            // в чате оффлайн
                            //addreplaced("оффлайн".Translate());
                            for (int i = 0; i < offlinePartyLogin.Count; i++)
                            {
                                var lo = offlinePartyLogin[i];
                                n = addPl(lo, frameOnline(false, lo));
                                n.Tooltip += "OCity_Dialog_ChennelUser".Translate();
                                n.InChat = true;
                            }
                        }

                        var other = SessionClientController.Data.Chats[0].PartyLogin == null
                            ? new List<string>()
                            : SessionClientController.Data.Chats[0].PartyLogin
                            .Where(p => p != "" && p != "system" && !allreadyLogin.Any(al => al == p))
                            .ToList();
                        if (other.Count > 0)
                        {
                            // игроки
                            addreplaced("OCity_Dialog_Exchenge_Gamers".Translate());
                            var offlinePartyLogin = new List<string>();
                            for (int i = 0; i < other.Count; i++)
                            {
                                var lo = other[i];
                                if (isOnline(lo))
                                {
                                    var n = addPl(lo, frameOnline(true, lo));
                                    //n.Tooltip += "OCity_Dialog_ChennelUser".Translate();
                                }
                                else
                                    offlinePartyLogin.Add(lo);
                            }

                            // игроки оффлайн
                            //addreplaced("оффлайн".Translate());
                            for (int i = 0; i < offlinePartyLogin.Count; i++)
                            {
                                var lo = offlinePartyLogin[i];
                                var n = addPl(lo, frameOnline(false, lo));
                                //n.Tooltip += "OCity_Dialog_ChennelUser".Translate();
                            }

                        }
                    }

                    lbCannals.Drow();
                    lbPlayers.Drow();

                    var iconRect = new Rect(inRect.x, inRect.y, iconWidth, iconWidth);
                    TooltipHandler.TipRegion(iconRect, "OCity_Dialog_ChennelCreate".Translate());
                    if (Widgets.ButtonImage(iconRect, GeneralTexture.IconAddTex))
                    {
                        CannalAdd();
                    }

                    if (lbCannals.SelectedIndex > 0 && SessionClientController.Data.Chats.Count > lbCannals.SelectedIndex)
                    {
                        //Если что-то выделено, и это не общий чат (строка 0)
                        iconRect.x += iconWidthSpase;
                        TooltipHandler.TipRegion(iconRect, "OCity_Dialog_ChennelClose".Translate());
                        if (Widgets.ButtonImage(iconRect, GeneralTexture.IconDelTex))
                        {
                            CannalDelete();
                        }
                    }

                    if (lbCannals.SelectedIndex >= 0 && SessionClientController.Data.Chats.Count > lbCannals.SelectedIndex)
                    {
                        iconRect.x += iconWidthSpase;
                        TooltipHandler.TipRegion(iconRect, "OCity_Dialog_OthersFunctions".Translate());
                        if (Widgets.ButtonImage(iconRect, GeneralTexture.IconSubMenuTex))
                        {
                            CannalsMenuShow();
                        }
                    }

                    /// -----------------------------------------------------------------------------------------
                    /// Чат
                    ///
                    if (lbCannalsLastSelectedIndex != lbCannals.SelectedIndex)
                    {
                        lbCannalsLastSelectedIndex = lbCannals.SelectedIndex;
                        if (lbCannals.SelectedIndex >= 0 && SessionClientController.Data.Chats.Count > lbCannals.SelectedIndex)
                        {
                            var selectCannal = SessionClientController.Data.Chats[lbCannals.SelectedIndex];
                            if (selectCannal.Posts != null && selectCannal.Posts.Count > 0)
                            {
                                var chatLastPostTime = selectCannal.Posts.Max(p => p.Time);
                                if (ChatLastPostTime != chatLastPostTime)
                                {
                                    ChatLastPostTime = chatLastPostTime;
                                    Func<ChatPost, string> getPost = (cp) => "[" + cp.Time.ToGoodUtcString("dd HH:mm ") + cp.OwnerLogin + "]: " + cp.Message;

                                    var totalLength = 0;
                                    ChatBox.Text = selectCannal.Posts
                                        .Reverse<ChatPost>()
                                        .Where(i => (totalLength += i.Message.Length) < 5000)
                                        .Aggregate("", (r, i) => getPost(i) + (r == "" ? "" : Environment.NewLine + r));
                                    ChatScrollToDown = true;
                                }
                                //else ChatBox.Text = "";
                            }
                            //else ChatBox.Text = "";
                        }
                        else
                            ChatBox.Text = "";
                    }

                    if (lbCannals.SelectedIndex >= 0 && SessionClientController.Data.Chats.Count > lbCannals.SelectedIndex)
                    {
                        var selectCannal = SessionClientController.Data.Chats[lbCannals.SelectedIndex];
                        var chatAreaOuter = new Rect(inRect.x + 110f, inRect.y, inRect.width - 110f, inRect.height - 30f);
                        ChatBox.Drow(chatAreaOuter, ChatScrollToDown);
                        ChatScrollToDown = false;

                        var rrect = new Rect(inRect.x + inRect.width - 25f, inRect.y + inRect.height - 25f, 25f, 25f);
                        Text.Font = GameFont.Medium;
                        Text.Anchor = TextAnchor.MiddleCenter;
                        Widgets.Label(rrect, "▶");
                        Text.Font = GameFont.Small;
                        Text.Anchor = TextAnchor.MiddleLeft;
                        bool rrcklick = Widgets.ButtonInvisible(rrect);

                        if (ChatInputText != "")
                        {
                            if (Mouse.IsOver(rrect))
                            {
                                Widgets.DrawHighlight(rrect);
                            }

                            var ev = Event.current;
                            if (ev.isKey && ev.type == EventType.KeyDown && ev.keyCode == KeyCode.Return
                                || rrcklick)
                            {
                                //SoundDefOf.RadioButtonClicked.PlayOneShotOnCamera();
                                SessionClientController.Command((connect) =>
                                {
                                    connect.PostingChat(selectCannal.Id, ChatInputText);
                                });

                                ChatInputText = "";
                            }
                        }

                        GUI.SetNextControlName("StartTextField");
                        ChatInputText = GUI.TextField(new Rect(inRect.x + 110f, inRect.y + inRect.height - 25f, inRect.width - 110f - 30f, 25f)
                            , ChatInputText, 10000);

                        if (NeedFockus)
                        {
                            NeedFockus = false;
                            GUI.FocusControl("StartTextField");
                        }
                    }
                }
            }
        }

19 Source : NonNativeKeyboard.cs
with Apache License 2.0
from abist-co-ltd

private void DoTextUpdated(string value) => OnTextUpdated?.Invoke(value);

19 Source : FileContainerServer.cs
with MIT License
from actions

private void OutputLogForFile(RunnerActionPluginExecutionContext context, string itemPath, string logDescription, Action<string> log)
        {
            // output detail upload trace for the file.
            ConcurrentQueue<string> logQueue;
            if (_fileUploadTraceLog.TryGetValue(itemPath, out logQueue))
            {
                log(logDescription);
                string message;
                while (logQueue.TryDequeue(out message))
                {
                    log(message);
                }
            }
        }

19 Source : HookInterceptor.cs
with MIT License
from AdamCarballo

private static bool OnPreIntercept(EditorWindow replacedetStoreWindow) {
			LogVerbose("replacedet Store Window found!");

			// Obtain the url data using reflection
			var type = _replacedembly.GetType("UnityEditor.replacedetStoreContext");
			var instance = type.GetMethod("GetInstance").Invoke(null, null);
			string url = (string) instance.GetType().GetMethod("GetInitialOpenURL").Invoke(instance, null);

			// Check if there is a url
			if (string.IsNullOrEmpty(url)) {
				LogVerbose("URL is empty, no payload");
				return false;
			}

			LogVerbose($"Initial Open URL: {url}");

			// Check if the preplaceded url is a hook or something else
			if (!url.StartsWith(_replacedembledUrl)) {
				LogDebug("URL is not a Hook url, ignoring...");
				return false;
			}

			// Close the replacedet Store window
			if (WasWindowOpen) {
				LogVerbose("replacedet Store window was opened previously, blocking close...");
			} else {
				LogVerbose("Closing replacedet Store window");
				replacedetStoreWindow.Close();
			}

			// Subtract the payload from the url
			var payload = url.Replace(_replacedembledUrl, string.Empty);
			LogVerbose($"URL payload: {payload}");
			
			if (!_preferences.AllowIntercepting) {
				LogDebug("Intercepting is disabled on settings");
				return true;
			}

			Intercepted?.Invoke(payload);

			return true;
		}

19 Source : HookInterceptor.cs
with MIT License
from AdamCarballo

private static void OnIntercept(string payload) {
			var data = payload.Split('/').ToList();
			// Trim empty splits (when a url payload ends with / this will avoid issues where it thinks there are multiple splits)
			data = data.Where(x => !string.IsNullOrEmpty(x)).ToList();

			if (!IsSecure(ref data)) {
				LogEssential($"Payload sent with an incorrect or empty key!\nDisable 'Use secure hooks' if you want to use hooks without security keys");
				return;
			}

			InterceptedSecurely?.Invoke(string.Join("/", data.ToArray()));

			if (!_preferences.AllowFormatting) {
				LogDebug("Formatting is disabled on settings");
				return;
			}
			
			if (_preferences.Exceptions.Contains(data[0])) {
				LogDebug("Payload is part of exceptions list. Stopping formatting...");
				return;
			}

			Formatted?.Invoke(data);
		}

19 Source : WebViewRender.cs
with MIT License
from adamped

public void OnReceiveValue(Java.Lang.Object value)
		{
			System.Diagnostics.Debug.WriteLine("Javascript Return: " + Convert.ToString(value));
			_callback?.Invoke(Convert.ToString(value));
		}

19 Source : AdColony.cs
with Apache License 2.0
from AdColony

public void _OnRequestIntersreplacedialFailed(string paramJson)
        {
            Hashtable values = (AdColonyJson.Decode(paramJson) as Hashtable);
            if (values == null)
            {
                Debug.LogError("Unable to parse parameters in _OnRequestIntersreplacedialFailed, " + (paramJson ?? "null"));
                return;
            }

            string zoneId = "";
            if (values != null && values.ContainsKey("zone_id"))
            {
                zoneId = values["zone_id"] as string;
            }

            if (Ads.OnRequestIntersreplacedialFailed != null)
            {
                Ads.OnRequestIntersreplacedialFailed();
            }
            if (Ads.OnRequestIntersreplacedialFailedWithZone != null)
            {
                Ads.OnRequestIntersreplacedialFailedWithZone(zoneId);
            }
        }

19 Source : RxEntry.cs
with MIT License
from adospace

private void NativeControl_Completed(object sender, EventArgs e)
        {
            CompletedAction?.Invoke(NativeControl.Text);
        }

19 Source : RxInputView.cs
with MIT License
from adospace

private void NativeControl_Unfocused(object sender, FocusEventArgs e)
        {
            if (NativeControl.Text != Text)
                AfterTextChangedAction?.Invoke(NativeControl.Text);
        }

19 Source : RxSearchHandler.cs
with MIT License
from adospace

protected override void OnUpdate()
        {
            if (NativeControl.ItemsSource is ObservableItemsSource<I> existingCollection &&
                existingCollection.ItemsSource == Results)
            {
                _customDataTemplate.Owner = this;
                existingCollection.NotifyCollectionChanged();
            }
            else if (Results != null)
            {
                _customDataTemplate = new CustomDataTemplate(this);
                NativeControl.ItemsSource = ObservableItemsSource<I>.Create(Results);
                NativeControl.ItemTemplate = _customDataTemplate.DataTemplate;
            }
            else
            {
                NativeControl.ItemsSource = null;
                NativeControl.ItemTemplate = null;
            }

            NativeControl.Keyboard = Keyboard;
            NativeControl.HorizontalTextAlignment = HorizontalTextAlignment;
            NativeControl.VerticalTextAlignment = VerticalTextAlignment;
            NativeControl.TextColor = TextColor;
            NativeControl.CharacterSpacing = CharacterSpacing;
            NativeControl.CancelButtonColor = CancelButtonColor;
            NativeControl.FontFamily = FontFamily;
            NativeControl.FontSize = FontSize;
            NativeControl.FontAttributes = FontAttributes;
            NativeControl.Placeholder = Placeholder;
            NativeControl.PlaceholderColor = PlaceholderColor;
            NativeControl.BackgroundColor = BackgroundColor;
            NativeControl.ClearIconHelpText = ClearIconHelpText;
            NativeControl.ClearIconName = ClearIconName;
            NativeControl.ClearIcon = ClearIcon;
            //NativeControl.ClearPlaceholderCommandParameter = ClearPlaceholderCommandParameter;
            //NativeControl.ClearPlaceholderCommand = ClearPlaceholderCommand;
            NativeControl.ClearPlaceholderEnabled = ClearPlaceholderEnabled;
            NativeControl.ClearPlaceholderHelpText = ClearPlaceholderHelpText;
            NativeControl.ClearPlaceholderIcon = ClearPlaceholderIcon;
            NativeControl.ClearPlaceholderName = ClearPlaceholderName;
            //NativeControl.CommandParameter = CommandParameter;
            //NativeControl.Command = Command;
            NativeControl.DisplayMemberName = DisplayMemberName;
            NativeControl.IsSearchEnabled = IsSearchEnabled;
            //NativeControl.ItemsSource = ItemsSource;
            //NativeControl.ItemTemplate = ItemTemplate;
            NativeControl.QueryIconHelpText = QueryIconHelpText;
            NativeControl.QueryIconName = QueryIconName;
            NativeControl.QueryIcon = QueryIcon;
            NativeControl.Query = Query;
            NativeControl.SearchBoxVisibility = SearchBoxVisibility;
            NativeControl.ShowsResults = ShowsResults;

            NativeControl.Command = new ActionCommand(() => SearchAction?.Invoke(Query));

            if (QueryChangedAction != null)
            {
                NativeControl.PropertyChanged += NativeControl_PropertyChanged;
            }

            base.OnUpdate();
        }

19 Source : RxSearchHandler.cs
with MIT License
from adospace

private void NativeControl_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Query" && NativeControl != null)
            {
                QueryChangedAction?.Invoke(NativeControl.Query);
            }
        }

19 Source : RxEntryCell.cs
with MIT License
from adospace

private void NativeControl_Completed(object sender, EventArgs e)
        {
            if (NativeControl != null)
                CompletedAction?.Invoke(NativeControl.Text);
        }

19 Source : Utility.cs
with MIT License
from Adoxio

private static void ForEachParam(string parameters, Action<string> action)
		{
			var split = SplitOnSemicolon(parameters);

			foreach (var parameter in split)
			{
				action(parameter);
			}
		}

19 Source : SyntaxWalkerBase.cs
with MIT License
from adrianoc

protected void WithCurrentMethod(string declaringTypeName, string localVariable, string methodName, string[] paramTypes, Action<string> action)
        {
            using (Context.DefinitionVariables.WithCurrentMethod(declaringTypeName, methodName, paramTypes, localVariable))
            {
                action(methodName);
            }
        }

19 Source : CecilifierContext.cs
with MIT License
from adrianoc

public void TriggerInstructionAdded(string instVar)
        {
            InstructionAdded?.Invoke(instVar);
        }

19 Source : AndroidPermissionsManager.cs
with MIT License
from adrenak

public virtual void OnPermissionGranted(string permissionName) {
            //Debug.Log("Permission " + permissionName + " GRANTED");
            if (OnPermissionGrantedAction != null) {
                OnPermissionGrantedAction(permissionName);
            }
        }

19 Source : AndroidPermissionsManager.cs
with MIT License
from adrenak

public virtual void OnPermissionDenied(string permissionName) {
            //Debug.Log("Permission " + permissionName + " DENIED!");
            if (OnPermissionDeniedAction != null) {
                OnPermissionDeniedAction(permissionName);
            }
        }

19 Source : SyntaxTreeDump.cs
with MIT License
from adrianoc

private void Ident(string level, Action<string> action)
        {
            action(ident + "\t");
            ident = level;
        }

See More Examples