Inheritance: MonoBehaviour
        /// <summary>
        /// Returns a connection info object from the selected fields in the treeview
        /// - also sets the date of last usage
        /// </summary>
        /// <returns></returns>
        private IConnectionInfo GetConnectionFromTreeView()
        {
            if (this.serverTreeview.SelectedItem == null)
            {
                return(null);
            }
            var item    = this.serverTreeview.SelectedItem;
            var vm      = item as TeamProjectViewModel;
            var team    = vm.Team;
            var project = vm.Project;

            if (team != null)
            {
                project = team.ParentProject;
            }
            else if (project != null)
            {
                team = null;
            }

            IConnectionInfo connection = BugReporter.CreateConnectionInfo(this.ServerComboBox.Text.ToUri(), project, team);

            connection.SetLastUsage(DateTime.Now);
            return(connection);
        }
Example #2
0
    static void OpenWindow()
    {
        BugReporter bugReporter = (BugReporter)GetWindow(typeof(BugReporter));

        bugReporter.titleContent = new GUIContent("Bug Reporter");
        bugReporter.Show();
    }
Example #3
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (textBoxX1.Text != "")
            {
                string ruleName = (iiSchoolYear.Value > 0 ? "" + iiSchoolYear.Value : "") + textBoxX1.Text;

                _CopyElement = ReviseXmlContent(_CopyElement, iiSchoolYear.Value);

                try
                {
                    SmartSchool.Feature.SubjectTable.AddSubejctTable.Insert(ruleName, _Catalog, _CopyElement);
                }
                catch (Exception ex)
                {
                    CurrentUser user = CurrentUser.Instance;
                    BugReporter.ReportException("SmartSchool", user.SystemVersion, ex, false);
                    MsgBox.Show("新增" + _Catalog + "時發生未預期之錯誤。\n系統已回報此錯誤內容。");
                }
                SubjectTable.Items[_Catalog].Reflash();
                FrmSubjectTableConfiguration.SetAdvTreeExpandStatus(iiSchoolYear.Value.ToString(), true);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            else
            {
                MsgBox.Show("必需輸入" + _Catalog + "名稱。");
            }
        }
Example #4
0
        private static void Main()
        {
            try
            {
                PyEngine     = Python.CreateEngine();
                NtrClient    = new NtrClient();
                ScriptHelper = new ScriptHelper();

                GlobalScope = PyEngine.CreateScope();
                GlobalScope.SetVariable("nc", ScriptHelper);

                LoadConfig();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                GCmdWindow = new CmdWindow();
                Dc         = new DebugConsole();
                Application.Run(GCmdWindow);
            }
            catch (Exception e)
            {
                BugReporter br = new BugReporter(e, "Program exception");
                MessageBox.Show(
                    @"WARNING - NTRDebugger has encountered an error" + Environment.NewLine +
                    @"This error is about to crash the program, please send the generated" + Environment.NewLine +
                    @"Error log to imthe666st!" + Environment.NewLine + Environment.NewLine +
                    @"Sorry for the inconvinience -imthe666st"
                    );
            }
        }
Example #5
0
        public void Append(Exception exception, string expectedRootError, string expectedText)
        {
            StringBuilder text      = new();
            string        rootError = BugReporter.Append(text, exception);

            rootError.Should().Be(expectedRootError);
            text.ToString().Should().Be(expectedText);
        }
 public static BugReporter Get()
 {
     if (s_instance == null)
     {
         s_instance = new BugReporter();
     }
     return(s_instance);
 }
 /// <summary>
 /// Disconnect from the current server connection
 /// and update main window UI
 /// </summary>
 /// <param name="callback"></param>
 public void HandleLogoutRequest(Action callback = null)
 {
     BugReporter.Disconnect();
     // Main window UI changes
     vmAvatar.ByteData              = null;
     imgAvatar.Visibility           = Visibility.Collapsed;
     this.newAccountGrid.Visibility = Visibility.Visible;
     callback?.Invoke();
     AutomationProperties.SetName(btnAccountConfig, Properties.Resources.HandleLogoutRequestSignIn);
     btnAccountConfig.ToolTip = Properties.Resources.HandleLogoutRequestSignIn;
 }
 private void _historyWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         _errorList.AddRange(Graduation.Instance.CheckSemesterHistories(_students));
     }
     catch (Exception ex)
     {
         MsgBox.Show("檢查學期歷程時發生錯誤。" + ex.Message);
         BugReporter.ReportException(ex, true);
     }
 }
Example #9
0
 public void Log(string msg)
 {
     OnLogArrival?.Invoke(msg);
     try
     {
         Program.GCmdWindow.BeginInvoke(Program.GCmdWindow.DelAddLog, msg);
     }
     catch (Exception ex)
     {
         BugReporter br = new BugReporter(ex, "Logging exception");
     }
 }
Example #10
0
        public static async Task <Release> GetLastUpdate()
        {
            try
            {
                IReadOnlyList <Release> lastReleases = await Rep.Release.GetAll("imthe666st", "NTRClient");

                LastRelease = lastReleases[0];
                return(LastRelease);
            }
            catch (Exception e)
            {
                MessageBox.Show(@"An error occured trying to look for updates!");
                BugReporter br = new BugReporter(e, "Updater exception", false);
                return(null);
            }
        }
