示例#1
0
        private string GetAssetNameForReleaseType(ReleaseType releaseType)
        {
            var result = string.Empty;

            switch (releaseType)
            {
            case ReleaseType.Presets:
                result = CoreConstants.PresetsFiles.BuildingPresetsFile;
                break;

            case ReleaseType.PresetsAndIcons:
                result = "Presets.and.Icons.Update";
                break;

            case ReleaseType.PresetsIcons:
                result = CoreConstants.PresetsFiles.IconNameFile;
                break;

            case ReleaseType.PresetsColors:
                result = CoreConstants.PresetsFiles.ColorPresetsFile;
                break;

            case ReleaseType.PresetsWikiBuildingInfo:
                result = CoreConstants.PresetsFiles.WikiBuildingInfoPresetsFile;
                break;

            case ReleaseType.Unknown:
            default:
                break;
            }

            return(result);
        }
        public WorkflowInfo(IWorkflow workflow, IEnumerable <ReleaseInfo> releases, string releaseName,
                            Rejection rejectionType, ReleaseType workflowReactionTypeResponsibleForRejection,
                            RejectionSkippableType rejectionSkippability, int escalationTimeoutInHours,
                            IEnumerable <INote> notes)
        {
            Releases      = releases;
            ReleaseName   = releaseName;
            RejectionType = rejectionType;
            WorkflowReactionTypeResponsibleForRejection = workflowReactionTypeResponsibleForRejection;
            RejectionSkippability    = rejectionSkippability;
            EscalationTimeoutInHours = escalationTimeoutInHours;
            Notes    = notes;
            Workflow = workflow;
            IsEscalationProcedureSet = EscalationTimeoutInHours > 0;
            switch (rejectionSkippability)
            {
            case RejectionSkippableType.NotApplicable:
                IsRejectionSkippable = null;
                break;

            case RejectionSkippableType.RejectionCannotBeSkipped:
                IsRejectionSkippable = false;
                break;

            case RejectionSkippableType.RejectionCanBeSkipped:
                IsRejectionSkippable = true;
                break;

            default:
                throw new ArgumentException("Unknown rejection skippability type");
            }
        }
 /// 设置挂断时间
 /// <summary>
 /// 设置挂断时间
 /// </summary>
 /// <param name="date"></param>
 /// <param name="releasetype"></param>
 /// <param name="AudioURL"></param>
 public void SetReleaseTime(DateTime date, ReleaseType releasetype)
 {
     //设置厂家id
     CallRecordORIG.SessionID     = HollyContactHelper.Instance.GetHollyCallID(); //厂家callid
     CallRecordORIG.GenesysCallID = HollyContactHelper.Instance.GetHollyCallID(); //厂家callid
     //设置主叫和被叫 (已存在数据则不覆盖)
     SetPhoneNumAndAni(false);
     //设置挂断时间
     if (releasetype == ReleaseType.客服挂断)
     {
         CallRecordORIG.AgentReleaseTime = date;
         Loger.Log4Net.Info("[==BusinessProcess=] >>>> AgentReleaseTime >>>> " + date);
     }
     else if (releasetype == ReleaseType.用户挂断)
     {
         CallRecordORIG.CustomerReleaseTime = date;
         Loger.Log4Net.Info("[==BusinessProcess=] >>>> CustomerReleaseTime >>>> " + date);
     }
     //设置话后开始时间
     CallRecordORIG.AfterWorkBeginTime = date;
     Loger.Log4Net.Info("[==BusinessProcess=] >>>> AfterWorkBeginTime >>>> " + date);
     //获取录音地址
     GetURL(date);
     //计算通话时长
     CalcTotalTime(date);
     //检查是否转接出去的电话
     //存在转接开始时间,没有转接取消时间
     if (CallRecordORIG.ConsultTime.HasValue == true &&
         CallRecordORIG.ReconnectCall.HasValue == false &&
         CallRecordORIG.TransferOutTime.HasValue == false)
     {
         SetTransferOutTime(date);
     }
 }
示例#4
0
        static void UpdateManifestVersion(string manifestPath, ReleaseType releaseType)
        {
            var document = XDocument.Load(manifestPath);
            var xmlns    = new XmlNamespaceManager(new NameTable());

            xmlns.AddNamespace("ms", VsxXmlns);
            var     identityElement  = document.XPathSelectElement("/ms:PackageManifest/ms:Metadata/ms:Identity", xmlns);
            var     versionAttribute = identityElement.Attribute("Version");
            var     version          = new Version((string)versionAttribute);
            Version newVersion;

            switch (releaseType)
            {
            case ReleaseType.Prerelease:
                newVersion = new Version(version.Major, version.Minor, version.Build + 1);
                break;

            case ReleaseType.BugfixRelease:
                newVersion = new Version(version.Major, version.Minor, version.Build + 1);
                break;

            case ReleaseType.FeatureRelease:
                newVersion = new Version(version.Major, version.Minor + 1, version.Build);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(releaseType), releaseType, null);
            }
            versionAttribute.Value = newVersion.ToString();
            document.Save(manifestPath);
        }
