コード例 #1
0
        public bool IsLess(int major, int minor, int build, VersionType type)
        {
            if (Major < major)
            {
                return(true);
            }
            if (Major > major)
            {
                return(false);
            }

            if (Minor < minor)
            {
                return(true);
            }
            if (Minor > minor)
            {
                return(false);
            }

            if (Build < build)
            {
                return(true);
            }
            if (Build > build)
            {
                return(false);
            }

            return(Type < type);
        }
コード例 #2
0
        public bool IsGreaterEqual(int major, int minor, int build, VersionType type)
        {
            if (Major > major)
            {
                return(true);
            }
            if (Major < major)
            {
                return(false);
            }

            if (Minor > minor)
            {
                return(true);
            }
            if (Minor < minor)
            {
                return(false);
            }

            if (Build > build)
            {
                return(true);
            }
            if (Build < build)
            {
                return(false);
            }

            return(Type >= type);
        }
コード例 #3
0
        /// <summary>
        /// Gets the version set in the current source, or null if one does not exist.
        /// </summary>
        /// <param name="versionType">The type of version to retrieve from the source.</param>
        /// <returns>The found version, or null if one does not exist.</returns>
        public Version GetVersion(VersionType versionType)
        {
            var regex = CreateVersionRegex(versionType);
            var match = regex.Match(Source);

            return(new Version(match.Groups["version"].Value));
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: webdes27/game-updater
        private void SetVersionTypeUnsafe(String av, VersionType a)
        {
            VersionType = a;
            Version     = av;

            switch (a)
            {
            case VersionType.UNKNOWN:
                _versionInfo.Text      = LanguageHolder.Instance()[WordEnum.VERSION_IS_NOT_CHECK];
                _versionInfo.ForeColor = COLOR2;
                _versionInfo.Tag       = "ASSEMBLY";
                _versionInfo.Cursor    = Cursors.Hand;
                break;

            case VersionType.SAME:
            case VersionType.LOWER:
                _versionInfo.Text      = LanguageHolder.Instance()[WordEnum.VERSION_IS_OK];
                _versionInfo.ForeColor = COLOR;
                _versionInfo.Cursor    = Cursors.Default;
                _versionInfo.Tag       = null;
                break;

            case VersionType.BIGGER:
                _versionInfo.Text      = LanguageHolder.Instance()[WordEnum.VERSION_IS_BAD];
                _versionInfo.ForeColor = Color.Red;
                _versionInfo.Tag       = "ASSEMBLY";
                _versionInfo.Cursor    = Cursors.Hand;
                break;
            }
        }
コード例 #5
0
        protected void WritePackages(IEnumerable <JObject> packages, VersionType versionType)
        {
            // Get the PowerShellPackageView
            var view = PowerShellPackage.GetPowerShellPackageView(packages, versionType);

            WriteObject(view, enumerateCollection: true);
        }
コード例 #6
0
ファイル: Version.cs プロジェクト: mafaca/TypeTreeDiff
        private Version From(int major, int minor, int build, VersionType type, int typeNumber)
        {
            ulong data = ((ulong)(major & 0xFFFF) << 48) | ((ulong)(minor & 0xFF) << 40) | ((ulong)(build & 0xFF) << 32)
                         | ((ulong)((int)type & 0xFF) << 24) | ((ulong)(typeNumber & 0xFF) << 16) | (0x000000000000FFFFUL & m_data);

            return(new Version(data));
        }
コード例 #7
0
ファイル: VersionUpdater.cs プロジェクト: Dpst94/tvrename
    public UpdateVersion(string version, VersionType type)
    {
        if (string.IsNullOrWhiteSpace(version))
        {
            throw new ArgumentException("The provided version string is invalid.", nameof(version));
        }

        string matchString = (type == VersionType.Semantic)
            ? @"^(?<major>[0-9]+)((\.(?<minor>[0-9]+))(\.(?<patch>[0-9]+))?)?(\-(?<pre>[0-9A-Za-z\-\.]+|[*]))?(\+(?<build>[0-9A-Za-z\-\.]+|[*]))?$"
            : @"^(?<major>[0-9]+)((\.(?<minor>[0-9]+))(\.(?<patch>[0-9]+))?)?( (?<pre>[0-9A-Za-z\- \.]+))?$";

        Regex regex = new Regex(matchString, RegexOptions.ExplicitCapture);
        Match match = regex.Match(version);

        if (!match.Success || !match.Groups["major"].Success || !match.Groups["minor"].Success)
        {
            throw new ArgumentException("The provided version string is invalid.", nameof(version));
        }
        if (type == VersionType.Semantic && !match.Groups["patch"].Success)
        {
            throw new ArgumentException("The provided version string is invalid semantic version.", nameof(version));
        }

        this.VersionNumber = new Version(int.Parse(match.Groups["major"].Value),
                                         int.Parse(match.Groups["minor"].Value),
                                         match.Groups["patch"].Success ? int.Parse(match.Groups["patch"].Value) : 0);

        this.Prerelease = match.Groups["pre"].Value.Replace(" ", string.Empty);
        this.Build      = match.Groups["build"].Value ?? string.Empty;
    }
コード例 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello!! Its your Document Worker!!");
            Console.WriteLine();
            Console.Write("Enter the Pro or Expert version code: ? ");
            DocumentWorker dw = new DocumentWorker();

            if (int.TryParse(Console.ReadLine(), out int userCode))
            {
                VersionType version = KeyLicenseValidator.Validate(userCode);
                Console.WriteLine("Your version is {0}", version);
                switch (version)
                {
                case VersionType.Standart:
                    break;

                case VersionType.Pro:
                    dw = new ProDocumentWorker();
                    break;

                case VersionType.Expert:
                    dw = new ExpertDocumentWorker();
                    break;

                default:
                    break;
                }
            }

            dw.OpenDocument();
            dw.EditDocument();
            dw.SaveDocument();

            Console.ReadKey();
        }
コード例 #9
0
        public string GenerateVersionNumber(VersionType versionType, string versionNumber)
        {
            string newVersionNumber = string.Empty;

            string[] versionParts = versionNumber.Split('.');
            //first index = Major;
            //Second index = Minor;
            //Third index =draft;

            if (versionType == VersionType.Draft)
            {
                int draftPart = Convert.ToInt32(versionParts[2]);
                draftPart       = draftPart + 1;
                versionParts[2] = draftPart.ToString();
            }
            else if (versionType == VersionType.Minor)
            {
                int minorPart = Convert.ToInt32(versionParts[1]);
                minorPart       = minorPart + 1;
                versionParts[1] = minorPart.ToString();
                //clear the draft part
                versionParts[2] = "0";
            }
            else if (versionType == VersionType.Major)
            {
                int majorPart = Convert.ToInt32(versionParts[0]);
                majorPart       = majorPart + 1;
                versionParts[0] = majorPart.ToString();
                //clear the minor and draft part;
                versionParts[1] = "0";
                versionParts[2] = "0";
            }
            newVersionNumber = string.Join(".", versionParts);
            return(newVersionNumber);
        }