Example #11
0
 public static void SaveToXml(string filePath, SettingsManager sourceObj)
 {
     try
     {
         using (StreamWriter writer = new StreamWriter(filePath))
         {
             System.Xml.Serialization.XmlSerializer xmlSerializer =
                 new System.Xml.Serialization.XmlSerializer(sourceObj.GetType());
             xmlSerializer.Serialize(writer, sourceObj);
         }
     }
     catch (Exception ex)
     {
         BugReporter br = new BugReporter(ex, "XML save exception");
     }
 }
Example #12
0
        public static void ShowBugReport(System.Exception exception = null, string exceptionDetails = "")
        {
            BugReporter bugReporter = new BugReporter
            {
                SoftwareTitle    = "MarkdownPad 2",
                SoftwareVersion  = AssemblyUtilities.Version,
                WebBugReportUrl  = Urls.MarkdownPad_BugReportWeb,
                Exception        = exception,
                ExceptionDetails = exceptionDetails,
                CurrentCulture   = Settings.Default.App_Locale,
                User             = "******",
                Pass             = "******".ToSecureString()
            };

            bugReporter.Show();
        }
Example #13
0
        internal static void OnThreadException(object sender, System.Threading.ThreadExceptionEventArgs t)
        {
            Exception  e  = t.Exception;
            StackTrace st = new StackTrace(e);

            try
            {
                if (!Directory.Exists(Path.Combine(Program.DataPath, "ErrorLog")))
                {
                    Directory.CreateDirectory(Path.Combine(Program.DataPath, "ErrorLog"));
                }

                Dictionary <string, string> data = new Dictionary <string, string>
                {
                    { "ApproxLoginCount", MainData.Instance.ApproxLoginCount.ToString() }
                };

                ErrorLog log = new ErrorLog()
                {
                    Name       = (Setting.Value.Jira_Username != null && Setting.Value.Jira_Username != "" ? Setting.Value.Jira_Username : Environment.UserName),
                    Date       = DateTime.Now.ToString("M-d-yyyy"),
                    Time       = DateTime.Now.ToString("h-mm-ss tt"),
                    Version    = GetUpdateFile(Path.Combine(DataPath, "CurrentVersion.json")).Version,
                    StackTrace = e.StackTrace,
                    Source     = e.Source,
                    Message    = e.Message,
                    Data       = data
                };
                bugReporter = new BugReporter(log);

                var path = Path.Combine(Program.DataPath + "ErrorLog", log.Date + " " + log.Time + " Error.json");

                Serializer <ErrorLog> .WriteToJSONFile(log, path);

                if (e.Source == "Atlassian.Jira")
                {
                    JiraChecker.JiraFailCount++;
                }
            }
            catch
            {
                //it done messed up
            }
        }