示例#5
0
        private string GetTagForReleaseType(ReleaseType releaseType)
        {
            var result = string.Empty;

            switch (releaseType)
            {
            case ReleaseType.Presets:
            case ReleaseType.PresetsAndIcons:
                result = TAG_PRESETS;
                break;

            case ReleaseType.PresetsIcons:
                result = TAG_PRESETS_ICONS;
                break;

            case ReleaseType.PresetsColors:
                result = TAG_PRESETS_COLORS;
                break;

            case ReleaseType.PresetsWikiBuildingInfo:
                result = TAG_PRESETS_WIKIBUILDINGINFO;
                break;

            case ReleaseType.Unknown:
            default:
                break;
            }

            return(result);
        }
示例#6
0
 public SematicVersion NextRelease(ReleaseType type)
 {
     if (!IsRelease)
     {
         PreRelease = new string[0];
         if (Major == 0)
         {
             Major = 1;
             Minor = 0;
             Patch = 0;
         }
     }
     else if (type == ReleaseType.Major)
     {
         Major++;
         Minor = 0;
         Patch = 0;
     }
     else if (type == ReleaseType.Minor)
     {
         Minor++;
         Patch = 0;
     }
     else
     {
         Patch++;
     }
     Validate();
     return(this);
 }
示例#7
0
        private string GetPathToUpdatedPresetsFile(ReleaseType releaseType)
        {
            var result = string.Empty;

            //maybe this will change for each presets type in the future

            switch (releaseType)
            {
            case ReleaseType.Presets:
                result = Path.Combine(_basePath, CoreConstants.PrefixUpdatedPresetsFile + GetAssetNameForReleaseType(releaseType));
                break;

            case ReleaseType.PresetsAndIcons:
                result = Path.Combine(_basePath, CoreConstants.PrefixUpdatedPresetsFile + GetAssetNameForReleaseType(releaseType));
                break;

            case ReleaseType.PresetsIcons:
                result = Path.Combine(_basePath, CoreConstants.PrefixUpdatedPresetsFile + GetAssetNameForReleaseType(releaseType));
                break;

            case ReleaseType.PresetsColors:
                result = Path.Combine(_basePath, CoreConstants.PrefixUpdatedPresetsFile + GetAssetNameForReleaseType(releaseType));
                break;

            case ReleaseType.PresetsWikiBuildingInfo:
                result = Path.Combine(_basePath, CoreConstants.PrefixUpdatedPresetsFile + GetAssetNameForReleaseType(releaseType));
                break;

            case ReleaseType.Unknown:
            default:
                break;
            }

            return(result);
        }
示例#8
0
        ///////////////////////////////////////////////////////////////////////

        public Uri CreateUri(
            BuildType buildType,
            ReleaseType releaseType
            )
        {
            if (baseUri == null)
            {
                return(null);
            }

            try
            {
                string relativeUri = Format(buildType, releaseType);

                if (relativeUri == null)
                {
                    return(null);
                }

                Uri uri;

                if (Uri.TryCreate(baseUri, relativeUri, out uri))
                {
                    return(uri);
                }
            }
            catch
            {
                // do nothing.
            }

            return(null);
        }
示例#9
0
        public void comboBox_vType_selectionChanged(object sender, EventArgs e)
        {
            ReleaseType type  = ReleaseType.unknown;
            string      value = ((comboBox_vType.SelectedItem as ComboBoxItem).Content.ToString());

            switch (value)
            {
            case "Release":
                type = ReleaseType.release;
                break;

            case "Snapshot":
                type = ReleaseType.snapshot;
                break;

            case "Beta":
                type = ReleaseType.old_beta;
                break;

            case "Alpha":
                type = ReleaseType.old_alpha;
                break;

            case "All":
                comboBox_mcver.Items.Filter = null;
                return;
            }

            comboBox_mcver.Items.Filter = (p) => { return(((p as Control).Tag as TinyMinecraftVersion).Type == type); };
        }
        public T ReadJson <T>(ReleaseType rtype)
        {
            string json = null;

            switch (rtype)
            {
            case ReleaseType.Deployment:
                json = File.ReadAllText("pipelines\\deployments.json");
                break;

            case ReleaseType.Environment:
                json = File.ReadAllText("pipelines\\environments.json");
                break;

            case ReleaseType.Project:
                json = File.ReadAllText("pipelines\\projects.json");
                break;

            case ReleaseType.Release:
                json = File.ReadAllText("pipelines\\releases.json");
                break;
            }

            return(JsonConvert.DeserializeObject <T>(json));;
        }
示例#11
0
        private IEnumerable <NewpctRelease> ParseDailyContent(string content)
        {
            var SearchResultParser = new HtmlParser();
            var doc = SearchResultParser.Parse(content);

            List <NewpctRelease> releases = new List <NewpctRelease>();

            try
            {
                var rows = doc.QuerySelectorAll(".content .info");
                foreach (var row in rows)
                {
                    var anchor = row.QuerySelector("a");
                    var title  = Regex.Replace(anchor.TextContent, @"\s+", " ").Trim();
                    var title2 = Regex.Replace(anchor.GetAttribute("title"), @"\s+", " ").Trim();
                    if (title2.Length >= title.Length)
                    {
                        title = title2;
                    }

                    var detailsUrl = anchor.GetAttribute("href");
                    if (!_includeVo && _voUrls.Any(vo => detailsUrl.ToLower().Contains(vo.ToLower())))
                    {
                        continue;
                    }

                    var         span        = row.QuerySelector("span");
                    var         quality     = span.ChildNodes[0].TextContent.Trim();
                    ReleaseType releaseType = ReleaseTypeFromQuality(quality);
                    var         sizeText    = span.ChildNodes[1].TextContent.Replace("Tama\u00F1o", "").Trim();

                    var div      = row.QuerySelector("div");
                    var language = div.ChildNodes[1].TextContent.Trim();
                    _dailyResultIdx++;

                    NewpctRelease newpctRelease;
                    if (releaseType == ReleaseType.TV)
                    {
                        newpctRelease = GetReleaseFromData(releaseType,
                                                           string.Format("Serie {0} - {1} Calidad [{2}]", title, language, quality),
                                                           detailsUrl, quality, language, ReleaseInfo.GetBytes(sizeText), _dailyNow - TimeSpan.FromMilliseconds(_dailyResultIdx));
                    }
                    else
                    {
                        newpctRelease = GetReleaseFromData(releaseType,
                                                           string.Format("{0} [{1}][{2}]", title, quality, language),
                                                           detailsUrl, quality, language, ReleaseInfo.GetBytes(sizeText), _dailyNow - TimeSpan.FromMilliseconds(_dailyResultIdx));
                    }

                    releases.Add(newpctRelease);
                }
            }
            catch (Exception ex)
            {
                OnParseError(content, ex);
            }

            return(releases);
        }
示例#12
0
        static void UpdateAppConfigVersion(string appConfigPath, ReleaseType releaseType)
        {
            var document = XDocument.Load(appConfigPath);
            var element  = document.XPathSelectElement("/Other/IsPrerelease");

            element.Value = releaseType == ReleaseType.Prerelease ? bool.TrueString : bool.FalseString;
            document.Save(appConfigPath);
        }
示例#13
0
 public void releaseTo(Client client, ReleaseType type)
 {
     switch (type)
     {
     case ReleaseType.RELEASE_ALL:
         break;
     }
 }
示例#14
0
        void Create(int id, int code, string name, string info, string icon_name,
                    ApplyType applyType, ApplyProperty applyProperty, ReleaseType releaseType, string efx_name, int animName, params SkillLevelDate[] skillLevelDates)
        {
            SkillInitial skillInitial = new SkillInitial(id, code, name, info, icon_name,
                                                         applyType, applyProperty, releaseType, efx_name, animName, skillLevelDates);

            skillInitials.Add(skillInitial);
            mapSkill.Add(id, skillInitial);
        }
示例#15
0
        public ArtistReleaseType(ReleaseType type, ReleaseStatus status, ReleaseArtistType artistType)
        {
            StringBuilder builder = new StringBuilder();

            Format(builder, type, artistType);
            builder.Append('+');
            Format(builder, status, artistType);
            str = builder.ToString();
        }
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                // Get the Document
                Document document = commandData.Application.ActiveUIDocument.Document;

                // Create an Analytical Member
                AnalyticalMember analyticalMember = CreateAnalyticalMember.CreateMember(document);

                // Start transaction
                using (Transaction transaction = new Transaction(document, "Release Conditions"))
                {
                    transaction.Start();



                    // Get release conditions of analytical member
                    IList <ReleaseConditions> releaseConditions = analyticalMember.GetReleaseConditions();
                    foreach (ReleaseConditions rc in releaseConditions)
                    {
                        Console.WriteLine("Position: " + rc.Start +
                                          "Fx: " + rc.Fx.ToString() +
                                          "Fy: " + rc.Fy.ToString() +
                                          "Fz: " + rc.Fz.ToString() +
                                          "Mx: " + rc.Mx.ToString() +
                                          "My: " + rc.My.ToString() +
                                          "Mz: " + rc.Mz.ToString());
                    }

                    // Get release type at start
                    ReleaseType releaseType = analyticalMember.GetReleaseType(true);

                    // Change release type
                    analyticalMember.SetReleaseType(true, ReleaseType.UserDefined);

                    try
                    {
                        analyticalMember.SetReleaseConditions(new ReleaseConditions(true, false, true, false, true, false, true));
                    }
                    catch (InvalidOperationException ex)
                    {
                        message = ex.Message;
                        return(Result.Failed);
                    }

                    transaction.Commit();
                }

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(Result.Failed);
            }
        }
示例#17
0
 public NewpctRelease(NewpctRelease copyFrom) :
     base(copyFrom)
 {
     NewpctReleaseType = copyFrom.NewpctReleaseType;
     SeriesName        = copyFrom.SeriesName;
     Season            = copyFrom.Season;
     Episode           = copyFrom.Episode;
     EpisodeTo         = copyFrom.EpisodeTo;
 }
