Exemplo n.º 1
0
        private void generateBut_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.RestoreDirectory = true;
            sfd.InitialDirectory = @"C:\Users\" + Environment.UserName + @"\AppData\Roaming\Autodesk\Revit\Addins\2017";
            sfd.FileName         = DateTime.Now.ToString("yyyyMMdd-HHmmss") + ".addin";
            sfd.ShowDialog();

            StreamWriter sw = new StreamWriter(Path.GetFullPath(sfd.FileName));

            sw.WriteLine(dll.exportAddin());
            sw.Close();

            MessageBox.Show("Success Save to \"" + Path.GetFullPath(sfd.FileName) + "\"", "Success Generate", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            this.Close();
        }
Exemplo n.º 2
0
        private void install_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string addinpath = @"C:\Users\" + Environment.UserName + @"\AppData\Roaming\Autodesk\Revit\Addins\2017\" + DateTime.Now.ToString("yyyyMMdd-HHmmss") + ".addin";
                string dllpath   = Dll.repeatFileName(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\Autodesk\Revit\Addins\2017\" + Path.GetFileName(ofd.FileName));
                //MessageBox.Show(dllpath);
                File.Copy(Path.GetFullPath(ofd.FileName), dllpath);
                Dll d = new Dll(dllpath);

                StreamWriter sw = new StreamWriter(addinpath);
                sw.WriteLine(d.exportAddin());
                sw.Close();

                MessageBox.Show("Success Save to \"" + d.toString() + "\" and create .addin manifest file.", "Success Install", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.Close();
            }
        }