Example #1
0
        static void Main()
        {
            try {
                // setup global bug tracker
                Application.ThreadException += new ThreadExceptionEventHandler(BugTracking.OnThreadException);

                // setup main thread
                Thread mainThread = Thread.CurrentThread;
                mainThread.Name = "ExoEngine.MainThread";

                // setup data directories
                sTexturePath       = GetDataPath("Textures");
                sWorldcraftMapPath = GetDataPath("Maps");
                sWorldPath         = GetDataPath("Worlds");
                sSpritePath        = GetDataPath("Sprites");
                sScreenshotPath    = GetDataPath("");

                // create main form
                _mainform = new MainForm();
                _mainform.Initialize();

                // run application
                Application.Run(_mainform);
                _mainform = null;
            }
            catch (Exception e) {
                BugTracking.LogException(e);
            }
        }
Example #2
0
        protected override bool OnExecute()
        {
            World world = ExoEngine.ActiveWorld;

            // serialize World -> XML
            //Debug2.Push( "XmlSerializer.Serialize( world )" );
            try {
                StreamWriter  sOut   = new StreamWriter(world.FileName, false, System.Text.Encoding.Default, 1);
                XmlSerializer xmlOut = new System.Xml.Serialization.XmlSerializer(typeof(World));
                xmlOut.Serialize(sOut, world, new XmlSerializerNamespaces());
                sOut.Close();
            }
            catch (Exception e) {
                string fileName = BugTracking.WriteExceptionRecord(e);
                ExoEngine.Error("Error save World to file '" + world.FileName + "'.\n" +
                                "Please send this bug report to [email protected]:\n" +
                                fileName);
                return(false);
            }
            //Debug2.Pop();

            ExoEngine.ActiveWorld.Dirty = false;
            ExoEngine.UpdateAll();

            return(true);
        }