コード例 #10
0
        protected override void LazyInit()
        {
            base.LazyInit();

            if (_aqsSchemaVersion == _validVersionValues[0])
            {
                _aqsSchemaVersionType = VersionType.Item20;
            }
            else if (_aqsSchemaVersion == _validVersionValues[1])
            {
                _aqsSchemaVersionType = VersionType.Item21;
            }
            else if (_aqsSchemaVersion == _validVersionValues[2])
            {
                _aqsSchemaVersionType = VersionType.Item22;
            }
            else
            {
                throw new NotImplementedException();
            }

            GetServiceImplementation(out _requestManager);
            GetServiceImplementation(out _serializationHelper);
            GetServiceImplementation(out _compressionHelper);
            GetServiceImplementation(out _documentManager);
            GetServiceImplementation(out _settingsProvider);
            GetServiceImplementation(out _transactionManager);

            TryGetConfigParameter(CONFIG_PARAM_ACTION_CODES, ref _commaSeparatedActionCodes);
            AppendAuditLogEvent("Action Codes: {0}", _commaSeparatedActionCodes == null ? "NONE" :
                                _commaSeparatedActionCodes);

            _baseDao = ValidateDBProvider(SOURCE_PROVIDER_KEY, typeof(NamedNullMappingDataReader));
        }
コード例 #11
0
 public PackageVersion(int major, int minor, int patch, VersionType type)
 {
     this.Major       = major;
     this.Minor       = minor;
     this.Patch       = patch;
     this.VersionType = type;
 }
コード例 #12
0
        public AppVersion GetNewVersion()
        {
            AppInfo appInfo = AppInfo.Get(this._appName);

            if (appInfo == null)
            {
                return(null);
            }
            Version     version       = Version.Parse(this._version);
            VersionType acceptVersion = UserAcceptVersionType(_userCode, appInfo.App_Id);

            acceptVersion = acceptVersion | VersionType.Release;//always contain RELEASE version
            long verNumber  = version.GetVersionNumber();
            var  collection = AppVersionCollection.SingletonInstance().FindAll(it => it.App_Id == appInfo.App_Id && it.VersionNumber > verNumber && (it.Version_Type & acceptVersion) == it.Version_Type);

            if (collection == null || collection.Count <= 0)
            {
                return(null);
            }
            var        forceUpgrades = collection.FindAll(it => it.Is_Force_Upgrade == 1);//force upgrade app versions
            var        orderedList   = collection.OrderByDescending(it => it.VersionNumber);
            AppVersion latestVersion = orderedList.FirstOrDefault();

            if (latestVersion.Is_Force_Upgrade != 1)
            {
                latestVersion.Is_Force_Upgrade = (forceUpgrades != null && forceUpgrades.Count > 0) ? 1 : 0;
            }
            return(latestVersion);
        }
コード例 #13
0
        /// <summary>
        /// 第4步:过滤出要更新的所有文件
        /// </summary>
        private void CheckFilesToUpdate()
        {
            if (curWaiting >= _waitingList.Count)//完成
            {
                _isAllFileListReady = true;
                if (_isSureToUpdateVersion)
                {
                    DownloadVersion();
                }
                return;
            }
            string      sVersion = _waitingList[curWaiting]._strVersion;
            string      xmlUrl   = _strDownloadUrl + sVersion + "/filespath.xml";
            WWWLoadTask task     = new WWWLoadTask("", xmlUrl);//下载该版本的文件列表xml

            task.EventFinished += new task.TaskBase.FinishedHandler(delegate(bool manual, TaskBase currentTask)
            {
                if (manual)
                {
                    return;
                }

                WWW _download = currentTask.GetWWW();
                if (_download == null || _download.text.Length == 0)
                {
                    _versionType = VersionType.Error;
                    _errorCode   = ErrorCode.DownLoadFileListXMLFailed;
                    return;//下载版本信息文件失败
                }
                RecordFilesNeedToDownload(_download.text, sVersion);
                curWaiting++;
                CheckFilesToUpdate();//继续下个版本
            });
        }
コード例 #14
0
        private int Run(string[] args)
        {
            if (args.Length >= 1)
            {
                if (args[0] == "solista")
                {
                    _versionType = VersionType.Solista;
                }
                else if (args[0] == "reboot13")
                {
                    _versionType = VersionType.Reboot13;
                }
                else
                {
                    Help();
                    return(Program.ExitCodeWrongParameters);
                }

                Start();
            }
            else
            {
                Help();
                return(Program.ExitCodeWrongParameters);
            }

            Console.WriteLine("Program Ended");
            return(Program.ExitCodeOk);
        }
