Esempio n. 1
0
        public ExecutionTests(ITestOutputHelper testOutputHelper)
        {
            _testOutputHelper = testOutputHelper;

            #if DEBUG
            var testName = ((ITest)
                            _testOutputHelper
                            .GetType()
                            .GetField("test", BindingFlags.Instance | BindingFlags.NonPublic) !
                            .GetValue(_testOutputHelper) !
                            ).DisplayName.Replace(GetType().FullName + ".", "");
            var safeTestName = Regex.Replace(testName, "[^a-zA-Z._-]+", "_");
            if (safeTestName.Length > 100)
            {
                safeTestName = safeTestName.Substring(0, 100) + "-" + safeTestName.GetHashCode();
            }

            var testPath = Path.Combine(
                AppContext.BaseDirectory, "assembly-log",
                GetType().Name, safeTestName,
                "{0}.dll"
                );
            //AssemblyLog.Enable(testPath);
            //PerformanceLog.Enable((name, ticks) => testOutputHelper.WriteLine("[Perf] {0}: {1:F2}ms", name, (double)ticks / TimeSpan.TicksPerMillisecond));
            #endif
        }
Esempio n. 2
0
        public void SetDisplayName()
        {
            if (string.IsNullOrEmpty(RemarkName) == true)
            {
                if (string.IsNullOrEmpty(NickName) == true)
                {
                    if (string.IsNullOrEmpty(DisplayName) == true)
                    {
                        DisplayName = UserName;
                    }
                }
                else
                {
                    DisplayName = NickName;
                }
            }
            else
            {
                DisplayName = RemarkName;
            }

            var startPos = DisplayName.IndexOf("<span", StringComparison.Ordinal);

            while (startPos > -1)
            {
                var    endPos = DisplayName.IndexOf("</span>", StringComparison.Ordinal);
                string emjio  = DisplayName.Substring(startPos, endPos - startPos + 7);
                DisplayName = DisplayName.Replace(emjio, "[]");
                startPos    = DisplayName.IndexOf("<span", StringComparison.Ordinal);
            }
        }
Esempio n. 3
0
        public ExecutionTests(ITestOutputHelper testOutputHelper)
        {
            _testOutputHelper = testOutputHelper;

            #if DEBUG
            var testName = ((ITest)
                            _testOutputHelper
                            .GetType()
                            .GetField("test", BindingFlags.Instance | BindingFlags.NonPublic) !
                            .GetValue(_testOutputHelper) !
                            ).DisplayName.Replace(GetType().FullName + ".", "");
            var safeTestName = Regex.Replace(testName, "[^a-zA-Z._-]+", "_");
            if (safeTestName.Length > 100)
            {
                safeTestName = safeTestName.Substring(0, 100) + "-" + safeTestName.GetHashCode();
            }

            var testPath = Path.Combine(
                AppContext.BaseDirectory, "assembly-log",
                GetType().Name, safeTestName,
                "{0}.dll"
                );
            AssemblyLog.Enable(testPath);
            #endif
        }
Esempio n. 4
0
        private IList <UserRowData> InternalSelect(int startRowIndex, int maximumRows, out int resultCount)
        {
            if (maximumRows == 0)
            {
                resultCount = 0;
                return(new List <UserRowData>());
            }

            List <UserRowData> users;

            using (var service = new UserManagement())
            {
                var filter = new ListUsersRequest
                {
                    UserName       = UserName.Replace("*", "%").Replace("?", "_"),
                    DisplayName    = DisplayName.Replace("*", "%").Replace("?", "_"),
                    Page           = { FirstRow = startRowIndex },
                    ExactMatchOnly = false
                };

                users = CollectionUtils.Map(
                    service.FindUsers(filter),
                    (UserSummary summary) => new UserRowData(summary, service.GetUserDetail(summary.UserName)));
            }
            resultCount = users.Count;

            return(users);
        }
Esempio n. 5
0
        public Powerset(BinaryReader reader)
        {
            nID         = -1;
            Powers      = new IPower[0];
            DisplayName = reader.ReadString();
            nArchetype  = reader.ReadInt32();
            SetType     = (Enums.ePowerSetType)reader.ReadInt32();
            ImageName   = reader.ReadString();
            FullName    = reader.ReadString();
            if (string.IsNullOrEmpty(FullName))
            {
                FullName = "Orphan." + DisplayName.Replace(" ", "_");
            }
            SetName          = reader.ReadString();
            Description      = reader.ReadString();
            SubName          = reader.ReadString();
            ATClass          = reader.ReadString();
            UIDTrunkSet      = reader.ReadString();
            UIDLinkSecondary = reader.ReadString();
            var num = reader.ReadInt32();

            UIDMutexSets = new string[num + 1];
            nIDMutexSets = new int[num + 1];
            for (var index = 0; index <= num; ++index)
            {
                UIDMutexSets[index] = reader.ReadString();
                nIDMutexSets[index] = reader.ReadInt32();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// このアプリケーションを適用可能な最新版に更新します。
        /// </summary>
        /// <returns>更新の完了を通知するタスク。</returns>
        public virtual Task UpdateAsync()
        {
            var updateServiceUrl = GetUpdateServiceUrl();

            var arguments = String.Format(@"-n ""{0}"" -p ""{1}"" -u ""{2}""",
                                          DisplayName.Replace("\"", "\\\""),
                                          InstalledPath,
                                          updateServiceUrl);

            var source  = new TaskCompletionSource <object>();
            var process = new Process
            {
                EnableRaisingEvents = true,
                StartInfo           = new ProcessStartInfo
                {
                    FileName  = "Candy.Updater.exe",
                    Arguments = arguments,
                },
            };

            process.Exited += (_, __) =>
            {
                process.Dispose();
                source.SetResult(null);
            };
            process.Start();

            return(source.Task);
        }
Esempio n. 7
0
 public string HeaderText()
 {
     if (string.IsNullOrEmpty(DisplayName))
     {
         return(string.Empty);
     }
     return(DisplayName.Replace(" ", "<br />"));
 }
Esempio n. 8
0
 public Video(string filePath, string name = null) : base(name)
 {
     if (string.IsNullOrEmpty(filePath))
     {
         throw new NullReferenceException("Video File Path");
     }
     ID          = Guid.NewGuid().ToString();
     DisplayName = Path.GetFileNameWithoutExtension(filePath);
     Name        = DisplayName.Replace(' ', '_');
     FilePath    = filePath;
     IndexDate   = DateTime.Now;
 }
Esempio n. 9
0
 public void SetAsDefault(object sender, EventArgs e)
 {
     ActionHelper.Execute(delegate() {
         var service   = SnapInContext.Instance.ServiceGateway;
         var serverDto = GetServerDto();
         var auth      = SnapInContext.Instance.AuthTokenManager.GetAuthToken(serverDto.ServerName);
         _tenantConfigDto.ProviderPolicy = new ProviderPolicyDto {
             DefaultProvider = _provider.Name
         };
         _tenantConfigDto = service.Tenant.UpdateConfig(serverDto, _tenantName, _tenantConfigDto, auth.Token, TenantConfigType.PROVIDER);
         IsDefaultDomain  = true;
         DisplayName      = IsDefaultDomain ? DisplayName + " (Default)" : DisplayName.Replace(" (Default)", string.Empty);
         ((IdentitySourcesNode)(this.Parent)).Refresh(sender, e);
     });
 }
Esempio n. 10
0
        public string GetNameKey()
        {
            var result = "Unnamed";

            if (NameLookupTag != null)
            {
                result = NameLookupTag;
            }
            else if (DisplayName != null)
            {
                result = DisplayName.Replace("$", "");
            }

            return(result);
        }
Esempio n. 11
0
        /// <summary>
        /// このアプリケーションを適用可能な最新版に更新します。
        /// </summary>
        /// <returns>更新の完了を通知するタスク。</returns>
        public override async Task UpdateAsync()
        {
            // Candy.Updater.exe だけは Candy.exe 側で書き換える
            var client = new HttpClient();

            var updateServiceUrl = GetUpdateServiceUrl();
            var json             = await client.GetStringAsync(updateServiceUrl).ConfigureAwait(false);

            var latest = JsonConvert.DeserializeObject <UpdateSummary>(json);

            using (var stream = await client.GetStreamAsync(latest.PackagePath).ConfigureAwait(false))
                using (var archive = new ZipArchive(stream, ZipArchiveMode.Read))
                {
                    var entry = archive.GetEntry("Candy.Updater.exe");

                    if (entry != null)
                    {
                        using (var updater = entry.Open())
                            using (var dest = File.OpenWrite("Candy.Updater.exe"))
                            {
                                dest.SetLength(0);
                                await updater.CopyToAsync(dest).ConfigureAwait(false);
                            }
                    }
                }

            var arguments = String.Format(@"-n ""{0}"" -p ""{1}"" -u ""{2}"" -s",
                                          DisplayName.Replace("\"", "\\\""),
                                          InstalledPath,
                                          updateServiceUrl);

            var process = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName  = "Candy.Updater.exe",
                    Arguments = arguments,
                },
            };

            process.Start();

            // 自身を終了させる(Candy.Updater.exe は Candy.exe が終了するまで待機してくれる)
            Application.Current.Shutdown();

            // 完了しないタスクで呼出元をアプリケーション終了まで待機させ続ける
            await _never.ConfigureAwait(false);
        }
Esempio n. 12
0
            public InternalEntry(int body, int itemID, string name)
            {
                Body   = body;
                ItemID = itemID;
                Name   = name;

                DisplayName = name.ToLower();

                for (var i = 0; i < m_GroupNames.Length; ++i)
                {
                    if (DisplayName.StartsWithOrdinal(m_GroupNames[i]))
                    {
                        DisplayName = DisplayName.Substring(m_GroupNames[i].Length);
                        break;
                    }
                }

                DisplayName = DisplayName.Replace('_', ' ');
            }
Esempio n. 13
0
            /**
             *  Split Raw values to usable values
             *  @todo fix initial
             */
            public void GetValues()
            {
                DisplayName    = RawName + " " + RawSurname;
                SamAccountName = DisplayName.Replace(" ", ".");
                Name           = RawName;
                Surname        = RawSurname;
                Title          = RawTitle;
                Department     = RawDepartment;
                Manager        = RawManager;
                HomeDirectory  = RawHomeFolder.Contains("1G")?"\\\\srvdlpes\\Users$\\$samaccountname":"";
                Office         = RawOffice;
                Phone          = GetPhone(this.RawPhone);
                if (HomeDirectory == "" && RawHomeFolder.Contains("G"))
                {
                    HomeDirectory = "\\\\srvdlpes\\Managers$\\$samaccountname";
                }

                DistrbutionGroups = ExtractDistributionList(RawDistributionGroup);
                ShareDriveAccess  = ExtractShareDriveAccess(RawShareDriveAccess);
            }
Esempio n. 14
0
        protected override void OnAction(Action action, AsyncStatus status)
        {
            base.OnAction(action, status);
            var serverDto = GetServerDto();
            var service   = SnapInContext.Instance.ServiceGateway;
            var auth      = SnapInContext.Instance.AuthTokenManager.GetAuthToken(serverDto, _tenantName);

            ActionHelper.Execute(delegate()
            {
                var isDefault = false;
                switch ((IdentityProviderNodeAction)(int)action.Tag)
                {
                case IdentityProviderNodeAction.ActionSetDefault:
                    _tenantConfigDto.ProviderPolicy = new ProviderPolicyDto {
                        DefaultProvider = _provider.Name
                    };
                    _tenantConfigDto = service.Tenant.UpdateConfig(serverDto, _tenantName, _tenantConfigDto, auth.Token, TenantConfigType.PROVIDER);
                    isDefault        = true;
                    break;
                }
                DisplayName = isDefault ? DisplayName + " (Default)" : DisplayName.Replace(" (Default)", string.Empty);
                ((IdentityProvidersNode)(this.Parent)).DoRefresh();
            }, auth);
        }
Esempio n. 15
0
 public virtual string GetRemoteName(string Gender) => $"{Gender}{DisplayName.Replace(" ", null)}On.bmp";
Esempio n. 16
0
 public CustomNamedTestCommand(IMethodInfo method) : base(method)
 {
     this.DisplayName = DisplayName.Replace("_", " ");
 }