Exemplo n.º 1
0
        // public override string ToString()
        // {
        //     var sb = new StringBuilder();
        //     sb.AppendLine(">> DeleteByAttribute:");
        //     sb.AppendLine($"   - target directory: {this._sourceDir}");
        //     sb.AppendLine($"   - file mask: {this._mask}");
        //     sb.AppendLine($"   - include sub directories: {this._recursive}");
        //     sb.AppendLine($"   - file attribute: {_fileAttribute.ToString()}");
        //     return sb.ToString();
        // }

        public override void Apply(FileInfo file, int index)
        {
            if ((file.Attributes & _fileAttribute) == _fileAttribute)
            {
                try
                {
                    if (!_test)
                    {
                        Win32ApiWrapper.MoveToRecycleBin(file.FullName);
                    }

                    if (_verbose)
                    {
                        ConsoleLog.WriteInfo($">>File '{file.FullName}' has been moved to RecycleBin, attribute: {_fileAttribute.ToString()}");
                    }
                }
                catch (AggregateException aex)
                {
                    ConsoleLog.WriteError($"Error while deleting '{file.FullName}': {aex.Message}");
                }
                catch (IOException ex)
                {
                    ConsoleLog.WriteError($"Error while deleting '{file.FullName}': {ex.Message}");
                }
            }
        }
        public override void Apply(FileInfo file, int index)
        {
            if (!_test)
            {
                var tempFileName = Path.GetFileName(file.FullName);
                if (!DateTime.TryParse(tempFileName.Substring(0, 10), out _datePattern))
                {
                    ConsoleLog.WriteWarning($">> Unable to get date pattern from: '{tempFileName}'");
                    return;
                }

                var tempDirName = Path.GetDirectoryName(file.FullName);
                var newName     = Path.Combine(tempDirName, "_" + tempFileName);

                using (var image = new Bitmap(file.FullName))
                {
                    image.ModifyDateTaken(_datePattern);
                    image.Save(newName);

                    var newFile = new FileInfo(newName);
                    newFile.CreationTime   = _datePattern;
                    newFile.LastAccessTime = _datePattern;
                    newFile.LastWriteTime  = _datePattern;
                }

                Win32ApiWrapper.MoveToRecycleBin(file.FullName);
            }
            if (_verbose)
            {
                ConsoleLog.WriteInfo($">> Image '{file.FullName}' has been updated, date taken now is: {_datePattern}");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// [コンストラクタ]
        /// </summary>
        public DrawPanel()
        {
            // ウィンドウをタッチ入力に対応させる
            Win32ApiWrapper.RegisterTouchWindow(this.Handle, 0);

            // ちらつきを防止する
            this.DoubleBuffered = true;

            // 軌道を初期化する
            this.orbit = new List <TouchPoint>(this.Size.Height + this.Size.Width);

            TouchMove += new TouchEventHandler(drowWhenTouchMove);
        }
Exemplo n.º 4
0
        public override void Apply(FileInfo file, int index)
        {
            if ((file.Length / 1024) < _maxSize)
            {
                if (!_test)
                {
                    Win32ApiWrapper.MoveToRecycleBin(file.FullName);
                }

                if (_verbose)
                {
                    ConsoleLog.WriteInfo($">> File '{file.FullName}' has been moved to RecycleBin, size: {file.Length / 1024}KB");
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// [メソッド]
        /// Windows メッセージを処理します。
        /// </summary>
        /// <param name="m">Windowsメッセージ</param>
        protected override void WndProc(ref Message m)
        {
            // WMthis.TOUCHのメッセージハンドラを実装する
            if (m.Msg == Win32ApiWrapper.WM_TOUCH)
            {
                Win32ApiWrapper.TouchEventData[] eventData = Win32ApiWrapper.GetTouchEventData(m);

                // 基本イベントを割り当てる
                allocateBasicEvent(eventData[0]);

                // 排他的イベントを割り当てる
                allocateExclusiveEvent(eventData);

                // 背面のコントロールを呼び出す
                var  touchPoint = new TouchPoint(eventData[0].x, eventData[0].y);
                bool isCalled   = callBackControl(touchPoint, m);
                if (isCalled)
                {
                    return;
                }
            }

            base.WndProc(ref m);
        }