コード例 #15
0
ファイル: Utils.cs プロジェクト: frododavinci/wabbajack
 public static string ReadStringTerm(this ReadOnlyMemorySlice <byte> bytes, VersionType version)
 {
     if (bytes.Length <= 1)
     {
         return(string.Empty);
     }
     return(GetEncoding(version).GetString(bytes[0..^ 1]));
コード例 #16
0
ファイル: VersionInfo.cs プロジェクト: smabuk/Smab.Version
        public string GetVersion(VersionType versionType)
        {
            string versionString = versionType switch
            {
                VersionType.FileVersion => FileVersion,
                VersionType.ProductVersion => ProductVersion,
                VersionType.AssemblyVersion => AssemblyVersion,
                VersionType.CodeBase => CodeBase,
                VersionType.Location => AssemblyType.Assembly.IsDynamic ? "" : (AssemblyType.Assembly.Location ?? ""),
                _ => ""
            };

            if (string.IsNullOrEmpty(versionString))
            {
                foreach (var ca in AssemblyType.Assembly.CustomAttributes)
                {
                    if (versionType.ToString().ToLowerInvariant() == ca.AttributeType.ToString().Replace("System.Reflection.Assembly", "").Replace("Attribute", "").ToLowerInvariant())
                    {
                        versionString = ca.ConstructorArguments[0].Value.ToString();
                    }
                }
            }

            return(versionString);
        }
コード例 #17
0
        public static string ReadStringLenNoTerm(this BinaryReader rdr, VersionType version)
        {
            var len   = rdr.ReadByte();
            var bytes = rdr.ReadBytes(len);

            return(GetEncoding(version).GetString(bytes));
        }
コード例 #18
0
 public VersionInfo(
     VersionType versionType,
     Version versionNum)
 {
     VersionType = versionType;
     VersionNum  = versionNum;
 }
コード例 #19
0
        public Version Parse(string str)
        {
            str = str.ToLower().Replace("version:", "").Replace("version", "").Replace("ver", "").Replace("v", "");
            string[] arr = str.Split('-');
            if (arr.Length > 1)
            {
                string typeText = arr[0];
                verType = GetVerType(typeText);
                str     = arr[1];

                if (arr.Length > 2)
                {
                    datetime = Convert.ToInt64(arr[2]);
                }
            }
            else
            {
                str = arr[0];
            }

            arr = str.Split('_');
            if (arr.Length > 1)
            {
                string stageTxt = arr[1];
                stages = GetStages(stageTxt);
            }

            arr     = arr[0].Split('.');
            master  = Convert.ToInt32(arr[0]);
            minor   = Convert.ToInt32(arr[1]);
            revised = Convert.ToInt32(arr[2]);
            return(this);
        }
コード例 #20
0
ファイル: FolderRecord.cs プロジェクト: rhysmdnz/wabbajack
 public static int HeaderLength(VersionType version)
 {
     return(version switch
     {
         VersionType.SSE => 0x18,
         _ => 0x10,
     });
コード例 #21
0
 public virtual void Increase(VersionType p_versionType)
 {
     if (p_versionType == GetVersionType())
     {
         number++;
     }
 }
コード例 #22
0
        /// <summary>
        /// Creates a new version number
        /// </summary>
        /// <returns>The version number</returns>
        public static Version CreateVersion(VersionNumberFormat format, VersionType type)
        {
            var year = DateTime.Now.ToString("yy").ToInt();
            var week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay,
                                                                         DayOfWeek.Monday);

            var daysOfYear  = DateTime.Now.DayOfYear;
            var minuteOfDay = (int)DateTime.Now.TimeOfDay.TotalMinutes;

            switch (format)
            {
            case VersionNumberFormat.Short:
                return(type == VersionType.WithCalendarWeek
                        ? new Version(year, week)
                        : new Version(year, daysOfYear));

            case VersionNumberFormat.Middle:
                return(type == VersionType.WithCalendarWeek
                        ? new Version(year, week, 0)
                        : new Version(year, daysOfYear, 0));

            default:
                return(type == VersionType.WithCalendarWeek
                        ? new Version(year, week, 0, minuteOfDay)
                        : new Version(year, daysOfYear, 0, minuteOfDay));
            }
        }
コード例 #23
0
        private static string GetUpgradedVersion(string version, VersionType versionBump)
        {
            var currentVersion = PackageVersion.FromString(version);
            var newVersion     = currentVersion.BumpVersion(versionBump);

            return(newVersion.Serialize());
        }
コード例 #24
0
ファイル: ResManager.cs プロジェクト: vbetter/ResManager
    public void SetVersion(VersionType versionType, Version version)
    {
        string versionStr  = "";
        string versionPath = "";

        switch (versionType)
        {
        case VersionType.package:
            return;

        case VersionType.update:
            versionStr  = JsonMapper.ToJson(version);
            versionPath = PersistentDataPath + UPDATE + ".json";
            break;

        case VersionType.unzip:
            versionStr  = JsonMapper.ToJson(version);
            versionPath = PersistentDataPath + UNZIP + ".json";
            break;

        default:
            return;
        }

        File.WriteAllText(versionPath, versionStr);
    }
コード例 #25
0
        /// <summary>
        /// Get the view of PowerShell Package. Use for Get-Package command. 
        /// </summary>
        /// <param name="metadata"></param>
        /// <param name="versionType"></param>
        /// <returns></returns>
        public static List<PowerShellPackage> GetPowerShellPackageView(IEnumerable<JObject> metadata, VersionType versionType)
        {
            List<PowerShellPackage> view = new List<PowerShellPackage>();
            foreach (JObject json in metadata)
            {
                PowerShellPackage package = new PowerShellPackage();
                package.Id = json.Value<string>(Properties.PackageId);
                package.Version = new List<NuGetVersion>();
                string version = string.Empty;
                NuGetVersion nVersion;

                switch (versionType)
                {
                    case VersionType.all:
                        JArray versions = json.Value<JArray>(Properties.Versions);
                        if (versions != null && !versions.IsEmpty())
                        {
                            if (versions.FirstOrDefault().Type == JTokenType.Object)
                            {
                                package.Version = versions.Select(j => NuGetVersion.Parse((string)j["version"]))
                                    .OrderByDescending(v => v)
                                    .ToList();
                            }

                            if (versions.FirstOrDefault().Type == JTokenType.String)
                            {
                                package.Version = versions.Select(j => (NuGetVersion.Parse((string)j)))
                                    .OrderByDescending(v => v)
                                    .ToList();
                            }
                        }
                        else
                        {
                            version = json.Value<string>(Properties.Version);
                            nVersion = NuGetVersion.Parse(version);
                            package.Version.Add(nVersion);
                        }
                        break;
                    case VersionType.latest:
                        version = json.Value<string>(Properties.LatestVersion);
                        nVersion = NuGetVersion.Parse(version);
                        package.Version.Add(nVersion);
                        break;
                    case VersionType.single:
                        version = json.Value<string>(Properties.Version);
                        nVersion = NuGetVersion.Parse(version);
                        package.Version.Add(nVersion);
                        break;
                }

                package.Description = json.Value<string>(Properties.Description);
                if (string.IsNullOrEmpty(package.Description))
                {
                    package.Description = json.Value<string>(Properties.Summary);
                }
                view.Add(package);
            }
            return view;
        }
コード例 #26
0
        public void TestCase_S09_TC06_ResourceIDDifferentWithUrl()
        {
            Site.Assume.IsTrue(Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11272, this.Site), "This test case runs only when implementation uses the value of the ResourceID attribute to identify the file instead of the Url attribute  when UseResourceID set to true and the ResourceID attribute is set on the Request element.");

            string anotherFile = this.PrepareFile();

            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            // Invoke "GetVersions"sub-request with correct input parameters.
            GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken());
            CellStorageResponse       cellStoreageResponse  = Adapter.CellStorageRequest(
                this.DefaultFileUrl,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, null, true);
            GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site);

            Site.Assert.AreEqual <ErrorCodeType>(
                ErrorCodeType.Success,
                SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "Get versions should be succeed.");

            VersionType version = cellStoreageResponse.ResponseVersion as VersionType;

            Site.Assume.AreEqual <ushort>(3, version.MinorVersion, "This test case runs only when MinorVersion is 3 which indicates the protocol server is capable of performing ResourceID specific behavior.");

            // Set both Url and ResourceID attribute
            cellStoreageResponse = Adapter.CellStorageRequest(
                anotherFile,
                new SubRequestType[] { getVersionsSubRequest },
                "1", 2, 2, null, null, null, null, null, cellStoreageResponse.ResponseCollection.Response[0].ResourceID, true);

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11272
                Site.CaptureRequirementIfIsTrue(
                    cellStoreageResponse.ResponseCollection.Response[0].Url.Equals(this.DefaultFileUrl, StringComparison.CurrentCultureIgnoreCase),
                    "MS-FSSHTTP",
                    11272,
                    @"[In Appendix B: Product Behavior] [UseResourceID] Also when true and the ResourceID attribute is set on the Request element, the implementation does use the value of the ResourceID attribute to identify the file instead of the Url attribute. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11074
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    11074,
                    @"[In MinorVersionNumberType][The value of MinorVersionNumberType] 3: In responses, indicates that the protocol server is capable of performing ResourceID specific behavior.");
            }
            else
            {
                Site.Assert.IsTrue(
                    cellStoreageResponse.ResponseCollection.Response[0].Url.Equals(this.DefaultFileUrl, StringComparison.CurrentCultureIgnoreCase),
                    "[In Appendix B: Product Behavior] [UseResourceID] Also when true and the ResourceID attribute is set on the Request element, the implementation does use the value of the ResourceID attribute to identify the file instead of the Url attribute. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)");
                Site.Assert.AreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site),
                    @"[In MinorVersionNumberType][The value of MinorVersionNumberType] 3: In responses, indicates that the protocol server is capable of performing ResourceID specific behavior.");
            }
        }
