Exemplo n.º 1
0
        private void loadedHosts_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            // Get the name of the file to open from the ListBox.

            ListView.SelectedListViewItemCollection items = loadedHosts.SelectedItems;
            ListViewItem lvItem = items[0];

            string ipa = lvItem.SubItems[0].Text;
            string doa = lvItem.SubItems[1].Text;

            FormCollection formCollection = Application.OpenForms;

            foreach (Form form in formCollection.Cast <Form>().ToList())
            {
                if (form is hosteditor.editForm)
                {
                    editorForm.Close();
                }
            }

            editorForm = new hosteditor.editForm(this);

            editorForm.Show();

            editorForm.Left    = this.Location.X + ((this.Width / 2) - editorForm.Width);
            editorForm.Top     = this.Location.Y + ((this.Height / 2) - editorForm.Height);
            editorForm.TopMost = true;
            editorForm.AddMode = false;


            editorForm.setIP(ipa);
            editorForm.setDomains(doa);
        }
Exemplo n.º 2
0
        public ActionResult Paypal(FormCollection form)
        {
            string val = "";

            foreach (string item in form.AllKeys)
            {
                val += string.Format(" {0} - {1} <br/>", item, form[item]);
            }


            if (!HttpContext.Application.AllKeys.Any(k => k.Equals("tx")))
            {
                HttpContext.Application.Add("tx", val);
            }
            else
            {
                HttpContext.Application["tx"] = val;
            }


            form.Add("cmd", "_notify-validate");
            string data = String.Join("&", form.Cast <string>()
                                      .Select(key => String.Format("{0}={1}", key, HttpUtility.UrlEncode(form[key]))));

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.sandbox.paypal.com/cgi-bin/webscr?");

            if (!HttpContext.Application.AllKeys.Any(k => k.Equals("request")))
            {
                HttpContext.Application.Add("request", data);
            }
            else
            {
                HttpContext.Application["request"] = data;
            }

            request.Method        = "POST";
            request.ContentLength = data.Length;

            using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
            {
                writer.Write(data);
            }

            using (StreamReader reader = new StreamReader(request.GetResponse().GetResponseStream()))
            {
                if (!HttpContext.Application.AllKeys.Any(k => k.Equals("tx1")))
                {
                    HttpContext.Application.Add("tx1", reader.ReadToEnd());
                }
                else
                {
                    HttpContext.Application["tx1"] = reader.ReadToEnd();
                }
            }

            // testing

            return(View());
        }
        public ActionResult Post(FormCollection form)
        {
            var keys = form.Cast <string>().ToList();

            var builder = new StringBuilder();
            var model   = string.Join("; ", keys.Select(k => string.Format("{0} = {1}", k, form[k])));

            return(View("Result", (object)model));
        }
Exemplo n.º 4
0
 private static bool ConsulStatusForm(string form, FormCollection fc, bool formFound)
 {
     foreach (var frm in fc.Cast <Form>().Where(frm => frm.Name == form))
     {
         frm.Focus();
         formFound = true;
     }
     return(formFound);
 }
Exemplo n.º 5
0
        public ActionResult Result(FormCollection collection)
        {
            try
            {
                var sum = collection.Cast <object>().Sum(key => int.Parse(collection[key as string]));

                return(this.View(new Result(sum.ToString())));
            }
            catch (Exception ex)
            {
                return(this.View(new Result(ex.Message)));
            }
        }
        public IActionResult QuickTradeSearchSave(FormCollection formCollection)
        {
            //SaveSearch(model.txtPortfolio,model.txtCUSIP,model.txtBrokerFIN,model.txtUserCode,model.txtTradeDate.ToShortDateString(), model.txtSettleDate.ToShortDateString(), model.txtTranDate.ToShortDateString(), model.txtLoadDate.ToShortDateString(), model.txtTradeDate1.ToShortDateString(), model.txtSettleDate1.ToShortDateString(),
            //            model.txtTranDate1.ToShortDateString(), model.txtLoadDate1.ToShortDateString(),model.txtCurrencyCode,model.txtTradeRef,model.txtConfirmRef,model.txtStockSymbol,model.txtBrokerCode,model.txtDTCAgentId,model.txtDTCAgentInternalAccountNo,model.drpTradeRefOp,model.drpConfirmRefOp,model.drpStockSymbolOp
            //                ,model.drpBrokerCodeOp,model.drpDTCAgentIdOp,model.drpDTCAgentInternalAccountNoOp,model.drpDeleted,model.drpPortfolioOp,model.drpCUSIPOp,model.drpBrokerFINOp,model.drpUserCodeOp,model.drpMatchStatusOp,model.drpCurrCodeOp,model.drpTransactionCode, model.drpMatchStatus,model.historyArchiveCurrent);

            var valueList = formCollection.Cast <object>().ToDictionary(item => item.ToString(), item => formCollection[item.ToString()]);

// exec usp_SaveQuickFind @user_name = 'testuser',@SourceName='TradeBrowser', @Description = '', @LastUsed=0, @LastUsedToday=0
            var quickFind = SaveQuickFind("TradeBrowser", formCollection["quickFindText"], false, false);

            return(View("~/Views/TDMSTradeSearch/TDMSTradeSearch.cshtml"));
        }
