コード例 #1
0
        private static string?GetRemoteUrl(GitRepository repository, ref string?remoteName, Action <string, object?[]>?logWarning)
        {
            string?unknownRemoteName = null;
            string?remoteUrl         = null;

            if (!NullableString.IsNullOrEmpty(remoteName))
            {
                remoteUrl = repository.Config.GetVariableValue(RemoteSectionName, remoteName, UrlVariableName);
                if (remoteUrl == null)
                {
                    unknownRemoteName = remoteName;
                }
            }

            if (remoteUrl == null && !TryGetRemote(repository.Config, out remoteName, out remoteUrl))
            {
                logWarning?.Invoke(Resources.RepositoryHasNoRemote, new[] { repository.WorkingDirectory });
                return(null);
            }

            if (unknownRemoteName != null)
            {
                logWarning?.Invoke(Resources.RepositoryDoesNotHaveSpecifiedRemote, new[] { repository.WorkingDirectory, unknownRemoteName, remoteName });
            }

            return(remoteUrl);
        }
コード例 #2
0
 public void SetStringValue(string columnName, string value)
 {
     NullableString tempvalue = new NullableString(value);
     {
         CommonPINVOKE.DataRow_SetStringValue__SWIG_1(swigCPtr, columnName, NullableString.getCPtr(tempvalue));
         if (CommonPINVOKE.SWIGPendingException.Pending)
         {
             throw CommonPINVOKE.SWIGPendingException.Retrieve();
         }
     }
 }
コード例 #3
0
 public string ValueAsString(string columnName)
 {
     global::System.IntPtr cPtr = CommonPINVOKE.DataRow_ValueAsString__SWIG_1(swigCPtr, columnName);
     if (CommonPINVOKE.SWIGPendingException.Pending)
     {
         throw CommonPINVOKE.SWIGPendingException.Retrieve();
     }
     using (NullableString tempString = (cPtr == global::System.IntPtr.Zero) ? null : new NullableString(cPtr, false)) {
         return(tempString?.GetValueOrDefault());
     }
 }
コード例 #4
0
    private IEnumerator Start()
    {
        yield return(new WaitForSeconds(2));

        Vector3List[1].Value = UnityEngine.Vector3.one;
        String = "abc";

        yield return(new WaitForSeconds(2));

        String = default;
    }
コード例 #5
0
ファイル: GitEnvironment.cs プロジェクト: dotnet/sourcelink
        public static GitEnvironment Create(string?configurationScope)
        {
            if (NullableString.IsNullOrEmpty(configurationScope))
            {
                return(CreateFromProcessEnvironment());
            }

            if (string.Equals(configurationScope, LocalConfigurationScopeName, StringComparison.OrdinalIgnoreCase))
            {
                return(Empty);
            }

            throw new NotSupportedException(string.Format(Resources.ValueOfIsNotValidConfigurationScope, GitRepositoryConfigurationScopeName, configurationScope));
        }
コード例 #6
0
ファイル: GitConfig.cs プロジェクト: slamj1/sourcelink-1
        internal static bool TryParseInt64Value(string?str, out long value)
        {
            if (NullableString.IsNullOrEmpty(str))
            {
                value = 0;
                return(false);
            }

            long multiplier;

            switch (str[str.Length - 1])
            {
            case 'K':
            case 'k':
                multiplier = 1024;
                break;

            case 'M':
            case 'm':
                multiplier = 1024 * 1024;
                break;

            case 'G':
            case 'g':
                multiplier = 1024 * 1024 * 1024;
                break;

            default:
                multiplier = 1;
                break;
            }

            if (!long.TryParse(multiplier > 1 ? str.Substring(0, str.Length - 1) : str, out value))
            {
                return(false);
            }

            try
            {
                value = checked (value * multiplier);
            }
            catch (OverflowException)
            {
                return(false);
            }

            return(true);
        }
コード例 #7
0
ファイル: GetSourceLinkUrl.cs プロジェクト: dotnet/sourcelink
        private Version GetVersion(ITaskItem?hostItem)
        {
            var versionAsString = hostItem?.GetMetadata(VersionMetadataName);

            if (!NullableString.IsNullOrEmpty(versionAsString))
            {
                if (Version.TryParse(versionAsString, out var version))
                {
                    return(version);
                }

                Log.LogError(CommonResources.ItemOfItemGroupMustSpecifyMetadata, hostItem !.ItemSpec, HostsItemGroupName, VersionMetadataName);
            }

            return(s_versionWithNewUrlFormat);
        }
コード例 #8
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NullableString obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }