Example #1
0
 public AppReleaseInfo(AppRelease r)
 {
     Id = r.Id;
     AppVersion = r.AppVersion;
     LastUpdateTime = r.LastUpdateTime;
     ZipUrl = "/Project/AppReleasePackage/" + Id;
 }
Example #2
0
 internal void UpdateAppRelease(AppRelease release, HttpPostedFileBase file)
 {
     CheckIsAdmin();
     UpdateAppReleaseFile(release, file);
     release.LastUpdateTime = DateTime.Now;
     db.UpdateObject(release);
 }
Example #3
0
        internal void UpdateAppReleaseFileFromUrl(AppRelease release, string url)
        {
            CheckIsAdmin();
            var rid = release.Id;

            System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                string file = Path.GetTempFileName();
                try {
                    System.Net.WebClient wc = new System.Net.WebClient();
                    wc.DownloadFile(url, file);

                    string filePath = release.ZipPath;
                    string dir      = Path.GetDirectoryName(filePath);

                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }

                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                    File.Move(file, filePath);

                    using (var db = DataConnection.GetConnection()) {
                        var r            = db.SelectObjectById <AppRelease> (rid);
                        r.LastUpdateTime = DateTime.Now;
                        db.UpdateObject(r);
                    }
                } finally {
                    File.Delete(file);
                }
            });
        }
Example #4
0
 public ActionResult UploadAssemblies(AppRelease release)
 {
     AppRelease rp = CurrentUserModel.GetAppRelease (release.Id);
     rp.AppVersion = release.AppVersion;
     rp.AddinRootVersion = release.AddinRootVersion;
     CurrentUserModel.UpdateAppRelease (rp, Request.Files.Count > 0 ? Request.Files[0] : null);
     return RedirectToAction ("Index", "Admin");
 }
 public ActionResult UpdateRelease(AppRelease release)
 {
     AppRelease rp = CurrentUserModel.GetAppRelease (release.Id);
     rp.AppVersion = release.AppVersion;
     rp.AddinRootVersion = release.AddinRootVersion;
     rp.CompatibleAppReleaseId = release.CompatibleAppReleaseId;
     if (release.ZipUrl != null)
         CurrentUserModel.UpdateAppReleaseFileFromUrl (rp, release.ZipUrl);
     else
         CurrentUserModel.UpdateAppRelease (rp, Request.Files.Count > 0 ? Request.Files[0] : null);
     return RedirectToAction ("Index", "Admin");
 }
Example #6
0
 public AppReleaseInfo(UserModel m, AppRelease r)
 {
     Id = r.Id;
     AppVersion = r.AppVersion;
     AddinRootVersion = r.AddinRootVersion;
     LastUpdateTime = r.LastUpdateTime;
     if (r.CompatibleAppReleaseId != null) {
         var cr = m.GetAppRelease (r.CompatibleAppReleaseId.Value);
         CompatibleAppVersion = cr.AppVersion;
     }
     ZipUrl = "/Project/AppReleasePackage/" + Id;
 }
Example #7
0
        void UpdateAppReleaseFile(AppRelease release, HttpPostedFileBase file)
        {
            if (file != null && file.ContentLength > 0)
            {
                string filePath = release.ZipPath;
                string dir      = Path.GetDirectoryName(filePath);

                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                file.SaveAs(filePath);
            }
        }
Example #8
0
 internal void CreateAppRelease(AppRelease release, HttpPostedFileBase file)
 {
     CheckIsAdmin();
     release.ApplicationId  = application.Id;
     release.LastUpdateTime = DateTime.Now;
     db.InsertObject(release);
     if (release.ZipUrl != null)
     {
         UpdateAppReleaseFileFromUrl(release, release.ZipUrl);
     }
     else
     {
         UpdateAppReleaseFile(release, file);
     }
 }