Example #14
0
 public static SettingsManager LoadFromXml(string filePath)
 {
     try
     {
         using (StreamReader reader = new StreamReader(filePath))
         {
             System.Xml.Serialization.XmlSerializer xmlSerializer =
                 new System.Xml.Serialization.XmlSerializer(typeof(SettingsManager));
             return((SettingsManager)xmlSerializer.Deserialize(reader));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(@"Ignore this message if you just downloaded or updated this tool..." +
                         Environment.NewLine + Environment.NewLine + ex.Message);
         BugReporter br = new BugReporter(ex, "XML Load exception", false);
     }
     return(new SettingsManager());
 }
        /// <summary>
        /// Attempt to connect to the service at the given server URL.
        /// Populates user profile if connection is made correctly.
        /// If connection fails, a message dialog will be shown to the user
        /// if promptIfNeeded is true.
        /// </summary>
        /// <param name="serverUrl">url like https://accountname.visualstudio.com to connect to</param>
        /// <param name="promptIfNeeded">if true, may show account picker & error dialog. Otherwise, no dialogs are shown to user</param>
        /// <param name="callback">Action to execute after attempt to connect before reallowing further action</param>
        public async void HandleLoginRequest(Uri serverUrl = null, bool promptIfNeeded = true, Action callback = null)
        {
            SetAllowFurtherAction(false);

            // If the main window is always on top, then an error occurs where
            //  the login dialog is not a child of the main window, so we temporarily
            //  turn topmost off and turn it back on after logging in
            bool oldTopmost = this.Topmost;

            this.Topmost = false;

            if (serverUrl != null && await CheckWebsiteAvailability(serverUrl).ConfigureAwait(true) == false)
            {
                NotifyLoginUnsuccessful(promptIfNeeded);
            }
            else
            {
                try
                {
                    if (serverUrl != null)
                    {
                        await BugReporter.ConnectAsync(serverUrl, promptIfNeeded).ConfigureAwait(true);

                        await BugReporter.PopulateUserProfileAsync().ConfigureAwait(true);

                        UpdateMainWindowLoginFields();
                    }
                }
                catch (Exception ex)
                {
                    ex.ReportException();
                    NotifyLoginUnsuccessful(promptIfNeeded);
                    BugReporter.FlushToken(serverUrl);
                    HandleLogoutRequest();
                }
            }

            this.Topmost = oldTopmost;
            callback?.Invoke();

            Logger.PublishTelemetryEvent(TelemetryAction.Mainwindow_Login_Attempted, TelemetryProperty.PromptIfNeeded, promptIfNeeded.ToString(CultureInfo.InvariantCulture));
            SetAllowFurtherAction(true);
        }
Example #16
0
        // The following exist only for debugging purposes or old versions.
        // Feel free to ignore unless you know you're debugging with them.
        // GET api/values/name
        public IEnumerable <object> Get(string value, string showAll)
        {
            switch (showAll)
            {
            case "galwantsdata":
                return(LogDataForGal.GetLogDataForGal(value));

            case "0":
                return(new QueryHandler().GetPersons(
                           value, false, false));

            case "1":
                return(new QueryHandler().GetPersons(
                           value, true, false));

            case "reportoddity":
                return(BugReporter.ReportBug(value));
            }
            return(new object[] { });
        }
Example #17
0
        // POST api/values
        public void Post([FromBody] Request request)
        {
            switch (request.Type)
            {
            case PersonalFieldAdder.WHAT_I_DO:
            case PersonalFieldAdder.ADD_MOBILE:
            case PersonalFieldAdder.ADD_WORK_NUMBER:
            case PersonalFieldAdder.ADD_OTHER_NUMBER:
            case PersonalFieldAdder.SEX:
                PersonalFieldAdder.AddPersonalField(
                    request.MisparIshi, request.Data, request.Type);
                return;

            case "log":
                Logger.Log(request.Logs);
                return;

            case "deletetag":
                TagAdder.DeleteTagForPerson(request.MisparIshi, request.Data);
                return;

            case "reportoddity":     // It's an oddity. We don't write bugs.
                BugReporter.ReportBug(request.Data);
                return;

            case "addadmin":
                AdminAdder.AddAdmin(request.MisparIshi, request.IsSuperAdmin);
                return;

            case "deleteadmin":
                AdminAdder.DeleteAdmin(request.MisparIshi);
                return;

            case "admindeletetag":
                AdminTagDeleter.DeleteTag(request.Data);
                return;
            }
        }
Example #18
0
        void bkwDataLoader_DoWork(object sender, DoWorkEventArgs e)
        {
            Dictionary <List <string>, ManualResetEvent>   handle = (Dictionary <List <string>, ManualResetEvent>)((object[])e.Argument)[0];
            Dictionary <ManualResetEvent, List <RowData> > Filler = (Dictionary <ManualResetEvent, List <RowData> >)((object[])e.Argument)[1];
            List <string> exportFieldList = (List <string>)((object[])e.Argument)[2];

            foreach (List <string> splitList in handle.Keys)
            {
                try
                {
                    if (ExportPackage != null)
                    {
                        ExportPackageEventArgs args = new ExportPackageEventArgs();
                        foreach (string var in splitList)
                        {
                            args.List.Add(var);
                        }
                        foreach (string var in exportFieldList)
                        {
                            if (_ExportableFields.Contains(var))
                            {
                                args.ExportFields.Add(var);
                            }
                        }
                        ExportPackage.Invoke(this, args);
                        Filler[handle[splitList]].AddRange(args.Items);
                    }
                }
                catch (Exception ex)
                {
                    BugReporter.ReportException(ex, false);
                }
                finally
                {
                    handle[splitList].Set();
                }
            }
        }
Example #19
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txt.Text.Length < 5)
            {
                MessageBox.Show("Enter more details about your problem.", "Can't submit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            BugReporter r = new BugReporter();

            btnSubmit.Enabled = false;
            bool result = r.ReportBug(string.Format("v.{0}\n{1}\n\n{2}", Security.Version.Full, txt.Text, mUI.CollectData()), txtEmail.Text);

            if (!result)
            {
                MessageBox.Show("An error occured; try submitting content manually to http://typpo.us/submit.php", "Not submitted", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                this.Close();
            }
            btnSubmit.Enabled = true;
        }
Example #20
0
 public static int RunCommandAndGetOutput(string exeFile, string args, ref string output)
 {
     try
     {
         Process proc = new Process
         {
             StartInfo = new ProcessStartInfo
             {
                 FileName  = exeFile,
                 Arguments = args,
                 RedirectStandardOutput = true,
                 CreateNoWindow         = true,
                 UseShellExecute        = false,
                 RedirectStandardError  = true
             }
         };
         proc.Start();
         proc.WaitForExit();
         var processOutput = proc.StandardError.ReadToEnd();
         processOutput += proc.StandardOutput.ReadToEnd();
         var ret = proc.ExitCode;
         output = processOutput;
         proc.Close();
         return(ret);
     }
     catch (System.ComponentModel.Win32Exception e) {
         output = String.Format("Could not open '{0}'. Make sure it is on your executable path.", exeFile);
         Console.Error.WriteLine(e);
         return(-1);
     }
     catch (Exception e)
     {
         output = e.Message;
         BugReporter br = new BugReporter(e, "Run CMD exception", false);
         return(-1);
     }
 }
        /// <summary>
        /// Repopulates the team projects and children teams
        ///     returns a started Task so it can be awaited on
        /// </summary>
        private static Task <List <TeamProjectViewModel> > UpdateTeamProjects()
        {
            Task <List <TeamProjectViewModel> > t = Task.Run <List <TeamProjectViewModel> >(() =>
            {
                List <TeamProjectViewModel> result = new List <TeamProjectViewModel>();
                try
                {
                    var projects = BugReporter.GetProjectsAsync().Result;
                    foreach (var project in projects.OrderBy(project => project.Name))
                    {
                        var vm = new TeamProjectViewModel(project, new List <TeamProjectViewModel>());
                        result.Add(vm);
                    }
                    PopulateTreeviewWithTeams(result);
                    return(result);
                }
                catch (Exception)
                {
                    return(null);
                }
            });

            return(t);
        }
        public bool Validate(GraduationPlanInfo info, IErrorViewer responseViewer)
        {
            _OneTimeOneCheck.WaitOne();
            bool pass = true;

            try
            {
                if (!_PassedList.Contains(info))
                {
                    _Editor.SetSource(info.GraduationPlanElement);
                    pass &= _Editor.IsValidated;
                    pass &= _Editor.GetSource().SelectNodes("Subject").Count == info.GraduationPlanElement.SelectNodes("Subject").Count;
                    if (pass)
                    {
                        foreach (XmlNode var in _Editor.GetSource().SelectNodes("Subject"))
                        {
                            XmlElement subject1 = (XmlElement)var;
                            XmlElement subject2 = (XmlElement)info.GraduationPlanElement.SelectSingleNode("Subject[@SubjectName='" + subject1.GetAttribute("SubjectName") + "' and @Level='" + subject1.GetAttribute("Level") + "']");
                            if (subject2 != null)
                            {
                                foreach (XmlAttribute attributeInfo in subject1.Attributes)
                                {
                                    if (subject1.GetAttribute(attributeInfo.Name) != subject2.GetAttribute(attributeInfo.Name))
                                    {
                                        pass = false;
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                pass = false;
                                break;
                            }
                        }
                    }
                    if (pass)
                    {
                        _PassedList.Add(info);
                    }
                }
                if (pass)
                {
                    foreach (IValidater <GraduationPlanInfo> extendValidater in _ExtendValidater)
                    {
                        pass &= extendValidater.Validate(info, responseViewer);
                    }
                }
                else
                {
                    if (responseViewer != null)
                    {
                        responseViewer.SetMessage("課程規畫表:\"" + info.Name + "\"驗證失敗");
                    }
                    pass = false;
                }
                _OneTimeOneCheck.Set();
            }
            catch (Exception ex)
            {
                if (responseViewer != null)
                {
                    responseViewer.SetMessage("課程規畫表:\"" + info.Name + "\"在驗證過程中發生未預期錯誤");
                }
                BugReporter.ReportException("SmartSchool", CurrentUser.Instance.SystemVersion, ex, false);
                _OneTimeOneCheck.Set();
                return(false);
            }
            return(pass);
        }
Example #23
0
 private void OnGUI()
 {
     UnityEngine.Debug.developerConsoleVisible = false;
     BugReporter.Get().OnGUI();
 }
Example #24
0
        public void ExecuteCommand(string n)
        {
            Addlog(n);
            textBox_cmd.Clear();
            string[] args = n.Split(' ');
            string   cmd  = args[0];

            if (cmd == "close")
            {
                Hide();
            }
            else if (cmd == "gs_use")
            {
                if (args.Length == 1)
                {
                    Addlog(string.Format("GS_USE: {0}", Program.Sm.GsUsed));
                }
                else if (args.Length >= 3)
                {
                    try
                    {
                        int a = Convert.ToInt32(args[2]);

                        if (args[1] == "set")
                        {
                            Program.Sm.GsUsed = a;
                            Addlog(string.Format("GS_USE: {0}", Program.Sm.GsUsed));
                        }
                        else if (args[1] == "add")
                        {
                            Program.Sm.GsUsed += a;
                            if (Program.Sm.GsUsed < 0)
                            {
                                Program.Sm.GsUsed = 0;
                            }
                            Addlog(string.Format("GS_USE: {0}", Program.Sm.GsUsed));
                        }
                        else
                        {
                            Addlog("USAGE: gs_use <cmd> <amount>");
                        }
                    }
                    catch (Exception)
                    {
                        Addlog("USAGE: gs_use " + args[1] + " <amount>");
                    }
                }
                else
                {
                    Addlog("USAGE: gs_use <cmd> <amount>");
                }
            }
            else if (cmd == "update")
            {
                string nVersion = Octo.GetLastVersionName();
                string nBody    = Octo.GetLastVersionBody();
                MessageBox.Show(
                    @"A new Update has been released!" + Environment.NewLine +
                    nVersion + Environment.NewLine + Environment.NewLine +
                    nBody
                    );
            }
            else if (cmd == "error")
            {
                Addlog("Generating error file");
                BugReporter br = new BugReporter(new Exception("User generated exception"), "User generated exception");
            }
        }
Example #25
0
        public static void Main()
        {
            if (System.IO.File.Exists(System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "阿寶萬歲萬歲萬萬歲")))
            {
                return;
            }

            //毛毛蟲
            List <Customization.PlugIn.ExtendedContent.IContentItem> _items = new List <Customization.PlugIn.ExtendedContent.IContentItem>();

            List <Type> _type_list = new List <Type>(new Type[] {
                //// 異動資料項目(舊)先註
                //typeof(Content.UpdatePalmerwormItem)
            });

            foreach (Type type in _type_list)
            {
                if (!Attribute.IsDefined(type, typeof(SmartSchool.AccessControl.FeatureCodeAttribute)) || CurrentUser.Acl[type].Viewable)
                {
                    try
                    {
                        IContentItem item = type.GetConstructor(Type.EmptyTypes).Invoke(null) as IContentItem;
                        _items.Add(item);
                    }
                    catch (Exception ex) { BugReporter.ReportException(ex, false); }
                }
            }
            foreach (Customization.PlugIn.ExtendedContent.IContentItem var in _items)
            {
                K12.Presentation.NLDPanels.Student.AddDetailBulider(new ContentItemBulider(var));
            }

            //UserControl1 updateRecord = new UserControl1();
            //BaseItem item = c.ProcessRibbon.Items[0];

            //SmartSchool.Customization.PlugIn.GeneralizationPluhgInManager<BaseItem>.Instance[@"學生\指定"].Add(item);
            //SmartSchool.Customization.PlugIn.GeneralizationPluhgInManager<BaseItem>.Instance.Add(@"學生\學籍作業", updateRecord);

            // 舊功能
            //名冊Ribbon
            //new Process.NameList();

            // 批次畢業異動功能
            new Process.BatchUpdateRecord();

            RibbonBarButton rbItemExport = K12.Presentation.NLDPanels.Student.RibbonBarItems["資料統計"]["匯出"];

            #region 匯出(1000708)

            //rbItemExport["異動相關匯出"]["匯出新生異動"].Enable = CurrentUser.Acl["Button0200"].Executable;
            //rbItemExport["異動相關匯出"]["匯出新生異動"].Click += delegate
            //{
            //    new ExportStudent(new ExportNewStudentsUpdateRecord()).ShowDialog();
            //};

            //rbItemExport["異動相關匯出"]["匯出轉入異動"].Enable = CurrentUser.Acl["Button0200"].Executable;
            //rbItemExport["異動相關匯出"]["匯出轉入異動"].Click += delegate
            //{
            //    new ExportStudent(new ExportTransferSchoolStudentsUpdateRecord()).ShowDialog();
            //};

            //rbItemExport["異動相關匯出"]["匯出學籍異動"].Enable = CurrentUser.Acl["Button0200"].Executable;
            //rbItemExport["異動相關匯出"]["匯出學籍異動"].Click += delegate
            //{
            //    new ExportStudent(new ExprotStudentsUpdateRecord()).ShowDialog();
            //};

            //rbItemExport["異動相關匯出"]["匯出畢業異動"].Enable = CurrentUser.Acl["Button0200"].Executable;
            //rbItemExport["異動相關匯出"]["匯出畢業異動"].Click += delegate
            //{
            //    new ExportStudent(new ExportStudentGraduateUpdateRecord()).ShowDialog();
            //};
            #endregion


            RibbonBarButton rbItemImport = K12.Presentation.NLDPanels.Student.RibbonBarItems["資料統計"]["匯入"];

            #region 匯入(1000708)
            //rbItemImport["異動相關匯入"]["匯入新生異動"].Enable = CurrentUser.Acl["Button0280"].Executable;
            //rbItemImport["異動相關匯入"]["匯入新生異動"].Click += delegate
            //{
            //    new ImportStudent(new ImportNewStudentsUpdateRecord()).ShowDialog();
            //};

            //rbItemImport["異動相關匯入"]["匯入轉入異動"].Enable = CurrentUser.Acl["Button0280"].Executable;
            //rbItemImport["異動相關匯入"]["匯入轉入異動"].Click += delegate
            //{
            //    new ImportStudent(new ImportTransferSchoolStudentsUpdateRecord()).ShowDialog();
            //};

            //rbItemImport["異動相關匯入"]["匯入畢業異動"].Enable = CurrentUser.Acl["Button0280"].Executable;
            //rbItemImport["異動相關匯入"]["匯入畢業異動"].Click += delegate
            //{
            //    new ImportStudent(new ImportStudentGraduateUpdateRecord()).ShowDialog();
            //};
            #endregion

            //匯出異動紀錄(1000708註解)
            //SmartSchool.Customization.PlugIn.ImportExport.ExportStudent.AddProcess(new ImportExport.ExportNewStudentsUpdateRecord());
            //SmartSchool.Customization.PlugIn.ImportExport.ExportStudent.AddProcess(new ImportExport.ExportTransferSchoolStudentsUpdateRecord());
            //SmartSchool.Customization.PlugIn.ImportExport.ExportStudent.AddProcess(new ImportExport.ExprotStudentsUpdateRecord());
            //SmartSchool.Customization.PlugIn.ImportExport.ExportStudent.AddProcess(new ImportExport.ExportStudentGraduateUpdateRecord());

            //匯入異動紀錄(1000708註解)
            //SmartSchool.Customization.PlugIn.ImportExport.ImportStudent.AddProcess(new ImportExport.ImportNewStudentsUpdateRecord());
            //SmartSchool.Customization.PlugIn.ImportExport.ImportStudent.AddProcess(new ImportExport.ImportTransferSchoolStudentsUpdateRecord());
            //SmartSchool.Customization.PlugIn.ImportExport.ImportStudent.AddProcess(new ImportExport.ImportStudentGraduateUpdateRecord());

            //??被註解
            //SmartSchool.Customization.PlugIn.ImportExport.ImportStudent.AddProcess(new ImportExport.ImportStudentsUpdateRecord());
            //SmartSchool.Customization.PlugIn.ImportExport.ImportStudent.AddProcess(new ImportExport.ImportStudentGraduateUpdateRecord());
            SmartSchool.Customization.Data.StudentHelper.FillingUpdateRecord += new EventHandler <SmartSchool.Customization.Data.FillEventArgs <SmartSchool.Customization.Data.StudentRecord> >(StudentHelper_FillingUpdateRecord);
        }
Example #26
0
        private void sendTestEmailExecute()
        {
            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "IncreaseContrastTeriostar.gif");

            BugReporter.SendBugReport("Test", "Greg", "*****@*****.**", "My program crashed!", path);
        }
Example #27
0
    void OnGUI()
    {
        GUI.skin  = GSkin;
        GUI.depth = -1000;
        switch (_bugReportStep)
        {
        default:
        case ErrGuiStep.Step_Idle:
            if (_strRuntimeError.Length > 0)
            {
                Time.timeScale = 0;

                GUI.Label(new Rect(0, 0, Screen.width, Screen.height), "", "BlackMask");
                GUI.Label(new Rect(40, 40, 24, 24), "", "ErrorTip");
                GUI.Label(new Rect(70, 46, Screen.width - 140, Screen.height - 70), _strRuntimeError, "WhiteVerdanaText");
                Rect rect = new Rect((Screen.width - 566) / 2, (Screen.height - 156) / 2, 566, 156);
                GUI.BeginGroup(rect, "", "MsgBoxWindow");
                // Title / Caption
                GUI.Label(new Rect(1, 7, rect.width, 26), "System Error", "MsgCaptionTextSD");
                GUI.Label(new Rect(0, 6, rect.width, 26), "System Error", "MsgCaptionText");

                // Content
                GUI.Label(new Rect(25, 46, 48, 48), "", "ErrorSignal");
                GUI.Label(new Rect(88, 59, 450, 90), _strListInUse[(int)EStr.ErrorOccured], "WhiteVerdanaText");

                int button_x_begin = ((int)rect.width - 108) / 2;

                if (GUI.Button(new Rect(button_x_begin - 100, 112, 108, 24), _strListInUse[(int)EStr.Quit], "ButtonStyle"))
                {
                    _bugReportStep = ErrGuiStep.Step_QuitGame;
                }
                if (GUI.Button(new Rect(button_x_begin + 100, 112, 108, 24), _strListInUse[(int)EStr.SendReport], "ButtonStyle"))
                {
                    _bugReportStep = ErrGuiStep.Step_Report;
                }
                GUI.EndGroup();
            }
            else if (!string.IsNullOrEmpty(_strToThrowToMainThread))
            {
                Debug.LogError(_strToThrowToMainThread);
                _strToThrowToMainThread = string.Empty;
            }
            break;

        case ErrGuiStep.Step_Report:
            if (true)
            {
                Time.timeScale = 0;

                GUI.Label(new Rect(0, 0, Screen.width, Screen.height), "", "BlackMask");
                GUI.Label(new Rect(40, 40, 24, 24), "", "ErrorTip");
                GUI.Label(new Rect(70, 46, Screen.width - 140, Screen.height - 70), _strRuntimeError, "WhiteVerdanaText");

                Rect rect = new Rect((Screen.width - 566) / 2, (Screen.height - 156) / 2, 566, 156);
                GUI.BeginGroup(rect, "", "MsgBoxWindow");
                // Title / Caption
                GUI.Label(new Rect(1, 7, rect.width, 26), "System Error", "MsgCaptionTextSD");
                GUI.Label(new Rect(0, 6, rect.width, 26), "System Error", "MsgCaptionText");

                GUI.Label(new Rect(12, 36, 240, 20), _strListInUse[(int)EStr.StepsToReproduce], "WhiteVerdanaText");
                _reproduceDesc = GUI.TextArea(new Rect(20, 56, 526, 60), _reproduceDesc);
                int button_x_begin = ((int)rect.width - 108) / 2;
                if (BugReporter.IsSending)
                {
                    string strSending = _strListInUse[(int)EStr.Sending];
                    int    len        = ((int)Time.realtimeSinceStartup) % (strSending.Length);
                    GUI.Button(new Rect(button_x_begin, 116, 108, 24), strSending.Substring(0, len), "ButtonStyle");
                }
                else if (GUI.Button(new Rect(button_x_begin, 116, 108, 24), _strListInUse[(int)EStr.SendAndQuit], "ButtonStyle"))
                {
                    BugReporter.SendEmailAsync(_strRuntimeError + "\nReproduce Steps:\n" + _reproduceDesc, 5, delegate { _bugReportStep = ErrGuiStep.Step_QuitGame; });
                }
                GUI.EndGroup();
            }
            break;

        case ErrGuiStep.Step_QuitGame:
            _bugReportStep = ErrGuiStep.Step_Dying;
            Debug.Log(_lastLogTime.ToString("G") + "[Quit Game Unexpectedly]");
            Application.Quit();
#if UNITY_EDITOR
            Time.timeScale = 1;
            //Application.RegisterLogCallback(null);
#endif
            break;

        case ErrGuiStep.Step_Dying:
            // Donothing but dying
            break;
        }

#if SAVE_GAME_LOG
        if (bShowLog)
        {
            GUI.Label(new Rect(0, Screen.height - 380, Screen.width, 380), "", "BottomBG3ZX");
            GUI.Label(new Rect(-20, Screen.height - 375, Screen.width, 20), "Game Logs:", "LogTip");
            scrollViewPos = GUI.BeginScrollView(new Rect(0, Screen.height - 350, Screen.width - 8, 246), scrollViewPos, new Rect(0, 0, Screen.width - 20, Logs.Count * 25));
            for (int i = 0; i < Logs.Count; i++)
            {
                if (Logs[i].Type == LogType.Log)
                {
                    GUI.Label(new Rect(12, i * 25, Screen.width - 100, 25), Logs[i].LogTime.ToShortTimeString() + "\t\t" + Logs[i].LogString, "LogTip");
                    GUI.Label(new Rect(Screen.width - 80, i * 25, 50, 25), Logs[i].Count.ToString(), "LogTip");
                }
                else if (Logs[i].Type == LogType.Warning)
                {
                    GUI.Label(new Rect(12, i * 25, Screen.width - 100, 25), Logs[i].LogTime.ToShortTimeString() + "\t\t" + Logs[i].LogString, "WarningTip");
                    GUI.Label(new Rect(Screen.width - 80, i * 25, 50, 25), Logs[i].Count.ToString(), "WarningTip");
                }
                else
                {
                    GUI.Label(new Rect(12, i * 25, Screen.width - 100, 25), Logs[i].LogTime.ToShortTimeString() + "\t\t" + Logs[i].LogString, "ErrorTip");
                    GUI.Label(new Rect(Screen.width - 80, i * 25, 50, 25), Logs[i].Count.ToString(), "ErrorTip");
                }
                if (GUI.Button(new Rect(Screen.width - 155, i * 25 + 2, 73, 22), "Detail", "ButtonStyle"))
                {
                    Detail = Logs[i].StackTrace;
                }
            }
            GUI.EndScrollView();
            GUI.Label(new Rect(0, Screen.height - 350, Screen.width, 250), "", "NumberInput");
            GUI.TextField(new Rect(4, Screen.height - 99, Screen.width - 8, 98), Detail, "WhiteVerdanaText");
            GUI.Label(new Rect(0, Screen.height - 100, Screen.width, 100), "", "NumberInput");
        }
#endif
    }
Example #28
0
 private void submitReportExecute()
 {
     BugReporter.SendBugReport(reportType, UserName, UserEmail, BugDescription, logPath);
 }
Example #29
0
        private void PacketRecvThreadStart()
        {
            byte[]        buf    = new byte[84];
            uint[]        args   = new uint[16];
            NetworkStream stream = NetStream;

            while (true)
            {
                try
                {
                    int ret = ReadNetworkStream(stream, buf, buf.Length);
                    if (ret == 0)
                    {
                        break;
                    }
                    int  t     = 0;
                    uint magic = BitConverter.ToUInt32(buf, t);
                    t += 4;
                    uint seq = BitConverter.ToUInt32(buf, t);
                    t += 4;
                    uint type = BitConverter.ToUInt32(buf, t);
                    t += 4;
                    uint cmd = BitConverter.ToUInt32(buf, t);
                    for (int i = 0; i < args.Length; i++)
                    {
                        t      += 4;
                        args[i] = BitConverter.ToUInt32(buf, t);
                    }
                    t += 4;
                    uint dataLen = BitConverter.ToUInt32(buf, t);

                    if (cmd != 0)
                    {
                        Log(string.Format("packet: cmd = {0}, dataLen = {1}", cmd, dataLen));
                    }

                    if (magic != 0x12345678)
                    {
                        Log(string.Format("broken protocol: magic = {0}, seq = {1}", magic, seq));
                        break;
                    }

                    if (cmd == 0)
                    {
                        if (dataLen != 0)
                        {
                            byte[] dataBuf = new byte[dataLen];
                            ReadNetworkStream(stream, dataBuf, dataBuf.Length);
                            string logMsg = Encoding.UTF8.GetString(dataBuf);
                            // Tinkering even more with the Debugger

                            if (logMsg.StartsWith("valid memregions:"))
                            {
                                // Setting memregions
                                Program.GCmdWindow.textBox_memlayout.Invoke(
                                    new CmdWindow.SetMemregionsCallback(Program.GCmdWindow.SetMemregions), logMsg);
                            }
                            else if (logMsg.StartsWith("patching smdh") || logMsg.StartsWith("rtRecvSocket failed: "))
                            {
                                Program.GCmdWindow.RunProcessesCmd();
                            }
                            else if (logMsg.StartsWith("pid: "))
                            {
                                Program.GCmdWindow.textBox_processes.Invoke(
                                    new CmdWindow.SetProcessesCallback(Program.GCmdWindow.SetProcesses), logMsg);
                            }
                            // END

                            Log(logMsg);
                        }
                        lock (_syncLock)
                        {
                            _heartbeatSendable = 1;
                        }
                        continue;
                    }
                    if (dataLen != 0)
                    {
                        byte[] dataBuf = new byte[dataLen];
                        ReadNetworkStream(stream, dataBuf, dataBuf.Length);
                        HandlePacket(cmd, seq, dataBuf);
                    }
                }
                catch (Exception e)
                {
                    Log(e.Message);
                    Log(e.StackTrace);
                    BugReporter br = new BugReporter(e, "Packet receiver exception");
                    break;
                }
            }

            Log("Server disconnected.");
            Disconnect(false);
        }
Example #30
0
    private void OnWindowLoad()
    {
        string title = String.Format("LunaLua Module Manager - v{0} - {1}", Assembly.GetExecutingAssembly().GetName().Version.ToString(),
            SplashMessages[r.Next(SplashMessages.Length)]);
        this.Title = title;

        try
        {
            using (var client = new WebClient())
            {
                string jsonDatabase = client.DownloadString("http://mrmiketheripper.x10.mx/luamodulemanager/test.json");

                //if (jsonDatabase != null)
                    //example = JsonConvert.DeserializeObject<List<LuaModuleManager.LuaModule>>(jsonDatabase);
                LoadDatabaseIntoTreeview();
            }
        }
        catch(Exception ex)
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                "Error loading database from: {0}\n\n{1}", Program.ProgramSettings.DatabaseURL, ex.Message);
            md.Icon = Image.LoadFromResource("Gtktester.Icons.PNG.256.png").Pixbuf;
            md.WindowPosition = WindowPosition.Center;
            md.Run();
            md.Destroy();

            if (Program.ProgramSettings.EnableSilentBugReporting)
            {
                BugReporter br = new BugReporter();
                br.SubmitSilentBugReport(String.Format("An error ocurred while loading in the database from: {0}\nUsername: {3}\nMessage: {1}\n\nStack Trace: {2}", Program.ProgramSettings.DatabaseURL, ex.Message, ex.StackTrace, Program.ProgramSettings.OptionalUsername));
                br.Destroy();
            }

            Environment.Exit(-3);
        }

        try
        {
            using (WebClient wc = new WebClient())
            {
                string json = wc.DownloadString("http://engine.wohlnet.ru/LunaLua/get.php?showversions");
                if (json != null)
                {
                    wohl = JsonConvert.DeserializeObject<WohlJsonObj>(json);
                    LoadWohlDatabase();

                    this.lunaluainformation1.CheckForLunaDllUpdates();
                }
            }
        }
        catch(Exception ex)
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                "Error loading database from: {0}\n\n{1}", Program.ProgramSettings.WohlstandJSON, ex.Message);
            md.Icon = Image.LoadFromResource("Gtktester.Icons.PNG.256.png").Pixbuf;
            md.WindowPosition = WindowPosition.Center;
            md.Run();
            md.Destroy();

            if (Program.ProgramSettings.EnableSilentBugReporting)
            {
                BugReporter br = new BugReporter();
                br.SubmitSilentBugReport(String.Format("An error ocurred while loading in the database from: {0}\nUsername: {3}\nMessage: {1}\nStack Trace: {2}", Program.ProgramSettings.WohlstandJSON, ex.Message, ex.StackTrace, Program.ProgramSettings.OptionalUsername));
                br.Destroy();
            }

            Environment.Exit(-4);
        }
    }
        /// <summary>
        /// Handles click on file bug button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnFileBug_Click(object sender, RoutedEventArgs e)
        {
            var vm = ((Button)sender).Tag as ScanListViewItemViewModel;

            if (vm.BugId.HasValue)
            {
                // Bug already filed, open it in a new window
                try
                {
                    var bugUri = await BugReporter.GetExistingBugUriAsync(vm.BugId.Value).ConfigureAwait(true);

                    System.Diagnostics.Process.Start(bugUri.ToString());
                }
                catch (Exception ex)
                {
                    // Happens when bug is deleted, message describes that work item doesn't exist / possible permission issue
                    MessageDialog.Show(ex.InnerException?.Message);
                    vm.BugId = null;
                }
            }
            else
            {
                // File a new bug
                Logger.PublishTelemetryEvent(TelemetryAction.Scan_File_Bug, new Dictionary <TelemetryProperty, string>()
                {
                    { TelemetryProperty.By, FileBugRequestSource.HowtoFix.ToString() },
                    { TelemetryProperty.IsAlreadyLoggedIn, BugReporter.IsConnected.ToString(CultureInfo.InvariantCulture) }
                });

                // TODO: figuring out whether a team project has been chosen should not require
                //  looking at the most recent connection, this should be broken out
                if (BugReporter.IsConnected && Configuration.SavedConnection?.IsPopulated == true)
                {
                    Action <int> updateZoom = (int x) => Configuration.ZoomLevel = x;
                    (int?bugId, string newBugId) = FileBugAction.FileNewBug(vm.GetBugInformation(), Configuration.SavedConnection, Configuration.AlwaysOnTop, Configuration.ZoomLevel, updateZoom);

                    vm.BugId = bugId;

                    // Check whether bug was filed once dialog closed & process accordingly
                    if (vm.BugId.HasValue)
                    {
                        vm.LoadingVisibility = Visibility.Visible;
                        try
                        {
                            var success = await FileBugAction.AttachBugData(this.EcId, vm.Element.BoundingRectangle,
                                                                            vm.Element.UniqueId, newBugId, vm.BugId.Value).ConfigureAwait(false);

                            if (!success)
                            {
                                MessageDialog.Show(Properties.Resources.ScannerResultControl_btnFileBug_Click_There_was_an_error_identifying_the_created_bug_This_may_occur_if_the_ID_used_to_create_the_bug_is_removed_from_its_AzureDevOps_description_Attachments_have_not_been_uploaded);
                                vm.BugId = null;
                            }
                            vm.LoadingVisibility = Visibility.Collapsed;
                        }
                        catch (Exception)
                        {
                            vm.LoadingVisibility = Visibility.Collapsed;
                        }
                    }
                }
                else
                {
                    bool?accepted = MessageDialog.Show(Properties.Resources.ScannerResultControl_btnFileBug_Click_Please_log_in_to_AzureDevOps_ensure_both_AzureDevOps_account_name_and_team_project_are_selected);
                    if (accepted.HasValue && accepted.Value)
                    {
                        SwitchToServerLogin();
                    }
                }
            }
        }
Example #32
0
 protected void OnConvertActionActivated(object sender, EventArgs e)
 {
     BugReporter br = new BugReporter();
     br.Show();
 }