示例#1
0
        public void CanCreateEmptyTest()
        {
            var setupFile = new InstallerSetup();
            var setupText = setupFile.GetSetupText();

            setupText.ShouldEqual("");
        }
示例#2
0
        public void Download_Click(object sender, EventArgs e)
        {
            var installerSetup = new InstallerSetup();

            installerSetup.Add((int)_channel.ChannelID, _channel.ChannelGUID, _channel.ChannelName, 10);
            Response.RedirectPermanent(Url.For(installerSetup), true);
        }
示例#3
0
        private InstallerSetup GetInstallerSubscriptions(int pcID)
        {
            var installerSetup = new InstallerSetup();

            foreach (RepeaterItem ri in PCs.Items)
            {
                HiddenField PCID    = (HiddenField)ri.FindControl("PCID");
                Repeater    Streams = (Repeater)ri.FindControl("Streams");

                if (pcID == int.Parse(PCID.Value))
                {
                    foreach (RepeaterItem ri2 in Streams.Items)
                    {
                        HiddenField StreamID   = (HiddenField)ri2.FindControl("StreamID");
                        HiddenField StreamGUID = (HiddenField)ri2.FindControl("StreamGUID");
                        Label       StreamName = (Label)ri2.FindControl("StreamName");
                        Label       Weighting  = (Label)ri2.FindControl("Weighting");
                        installerSetup.Add(int.Parse(StreamID.Value), StreamGUID.Value, StreamName.Text, int.Parse(Weighting.Text));
                    }

                    break;
                }
            }
            return(installerSetup);
        }
示例#4
0
        public void CanCreateSingleLineTest()
        {
            var setupFile = new InstallerSetup();

            setupFile.Add(10, "GUID", "Stream Name", 20);

            var setupText = setupFile.GetSetupText();

            setupText.ShouldEqual("10,,GUID,,Stream Name,,20\r\n");
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int userID = -1;
            int channelID;

            Helper.TryGetUserID(Session, out userID);

            if (Request.Params["channelID"] == null)
            {
                Response.Redirect("~/AllChannels.aspx");
            }

            if (!int.TryParse(Request.Params["channelID"], out channelID))
            {
                Response.Redirect("~/AllChannels.aspx");
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                _channel = client.GetChannelDetailsFull(userID, channelID);
            }
            finally
            {
                client.Dispose();
            }

            if (Request.QueryString["a"] == null)
            {
                var installerSetup = new InstallerSetup();
                installerSetup.Add((int)_channel.ChannelID, _channel.ChannelGUID, _channel.ChannelName, 10);
                Response.RedirectPermanent(Url.For(installerSetup), true);
            }
            ChannelName1.Text         = _channel.ChannelName;
            ChannelName2.Text         = _channel.ChannelName;
            ChannelName3.Text         = _channel.ChannelName;
            PublisherName.Text        = _channel.PublisherDisplayName;
            NoContents.Text           = _channel.NoContents.ToString();
            ShortDescription.Text     = string.IsNullOrEmpty(_channel.ChannelDescription) ? "No description available" : _channel.ChannelDescription;
            LongDescription.Text      = string.IsNullOrEmpty(_channel.ChannelLongDescription) ? "<p>No description available</p>" : "<p>" + Helper.FirstWords(_channel.ChannelLongDescription, 120).Replace("\r\n", "</p><p>") + "</p>";
            NoFollowers.Text          = _channel.NoFollowers.ToString();
            AddDate.Text              = _channel.AddDate.ToShortDateString();
            ContentLastAddedDate.Text = _channel.ContentLastAddedDate.ToShortDateString();
            PreviewLiteral.Visible    = _channel.PrivacyStatus != ChannelPrivacyStatus.Locked;

            _noSlides = _channel.Slides.Count;

            addStreamLink.NavigateUrl = "~/Download.aspx?channelID=" + channelID + "_strm";

            ChannelSlides.DataSource = _channel.Slides;
            ChannelSlides.DataBind();
        }