Example #9
0
 public void CreateAppRelease(LoginInfo login, string version, string addinsVersion, string compatibleVersion)
 {
     using (UserModel m = GetUserModel (login)) {
         AppRelease rel = new AppRelease ();
         rel.AppVersion = version;
         rel.AddinRootVersion = addinsVersion;
         if (!string.IsNullOrEmpty (compatibleVersion)) {
             var compatRel = m.GetAppReleases ().FirstOrDefault (r => r.AppVersion == compatibleVersion);
             if (compatRel != null)
                 rel.CompatibleAppReleaseId = compatRel.Id;
             else
                 throw new Exception ("Invalid compatible release number. Release '" + compatibleVersion + "' not found");
         }
         m.CreateAppRelease (rel, null);
     }
 }
Example #10
0
        internal void UpdateAppRelease(AppRelease release, HttpPostedFileBase file)
        {
            release.LastUpdateTime = DateTime.Now;
            db.UpdateObject (release);

            string filePath = release.ZipPath;
            string dir = Path.GetDirectoryName (filePath);

            if (!Directory.Exists (dir))
                Directory.CreateDirectory (dir);

            file.SaveAs (filePath);
        }
Example #11
0
 //
 // GET: /AppRelease/Create
 public ActionResult Create()
 {
     AppRelease rel = new AppRelease ();
     ViewData["Creating"] = true;
     return View("Edit", rel);
 }
 public ActionResult CreateRelease(AppRelease release)
 {
     CurrentUserModel.CreateAppRelease (release, Request.Files.Count > 0 ? Request.Files[0] : null);
     return RedirectToAction ("Index", "Admin");
 }
Example #13
0
        void UpdateAppReleaseFile(AppRelease release, HttpPostedFileBase file)
        {
            if (file != null) {
                string filePath = release.ZipPath;
                string dir = Path.GetDirectoryName (filePath);

                if (!Directory.Exists (dir))
                    Directory.CreateDirectory (dir);

                file.SaveAs (filePath);
            }
        }
Example #14
0
 internal void UpdateAppRelease(AppRelease release, HttpPostedFileBase file)
 {
     CheckIsAdmin ();
     release.LastUpdateTime = DateTime.Now;
     db.UpdateObject (release);
     UpdateAppReleaseFile (release, file);
 }
Example #15
0
 internal void CreateAppRelease(AppRelease release, HttpPostedFileBase file)
 {
     CheckIsAdmin ();
     release.ApplicationId = application.Id;
     release.LastUpdateTime = DateTime.Now;
     db.InsertObject (release);
     UpdateAppReleaseFile (release, file);
 }
Example #16
0
 internal void CreateAppRelease(AppRelease release, HttpPostedFileBase file)
 {
     CheckIsAdmin ();
     release.ApplicationId = application.Id;
     release.LastUpdateTime = DateTime.Now;
     db.InsertObject (release);
     if (release.ZipUrl != null)
         UpdateAppReleaseFileFromUrl (release, release.ZipUrl);
     else
         UpdateAppReleaseFile (release, file);
 }
Example #17
0
        internal void UpdateAppReleaseFileFromUrl(AppRelease release, string url)
        {
            CheckIsAdmin ();
            var rid = release.Id;
            System.Threading.ThreadPool.QueueUserWorkItem (delegate {
                string file = Path.GetTempFileName ();
                try {
                    System.Net.WebClient wc = new System.Net.WebClient ();
                    wc.DownloadFile (url, file);

                    string filePath = release.ZipPath;
                    string dir = Path.GetDirectoryName (filePath);

                    if (!Directory.Exists (dir))
                        Directory.CreateDirectory (dir);

                    if (File.Exists (filePath))
                        File.Delete (filePath);
                    File.Move (file, filePath);

                    using (var db = DataConnection.GetConnection ()) {
                        var r = db.SelectObjectById<AppRelease> (rid);
                        r.LastUpdateTime = DateTime.Now;
                        db.UpdateObject (r);
                    }
                } finally {
                    File.Delete (file);
                }
            });
        }