示例#18
0
        protected override bool ReadRealWorldParameters()
        {
            // Note that the PresetPluginName is "SSLComp" even if the PlugInName is "SSLComp Stereo"
            if (PresetPluginName == "SSLComp")
            {
                // <Parameters Type="RealWorld">8 1 * 3 4 3 * 1 1 1
                // 0 0 0.95000000000000006661 1 0.95000000000000006661 </Parameters>

                // split the parameters text into sections
                string[] splittedPhrase = PresetRealWorldParameters.Split(' ', '\n');

                // Threshold (-15 - +15)
                Threshold = float.Parse(splittedPhrase[0], CultureInfo.InvariantCulture); // compression threshold in dB

                // Ratio (2:1=0, 4:1=1, 10:1=2)
                Ratio = (RatioType)Enum.Parse(typeof(RatioType), splittedPhrase[1]);

                // Fade [Off=0 or *, Out=1, In=2]
                if (splittedPhrase[2] != "*")
                {
                    Fade = (FadeType)Enum.Parse(typeof(FadeType), splittedPhrase[2]);
                }
                else
                {
                    Fade = FadeType.Off;
                }

                // Attack [0 - 5, .1 ms, .3 ms, 1 ms, 3 ms, 10 ms, 30 ms)
                Attack = (AttackType)int.Parse(splittedPhrase[3]);

                // Release: 0 - 4, .1 s, .3 s, .6 s, 1.2 s, Auto
                Release = (ReleaseType)int.Parse(splittedPhrase[4]);

                // Make-Up Gain (-5 - +15) dB
                MakeupGain = float.Parse(splittedPhrase[5], CultureInfo.InvariantCulture);

                //*
                string Delimiter1 = splittedPhrase[6];

                // Rate-S (1 - +60) seconds
                // Autofade duration. Variable from 1 to 60 seconds
                RateS = float.Parse(splittedPhrase[7], CultureInfo.InvariantCulture);

                // In
                In = (splittedPhrase[8] == "1");

                // Analog
                Analog = (splittedPhrase[9] == "1");

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#19
0
        /* Function: ToVersionInt
         * Takes a version's component parts and returns them encoded in the <Integer Format>.  Also sanity-checks
         * the values so impossible combinations will result in zero.
         */
        static private ulong ToVersionInt(byte majorVersion, byte minorVersion, byte bugfixVersion,
                                          ReleaseType type, ushort count, byte month, byte day, ushort year)
        {
            ulong result = 0;

            // Either the major or the minor version must be set.
            if (majorVersion == 0 && minorVersion == 0)
            {
                return(0);
            }

            // All three also need to be under 100, but the regular expression already limits them to two digits for us.

            result |= (ulong)majorVersion << 56;
            result |= (ulong)minorVersion << 48;
            result |= (ulong)bugfixVersion << 40;

            result |= (ulong)type << 32;

            // Full releases cannot have date or count fields.
            if (type == ReleaseType.Full)
            {
                if (count != 0 || month != 0 || day != 0 || year != 0)
                {
                    return(0);
                }
            }

            // All other release types must have count or date fields.
            else
            {
                if (count != 0)
                {
                    if (count >= 1000 || month != 0 || day != 0 || year != 0)
                    {
                        return(0);
                    }

                    result |= (ulong)count << 16;
                }
                else
                {
                    if (month < 1 || month > 12 || day < 1 || day > 31 || year < 1990 || year > 2100)
                    {
                        return(0);
                    }

                    result |= (ulong)year << 16;
                    result |= (ulong)month << 8;
                    result |= day;
                }
            }

            return(result);
        }
        public VersionInfo(Version assemblyVersion)
        {
            this.assemblyVersion = assemblyVersion;
#if DEBUG
            releaseType = ReleaseType.Debug;
#elif TEST
            releaseType = ReleaseType.Test;
#else
            releaseType = ReleaseType.Stable;
#endif
        }
示例#21
0
        private IEnumerator DownloadPack(ReleaseType releaseType)
        {
            EditorUtility.DisplayProgressBar("Downloading", $"Downloading latest {releaseType}", 0);
            try
            {
                ReleaseResponse parsed       = null;
                string          errorMessage = null;
                var             releaseTask  = GitHubApi.GetLatestReleaseForRepo(
                    GithubRepo,
                    releaseType,
                    r => parsed       = r,
                    e => errorMessage = e);
                while (releaseTask.MoveNext())
                {
                    yield return(releaseTask.Current);
                }
                if (!string.IsNullOrEmpty(errorMessage))
                {
                    EditorUtility.DisplayDialog("Error", errorMessage, "Ok");
                    yield break;
                }

                if (buildPacks.Any(p => p.Id == parsed.id))
                {
                    EditorUtility.DisplayDialog("Info", $"Version {parsed.tag_name} already downloaded", "Ok");
                    yield break;
                }

                var downloadTask = DownloadPack(packsLocation, parsed, error =>
                {
                    errorMessage = error;
                });
                while (downloadTask.MoveNext())
                {
                    yield return(downloadTask.Current);

                    if (!string.IsNullOrEmpty(errorMessage))
                    {
                        EditorUtility.DisplayDialog("Error", errorMessage, "Ok");
                        yield break;
                    }
                }
                if (!string.IsNullOrEmpty(errorMessage))
                {
                    EditorUtility.DisplayDialog("Error", errorMessage, "Ok");
                    yield break;
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                UpdatePacksList();
            }
        }
示例#22
0
 public AbletonGlueCompressor(XElement xelement)
 {
     this.Threshold  = float.Parse(xelement.Descendants("Threshold").Descendants("Manual").Attributes("Value").First().Value, CultureInfo.InvariantCulture);
     this.Range      = float.Parse(xelement.Descendants("Range").Descendants("Manual").Attributes("Value").First().Value, CultureInfo.InvariantCulture);
     this.Makeup     = float.Parse(xelement.Descendants("Makeup").Descendants("Manual").Attributes("Value").First().Value, CultureInfo.InvariantCulture);
     this.Attack     = (AttackType)int.Parse(xelement.Descendants("Attack").Descendants("Manual").Attributes("Value").First().Value, CultureInfo.InvariantCulture);
     this.Ratio      = (RatioType)int.Parse(xelement.Descendants("Ratio").Descendants("Manual").Attributes("Value").First().Value, CultureInfo.InvariantCulture);
     this.Release    = (ReleaseType)int.Parse(xelement.Descendants("Release").Descendants("Manual").Attributes("Value").First().Value, CultureInfo.InvariantCulture);
     this.DryWet     = float.Parse(xelement.Descendants("DryWet").Descendants("Manual").Attributes("Value").First().Value, CultureInfo.InvariantCulture);
     this.PeakClipIn = xelement.Descendants("PeakClipIn").Descendants("Manual").Attributes("Value").First().Value.Equals("true");
 }
示例#23
0
        public ActionResult Album(string artist, string title, ReleaseType releaseType)
        {
            var albumArtist = _library.Library.Artists.Single(a => a.Name == artist);
            var album       = albumArtist.Albums.Single(a => a.Title == title && a.ReleaseType == releaseType);
            var model       = new LibraryAlbumViewModel(album,
                                                        Url.Action(nameof(PlayAlbum), new { artist, title, releaseType }),
                                                        _cloudService.GetArtworkUrl(album),
                                                        _cloudService.GetTrackUrl,
                                                        _cloudService.GetArtworkUrl);

            return(PartialView("_Album", model));
        }
        /// <summary>
        /// Parse a CurseForge mod page for information.
        /// </summary>
        /// <param name="mod">Initialized <see cref="Mod"/> with a set <see cref="Mod.Link"/>.</param>
        /// <returns><see cref="Mod"/> and <see cref="Exception"/>. If there was a exception, <see cref="Mod"/> will be null; if there was no exception, <see cref="Exception"/> will be null.</returns>
        public static (Mod Mod, Exception Exception) ParseForInfo(Mod mod)
        {
            try {
                HtmlWeb htmlWeb = new HtmlWeb()
                {
                    UserAgent = UserAgent
                };
                mod.HTML_Link = htmlWeb.Load(mod.Link);

                if (htmlWeb.StatusCode == HttpStatusCode.OK)
                {
                    HtmlNode node = mod.HTML_Link.DocumentNode;

                    mod.Name = node.SelectSingleNode(Filters.XPaths.Parsing.Info.Name).InnerText.Trim();
                    mod.File = node.SelectSingleNode(Filters.XPaths.Parsing.Info.File).InnerText.Trim();
                    mod.Date = EpochConverter(node.SelectSingleNode(Filters.XPaths.Parsing.Info.Date).Attributes["data-epoch"].Value.Trim());
                    mod.Size = node.SelectSingleNode(Filters.XPaths.Parsing.Info.Size).InnerText.Trim();
                    mod.MD5  = node.SelectSingleNode(Filters.XPaths.Parsing.Info.MD5).InnerText.Trim();

                    ReleaseType releaseType = ReleaseType.MostRecent;
                    Enum.TryParse(node.SelectSingleNode(Filters.XPaths.Parsing.Info.ReleaseType).Attributes["title"].Value.Trim(), out releaseType);
                    mod.ReleaseType = releaseType;

                    if (mod.MinecraftVersion.Count != 0)
                    {
                        mod.MinecraftVersion.Clear();
                    }
                    HtmlNodeCollection minecraftVersions = node.SelectNodes(Filters.XPaths.Parsing.Info.Versions);
                    foreach (HtmlNode minectaftVersion in minecraftVersions)
                    {
                        mod.MinecraftVersion.Add(HtmlEntity.DeEntitize(minectaftVersion.InnerText.Trim()));
                    }

                    mod.Link = HtmlEntity.DeEntitize(mod.Link);
                    mod.Name = HtmlEntity.DeEntitize(mod.Name);
                    mod.File = HtmlEntity.DeEntitize(mod.File);
                    mod.Size = HtmlEntity.DeEntitize(mod.Size);
                    mod.MD5  = HtmlEntity.DeEntitize(mod.MD5);

                    mod.Link_Download = $"{mod.Link}/download";
                    mod.Link_Files    = GetParentURL(mod.Link);

                    return(mod, null);
                }
                else
                {
                    return(null, new HtmlWebException($"HTTP returned status ({(int)htmlWeb.StatusCode}) {htmlWeb.StatusCode}."));
                }
            } catch (Exception ex) {
                return(null, ex);
            }
        }
示例#25
0
        /// <summary>
        /// Fetches a new release of the provided type, optionally at the specific version.
        /// </summary>
        /// <param name="releaseType">The <see cref="ReleaseType">ReleaseType</see> to fetch.</param>
        /// <param name="releaseVersion">The optional version to fetch.</param>
        /// <returns>The release on success, null on failure. Failure can occur if no versionwas found.</returns>
        public static Release Fetch(ReleaseType releaseType, GameVersion?releaseVersion = null)
        {
            string url;

            if (releaseVersion.HasValue)
            {
                url = String.Format("{0}/api/download/{1}/version/{2}", LauncherClient.Domain, releaseType.ToString().ToLowerInvariant(), releaseVersion.Value.ToVersionString());
            }
            else
            {
                url = String.Format("{0}/api/download/{1}/version", LauncherClient.Domain, releaseType.ToString().ToLowerInvariant());
            }

            using (var client = new WebClient())
            {
                string  value = client.DownloadString(url);
                JObject json  = JObject.Parse(value);

                ReleaseType fetchedReleaseType;
                if (!Enum.TryParse((string)json["type"], true, out fetchedReleaseType) || releaseType != fetchedReleaseType)
                {
                    return(null);
                }

                GameVersion fetchedVersion;
                if (!GameVersion.TryParse((string)json["version"], out fetchedVersion) ||
                    (releaseVersion.HasValue && !releaseVersion.Value.Equals(fetchedVersion)))
                {
                    return(null);
                }

                string patchNotes = (string)json["patchNotes"];

                var release = new Release()
                {
                    mVersion    = fetchedVersion,
                    mPatchNotes = patchNotes,
                    mType       = fetchedReleaseType
                };

                foreach (var download in json["downloads"])
                {
                    ReleasePlatform platform;
                    if (Enum.TryParse((string)download["platform"], true, out platform))
                    {
                        release.mPlatformChecksums.Add(platform, (string)download["checksum"]);
                    }
                }

                return(release);
            }
        }
示例#26
0
        public static IEnumerator GetLatestReleaseForRepo(
            string repo,
            ReleaseType releaseType,
            Action <ReleaseResponse> done,
            Action <string> error)
        {
            var releaseRequest = DownloadReleaseInfo(releaseType == ReleaseType.PreRelease ? "?per_page=1" : "/latest", repo, done, error);

            while (releaseRequest.MoveNext())
            {
                yield return(releaseRequest.Current);
            }
        }
示例#27
0
    public List <Skill> getPlayerSkillListByType(ReleaseType type)
    {
        List <Skill> list = new List <Skill>();

        foreach (Skill skill in skillList)
        {
            if ((SkillType)skill.type == SkillType.hero && (ReleaseType)skill.releaseType == type)
            {
                list.Add(skill);
            }
        }
        return(list);
    }
示例#28
0
        private static ReleaseType ParseReleaseType(ref string versionStr)
        {
            var releaseType = new ReleaseType()
            {
                Alpha = ParsePreRelease(ref versionStr, "-alpha."),
                Beta  = ParsePreRelease(ref versionStr, "-beta."),
                Rc    = ParsePreRelease(ref versionStr, "-rc."),
            };

            releaseType.Official = !releaseType.IsPreview;

            return(releaseType);
        }
        protected async Task<HttpResponseMessage> PostPackage(ProjectType projectType, ReleaseType releaseType,
            string versionString)
        {
            string unescapedVersionString = versionString.Replace("-", ".");
            Version version;
            if (!Version.TryParse(unescapedVersionString, out version))
            {
                return Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType,
                    "versionString is not valid: " + versionString);
            }
            if (!Request.Content.IsMimeMultipartContent())
            {
                return Request.CreateErrorResponse(HttpStatusCode.UnsupportedMediaType, 
                    "Content must be mime multipart");
            }

            try
            {
                var name = string.Format("{0}_{1}_{2}.zip",
                    projectType,
                    releaseType,
                    unescapedVersionString);

                Guid fileId;
                using (var contentStream = await Request.Content.ReadAsStreamAsync())
                {
                    fileId = Files.Create(name, contentStream);
                }

                var newFile = Context.Files.Single(file => file.FileId == fileId);

                var package = new WurmAssistantPackage()
                {
                    ProjectType = projectType,
                    ReleaseType = releaseType,
                    VersionString = unescapedVersionString,
                    File = newFile
                };
                Context.WurmAssistantPackages.Add(package);

                RemoveOutdatedPackages(projectType, releaseType);
                Context.SaveChanges();

                return Request.CreateResponse(HttpStatusCode.OK);
            }
            catch (System.Exception e)
            {
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e);
            }
        }
示例#30
0
        ///////////////////////////////////////////////////////////////////////

        private static string ReleaseTypeToString(
            ReleaseType releaseType
            )
        {
            string result = releaseType.ToString();

            if (!String.IsNullOrEmpty(result) &&
                Char.IsDigit(result[result.Length - 1]))
            {
                result += DigitSeparator;
            }

            return(result);
        }
示例#31
0
 public SkillBaseInfo(int id, string name, string sprite, string des, int mp, int ep, int lv, float coolTime, ReleaseObject releasetype, ReleaseType releaseType, List <ApplyAttrEffect> applyAttrEffects)
 {
     ID               = id;
     Name             = name;
     Sprite           = sprite;
     Des              = des;
     MP               = mp;
     EP               = ep;
     DemandLv         = lv;
     CoolTime         = coolTime;
     Releaseobject    = releasetype;
     Type             = releaseType;
     ApplyAttrEffects = applyAttrEffects;
 }
        public static IEnumerable<Project> GenerateProjects(int numberOfProjects, ReleaseType type)
        {
            IList<Project> projects = new List<Project>();

            for (int i = 0; i < numberOfProjects; i++)
            {
                projects.Add(new Project
                {
                    Id = Guid.NewGuid(),
                    Name = type == ReleaseType.Project ? GenerateProjectName() : GenerateReleaseName(),
                    Stage = GenerateTestingStage(),
                    Status = GenerateStatus()
                });
            }

            return projects;
        }
        protected string GetLatestVersion(ProjectType projectType, ReleaseType releaseType)
        {
            var packages = (from p in Context.WurmAssistantPackages
                            where p.ProjectType == projectType
                                  && p.ReleaseType == releaseType
                            orderby p.Created descending
                            select p).ToArray();

            var latest = (from p in packages
                          orderby p.Version descending, p.Created descending
                          select p).FirstOrDefault();

            if (latest == null)
            {
                return new Version(0,0,0,0).ToString();
            }
            else
            {
                return latest.VersionString;
            }
        }
        protected HttpResponseMessage GetPackage(ProjectType projectType, ReleaseType releaseType, string versionString)
        {
            string unescapedVersionString = versionString.Replace("-", ".");
            var package = (from p in Context.WurmAssistantPackages
                           where p.VersionString == unescapedVersionString
                                 && p.ProjectType == projectType
                                 && p.ReleaseType == releaseType
                           orderby p.Created descending
                           select p).FirstOrDefault();
            if (package == null)
            {
                return new HttpResponseMessage(HttpStatusCode.NotFound);
            }

            var response = new HttpResponseMessage(HttpStatusCode.OK);
            response.Content = new StreamContent(Files.Read(package.File.FileId));
            response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = package.File.Name
            };
            return response;
        }
