Exemple #1
0
	/// <summary>
	/// Fills submenu File -> Workspace -> Recent.
	/// </summary>
	public void ZFillMenuRecentWorkspaces(ToolStripDropDownMenu dd)
	{
		void _Add(string path, bool bold)
		{
			var mi = dd.Items.Add(path, null, (o, u) => ZLoadWorkspace(o.ToString()));
			if(bold) mi.Font = Au.Util.AFontsCached_.Bold;
		}

		dd.SuspendLayout();
		dd.Items.Clear();
		_Add(Program.Settings.workspace, true);
		var ar = Program.Settings.recentWS;
		int nRemoved = 0;
		for(int i = 0, n = ar?.Length ?? 0; i < n; i++) {
			var path = ar[i];
			if(dd.Items.Count >= 20 || !AFile.ExistsAsDirectory(path)) {
				ar[i] = null;
				nRemoved++;
			} else _Add(path, false);
		}
		if(nRemoved > 0) {
			var an = new string[ar.Length - nRemoved];
			for(int i = 0, j = 0; i < ar.Length; i++) if(ar[i] != null) an[j++] = ar[i];
			Program.Settings.recentWS = an;
		}
		dd.ResumeLayout();
	}
Exemple #2
0
    private void _ButtonBrowse_Click(object sender, EventArgs e)
    {
        var d = new FolderBrowserDialog();

        d.Description         = "Location. In the selected folder will be created the main folder of the workspace.";
        d.ShowNewFolderButton = true;
        d.SelectedPath        = AFile.ExistsAsDirectory(textLocation.Text) ? textLocation.Text : (string)AFolders.ThisAppDocuments;
        if (d.ShowDialog(this) != DialogResult.OK)
        {
            return;
        }
        textLocation.Text = d.SelectedPath;
    }
Exemple #3
0
    static void _CreateRefAndDoc(string refDir, string version, bool all, string dataDir)
    {
        var dir1 = refDir + @"\" + version + @"\ref\netcoreapp" + version.RegexReplace(@"^\d+\.\d+\K.+", @"\", 1);

        //AOutput.Write(dir1, AFile.ExistsAsDirectory(dir1));
        if (!AFile.ExistsAsDirectory(dir1, true))
        {
            throw new DirectoryNotFoundException("Not found: " + dir1);
        }
        if (0 == dir1.RegexReplace(@"(?i)\\Microsoft\.\KNETCore(?=\.)", "WindowsDesktop", out string dir2, 1))
        {
            throw new AuException();
        }
        //AOutput.Write(dir2, AFile.ExistsAsDirectory(dir2));
        if (!AFile.ExistsAsDirectory(dir2, true))
        {
            throw new DirectoryNotFoundException("Not found: " + dir2);
        }

        string dbRef, dbDoc;

        if (all)
        {
            dbRef = AFolders.ThisAppBS + "ref." + version + ".db";
            dbDoc = AFolders.ThisAppBS + "doc." + version + ".db";
        }
        else
        {
            dbRef = dataDir + @"\ref.db";
            dbDoc = dataDir + @"\doc.db";
        }
        _CreateRef(dbRef, dir1, dir2);
        _CreateDoc(dbDoc, dir1, dir2);

        if (!all)
        {
            Program.Settings.db_copy_ref = dbRef;
            Program.Settings.db_copy_doc = dbDoc;
        }
    }