Exemple #1
0
 public Chart()
 {
     InitializeComponent();
     map = FileIO.Load(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + SaltCharts.Properties.Settings.Default.LastMapFile + MAP_EXTENSION);
     PlotMap();
     btnSave.Enabled = false;
 }
Exemple #2
0
        private void ImportWaypoints(Map newMap)
        {
            bool Continue = false;
            ConflictResponse response =  ConflictResponse.Merged;

            foreach (Waypoint wp in newMap.GetWaypoints())
            {
                if (map.HasWaypoint(wp.Location))
                {
                    // There is a conflict in waypoints

                    if (Continue && response == ConflictResponse.Original)
                        // User has chosen to use the original waypoint, don't change anything
                        break;

                    Waypoint oldWp = map.GetWaypoint(wp.Location);
                    if (wp.IsExactMatch(oldWp))
                        // The original waypoint is an exact match, no need to change
                        break;

                    // Resolve the conflict
                    WaypointConflict conflict = new WaypointConflict(oldWp, wp);
                    conflict.Text = "Waypoint Conflict - " + wp.Location.ToString();
                    if (!Continue)
                    {
                        // User has not opted to bypass resolution screen
                        conflict.ShowDialog(this);
                        response = conflict.Response;
                        Continue = conflict.ContinueWithRemaining;
                    }

                    // Correct the resolved conflict
                    if (response == ConflictResponse.New)
                        oldWp.Copy(wp);
                    else if (response == ConflictResponse.Merged)
                        oldWp.Copy(conflict.Merged);
                }
                else
                    // There was no conflict
                    map.AddWaypoint(wp);
            }
        }
Exemple #3
0
 private void ImportStamps(Map newMap)
 {
     foreach (Stamp s in newMap.GetStamps())
         map.AddStamp(s);
 }
Exemple #4
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.DefaultExt = "map";
            ofd.Title = "Select Map File";
            ofd.Filter = "Map File|*.map";
            if (ofd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                ClearMap();
                SaltCharts.Properties.Settings.Default.LastMapFile = Path.GetFileNameWithoutExtension(ofd.FileName);
                map = FileIO.Load(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + SaltCharts.Properties.Settings.Default.LastMapFile + MAP_EXTENSION);
                PlotMap();

                this.Text = new StringBuilder("Salt Charts v").Append(Application.ProductVersion).Append(" - ").Append(SaltCharts.Properties.Settings.Default.LastMapFile).ToString();
            }
        }
Exemple #5
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            string mapName = Interaction.InputBox("Map name? (This is usually the name of the seed you used when you created your world)", "New Map");
            if (string.IsNullOrEmpty(mapName))
            {
                MessageBox.Show("You must enter a name for the map.", "Map Name Required!", MessageBoxButtons.OK);
                return;
            }

            SaltCharts.Properties.Settings.Default.LastMapFile = mapName;

            this.Text = new StringBuilder("Salt Charts v").Append(Application.ProductVersion).Append(" - ").Append(mapName).ToString();
            btnSave.Enabled = false;
            map = new Map();

            //clear all the map points
            ClearMap();
        }