示例#35
0
 private void majorRadioButton_CheckedChanged(object sender, EventArgs e)
 {
     releaseType = ReleaseType.Major;
     updatingToLabel.Text = "To: "
         + PreparedDeploySetupContext.GetNextVersion(releaseType, deploySetupContext.CurrentVersion);
 }
示例#36
0
 private NativeStringMarshaler(ReleaseType releaseType)
 {
     this.releaseType = releaseType;
 }
示例#37
0
 public WorkflowInfo(IWorkflow workflow, IEnumerable<ReleaseInfo> releases, string releaseName,
                     Rejection rejectionType, ReleaseType workflowReactionTypeResponsibleForRejection,
                     RejectionSkippableType rejectionSkippability, int escalationTimeoutInHours,
                     IEnumerable<INote> notes)
 {
     Releases = releases;
     ReleaseName = releaseName;
     RejectionType = rejectionType;
     WorkflowReactionTypeResponsibleForRejection = workflowReactionTypeResponsibleForRejection;
     RejectionSkippability = rejectionSkippability;
     EscalationTimeoutInHours = escalationTimeoutInHours;
     Notes = notes;
     Workflow = workflow;
     IsEscalationProcedureSet = EscalationTimeoutInHours > 0;
     switch (rejectionSkippability)
     {
         case RejectionSkippableType.NotApplicable:
             IsRejectionSkippable = null;
             break;
         case RejectionSkippableType.RejectionCannotBeSkipped:
             IsRejectionSkippable = false;
             break;
         case RejectionSkippableType.RejectionCanBeSkipped:
             IsRejectionSkippable = true;
             break;
         default:
             throw new ArgumentException("Unknown rejection skippability type");
     }
 }
