Example #1
0
        protected bool SimpleProcess()
        {
            RegistryValue[] values = Key.GetListOfValues();
            if (null != values && 0 < values.Length)
            {
                foreach (RegistryValue value in values)
                {
                    Reporter.Write("  " + value.Name + "   " + value.GetDataAsObject().ToString());
                }
            }
            else
            {
                Library.WriteNoValue(KeyPath, Reporter);
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="rootKey"></param>
        /// <param name="reporter"></param>
        /// <param name="logger"></param>
        public ClassBase(RegistryKey rootKey, short timeZoneBias, bool outputUtc, Reporter reporter, Logger logger, string currentControlSet = "")
        {
            if (!string.IsNullOrEmpty(currentControlSet))
            {
                Current = currentControlSet;
            }

            Initialize();

            _rootKey      = rootKey;
            _timeZoneBias = timeZoneBias;
            _outputUtc    = outputUtc;
            _reporter     = reporter;
            _logger       = logger;

            Reporter.Write(Library.GetClassName(this));
            Reporter.Write("キーの説明:" + Description);
            if (!string.IsNullOrEmpty(KeyPath))
            {
                if (PrintKeyInBase)
                {
                    Reporter.Write("キーのパス:" + KeyPath);
                }
                Key = RootKey.GetSubkey(KeyPath);

                if (null != Key)
                {
                    if (PrintKeyInBase)
                    {
                        Reporter.Write("キーの最終更新日時:" + Library.TransrateTimestamp(Key.Timestamp, TimeZoneBias, OutputUtc));
                        Reporter.Write("");
                    }
                }
                else
                {
                    Reporter.Write("");
                    if (!PrintKeyInBase)
                    {
                        Reporter.Write("検索したキーのパス:" + KeyPath);
                    }
                    Reporter.Write("Keyが見つかりませんでした。");
                    Reporter.Write("");
                }
            }
        }
Example #3
0
        public bool Process(int processCount)
        {
            // Registryとそこからのルートキーを生成・取得
            Registry    registry = new Registry(_hiveFileName);
            RegistryKey rootKey  = registry.GetRootKey();

            rootKey.Logger = _logger;
            int errorCount = 0;

            _reporter.Write("-----<<Start:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + ">>---------------------------------");
            _reporter.Write("------------------------------------------------------------");

            string current = string.Empty;

            if (SYSTEM.Equals(_configName, StringComparison.OrdinalIgnoreCase))
            {
                current = rootKey.GetSubkey("Select").GetValue("Current").GetDataAsObject().ToString();
            }

            Type[] types = GetTypes(_configName);

            // 単一ファイル対象の処理を強引に再帰に持っていくための苦し紛れ
            if (types.Length == 0)
            {
                this.ErrorMessage = string.Format("【パース対象外ファイルをスキップ】: {0}", _hiveFileName);
                return(false);
            }

            int count = 0;

            foreach (Type type in types)
            {
                if (_backgroundWorker.CancellationPending)
                {
                    return(false);
                }

                try
                {
                    if (!CallClass(rootKey, type, current))
                    {
                        errorCount++;
                    }
                }
                catch (Exception exception)
                {
                    // もちろん失敗とする
                    errorCount++;
                    this.ErrorMessage = exception.Message;
                }

                // Write Border
                _reporter.Write("------------------------------------------------------------");
                count++;

                int progress = (int)(((double)count / (double)types.Length) * 100);
                progress = (100 > progress) ? progress : 100;
                _backgroundWorker.ReportProgress(progress, "Plugins");
            }

            // (一応)正常系を通知
            _reporter.Write("-----<<End:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + ">>----------------------------");

            return(true);
        }
Example #4
0
 public static void WriteNoValue(string keyPath, Reporter reporter)
 {
     reporter.Write(keyPath + " にはValueがありませんでした。");
 }