コード例 #27
0
 public VersionInfo(int major, int minor = 0, int patch = 0)
 {
     Major = major;
     Minor = minor;
     Patch = patch;
     Type  = VersionType.Final;
     Build = 0;
 }
コード例 #28
0
 public string Pattern(VersionType type, string versionGroupName)
 {
     Debug.Assert(versionStrings.ContainsKey(type));
     string versionName = versionStrings[type];
     Debug.Assert(bracketsEnclosedVersionPattern.ContainsKey(extension));
     string format = bracketsEnclosedVersionPattern[extension];
     return string.Format(format, versionName, versionGroupName);
 }
コード例 #29
0
        public void SetAppropriateTypesForPatch(int major, int minor, int patch, VersionType type)
        {
            // Arrange & Act
            PackageVersion packageversion = new PackageVersion(major, minor, patch, type);

            // Assert
            Assert.IsInstanceOf <int>(packageversion.Patch);
        }
コード例 #30
0
 public VersionInfo(int major, int minor = 0, int patch = 0, VersionType type = VersionType.Final, int build = 0)
 {
     Major = major;
     Minor = minor;
     Patch = patch;
     Type  = type;
     Build = build;
 }
コード例 #31
0
ファイル: Utils.cs プロジェクト: TDarkShadow/wabbajack
 private static Encoding GetEncoding(VersionType version)
 {
     return(version switch
     {
         VersionType.TES3 => Encoding.ASCII,
         VersionType.SSE => Windows1252,
         _ => Encoding.UTF7
     });
コード例 #32
0
 private static Encoding GetEncoding(VersionType version)
 {
     if (version == VersionType.SSE)
     {
         return(Windows1252);
     }
     return(Encoding.UTF7);
 }
コード例 #33
0
ファイル: Utils.cs プロジェクト: christothes/ZSharp
 internal static string VersionToString(byte[] p, VersionType versionType)
 {
     string s = string.Empty;
     foreach (var b in p)
     {
         s += b;
     }
     return s;
 }
コード例 #34
0
        /// <summary>
        /// Instantiates a new version of the AssemblyInfoVersion for the target file contents. The constructor locates the line
        /// number containing the target version type and loads the type into memory for patching.
        /// </summary>
        /// <param name="targetFileContents">The target file lines</param>
        /// <param name="type">The type of version to load</param>
        public AssemblyInfoVersion(string[] targetFileContents, VersionType type)
        {
            Type = type;

            var searchString = $"{AppConfigFacade.AttributeDemarcationCharacters[0]}assembly: {type}(\"";
            var targetLine = targetFileContents.FirstOrDefault(l => l.StartsWith(searchString, StringComparison.OrdinalIgnoreCase));

            if (string.IsNullOrEmpty(targetLine))
                throw new ArgumentException(
                    $"The given target file contents does not have the \"{type}\" assembly version type.");

            Index = new List<string>(targetFileContents).IndexOf(targetLine);
            Version = new Version(targetLine.Replace(searchString, string.Empty).Replace(string.Format("\"){0}", AppConfigFacade.AttributeDemarcationCharacters[1]), string.Empty).Trim());
        }
コード例 #35
0
        /// <summary>
        /// Get the view of PowerShellPackage. Used for Get-Package -ListAvailable command. 
        /// </summary>
        /// <param name="metadata">list of PSSearchMetadata</param>
        /// <param name="versionType"></param>
        /// <returns></returns>
        internal static List<PowerShellRemotePackage> GetPowerShellPackageView(IEnumerable<PSSearchMetadata> metadata, VersionType versionType)
        {
            List<PowerShellRemotePackage> view = new List<PowerShellRemotePackage>();
            foreach (PSSearchMetadata data in metadata)
            {
                PowerShellRemotePackage package = new PowerShellRemotePackage();
                package.Id = data.Identity.Id;
                package.Description = data.Summary;

                switch (versionType)
                {
                    case VersionType.all:
                        {
                            package.Versions = data.Versions.OrderByDescending(v => v);
                            if (package.Versions != null && package.Versions.Any())
                            {
                                LegacyNuGet.SemanticVersion sVersion;
                                LegacyNuGet.SemanticVersion.TryParse(package.Versions.FirstOrDefault().ToNormalizedString(), out sVersion);
                                package.Version = sVersion;
                            }
                        }
                        break;
                    case VersionType.latest:
                        {
                            NuGetVersion nVersion = data.Version == null ? data.Versions.OrderByDescending(v => v).FirstOrDefault() : data.Version;
                            package.Versions = new List<NuGetVersion>() { nVersion };
                            if (nVersion != null)
                            {
                                LegacyNuGet.SemanticVersion sVersion;
                                LegacyNuGet.SemanticVersion.TryParse(nVersion.ToNormalizedString(), out sVersion);
                                package.Version = sVersion;
                            }
                        }
                        break;
                }

                view.Add(package);
            }
            return view;
        }
コード例 #36
0
        /// <summary>
        /// Get the view of PowerShellPackage. Used for Get-Package -Updates command. 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="version"></param>
        /// <param name="versionType"></param>
        /// <returns></returns>
        internal static PowerShellUpdatePackage GetPowerShellPackageUpdateView(PSSearchMetadata data, NuGetVersion version, VersionType versionType, NuGetProject project)
        {
            PowerShellUpdatePackage package = new PowerShellUpdatePackage();
            package.Id = data.Identity.Id;
            package.Description = data.Summary;
            package.ProjectName = project.GetMetadata<string>(NuGetProjectMetadataKeys.Name);
            switch (versionType)
            {
                case VersionType.updates:
                    {
                        package.Versions = data.Versions.Where(p => p > version).OrderByDescending(v => v);
                        if (package.Versions != null && package.Versions.Any())
                        {
                            LegacyNuGet.SemanticVersion sVersion;
                            LegacyNuGet.SemanticVersion.TryParse(package.Versions.FirstOrDefault().ToNormalizedString(), out sVersion);
                            package.Version = sVersion;
                        }
                    }
                    break;
                case VersionType.latest:
                    {
                        NuGetVersion nVersion = data.Versions.Where(p => p > version).OrderByDescending(v => v).FirstOrDefault();
                        if (nVersion != null)
                        {
                            package.Versions = new List<NuGetVersion>() { nVersion };
                            LegacyNuGet.SemanticVersion sVersion;
                            LegacyNuGet.SemanticVersion.TryParse(nVersion.ToNormalizedString(), out sVersion);
                            package.Version = sVersion;
                        }
                    }
                    break;
            }

            return package;
        }
コード例 #37
0
ファイル: AssemblyPage.cs プロジェクト: VISTALL/game-updater
        public void SetVersionTypeU(String va, VersionType t)
        {
            _currentVersion.Text = va;

            //_versionTypeLabel.Text = _versionType.ToString();
            
            _versionTypeLabel.Text =
                LanguageHolder.Instance()[
                    (WordEnum) Enum.Parse(typeof (WordEnum), string.Format("{0}_VERSION", t))];

            switch (t)
            {
                case VersionType.BIGGER:
                case VersionType.SAME:
                    _updateBtn.Enabled = true;
                    break;
            }
        }
コード例 #38
0
ファイル: AssemblyPage.cs プロジェクト: VISTALL/game-updater
 public void SetVersionType(String va, VersionType a)
 {
     var d = new DelegateCall(this, new MainForm.SetVersionTypeDelegate(SetVersionTypeU), va,  a);
    
     Invoke(d);
 }
コード例 #39
0
 protected void WritePackages(Dictionary<VsProject, IEnumerable<JObject>> dictionary, VersionType versionType)
 {
     // Get the PowerShellPackageView
     var view = PowerShellPackageWithProject.GetPowerShellPackageView(dictionary, versionType);
     if (view.IsEmpty())
     {
         if (UseRemoteSource)
         {
             Log(MessageLevel.Info, Resources.Cmdlet_NoPackageUpdates);
         }
         else
         {
             Log(MessageLevel.Info, Resources.Cmdlet_NoPackagesInstalled);
         }
     }
     WriteObject(view, enumerateCollection: true);
 }
コード例 #40
0
ファイル: IDatabase.cs プロジェクト: Stoner19/Memory-Lifter
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLayerVersionInfo"/> struct.
 /// </summary>
 /// <param name="version">The version.</param>
 public DataLayerVersionInfo(Version version)
 {
     Type = VersionType.Equal;
     Version = version;
 }
コード例 #41
0
 private void WritePackages(IEnumerable<PSSearchMetadata> packages, VersionType versionType)
 {
     var view = PowerShellRemotePackage.GetPowerShellPackageView(packages, versionType);
     if (view.Any())
     {
         WriteObject(view, enumerateCollection: true);
     }
     else
     {
         LogCore(MessageLevel.Info, Resources.Cmdlet_GetPackageNoPackageFound);
     }
 }
コード例 #42
0
        protected void SetVersion(VersionType parameterName, string version)
        {
            if (!DatabaseExists())
            {
                return;
            }

            if (VersionMissing(parameterName, Configuration.DatabaseName))
            {
                AddVersion(parameterName, Configuration.DatabaseName, version);
            }
            else
            {
                UpdateVersion(parameterName, Configuration.DatabaseName, version);
            }
        }
コード例 #43
0
 /// <summary>
 /// Locates the appropriate format string for the requirement type
 /// </summary>
 /// <param name="versionType"></param>
 /// <param name="spType"></param>
 /// <param name="productType"></param>
 /// <param name="architectureType"></param>
 /// <param name="includeType"></param>
 /// <returns></returns>
 private string GetDescriptionFormat(VersionType versionType, ServicePackType spType, ProductType productType, ArchitectureType architectureType, IncludeType includeType)
 {
     return DescriptionFormats[(int)versionType, (int)spType, (int)productType, (int)architectureType, (int)includeType];
 }
コード例 #44
0
        private void WritePackages(Dictionary<PSSearchMetadata, NuGetVersion> remoteUpdates, VersionType versionType, NuGetProject project)
        {
            List<PowerShellUpdatePackage> view = new List<PowerShellUpdatePackage>();
            foreach (KeyValuePair<PSSearchMetadata, NuGetVersion> pair in remoteUpdates)
            {
                PowerShellUpdatePackage package = PowerShellUpdatePackage.GetPowerShellPackageUpdateView(pair.Key, pair.Value, versionType, project);
                if (package.Versions != null && package.Versions.Any())
                {
                    view.Add(package);
                }
            }

            if (view.Any())
            {
                WriteObject(view, enumerateCollection: true);
            }
            else
            {
                LogCore(MessageLevel.Info, string.Format(Resources.Cmdlet_NoPackageUpdates, project.GetMetadata<string>(NuGetProjectMetadataKeys.Name)));
            }
        }
コード例 #45
0
ファイル: FileReading.cs プロジェクト: NathanCastle/Kinect
        public static Kinect.Activity ActivityFromText(string location)
        {
            Kinect.Activity newActivityFromText = new Kinect.Activity();
            newActivityFromText.activityStepArray = new List<Kinect.ActivityStep>();
            Kinect.ActivityStep newActivityStep = new Kinect.ActivityStep();
            List<string> strListLines = new List<string>();
            using (StreamReader reader = new StreamReader(location))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    strListLines.Add(line); // Add to list.
                }
            }
            VersionType ActivityVersion = new VersionType();
            bool boolInStep = false;
            bool boolFirstDoc = true;
            bool boolInDoc = false;
            bool boolInJoint = false;
            Kinect.JointOrientationCharacteristics JointCompared = new Kinect.JointOrientationCharacteristics();
            Kinect.BoneOrientationCharacteristics BoneCompared = new Kinect.BoneOrientationCharacteristics();
            string XAMLString = "";
            foreach (string strLine in strListLines)
            {
                if (strLine.StartsWith("Version-Number:"))
                {
                    if (strLine.Substring(15).Trim() == "0.0.2")
                    {
                        ActivityVersion = VersionType.VSprint2;
                    }
                }

                if (strLine.StartsWith("ActivityName: -"))
                {
                    string strName = strLine.Substring(13).TrimEnd(Convert.ToChar("-")).Trim();
                    newActivityFromText.activityName = strName;
                }
                //Begin a new step
                if (strLine.StartsWith("Step#: "))
                {
                    boolInStep = true;
                    newActivityStep = new Kinect.ActivityStep();
                }
                //If already in a step, place all new commands in the current step
                if (boolInStep == true)
                {
                    if (strLine.StartsWith("TimerUsed:")) //deal with the timer
                    {
                        if (strLine.StartsWith("TimerUsed: N")) //no timer
                        {
                            newActivityStep.isTimerUsed = false;
                            newActivityStep.MSTimer = 0;
                        }
                        else
                        {
                            string strtime = strLine.Substring(15);
                            strtime = strtime.TrimStart(Convert.ToChar("#"));
                            strtime = strtime.TrimEnd(Convert.ToChar("#"));
                            strtime = strtime.Trim();
                            newActivityStep.isTimerUsed = true;
                            newActivityStep.MSTimer = Convert.ToInt32(strtime);
                        }
                    }
                    if (strLine.StartsWith("ScoreValue:")) // deal with scoring
                    {
                    }
                    if (strLine.StartsWith("FlowDocCorrect: -")) //deal with correct flow doc
                    {
                        boolInDoc = true;
                        XAMLString = "";
                    }
                    if (strLine.StartsWith("EndFlowDocCorrect: -")) //add flowdoc to activity
                    {
                        boolInDoc = false;

                        using (StringReader stringReader = new StringReader(XAMLString))
                        {
                            XmlReader xmlReader = XmlReader.Create(stringReader);
                            FlowDocument readerLoadFlow = new FlowDocument();
                            readerLoadFlow.Blocks.Add((Section)XamlReader.Load(xmlReader));
                            newActivityStep.activityTextCorrect = readerLoadFlow;
                            XAMLString = "";
                            boolFirstDoc = true;
                        }
                    }
                    if (strLine.StartsWith("FlowDocIncorrect: -")) //deal with incorrect flow doc
                    {
                        boolInDoc = true;
                        XAMLString = "";
                    }
                    if (strLine.StartsWith("EndFlowDocIncorrect: -")) //add incorrect to activity
                    {
                        boolInDoc = false;
                        using (StringReader stringReader = new StringReader(XAMLString))
                        {
                            XmlReader xmlReader = XmlReader.Create(stringReader);
                            FlowDocument readerLoadFlow = new FlowDocument();
                            readerLoadFlow.Blocks.Add((Section)XamlReader.Load(xmlReader));
                            newActivityStep.activityTextWrong = readerLoadFlow;
                            XAMLString = "";
                            boolFirstDoc = true;
                        }
                    }
                    if (strLine.StartsWith("FlowDocDefault: -")) //deal with default flow doc
                    {
                        boolInDoc = true;
                        XAMLString = "";
                    }
                    if (strLine.StartsWith("EndFlowDocDefault: -")) //add default to activity
                    {
                        boolFirstDoc = true;
                        boolInDoc = false;
                        using (StringReader stringReader = new StringReader(XAMLString))
                        {
                            XmlReader xmlReader = XmlReader.Create(stringReader);
                            FlowDocument readerLoadFlow = new FlowDocument();
                            readerLoadFlow.Blocks.Add((Section)XamlReader.Load(xmlReader));
                            newActivityStep.activityTextDefault = readerLoadFlow;
                            XAMLString = "";
                        }
                    }
                    if (boolInDoc == true)
                    {
                        XAMLString = XAMLString + strLine;
                        if (boolFirstDoc == true)
                        {
                            if (XAMLString.StartsWith("FlowDocDefault: -"))
                            {
                                XAMLString = XAMLString.Substring(17);
                            }
                            if (XAMLString.StartsWith("FlowDocIncorrect: -"))
                            {
                                XAMLString = XAMLString.Substring(19);
                            }
                            if (XAMLString.StartsWith("FlowDocCorrect: -"))
                            {
                                XAMLString = XAMLString.Substring(17);
                            }
                            boolFirstDoc = false;
                        }
                    }
                    if (strLine.StartsWith("JointComparison - ") || strLine.StartsWith("BoneComparison - "))//Deal with Joint Comparison
                    {
                        boolInJoint = true;
                        continue;
                    }
                    if (boolInJoint == true) //Add characteristics to joint orientation comparison
                    {
                        if (ActivityVersion == VersionType.VSprint2)
                        {
                            if (strLine.StartsWith("Joint1"))
                            {
                                BoneCompared.FirstJoint = jntJointTypeFromString(strLine, 10);
                            }
                            if (strLine.StartsWith("Joint2"))
                            {
                                BoneCompared.SecondJoint = jntJointTypeFromString(strLine, 10);
                            }
                            if (strLine.StartsWith("Slope"))
                            {
                                BoneCompared.slopeYX = SlopeFromString(strLine);
                            }
                            if (strLine.StartsWith("ErrorRange"))
                            {
                                BoneCompared.acceptableError = ErrorFromString(strLine);
                            }
                        }
                        else
                        {
                            if (strLine.StartsWith("XCompare: Y"))
                            {
                                JointCompared.xCompared = true;
                                JointCompared.jointXPosition = PositionFromString(strLine);
                            }
                            if (strLine.StartsWith("XCompare: N"))
                            {
                                JointCompared.xCompared = false;
                                JointCompared.jointXPosition = 0f;
                            }
                            if (strLine.StartsWith("YCompare: Y"))
                            {
                                JointCompared.yCompared = true;
                                JointCompared.jointYPosition = PositionFromString(strLine);
                            }
                            if (strLine.StartsWith("YCompare: N"))
                            {
                                JointCompared.yCompared = false;
                                JointCompared.jointYPosition = 0f;
                            }
                            if (strLine.StartsWith("ZCompare: Y"))
                            {
                                JointCompared.zCompared = true;
                                JointCompared.jointZPosition = PositionFromString(strLine);
                            }

                            if (strLine.StartsWith("ZCompare: N"))
                            {
                                JointCompared.zCompared = false;
                                JointCompared.jointZPosition = 0f;
                            }
                            if (strLine.StartsWith("Joint Type: - "))
                            {
                                JointCompared.JointTypeID = jntJointTypeFromString(strLine, 15);
                            }
                            if (strLine.StartsWith("ErrorRange: - #"))
                            {
                                JointCompared.acceptableError = ErrorFromString(strLine);
                            }
                        }
                    }
                    if (strLine.StartsWith("EndJoint: - ")) // submit the joint
                    {
                        int intLength = 0;
                        boolInJoint = false;
                        try
                        {
                            intLength = newActivityStep.JointComparison.Length - 1;
                        }
                        catch (Exception ex)
                        {
                            Errors.WriteError(ex, "index array too small");
                            newActivityStep.JointComparison = new Kinect.JointOrientationCharacteristics[1];
                        }
                        Array.Resize(ref newActivityStep.JointComparison, intLength + 2); //account for zero-index and add an extra slot
                        if (intLength >= 0)
                        {
                            newActivityStep.JointComparison[intLength] = JointCompared;
                        }
                        else
                        {
                            newActivityStep.JointComparison[0] = JointCompared;
                        }
                        JointCompared = new Kinect.JointOrientationCharacteristics();
                    }
                    if (strLine.EndsWith("EndBone: - "))
                    {
                        int intLength = 0;
                        boolInJoint = false;
                        try
                        {
                            intLength = newActivityStep.BoneComparison.Length - 1;
                        }
                        catch (Exception ex)
                        {
                            Errors.WriteError(ex, "index array too small");
                            newActivityStep.BoneComparison = new Kinect.BoneOrientationCharacteristics[1];
                        }
                        Array.Resize(ref newActivityStep.BoneComparison, intLength + 2);
                        if (intLength >= 0)
                        {
                            newActivityStep.BoneComparison[intLength] = BoneCompared;
                        }
                        else
                        {
                            newActivityStep.BoneComparison[0] = BoneCompared;
                        }
                        BoneCompared = new Kinect.BoneOrientationCharacteristics();
                    }
                }
                //end the current step, add it to the activity

                if (strLine.EndsWith("EndStep: -"))
                {
                    int intLength = 0;
                    if (ActivityVersion == VersionType.VSprint2)
                    {
                        newActivityStep.usesNewRotationFormat = true;
                    }

                    boolInStep = false;
                    if (newActivityStep.activityTextDefault == null)
                    {
                        continue;
                    }
                    newActivityFromText.activityStepArray.Add(newActivityStep);
                    newActivityStep = new Kinect.ActivityStep();
                }
            }
            if (newActivityFromText == null || newActivityFromText.activityStepArray == null || newActivityFromText.activityStepArray.Count < 1)
            {
                throw new FormatException("Activity Contains No Steps");
            }

            return newActivityFromText;
        }
