Exemple #1
0
        /// <summary>
        ///     Finish tracking data and save results to the hard drive
        /// </summary>
        public static void FinishCollectingData()
        {
            lock (Trackers)
            {
                IsCollectingData = false;

                foreach (var tracker in Trackers)
                {
                    SerializeToXml(tracker.Hooks);
                }

                // Save to disk
                try
                {
                    CurrentData.Save(StatsFilename);
                }
                catch
                {
                    /*PremadeDialogs.GenericError(ex); // No need, not critical*/
                }
            }
        }
Exemple #2
0
        private void DataExport()
        {
            var filter = String.Empty;

            foreach (var f in CurrentData.SaveFileFilters)
            {
                filter += f + '|';
            }
            if (filter.EndsWith("|"))
            {
                filter = filter.Substring(0, filter.Length - 1);
            }

            var extensionOfFirstFilter = CurrentData.RecommendedExtension;

            __sfd.Filter = filter;

            var initialFilename =
                CurrentData.Lang.ResourcePath +
                extensionOfFirstFilter;

            __sfd.FileName = Anolis.Core.Utility.Miscellaneous.FSSafeResPath(initialFilename);

            if (__sfd.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try {
                CurrentData.Save(__sfd.FileName);
            } catch (UnauthorizedAccessException aex) {
                MessageBox.Show(this, "Unable to write the file: " + aex.Message, "Anolis Resourcer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            } catch (System.IO.IOException iex) {
                MessageBox.Show(this, "Unable to write the file: " + iex.Message, "Anolis Resourcer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }