コード例 #1
0
ファイル: TestAdvRegistry.cs プロジェクト: y11en/FileWall
        public void SetValueData_WithoutValueNameInPath()
        {
            var TestValueData = "Test Value Data";

            AdvRegistry.SetValueData(ExistentKeyPath, TestValueData);
            Assert.AreEqual(TestValueData, AdvRegistry.GetValueData(ExistentKeyPath));
        }
コード例 #2
0
ファイル: TestAdvRegistry.cs プロジェクト: y11en/FileWall
        public void SetValueData_ExistentKeyNonexitentVal()
        {
            var TestValueData = "Test Value Data";

            AdvRegistry.SetValueData(ExistentKey_NonexistentVal_Path, TestValueData);
            Assert.AreEqual(TestValueData, AdvRegistry.GetValueData(ExistentKey_NonexistentVal_Path));
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: y11en/FileWall
        private static int Benchmark(Ruleset ruleset, int benchmarkTime)
        {
            int accessCounter = 0;

            var time = DateTime.Now.AddMinutes(benchmarkTime);

            while (DateTime.Now < time)
            {
                foreach (Ruleset.PathsRow path in ruleset.Paths)
                {
                    // Try to open every file in list.
                    foreach (var fsPath in ExpandFSPaths(path))
                    {
                        FileStream file = null;
                        try
                        {
                            if (File.Exists(fsPath))
                            {
                                file = File.Open(fsPath, FileMode.Open, FileAccess.Read);
                            }
                        }
                        catch
                        {
                        }
                        finally
                        {
                            if (file != null)
                            {
                                file.Close();
                            }
                        }
                    }

                    if (AdvRegistry.IsRegistryPath(path.Path) && AdvRegistry.IsKeyExists(path.Path))
                    {
                        AdvRegistry.GetValueData(path.Path);
                    }
                }
                accessCounter++;
                Console.Write(".");
            }
            Console.WriteLine();

            return(accessCounter);
        }
コード例 #4
0
ファイル: TestAdvRegistry.cs プロジェクト: y11en/FileWall
        public void Initialize()
        {
            var Key = Registry.CurrentUser.CreateSubKey("existent");

            if (Key == null)
            {
                throw new ApplicationException("Can't create existent key in HKCU.");
            }

            Key.SetValue("existent", "TEST");

            if (Registry.CurrentUser.OpenSubKey("nonexistent") != null)
            {
                throw new ApplicationException("nonexistent key exists in HKCU.");
            }

            if (AdvRegistry.GetValueData(ExistentKey_NonexistentVal_Path) != null)
            {
                throw new ApplicationException("nonexistent val exists in HKCU\\existent.");
            }
        }
コード例 #5
0
ファイル: TestAdvRegistry.cs プロジェクト: y11en/FileWall
 public void SetValueData_EmptyData()
 {
     AdvRegistry.SetValueData(ExistentValPath, "");
     Assert.AreEqual(string.Empty, AdvRegistry.GetValueData(ExistentValPath));
 }
コード例 #6
0
ファイル: TestAdvRegistry.cs プロジェクト: y11en/FileWall
 public void GetValueData()
 {
     Assert.AreEqual("TEST", AdvRegistry.GetValueData(ExistentValPath));
 }