示例#6
0
        public ActionResult Installer(InstallerSetup subscription)
        {
            // create Custom dir
            string rootInstallersPath = System.Configuration.ConfigurationSettings.AppSettings["tempInstallersPath"];
            string installersPath     = rootInstallersPath + subscription.FolderName + "\\";
            string exeName            = subscription.ExtractorFileName + ".exe";

            if (!Directory.Exists(installersPath))
            {
                var tempInstallPath = rootInstallersPath + Guid.NewGuid() + "\\";
                Directory.CreateDirectory(tempInstallPath);

                // Create custom Setup.ini file

                System.IO.File.WriteAllText(tempInstallPath + "Setup.ini", subscription.GetSetupText());
                System.IO.File.Copy(rootInstallersPath + "Setup.exe", tempInstallPath + "Setup.exe");
                System.IO.File.Copy(rootInstallersPath + "Oxigen.msi", tempInstallPath + "Oxigen.msi");


                RunProcessAndWaitForExit(
                    System.Web.HttpContext.Current.Request.MapPath(
                        System.Web.HttpContext.Current.Request.ApplicationPath) + "Bin\\Oxigen.SelfExtractorCreator.exe",
                    subscription.ExtractorFileName + " \"" + tempInstallPath + "\\\"");
                // sign the self-extractor
                RunProcessAndWaitForExit(System.Configuration.ConfigurationSettings.AppSettings["signToolPath"],
                                         System.Configuration.ConfigurationSettings.AppSettings["signToolArguments"] +
                                         "\"" + tempInstallPath + exeName + "\" >> " +
                                         System.Configuration.ConfigurationSettings.AppSettings["debugPath"]);
                System.IO.File.Delete(tempInstallPath + "Setup.ini");
                System.IO.File.Delete(tempInstallPath + "Setup.exe");
                System.IO.File.Delete(tempInstallPath + "Oxigen.msi");

                try
                {
                    Directory.Move(tempInstallPath, installersPath);
                }
                catch (IOException)
                {
                    //file must have been just created by a different request so just delete the temp folder
                    System.IO.File.Delete(tempInstallPath + exeName);
                    Directory.Delete(tempInstallPath);
                }
            }

            var logEntry = new LogEntry("Installer Download")
            {
                UserRef   = Session.SessionID,
                Message   = subscription.FolderName,
                IpAddress = Request.ServerVariables["REMOTE_ADDR"]
            };

            logEntryRepository.SaveOrUpdate(logEntry);
            return(File(installersPath + exeName, "application/octet-stream", exeName));
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["channelID"] == null)
            {
                Response.Redirect("~AllChannels.aspx");
            }

            int userID = -1;
            int channelID;


            if (!int.TryParse(Request.Params["channelID"], out channelID))
            {
                Response.Redirect("~AllChannels.aspx");
            }

            if (Session["User"] != null)
            {
                userID = ((User)Session["User"]).UserID;
            }

            BLClient client = null;


            try
            {
                client = new BLClient();

                _channel = client.GetChannelToDownload(userID, channelID);
            }
            finally
            {
                client.Dispose();
            }

            if (Request.QueryString["a"] != "v")
            {
                var installerSetup = new InstallerSetup();
                installerSetup.Add(channelID, _channel.ChannelGUID, _channel.ChannelName, 10);
                Response.RedirectPermanent(Url.For(installerSetup), true);
                return;
            }

            StreamName.Text = _channel.ChannelName;
            URL.Text        = System.Configuration.ConfigurationSettings.AppSettings["streamDetailsURL"] + channelID;
        }
示例#8
0
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            ValueProviderResult value = bindingContext.ValueProvider.GetValue("subscription");

            string serializedSubscription = value.AttemptedValue;
            var    subscriptions          = serializedSubscription.Split('|');
            var    setupFile = new InstallerSetup();

            foreach (var subscription in subscriptions)
            {
                var values         = subscription.Split('-');
                var idAndWeighting = values[0].Split('.');
                int channelId      = int.Parse(idAndWeighting[0]);
                int weighting      = (idAndWeighting.Length == 2) ? int.Parse(idAndWeighting[1]) : Channel.DefaultWeighting;
                var channel        = _channelManagementService.Get(channelId);

                setupFile.Add(channelId, channel.ChannelGUID, channel.ChannelName, weighting);
            }
            return(setupFile);
        }
示例#9
0
文件: Helper.cs 项目: Oxigen2/Oxigen
 public static string For(InstallerSetup installerSetup)
 {
     return("http://download.oxigen.net/installer/" + installerSetup.UrlKey);
 }