Exemplo n.º 7
0
        private void buttonShowCompare_Click(object sender, EventArgs e)
        {
            List <String> hostsLines = new List <string>();

            ListView.ListViewItemCollection lvItems = loadedHosts.Items;

            foreach (ListViewItem item in lvItems)
            {
                String line = item.SubItems[0].Text + '\t' + item.SubItems[1].Text;
                hostsLines.Add(line);
            }

            FormCollection formCollection = Application.OpenForms;

            foreach (Form form in formCollection.Cast <Form>().ToList())
            {
                if (form is hosteditor.compareForm)
                {
                    compareForm.Close();
                }
            }

            compareForm = new hosteditor.compareForm();

            compareForm.Show();

            String originLine = "";

            originhosts.ForEach(delegate(String line)
            {
                originLine += line + "\r\n";
            });

            compareForm.setA(originLine);

            String resultLine = this.headerString;

            hostsLines.ForEach(delegate(String line)
            {
                resultLine += line + "\r\n";
            });

            compareForm.setB(resultLine);
        }
Exemplo n.º 8
0
        private void buttonAddHost_Click(object sender, EventArgs e)
        {
            FormCollection formCollection = Application.OpenForms;

            foreach (Form form in formCollection.Cast <Form>().ToList())
            {
                if (form is hosteditor.editForm)
                {
                    editorForm.Close();
                }
            }

            editorForm         = new hosteditor.editForm(this);
            editorForm.AddMode = true;

            editorForm.Show();

            editorForm.Left    = this.Location.X + ((this.Width / 2) - editorForm.Width);
            editorForm.Top     = this.Location.Y + ((this.Height / 2) - editorForm.Height);
            editorForm.TopMost = true;
        }
Exemplo n.º 9
0
        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                Debug.WriteLine(e.CloseReason.ToString());
                e.Cancel           = true;
                notifyIcon.Visible = true;
                Visible            = false;

                // Creates a list of open forms and then closes all open forms.
                FormCollection fc = Application.OpenForms;
                try {
                    foreach (Form form in fc.Cast <Form>().ToList())
                    {
                        //iterate through
                        if (form.Name == "Settings")
                        {
                            globals.set.Close();
                        }
                        else if (form.Name == "Logs")
                        {
                            globals.log.Close();
                        }
                        else if (form.Name == "Cloud")
                        {
                            globals.cld.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    SimpleLog.Log(ex);
                }
                notifyIcon.ShowBalloonTip(10, "Minimized to Taskbar", "Anticheat has been minimized to Taskbar.", ToolTipIcon.Info);
            }
            else
            {
                notifyIcon.Dispose();
            }
        }