コード例 #46
0
        private void Initialize()
        {
            String wss30 = "Microsoft Windows SharePoint Services 3.0";
            String wss30ID = "{90120000-1014-0000-0000-0000000FF1CE}";
            String wss30IDx64 = "{90120000-1014-0000-1000-0000000FF1CE}";
            String mossDisplay = "Microsoft Office SharePoint Server 2007";
            String moss2007ID = "{90120000-110D-0000-0000-0000000FF1CE}";
            String moss2007IDx64 = "{90120000-110D-0000-1000-0000000FF1CE}";
            String sps2003 = "Microsoft Office SharePoint Portal Server 2003";
            String sps2003ID = "{610F491D-BE5F-4ED1-A0F7-759D40C7622E}";
            String wss20 = "Microsoft Windows SharePoint Services 2.0";
            String wss20ID = "{91140409-7000-11D3-8CFE-0150048383C9}";
            String moss2010 = "Microsoft SharePoint Server 2010";
            String moss2010ID = "{20140000-110D-0000-1000-0000000FF1CE}";
            String moss2010IDNew = "{90140000-110D-0000-1000-0000000FF1CE}";
            String wss2010 = "Microsoft SharePoint Foundation 2010";
            String wss2010ID = "{90140000-1110-0000-1000-0000000FF1CE}";
            String wss2010New = "Microsoft SharePoint Foundation 2010 Core";
            String wss2010IDNew = "{90140000-1014-0000-1000-0000000FF1CE}";
            String wss2013 = "Microsoft SharePoint Foundation 2013 Core";
            String wss2013ID = "{20150000-1014-0000-1000-0000000FF1CE}";
            String wss2013IDNew = "{90150000-1014-0000-1000-0000000FF1CE}";
            String moss2013 = "Microsoft SharePoint Server 2013";
            String moss2013ID = "{20150000-110D-0000-1000-0000000FF1CE}";
            String moss2013IDNew = "{90150000-110D-0000-1000-0000000FF1CE}";

            if (KeyNameExists(moss2013ID, moss2013))
            {
                versionFamily = VersionFamily.SharePoint2013;
                versionType = VersionType.MOSS;
                versionNumber = GetDisplayVersionUnderKey(moss2013ID);
            }
            else if (KeyNameExists(moss2013IDNew, moss2013))
            {
                versionFamily = VersionFamily.SharePoint2013;
                versionType = VersionType.MOSS;
                versionNumber = GetDisplayVersionUnderKey(moss2013IDNew);
            }
            else if (KeyNameExists(wss2013ID, wss2013))
            {
                versionFamily = VersionFamily.SharePoint2013;
                versionType = VersionType.WSS;
                versionNumber = GetDisplayVersionUnderKey(wss2013ID);
            }
            else if (KeyNameExists(wss2013IDNew, wss2013))
            {
                versionFamily = VersionFamily.SharePoint2013;
                versionType = VersionType.WSS;
                versionNumber = GetDisplayVersionUnderKey(wss2013IDNew);
            }
            else if (KeyNameExists(moss2010ID, moss2010) || KeyNameExists(moss2010IDNew, moss2010))
            {
                versionFamily = VersionFamily.SharePoint2010;
                versionType = VersionType.MOSS;
                if (KeyNameExists(moss2010ID, moss2010))
                {
                    versionNumber = GetDisplayVersionUnderKey(moss2010ID);
                }
                else
                {
                    versionNumber = GetDisplayVersionUnderKey(moss2010IDNew);
                }
            }
            else if (KeyNameExists(wss2010ID, wss2010))
            {
                versionFamily = VersionFamily.SharePoint2010;
                versionType = VersionType.WSS;
                versionNumber = GetDisplayVersionUnderKey(wss2010ID);
            }
            else if (KeyNameExists(wss2010IDNew, wss2010New))
            {
                versionFamily = VersionFamily.SharePoint2010;
                versionType = VersionType.WSS;
                versionNumber = GetDisplayVersionUnderKey(wss2010New);
            }
            else if (KeyNameExists(moss2007ID, mossDisplay) || KeyNameExists(moss2007IDx64, mossDisplay))
            {
                versionFamily = VersionFamily.SharePoint2007;
                versionType = VersionType.MOSS;
                if (KeyNameExists(moss2007ID, mossDisplay))
                {
                    versionNumber = GetDisplayVersionUnderKey(moss2007ID);
                }
                else
                {
                    versionNumber = GetDisplayVersionUnderKey(moss2007IDx64);
                }
            }
            else if (KeyNameExists(wss30ID, wss30) || KeyNameExists(wss30IDx64, wss30))
            {
                versionFamily = VersionFamily.SharePoint2007;
                versionType = VersionType.WSS;
                if (KeyNameExists(wss30ID, wss30))
                {
                    versionNumber = GetDisplayVersionUnderKey(wss30ID);
                }
                else
                {
                    versionNumber = GetDisplayVersionUnderKey(wss30IDx64);
                }
            }
            else if (KeyNameExists(sps2003ID, sps2003))
            {
                versionFamily = VersionFamily.SharePoint2003;
                versionType = VersionType.MOSS;
            }
            else if (KeyNameExists(wss20ID, wss20))
            {
                versionFamily = VersionFamily.SharePoint2003;
                versionType = VersionType.WSS;
            }
            else
            {
                versionFamily = VersionFamily.None;
                versionType = VersionType.None;
            }
        }