示例#38
0
        public ReleaseCollection LoadReleasesForGivenArtist(Artist artist, ReleaseType type, int page)
        {
            List<Release> items = new List<Release>();
            DataSet dsReleases = MakeDataSet("SELECT *, release.status FROM release, artist  WHERE artist.id = release.artist AND artist.identifier = '" + artist.Identifier + "' AND type = " + ((int)type).ToString() + " AND release.status = 0 ORDER BY release_date DESC");
               ReleaseCollection rc = new ReleaseCollection(this, items);
            foreach (DataRow releaseRow in dsReleases.Tables[0].Rows)
            {
                Release r = ReleaseFromDataRow(releaseRow);
                items.Add(r);

            }
            if (rc.Count < 1)
                return null;
            return rc;
        }
        void RemoveOutdatedPackages(ProjectType projectType, ReleaseType releaseType)
        {
            var allPackages =
                Context.WurmAssistantPackages.Where(
                    package => package.ProjectType == projectType && package.ReleaseType == releaseType).ToArray();

            var packageCount = allPackages.Count();
            var countToRemove = packageCount - 3;
            if (countToRemove > 0)
            {
                var toDelete = allPackages.OrderBy(package => package.Created).Take(countToRemove);
                foreach (var package in toDelete)
                {
                    Context.WurmAssistantPackages.Remove(package);
                    Context.SaveChanges();
                    Files.Delete(package.FileId);
                }
            }
        }
 /// <summary>
 /// Determines whether the specified release list is completed.
 /// </summary>
 /// <param name="releaseList">The release list.</param>
 /// <param name="releaseType">Type of the release.</param>
 /// <returns>is completed value</returns>
 private static bool IsCompleted(IList<ReleaseListItem> releaseList, ReleaseType releaseType)
 {
     return releaseList.Where(release => release.ReleaseTypeEnumValue == releaseType).All(a => a.ReleaseStatusEnumValue == ReleaseStatus.Completed);
 }