Exemplo n.º 10
0
        private void Main_Resize(object sender, EventArgs e)
        {
            //if the form is minimized
            //hide it from the task bar
            //and show the system tray icon (represented by the NotifyIcon control)
            if (this.WindowState == FormWindowState.Minimized)
            {
                ShowInTaskbar      = true; // When set to false wont be included in Application.Openforms
                notifyIcon.Visible = true;
                Visible            = true;

                // Creates a list of open forms and then minimizes all open forms.
                FormCollection fc = Application.OpenForms;
                try
                {
                    foreach (Form form in fc.Cast <Form>().ToList())
                    {
                        //iterate through
                        if (form.Name == "Settings")
                        {
                            globals.set.WindowState = FormWindowState.Minimized;
                        }
                        else if (form.Name == "Logs")
                        {
                            globals.log.WindowState = FormWindowState.Minimized;
                        }
                        else if (form.Name == "Cloud")
                        {
                            globals.cld.WindowState = FormWindowState.Minimized;
                        }
                    }
                }
                catch (Exception ex)
                {
                    SimpleLog.Log(ex);
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// The Show action.
        /// </summary>
        /// <param name="buggsForm">The form of user data passed up from the client.</param>
        /// <param name="id">The unique id of the Bugg.</param>
        /// <returns>The view to display a Bugg on the client.</returns>
        public ActionResult Show(FormCollection buggsForm, int id, int page = 0)
        {
            using (var logTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(BuggId=" + id + ")"))
            {
                using (var unitOfWork = new UnitOfWork(new CrashReportEntities()))
                {
                    // Set the display properties based on the radio buttons
                    var displayModuleNames   = buggsForm["DisplayModuleNames"] == "true";
                    var displayFunctionNames = buggsForm["DisplayFunctionNames"] == "true";
                    var displayFileNames     = buggsForm["DisplayFileNames"] == "true";
                    var displayFilePathNames = false;


                    // Set up the view model with the Crash data
                    if (buggsForm["Page"] != null)
                    {
                        int.TryParse(buggsForm["Page"], out page);
                    }

                    if (buggsForm["DisplayFilePathNames"] == "true")
                    {
                        displayFilePathNames = true;
                        displayFileNames     = false;
                    }

                    var displayUnformattedCallStack = buggsForm["DisplayUnformattedCallStack"] == "true";

                    var model = GetResult(id, page, pageSize, unitOfWork);
                    model.SourceContext = model.CrashData.First().SourceContext;
                    model.Bugg.PrepareBuggForJira(model.CrashData);
                    // Handle 'CopyToJira' button
                    var buggIdToBeAddedToJira = 0;
                    foreach (var entry in buggsForm.Cast <object>().Where(entry => entry.ToString().Contains("CopyToJira-")))
                    {
                        int.TryParse(entry.ToString().Substring("CopyToJira-".Length), out buggIdToBeAddedToJira);
                        break;
                    }
                    if (buggIdToBeAddedToJira != 0)
                    {
                        model.Bugg.JiraProject = buggsForm["JiraProject"];
                        model.Bugg.CopyToJira();
                    }

                    var jc         = JiraConnection.Get();
                    var bValidJira = false;

                    // Verify valid JiraID, this may be still a TTP
                    if (!string.IsNullOrEmpty(model.Bugg.TTPID))
                    {
                        var jira = 0;
                        int.TryParse(model.Bugg.TTPID, out jira);

                        if (jira == 0)
                        {
                            bValidJira = true;
                        }
                    }

                    if (jc.CanBeUsed() && bValidJira)
                    {
                        // Grab the data form JIRA.
                        var jiraSearchQuery = "key = " + model.Bugg.TTPID;
                        var jiraResults     = new Dictionary <string, Dictionary <string, object> >();

                        try
                        {
                            jiraResults = jc.SearchJiraTickets(
                                jiraSearchQuery,
                                new string[]
                            {
                                "key",                 // string
                                "summary",             // string
                                "components",          // System.Collections.ArrayList, Dictionary<string,object>, name
                                "resolution",          // System.Collections.Generic.Dictionary`2[System.String,System.Object], name
                                "fixVersions",         // System.Collections.ArrayList, Dictionary<string,object>, name
                                "customfield_11200"    // string
                            });
                        }
                        catch (System.Exception)
                        {
                            model.Bugg.JiraSummary         = "JIRA MISMATCH";
                            model.Bugg.JiraComponentsText  = "JIRA MISMATCH";
                            model.Bugg.JiraResolution      = "JIRA MISMATCH";
                            model.Bugg.JiraFixVersionsText = "JIRA MISMATCH";
                            model.Bugg.JiraFixCL           = "JIRA MISMATCH";
                        }

                        // Jira Key, Summary, Components, Resolution, Fix version, Fix changelist
                        if (jiraResults.Any())
                        {
                            var jira           = jiraResults.First();
                            var summary        = (string)jira.Value["summary"];
                            var componentsText = "";
                            var components     = (System.Collections.ArrayList)jira.Value["components"];
                            foreach (Dictionary <string, object> component in components)
                            {
                                componentsText += (string)component["name"];
                                componentsText += " ";
                            }

                            var resolutionFields = (Dictionary <string, object>)jira.Value["resolution"];
                            var resolution       = resolutionFields != null ? (string)resolutionFields["name"] : "";

                            var fixVersionsText = "";
                            var fixVersions     = (System.Collections.ArrayList)jira.Value["fixVersions"];
                            foreach (Dictionary <string, object> fixVersion in fixVersions)
                            {
                                fixVersionsText += (string)fixVersion["name"];
                                fixVersionsText += " ";
                            }

                            var fixCl = jira.Value["customfield_11200"] != null
                                            ? (int)(decimal)jira.Value["customfield_11200"]
                                            : 0;

                            //Conversion to ado.net entity framework

                            model.Bugg.JiraSummary         = summary;
                            model.Bugg.JiraComponentsText  = componentsText;
                            model.Bugg.JiraResolution      = resolution;
                            model.Bugg.JiraFixVersionsText = fixVersionsText;
                            if (fixCl != 0)
                            {
                                model.Bugg.FixedChangeList = fixCl.ToString();
                            }
                        }
                    }

                    // Apply any user settings
                    if (buggsForm.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(buggsForm["SetStatus"]))
                        {
                            model.Bugg.Status = buggsForm["SetStatus"];
                            unitOfWork.CrashRepository.SetStatusByBuggId(model.Bugg.Id, buggsForm["SetFixedIn"]);
                        }

                        if (!string.IsNullOrEmpty(buggsForm["SetFixedIn"]))
                        {
                            model.Bugg.FixedChangeList = buggsForm["SetFixedIn"];
                            unitOfWork.CrashRepository.SetFixedCLByBuggId(model.Bugg.Id, buggsForm["SetFixedIn"]);
                        }

                        if (!string.IsNullOrEmpty(buggsForm["SetTTP"]))
                        {
                            model.Bugg.TTPID = buggsForm["SetTTP"];
                            unitOfWork.CrashRepository.SetJiraByBuggId(model.Bugg.Id, buggsForm["SetTTP"]);
                        }
                        unitOfWork.BuggRepository.Update(model.Bugg);

                        unitOfWork.Save();
                    }

                    var newCrash = model.CrashData.FirstOrDefault();
                    if (newCrash != null)
                    {
                        var callStack = new CallStackContainer(newCrash.CrashType, newCrash.RawCallStack, newCrash.PlatformName);

                        // Set callstack properties
                        callStack.bDisplayModuleNames          = displayModuleNames;
                        callStack.bDisplayFunctionNames        = displayFunctionNames;
                        callStack.bDisplayFileNames            = displayFileNames;
                        callStack.bDisplayFilePathNames        = displayFilePathNames;
                        callStack.bDisplayUnformattedCallStack = displayUnformattedCallStack;

                        model.CallStack = callStack;

                        // Shorten very long function names.
                        foreach (var entry in model.CallStack.CallStackEntries)
                        {
                            entry.FunctionName = entry.GetTrimmedFunctionName(128);
                        }

                        model.SourceContext = newCrash.SourceContext;

                        model.LatestCrashSummary = newCrash.Summary;
                    }

                    model.LatestCrashSummary      = newCrash.Summary;
                    model.Bugg.LatestCrashSummary = newCrash.Summary;
                    model.GenerationTime          = logTimer.GetElapsedSeconds().ToString("F2");

                    //Populate Jira Projects
                    var jiraConnection = JiraConnection.Get();
                    var response       = jiraConnection.JiraRequest("/issue/createmeta", JiraConnection.JiraMethod.GET, null,
                                                                    HttpStatusCode.OK);

                    using (var responseReader = new StreamReader(response.GetResponseStream()))
                    {
                        var responseText = responseReader.ReadToEnd();

                        JObject jsonObject = JObject.Parse(responseText);

                        JToken fields = jsonObject["projects"];

                        foreach (var project in fields)
                        {
                            model.JiraProjects.Add(new SelectListItem()
                            {
                                Text  = project["name"].ToObject <string>(),
                                Value = project["key"].ToObject <string>()
                            });
                        }
                    }

                    model.PagingInfo = new PagingInfo
                    {
                        CurrentPage  = page,
                        PageSize     = pageSize,
                        TotalResults = model.Bugg.NumberOfCrashes.Value
                    };

                    return(View("Show", model));
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// The Show action.
        /// </summary>
        /// <param name="buggsForm">The form of user data passed up from the client.</param>
        /// <param name="id">The unique id of the Bugg.</param>
        /// <returns>The view to display a Bugg on the client.</returns>
        public ActionResult Show(FormCollection buggsForm, int id)
        {
            using (var logTimer = new FAutoScopedLogTimer(this.GetType().ToString() + "(BuggId=" + id + ")", bCreateNewLog: true))
            {
                // Set the display properties based on the radio buttons
                var displayModuleNames   = buggsForm["DisplayModuleNames"] == "true";
                var displayFunctionNames = buggsForm["DisplayFunctionNames"] == "true";
                var displayFileNames     = buggsForm["DisplayFileNames"] == "true";
                var displayFilePathNames = false;
                if (buggsForm["DisplayFilePathNames"] == "true")
                {
                    displayFilePathNames = true;
                    displayFileNames     = false;
                }
                var displayUnformattedCallStack = buggsForm["DisplayUnformattedCallStack"] == "true";

                // Create a new view and populate with crashes
                List <Crash> crashes = null;
                var          model   = new BuggViewModel();
                var          newBugg = _unitOfWork.BuggRepository.GetById(id);
                if (newBugg == null)
                {
                    return(RedirectToAction("Index"));
                }
                crashes = newBugg.Crashes.OrderByDescending(data => data.TimeOfCrash).ToList();
                newBugg.CrashesInTimeFrameAll   = crashes.Count;
                newBugg.CrashesInTimeFrameGroup = crashes.Count;
                newBugg.NumberOfCrashes         = crashes.Count;

                // Handle 'CopyToJira' button
                var buggIdToBeAddedToJira = 0;
                foreach (var entry in buggsForm.Cast <object>().Where(entry => entry.ToString().Contains("CopyToJira-")))
                {
                    int.TryParse(entry.ToString().Substring("CopyToJira-".Length), out buggIdToBeAddedToJira);
                    break;
                }

                newBugg.PrepareBuggForJira(crashes);
                if (buggIdToBeAddedToJira != 0)
                {
                    newBugg.JiraProject = buggsForm["JiraProject"];
                    newBugg.CopyToJira();
                }

                var jc         = JiraConnection.Get();
                var bValidJira = false;

                // Verify valid JiraID, this may be still a TTP
                if (!string.IsNullOrEmpty(newBugg.TTPID))
                {
                    var jira = 0;
                    int.TryParse(newBugg.TTPID, out jira);

                    if (jira == 0)
                    {
                        bValidJira = true;
                    }
                }

                if (jc.CanBeUsed() && bValidJira)
                {
                    // Grab the data form JIRA.
                    var jiraSearchQuery = "key = " + newBugg.TTPID;
                    var jiraResults     = new Dictionary <string, Dictionary <string, object> >();

                    try
                    {
                        jiraResults = jc.SearchJiraTickets(
                            jiraSearchQuery,
                            new string[]
                        {
                            "key",                                          // string
                            "summary",                                      // string
                            "components",                                   // System.Collections.ArrayList, Dictionary<string,object>, name
                            "resolution",                                   // System.Collections.Generic.Dictionary`2[System.String,System.Object], name
                            "fixVersions",                                  // System.Collections.ArrayList, Dictionary<string,object>, name
                            "customfield_11200"                             // string
                        });
                    }
                    catch (System.Exception)
                    {
                        newBugg.JiraSummary         = "JIRA MISMATCH";
                        newBugg.JiraComponentsText  = "JIRA MISMATCH";
                        newBugg.JiraResolution      = "JIRA MISMATCH";
                        newBugg.JiraFixVersionsText = "JIRA MISMATCH";
                        newBugg.JiraFixCL           = "JIRA MISMATCH";
                    }

                    // Jira Key, Summary, Components, Resolution, Fix version, Fix changelist
                    if (jiraResults.Any())
                    {
                        var jira    = jiraResults.First();
                        var summary = (string)jira.Value["summary"];

                        var componentsText = "";
                        var components     = (System.Collections.ArrayList)jira.Value["components"];
                        foreach (Dictionary <string, object> component in components)
                        {
                            componentsText += (string)component["name"];
                            componentsText += " ";
                        }

                        var resolutionFields = (Dictionary <string, object>)jira.Value["resolution"];
                        var resolution       = resolutionFields != null ? (string)resolutionFields["name"] : "";

                        var fixVersionsText = "";
                        var fixVersions     = (System.Collections.ArrayList)jira.Value["fixVersions"];
                        foreach (Dictionary <string, object> fixVersion in fixVersions)
                        {
                            fixVersionsText += (string)fixVersion["name"];
                            fixVersionsText += " ";
                        }

                        var fixCl = jira.Value["customfield_11200"] != null ? (int)(decimal)jira.Value["customfield_11200"] : 0;

                        //Conversion to ado.net entity framework

                        newBugg.JiraSummary         = summary;
                        newBugg.JiraComponentsText  = componentsText;
                        newBugg.JiraResolution      = resolution;
                        newBugg.JiraFixVersionsText = fixVersionsText;
                        if (fixCl != 0)
                        {
                            newBugg.FixedChangeList = fixCl.ToString();
                        }
                    }
                }

                // Apply any user settings
                if (buggsForm.Count > 0)
                {
                    if (!string.IsNullOrEmpty(buggsForm["SetStatus"]))
                    {
                        newBugg.Status = buggsForm["SetStatus"];
                        newBugg.Crashes.ForEach(data => data.Status = buggsForm["SetStatus"]);
                    }

                    if (!string.IsNullOrEmpty(buggsForm["SetFixedIn"]))
                    {
                        newBugg.FixedChangeList = buggsForm["SetFixedIn"];
                        newBugg.Crashes.ForEach(data => data.FixedChangeList = buggsForm["SetFixedIn"]);
                    }

                    if (!string.IsNullOrEmpty(buggsForm["SetTTP"]))
                    {
                        newBugg.TTPID = buggsForm["SetTTP"];
                        newBugg.Crashes.ForEach(data => data.Jira = buggsForm["SetTTP"]);
                    }

                    _unitOfWork.BuggRepository.Update(newBugg);
                    _unitOfWork.Save();
                }

                // Set up the view model with the crash data
                model.Crashes = crashes;
                model.Bugg    = newBugg;

                var newCrash = model.Crashes.FirstOrDefault();
                if (newCrash != null)
                {
                    var callStack = new CallStackContainer(newCrash);

                    // Set callstack properties
                    callStack.bDisplayModuleNames          = displayModuleNames;
                    callStack.bDisplayFunctionNames        = displayFunctionNames;
                    callStack.bDisplayFileNames            = displayFileNames;
                    callStack.bDisplayFilePathNames        = displayFilePathNames;
                    callStack.bDisplayUnformattedCallStack = displayUnformattedCallStack;

                    model.CallStack = callStack;

                    // Shorten very long function names.
                    foreach (var entry in model.CallStack.CallStackEntries)
                    {
                        entry.FunctionName = entry.GetTrimmedFunctionName(128);
                    }

                    model.SourceContext = newCrash.SourceContext;

                    model.LatestCrashSummary = newCrash.Summary;
                }
                model.LatestCrashSummary      = newCrash.Summary;
                model.Bugg.LatestCrashSummary = newCrash.Summary;
                model.GenerationTime          = logTimer.GetElapsedSeconds().ToString("F2");
                return(View("Show", model));
            }
        }