コード例 #47
0
 protected void WritePackages(IEnumerable<JObject> packages, VersionType versionType)
 {
     // Get the PowerShellPackageView
     var view = PowerShellPackage.GetPowerShellPackageView(packages, versionType);
     WriteObject(view, enumerateCollection: true);
 }
コード例 #48
0
ファイル: VersionBase.cs プロジェクト: vsite-pood/vcb4
 public static VersionBase Create(string version, VersionType versionType)
 {
     switch (versionType)
     {
         case VersionType.AssemblyVersion:
             return new AssemblyVersion(version);
         case VersionType.FileVersion:
             return new FileVersion(version);
         case VersionType.InformationalVersion:
             return new InformationalVersion(version);
     }
     throw new ArgumentOutOfRangeException("Unsupported version type");
 }
コード例 #49
0
 /// <summary>
 /// Get the view of PowerShell Package. Use for Get-Package command. 
 /// </summary>
 /// <param name="metadata"></param>
 /// <param name="versionType"></param>
 /// <returns></returns>
 public static List<PowerShellPackageWithProject> GetPowerShellPackageView(Dictionary<VsProject, IEnumerable<JObject>> dictionary, VersionType versionType)
 {
     List<PowerShellPackageWithProject> views = new List<PowerShellPackageWithProject>();
     foreach (KeyValuePair<VsProject, IEnumerable<JObject>> entry in dictionary)
     {
         List<PowerShellPackage> packages = PowerShellPackage.GetPowerShellPackageView(entry.Value, versionType);
         foreach (PowerShellPackage package in packages)
         {
             PowerShellPackageWithProject view = new PowerShellPackageWithProject();
             view.Id = package.Id;
             view.Version = package.Version;
             view.Description = package.Description;
             view.ProjectName = entry.Key.Name;
             views.Add(view);
         }
     }
     return views;
 }
コード例 #50
0
ファイル: ConfigVersion.cs プロジェクト: rongxiong/Scut
 protected override object this[string index]
 {
     get
     {
         #region
         switch (index)
         {
             case "VersionType": return VersionType;
             case "ActionID": return ActionID;
             case "TypeName": return TypeName;
             case "CurVersion": return CurVersion;
             case "ModifyTime": return ModifyTime;
             case "State": return State;
             default: throw new ArgumentException(string.Format("ConfigVersion index[{0}] isn't exist.", index));
         }
         #endregion
     }
     set
     {
         #region
         switch (index)
         {
             case "VersionType":
                 _VersionType = value.ToEnum<VersionType>();
                 break;
             case "ActionID":
                 _ActionID = value.ToInt();
                 break;
             case "TypeName":
                 _TypeName = value.ToNotNullString();
                 break;
             case "CurVersion":
                 _CurVersion = value.ToInt();
                 break;
             case "ModifyTime":
                 _ModifyTime = value.ToDateTime();
                 break;
             case "State":
                 _State = value.ToInt();
                 break;
             default: throw new ArgumentException(string.Format("ConfigVersion index[{0}] isn't exist.", index));
         }
         #endregion
     }
 }
コード例 #51
0
        private void UpdateVersion(VersionType versionType, string databaseName, string version)
        {
            using (var currentConnection = new SqlConnection(Configuration.ConnectionString))
            {
                currentConnection.Open();

                UseDatabase(currentConnection, databaseName);

                var command = new SqlCommand(@"sys.sp_updateextendedproperty", currentConnection)
                {CommandType = CommandType.StoredProcedure};

                command.Parameters.Add(new SqlParameter("name", GetName(versionType)));
                command.Parameters.Add(new SqlParameter("value", version ?? string.Empty));

                command.ExecuteNonQuery();
            }
        }
コード例 #52
0
 private static string GetName(VersionType versionType)
 {
     return Enum.GetName(typeof (VersionType), versionType);
 }
コード例 #53
0
ファイル: IDatabase.cs プロジェクト: Stoner19/Memory-Lifter
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLayerVersionInfo"/> struct.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="version">The version.</param>
 public DataLayerVersionInfo(VersionType type, Version version)
 {
     Type = type;
     Version = version;
 }
コード例 #54
0
        private string GetVersion(VersionType versionType, string databaseName)
        {
            using (var currentConnection = new SqlConnection(Configuration.ConnectionString))
            {
                currentConnection.Open();

                UseDatabase(currentConnection, databaseName);

                const string Sql = @"SELECT CAST(Value AS nvarchar(500))
                FROM sys.extended_properties AS ep
                WHERE ep.name = @name;";

                var command = new SqlCommand(Sql, currentConnection) {CommandType = CommandType.Text};

                command.Parameters.Add(new SqlParameter("name", GetName(versionType)));

                var version = (string) command.ExecuteScalar();

                return string.IsNullOrEmpty(version) ? null : version;
            }
        }
コード例 #55
0
ファイル: MainForm.cs プロジェクト: VISTALL/game-updater
        private void SetVersionTypeUnsafe(String av, VersionType a)
        {
            VersionType = a;
            Version = av;

            switch (a)
            {
                case VersionType.UNKNOWN:
                    _versionInfo.Text = LanguageHolder.Instance()[WordEnum.VERSION_IS_NOT_CHECK];
                    _versionInfo.ForeColor = COLOR2;
                    _versionInfo.Tag = "ASSEMBLY";
                    _versionInfo.Cursor = Cursors.Hand;
                    break;
                case VersionType.SAME:
                case VersionType.LOWER:
                    _versionInfo.Text = LanguageHolder.Instance()[WordEnum.VERSION_IS_OK];
                    _versionInfo.ForeColor = COLOR;
                    _versionInfo.Cursor = Cursors.Default;
                    _versionInfo.Tag = null;
                    break;
                case VersionType.BIGGER:
                    _versionInfo.Text = LanguageHolder.Instance()[WordEnum.VERSION_IS_BAD];
                    _versionInfo.ForeColor = Color.Red;
                    _versionInfo.Tag = "ASSEMBLY";
                    _versionInfo.Cursor = Cursors.Hand;
                    break;
            }
        }
コード例 #56
0
		public abstract bool HasAccess(VersionType versionType);
コード例 #57
0
ファイル: MainForm.cs プロジェクト: VISTALL/game-updater
 public void SetVersionType(String av, VersionType a)
 {
     Invoke(new DelegateCall(this, new SetVersionTypeDelegate(SetVersionTypeUnsafe), av, a));
 }