Example #3
0
        protected void OnBeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
        {
            // Set cursor as wait
            Cursor.Current = Cursors.WaitCursor;

            // Populate sub directory in depth 2
            try {
                PopulateSubDirectory(e.Node, 2);
                Cursor.Current = Cursors.Default;

                // Set icon as opened
                if (e.Node.Parent != null)
                {
                    //e.node.ImageIndex = e.node.SelectedImageIndex = 1;
                }
            }
            catch (Exception excpt) {
                // Show error message and cancel expand
                BugTracking.WriteExceptionRecord(excpt);
                MessageBox.Show(excpt.Message, "Device Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                e.Cancel = true;
            }

            // Set cursor as default
            Cursor.Current = Cursors.Default;
        }
Example #4
0
        public static BugTracking BugTracking(int?counter)
        {
            var rtValue = new BugTracking();

            rtValue.UserId  = "UserId" + counter.Extra();
            rtValue.OrderId = counter.HasValue ? counter.Value : 9;

            return(rtValue);
        }
Example #5
0
        private void PopulateSubDirectory(TreeNode curNode, int depth)
        {
            //Debug.WriteLine( "scanning directory '" + curNode.FullPath + "'" );
            if (--depth < 0)
            {
                return;
            }

            if (curNode.Nodes.Count == 1 && curNode.Nodes[0].Text == "")
            {
                try {
                    // Get sub directory list
                    //Directory[] DirectoryList;
                    string[] DirectoryList = Directory.GetDirectories(curNode.FullPath + "\\");
                    Array.Sort((Array)DirectoryList);

                    // Clear dummy node and Populate TreeView
                    curNode.Nodes.Clear();

                    // Populate sub directory list
                    foreach (string dir in DirectoryList)
                    {
                        DirectoryInfo mDir = new DirectoryInfo(dir);
                        if ((mDir.Attributes & System.IO.FileAttributes.Hidden) == 0)                                   // Hidden = 0x2
                        // Add each directory
                        {
                            TreeNode node;
                            node            = curNode.Nodes.Add(mDir.Name);
                            node.ImageIndex = node.SelectedImageIndex = 0;

                            // Add dummy child node to make node expandable
                            node.Nodes.Add("");

                            // Populate sub directory
                            PopulateSubDirectory(node, depth);
                        }
                    }
                }
                catch (Exception e) {
                    BugTracking.WriteExceptionRecord(e);
                    throw new Exception(e.Message);
                }
            }
            else
            {
                foreach (TreeNode node in curNode.Nodes)
                {
                    // Populate sub directory
                    PopulateSubDirectory(node, depth);
                }
            }
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_solution_Click(object sender, EventArgs e)
        {
            MemoryStream mStream;

            if (dataGridView1.SelectedRows.Count != 0)
            {
                int    bugId       = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value);
                string projectname = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
                string classname   = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
                string method      = dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
                string lineNo      = dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
                string endline     = dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
                byte[] errorsnap   = (byte[])dataGridView1.SelectedRows[0].Cells[6].Value;
                string author      = dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
                string year        = dataGridView1.SelectedRows[0].Cells[8].Value.ToString();
                string month       = dataGridView1.SelectedRows[0].Cells[9].Value.ToString();
                string day         = dataGridView1.SelectedRows[0].Cells[10].Value.ToString();
                string sourcecode  = dataGridView1.SelectedRows[0].Cells[11].Value.ToString();
                string status      = dataGridView1.SelectedRows[0].Cells[12].Value.ToString();
                string addedby     = dataGridView1.SelectedRows[0].Cells[13].Value.ToString();
                string solveremail = dataGridView1.SelectedRows[0].Cells[14].Value.ToString();
                string solveyear   = dataGridView1.SelectedRows[0].Cells[15].Value.ToString();
                string solvemonth  = dataGridView1.SelectedRows[0].Cells[16].Value.ToString();
                string solveday    = dataGridView1.SelectedRows[0].Cells[17].Value.ToString();
                string solvecode   = dataGridView1.SelectedRows[0].Cells[18].Value.ToString();
                mStream = new MemoryStream(errorsnap);
                string role = email;
                if (role == "*****@*****.**")
                {
                    AdminPanelForm admin = new AdminPanelForm();
                    admin.BugDetailForm(email, bugId, projectname, classname, method, lineNo, endline, mStream, author, year, month, day, sourcecode, status, addedby, solveremail, solveyear, solvemonth, solveday, solvecode);
                    dataGridView1.Refresh();
                    LoadAllBugs();
                    btn_solution.Visible = false;
                }
                else
                {
                    BugTracking panel = new BugTracking();
                    panel.EditBugForm(email, bugId, projectname, classname, method, lineNo, endline, mStream, author, year, month, day, sourcecode, status, addedby, solveremail, solveyear, solvemonth, solveday, solvecode);
                    dataGridView1.Refresh();
                    LoadAllBugs();
                }
            }
            else
            {
                MessageBox.Show("Select row to update..");
            }
        }
Example #7
0
        // Initialize DirectoryTreeView with current logical drive list
        // It dosen't support OS specific drive list yet. (eg. My Documents, Network Neighborhood)
        private void InitializeShellTree()
        {
            this.PathSeparator = "\\";

            // Get Logical Drive List
            try {
                string[] strDriveList;
                strDriveList = Directory.GetLogicalDrives();

                foreach (string strDrive in strDriveList)
                {
                    // Add each drive
                    TreeNode node;
                    node = this.Nodes.Add(strDrive.Substring(0, strDrive.Length - 1));

                    switch (GetDriveType(strDrive))
                    {
                    case DriveType.Removable:
                        node.ImageIndex = node.SelectedImageIndex = 2;
                        break;

                    case DriveType.Fixed:
                        node.ImageIndex = node.SelectedImageIndex = 3;
                        break;

                    case DriveType.CdRom:
                        node.ImageIndex = node.SelectedImageIndex = 4;
                        break;

                    case DriveType.Remote:
                        node.ImageIndex = node.SelectedImageIndex = 5;
                        break;

                    default:
                        node.ImageIndex = node.SelectedImageIndex = 3;
                        break;
                    }

                    // Add dummy child node to make node expandable
                    node.Nodes.Add("");
                }
            }
            catch (Exception e) {
                BugTracking.WriteExceptionRecord(e);
                MessageBox.Show(e.Message, "Can't initialize device list", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #8
0
        //----------------------------------------------------------------------------

        public bool Execute()
        {
            //Debug.WriteLine( "Command: " + this.GetType().Name );

            BugTracking.SetWatch("CommandButton.LastExecute", this);

            this.CommandControls.ExecutionCount++;
            bool bResult = this.OnExecute();

            this.CommandControls.ExecutionCount--;

            // reset params, if any
            if (this.Params != null)
            {
                this.Params = null;
            }

            return(bResult);
        }
        //method to change data
        private void btn_solution_Click(object sender, EventArgs e)
        {
            MemoryStream mStream;

            if (dataGridView1.SelectedRows.Count != 0)
            {
                int    bugId       = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value);
                string projectname = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
                string classname   = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
                string method      = dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
                string lineNo      = dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
                string endline     = dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
                byte[] errorsnap   = (byte[])dataGridView1.SelectedRows[0].Cells[6].Value;
                string author      = dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
                string year        = dataGridView1.SelectedRows[0].Cells[8].Value.ToString();
                string month       = dataGridView1.SelectedRows[0].Cells[9].Value.ToString();
                string day         = dataGridView1.SelectedRows[0].Cells[10].Value.ToString();
                string sourcecode  = dataGridView1.SelectedRows[0].Cells[11].Value.ToString();
                string status      = dataGridView1.SelectedRows[0].Cells[12].Value.ToString();
                string addedby     = dataGridView1.SelectedRows[0].Cells[13].Value.ToString();
                string solveremail = dataGridView1.SelectedRows[0].Cells[14].Value.ToString();
                string solveyear   = dataGridView1.SelectedRows[0].Cells[15].Value.ToString();
                string solvemonth  = dataGridView1.SelectedRows[0].Cells[16].Value.ToString();
                string solveday    = dataGridView1.SelectedRows[0].Cells[17].Value.ToString();
                string solvecode   = dataGridView1.SelectedRows[0].Cells[18].Value.ToString();
                mStream = new MemoryStream(errorsnap);

                BugTracking tracking = new BugTracking();
                tracking.EditBugForm(email, bugId, projectname, classname, method, lineNo, endline, mStream, author, year, month, day, sourcecode, status, addedby, solveremail, solveyear, solvemonth, solveday, solvecode);
                dataGridView1.Refresh();
                LoadBugs();
            }
            else
            {
                MessageBox.Show("Please select a row");
            }
        }
Example #10
0
        public static BugTracking BugTracking(int? counter)
        {
            var rtValue = new BugTracking();
            rtValue.UserId = "UserId" + counter.Extra();
            rtValue.OrderId = counter.HasValue ? counter.Value : 9;

            return rtValue;
        }
Example #11
0
        protected override bool OnExecute()
        {
            if (ExoEngine.ActiveWorld != null)
            {
                if (ExoEngine.Commands.Execute(typeof(FileClose)) != true)
                {
                    return(false);
                }
            }

            string strFileName = null;

            if (this.Params != null)
            {
                if (this.Params[0] is string)
                {
                    strFileName = (string)this.Params[0];
                }
            }
            else
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Multiselect      = false;
                ofd.Title            = "Open World";
                ofd.Filter           = ExoEngine.sWorldFileFilter;
                ofd.InitialDirectory = ExoEngine.sWorldPath;

                DialogResult result = ofd.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return(false);
                }

                strFileName = ofd.FileName;
            }

            if (strFileName == null || File.Exists(strFileName) == false)
            {
                return(false);
            }

            // deserialize XML -> World
            //Debug2.Push( "XmlSerializer.Deserialize( world )" );
            World world = null;

            try {
                FileStream    sIn   = new FileStream(strFileName, FileMode.Open);
                XmlSerializer xmlIn = new System.Xml.Serialization.XmlSerializer(typeof(World));
                world = (World)xmlIn.Deserialize(sIn);
                sIn.Close();
            }
            catch (Exception e) {
                string fileName = BugTracking.WriteExceptionRecord(e);
                ExoEngine.Error("Error loading World from file '" + strFileName + "'.\n" +
                                "Please send this bug report to [email protected]:\n" +
                                fileName);
                return(false);
            }
            //Debug2.Pop();

            world.FileName = strFileName;
            world.Dirty    = false;
            world.Reset();

            ExoEngine.ActiveWorld = world;
            ExoEngine.UpdateAll();

            return(true);
        }
Example #12
0
        public void CheckForClearedOutSubAccounts(Order order, OrderViewModel.Split[] splits, OrderViewModel model)
        {
            try
            {
                if (splits == null || !splits.Any())
                {
                    var orderViewModelSplit = new OrderViewModel.Split{Account = model.Account,SubAccount = model.SubAccount,LineItemId = null};
                    splits = new OrderViewModel.Split[] { orderViewModelSplit };
                }

                var lastLineId = 0;
                var count = 0;
                foreach (var split in splits)
                {
                    if (string.IsNullOrWhiteSpace(split.SubAccount))
                    {
                        Split orderSplit = null;
                        if (split.LineItemId.HasValue)
                        {
                            if (split.LineItemId.Value != lastLineId)
                            {
                                lastLineId = split.LineItemId.Value;
                                count = 0;
                            }
                            else
                            {
                                count++;
                            }
                            var lineItem = order.LineItems.ElementAtOrDefault(split.LineItemId.Value - 1);
                            if (lineItem != null)
                            {
                                orderSplit = lineItem.Splits.ElementAtOrDefault(count);
                            }
                        }
                        else
                        {
                            orderSplit = order.Splits.FirstOrDefault(a => a.LineItem == null && a.Account == split.Account);
                        }

                        if (orderSplit != null)
                        {
                            if (orderSplit.Account == split.Account && !string.IsNullOrWhiteSpace(orderSplit.SubAccount))
                            {
                                //ok, the sub account has been cleared out.
                                var bugTracking = new BugTracking();
                                bugTracking.OrderId = order.Id;
                                bugTracking.UserId = _userIdentity.Current;
                                bugTracking.SplitId = orderSplit.Id;
                                bugTracking.TrackingMessage = string.Format("SubAccount Cleared Out for Account {0}. Previous value {1}", orderSplit.Account, orderSplit.SubAccount);
                                bugTracking.LineItemId = orderSplit.LineItem != null ? (int?)orderSplit.LineItem.Id : null;

                                _bugTrackingRepository.EnsurePersistent(bugTracking);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {

            }
        }
Example #13
0
        public void CheckForClearedOutSubAccounts(Order order, OrderViewModel.Split[] splits, OrderViewModel model)
        {
            try
            {
                if (splits == null || !splits.Any())
                {
                    var orderViewModelSplit = new OrderViewModel.Split {
                        Account = model.Account, SubAccount = model.SubAccount, LineItemId = null
                    };
                    splits = new OrderViewModel.Split[] { orderViewModelSplit };
                }

                var lastLineId = 0;
                var count      = 0;
                foreach (var split in splits)
                {
                    if (string.IsNullOrWhiteSpace(split.SubAccount))
                    {
                        Split orderSplit = null;
                        if (split.LineItemId.HasValue)
                        {
                            if (split.LineItemId.Value != lastLineId)
                            {
                                lastLineId = split.LineItemId.Value;
                                count      = 0;
                            }
                            else
                            {
                                count++;
                            }
                            var lineItem = order.LineItems.ElementAtOrDefault(split.LineItemId.Value - 1);
                            if (lineItem != null)
                            {
                                orderSplit = lineItem.Splits.ElementAtOrDefault(count);
                            }
                        }
                        else
                        {
                            orderSplit = order.Splits.FirstOrDefault(a => a.LineItem == null && a.Account == split.Account);
                        }

                        if (orderSplit != null)
                        {
                            if (orderSplit.Account == split.Account && !string.IsNullOrWhiteSpace(orderSplit.SubAccount))
                            {
                                //ok, the sub account has been cleared out.
                                var bugTracking = new BugTracking();
                                bugTracking.OrderId         = order.Id;
                                bugTracking.UserId          = _userIdentity.Current;
                                bugTracking.SplitId         = orderSplit.Id;
                                bugTracking.TrackingMessage = string.Format("SubAccount Cleared Out for Account {0}. Previous value {1}", orderSplit.Account, orderSplit.SubAccount);
                                bugTracking.LineItemId      = orderSplit.LineItem != null ? (int?)orderSplit.LineItem.Id : null;

                                _bugTrackingRepository.EnsurePersistent(bugTracking);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }