コード例 #1
0
ファイル: frmSource.cs プロジェクト: schifflee/PwrIDE
 //------------------------------------------------------------------------
 public void SetRepError(RepErr error)
 {
     errRep = error;
     if (errRep.any)
     {
         Util.MainForm.Errors.SetError(error.fileErr, error.line, error.error);
         Util.MainForm.Errors.Activate();
     }
     else
     {
         Util.MainForm.Errors.ClearErrors();
     }
 }
コード例 #2
0
ファイル: frmSource.cs プロジェクト: schifflee/PwrIDE
        //------------------------------------------------------------------------
        public void InstallRep()
        {
            if (fileOrigin == Origin.NEW)
            {
                return;
            }
            if (fileOrigin == Origin.LOCAL)
            {
                return;
            }
            if (fileType != ProjectFile.FileType.REPGEN)
            {
                return;
            }
            if (fileOrigin == Origin.PROJECT)
            {
                if (fileProject.Parent.Local)
                {
                    return;
                }
            }

            SymInst inst = (fileOrigin == Origin.PROJECT) ? fileProject.Parent.ParentSym : Config.GetSymIP(fileSym.server, fileSym.sym);
            string  name = (fileOrigin == Origin.PROJECT) ? fileProject.Name             : fileSym.name;
            SymFile file = (fileOrigin == Origin.PROJECT) ? fileProject.ToSymFile(inst)  : fileSym;

            if (inst == null)
            {
                throw new Exception("Error Installing File\nSymFile's Instance Not Found in Config\n(this shouldn't happen)");
            }

            if (modified)
            {
                FileSave();
            }

            RepErr err = RepErr.None();
            bool   completed = false, tryAgain = true;

            while (tryAgain)
            {
                tryAgain = false;
                if (Util.TrySymConnect(inst))
                {
                    try
                    {
                        err       = inst.Connection.FileInstall(file);
                        completed = true;
                    }
                    catch (Exception ex)
                    {
                        if (MessageBox.Show("Error Installing File \"" + name + "\"\n" + ex.Message + "\n\nRetry?", "PwrIDE", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                        {
                            tryAgain = true;
                        }
                        inst.Disconnect();
                    }
                }
            }
            if (completed)
            {
                SetRepError(err);
                if (err.any == false)
                {
                    MessageBox.Show("Installed \"" + name + "\"\nSize: " + Util.FormatBytes(err.installedSize));
                }
            }
        }