示例#41
0
文件: Artist.cs 项目: hannuraina/tag
 public ArtistReleaseType (ReleaseType type, ReleaseStatus status, ReleaseArtistType artistType)
 {
     StringBuilder builder = new StringBuilder ();
     Format (builder, type, artistType);
     builder.Append ('+');
     Format (builder, status, artistType);
     str = builder.ToString ();
 }
        private string Write15_ReleaseType(ReleaseType v)
        {
            switch (v)
            {
                case ReleaseType.Final:
                    return "Final";

                case ReleaseType.Alpha:
                    return "Alpha";

                case ReleaseType.Beta:
                    return "Beta";

                case ReleaseType.RC:
                    return "RC";
            }
            long num = (long) v;
            throw base.CreateInvalidEnumValueException(num.ToString(CultureInfo.InvariantCulture), "Nomad.Configuration.ReleaseType");
        }
示例#43
0
        public static Release Create(Core core, Musician musician, ReleaseType releaseType, string title, long coverId)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            string slug = title;
            Navigation.GenerateSlug(title, ref slug);

            slug = Functions.TrimStringToWord(slug);

            // TODO: fix this
            Item item = Item.Create(core, typeof(Release), new FieldValuePair("musician_id", musician.Id),
                new FieldValuePair("release_title", title),
                new FieldValuePair("release_slug", slug),
                new FieldValuePair("release_type", (byte)releaseType),
                new FieldValuePair("release_date_ut", UnixTime.UnixTimeStamp()),
                new FieldValuePair("release_cover_art", coverId));

            return (Release)item;
        }
 /// <summary>
 /// Determines whether the specified release list is cancelled.
 /// </summary>
 /// <param name="releaseList">The release list.</param>
 /// <param name="releaseType">Type of the release.</param>
 /// <returns>is cancelled value</returns>
 private static bool IsCancelled(IList<ReleaseListItem> releaseList, ReleaseType releaseType)
 {
     return releaseList.Where(release => release.ReleaseTypeEnumValue == releaseType).Any(a => a.ReleaseStatusEnumValue == ReleaseStatus.Cancelled || (a.ReleaseStatusEnumValue == ReleaseStatus.Planned && a.EndDate < DateTimeHelper.RetrieveCurrentDateTime()));
 }
示例#45
0
        public static UpdateInfo CheckForUpdate(ReleaseType channel = ReleaseType.Unknown)
        {
            if (channel == ReleaseType.Unknown)
                channel = AutoUpdateSettings.DefaultUpdateChannel;

            foreach(var rawurl in MANIFEST_URLS)
            {
                var url = rawurl;

                // Attempt to match the url to change the channel if possible
                // This allows overrides to the URLs for deployment of custom builds,
                // but does not require that they adopt the channel system
                var match = AutoUpdateSettings.MATCH_AUTOUPDATE_URL.Match(url);
                if (match.Success)
                {
                    var mg = match.Groups[AutoUpdateSettings.MATCH_UPDATE_URL_CHANNEL_GROUP];

                    // Replace the channel name with the chosen channel
                    url =
                        url.Substring(0, mg.Index)
                        +
                        channel.ToString().ToLowerInvariant()
                        +
                        url.Substring(mg.Index + mg.Length);
                }

                try
                {
                    using(var tmpfile = new Library.Utility.TempFile())
                    {
                        System.Net.WebClient wc = new System.Net.WebClient();
                        wc.Headers.Add(System.Net.HttpRequestHeader.UserAgent, string.Format("{0} v{1}{2}", APPNAME, SelfVersion.Version, string.IsNullOrWhiteSpace(InstallID) ? "" : " -" + InstallID));
                        wc.Headers.Add("X-Install-ID", InstallID);
                        wc.DownloadFile(url, tmpfile);

                        using(var fs = System.IO.File.OpenRead(tmpfile))
                        using(var ss = new SignatureReadingStream(fs, SIGN_KEY))
                        using(var tr = new System.IO.StreamReader(ss))
                        using(var jr = new Newtonsoft.Json.JsonTextReader(tr))
                        {
                            var update = new Newtonsoft.Json.JsonSerializer().Deserialize<UpdateInfo>(jr);

                            if (TryParseVersion(update.Version) <= TryParseVersion(SelfVersion.Version))
                                return null;

                            // Don't install a debug update on a release build and vice versa
                            if (string.Equals(SelfVersion.ReleaseType, "Debug", StringComparison.InvariantCultureIgnoreCase) && !string.Equals(update.ReleaseType, SelfVersion.ReleaseType, StringComparison.CurrentCultureIgnoreCase))
                                return null;

                            ReleaseType rt;
                            if (!Enum.TryParse<ReleaseType>(update.ReleaseType, true, out rt))
                                rt = ReleaseType.Unknown;

                            // If the update is too low to be considered, skip it
                            // Should never happen, but protects against mistakes in deployment
                            if (rt > channel)
                                return null;

                            LastUpdateCheckVersion = update;
                            return update;
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (OnError != null)
                        OnError(ex);
                }
            }

            return null;
        }
示例#46
0
文件: Artist.cs 项目: hannuraina/tag
 public ArtistReleaseType (ReleaseType type, ReleaseArtistType artistType) : this ((Enum)type, artistType)
 {
 }