Exemplo n.º 1
0
        /// <summary>
        /// Starts system restore
        /// </summary>
        /// <param name="strDescription">The description of the restore</param>
        /// <param name="rt">The type of restore point</param>
        /// <param name="lSeqNum">Returns the sequence number</param>
        /// <returns>The status of call</returns>
        /// <seealso cref="Use EndRestore() or CancelRestore() to end the system restore"/>
        public static int StartRestore(string strDescription, RestoreType rt, out long lSeqNum)
        {
            RestorePointInfo rpInfo   = new RestorePointInfo();
            STATEMGRSTATUS   rpStatus = new STATEMGRSTATUS();

            if (!SysRestoreAvailable())
            {
                lSeqNum = 0;
                return(-1);
            }

            try
            {
                // Prepare Restore Point
                rpInfo.dwEventType = BeginSystemChange;
                // By default we create a verification system
                rpInfo.dwRestorePtType  = (int)rt;
                rpInfo.llSequenceNumber = 0;
                rpInfo.szDescription    = strDescription;

                SRSetRestorePointW(ref rpInfo, out rpStatus);
            }
            catch (DllNotFoundException)
            {
                lSeqNum = 0;
                return(-1);
            }

            lSeqNum = rpStatus.llSequenceNumber;

            return(rpStatus.nStatus);
        }
Exemplo n.º 2
0
 public PathBlockState(int oldStackSize)
 {
     Block             = null;
     _restoreType      = RestoreType.PopPushOp;
     _restoreValue     = (ulong)oldStackSize;
     _restoreMergeType = default;
 }
Exemplo n.º 3
0
 public PathBlockState(Block block)
 {
     Block             = block;
     _restoreType      = RestoreType.None;
     _restoreValue     = 0;
     _restoreMergeType = default;
 }
Exemplo n.º 4
0
 public PathBlockState(ulong syncAddress, MergeType mergeType)
 {
     Block             = null;
     _restoreType      = RestoreType.PushBranchOp;
     _restoreValue     = syncAddress;
     _restoreMergeType = mergeType;
 }
Exemplo n.º 5
0
        //TODO conditions, exec script on use, etc

        public AidItemModel(string name, float weight, float value, float maxCondition, bool hidden, bool essential, string[] flags, string worldModel,
                            AidType aType, RestoreType rType, float amount)
            : base(name, weight, value, maxCondition, hidden, essential, flags, worldModel)
        {
            AType  = aType;
            RType  = rType;
            Amount = amount;
        }
Exemplo n.º 6
0
 public AidItemModel(string name, float weight, float maxCondition, bool unique, bool essential,
                     AidType aType, RestoreType rType, float amount)
     : base(name, weight, maxCondition, unique, essential)
 {
     AType  = aType;
     RType  = rType;
     Amount = amount;
 }
Exemplo n.º 7
0
        void restore(string parameter, RestoreType restoreType)
        {
            restoreButton.Enabled          = false;
            skipButton.Enabled             = false;
            restorationProgressBar.Visible = true;

            restorationBackgroundWorker.RunWorkerAsync(new RestoreTaskInfo(_record, restoreType, parameter));
        }
Exemplo n.º 8
0
 private protected FullBehavior(SimpleDescriptor standardShortDesc, SimpleDescriptor singleShortDesc, PartDescriptor <DataClass> longDesc,
                                PlayerBodyPartDelegate <ContainerClass> playerDesc, ChangeType <DataClass> transformDesc, RestoreType <DataClass> restoreDesc) : base(standardShortDesc, singleShortDesc)
 {
     longStr          = longDesc ?? throw new ArgumentNullException(nameof(longDesc));
     playerStr        = playerDesc ?? throw new ArgumentNullException(nameof(playerDesc));
     transformFromStr = transformDesc ?? throw new ArgumentNullException(nameof(transformDesc));
     restoredStr      = restoreDesc ?? throw new ArgumentNullException(nameof(restoreDesc));
 }
Exemplo n.º 9
0
        protected GillType(ShortPluralDescriptor shortDesc, SimpleDescriptor singleDesc, PartDescriptor <GillData> longDesc, PlayerBodyPartDelegate <Gills> playerDesc,
                           ChangeType <GillData> transform, RestoreType <GillData> restore) : base(PluralHelper(shortDesc), singleDesc, longDesc, playerDesc, transform, restore)
        {
            _index = indexMaker++;
            gills.AddAt(this, _index);

            pluralDesc = shortDesc;
        }
Exemplo n.º 10
0
        public void CreateRestorePoint(RestoreType restoreType)
        {
            List <FileInformation> files        = _watchedFilePaths.Select(x => _fileSystem.Read(x)).ToList();
            RestorePoint           restorePoint = _restorePointCreator.Create(_backupPath, files, _restorePoints,
                                                                              _dateTimeProvider, _storageAlgorithm, restoreType);

            _restorePoints.Add(restorePoint);
            WriteRestorePoint(restorePoint);
        }
Exemplo n.º 11
0
 public RestoreEffect()
 {
     EffectType    = AbilityEffectType.Restore;
     RestoreType   = RestoreType.None;
     Amount        = new GameValue();
     Duration      = new GameValue();
     LevelModifier = 0;
     OverCharge    = false;
 }
Exemplo n.º 12
0
 public RestoreEffect(RestoreType type, GameValue amount, GameValue duration, bool overcharge, int level = 0)
 {
     EffectType    = AbilityEffectType.Restore;
     RestoreType   = type;
     Amount        = new GameValue(amount);
     Duration      = new GameValue(duration);
     LevelModifier = level;
     OverCharge    = overcharge;
 }
Exemplo n.º 13
0
        void refreshUiOnSelectedRestorationType(RestoreType kind)
        {
            refreshRestoreButton();
            specifiedFolderTextBox.Enabled = (kind == RestoreType.ToPointedFolder);
            chooseFolderButton.Enabled     = (kind == RestoreType.ToPointedFolder);

            sevenZipDestinationArchiveLocationTextBox.Enabled  = (kind == RestoreType.As7ZipArchive);
            choose7zipArchiveDestinationLocationButton.Enabled = (kind == RestoreType.As7ZipArchive);
        }
Exemplo n.º 14
0
 public RestorePoint(string backupPath, DateTime restoreTime, StorageType storageType, RestoreType restoreType, List <FileInformation> files)
 {
     Id           = Guid.NewGuid();
     RestoreTime  = restoreTime;
     StorageType  = storageType;
     RestoreType  = restoreType;
     Path         = backupPath + "/" + "Restore" + Id.ToString();
     RestoreFiles = files.Select(x => x.Restore(Path)).ToList();
 }
Exemplo n.º 15
0
        public void CreateRestorePoint(RestoreType restoreType, EventType eventType, string description)
        {
            var descriptionData = Encoding.UTF8.GetBytes(description);
            var data            = new byte[3 + descriptionData.Length];

            data[0] = (byte)SystemRestoreCommunication.CreateRestorePoint;
            data[1] = (byte)restoreType;
            data[2] = (byte)eventType;
            Array.Copy(descriptionData, 0, data, 3, description.Length);
            ConnectionInfo.SendCommand(this, data);
            LogService.Send((string)Application.Current.Resources["CreateSystemRestorePoint"]);
        }
Exemplo n.º 16
0
 public RestorePoint
 (
     String path,
     IReadOnlyCollection <FileData> files,
     StorageAlgorithmType storageAlgorithmType,
     RestoreType restoreType,
     DateTime creationTime
 )
 {
     Path                 = path;
     Files                = files.Select(file => file.CreateRestoredFile(path)).Where(file => !file.IsNull).ToList();
     CreationTime         = creationTime;
     StorageAlgorithmType = storageAlgorithmType;
     RestoreType          = restoreType;
 }
        /// <summary>
        ///     Creates a restore point.
        /// </summary>
        public static bool CreateRestorePoint(string description, RestoreType restoreType, EventType eventType)
        {
            using (var objClass = new ManagementClass("\\\\.\\root\\default", "systemrestore", new ObjectGetOptions()))
            {
                var oInParams =
                    objClass.GetMethodParameters("CreateRestorePoint");
                oInParams["Description"]      = description;
                oInParams["RestorePointType"] = (uint)restoreType;
                oInParams["EventType"]        = (uint)eventType;

                var oOutParams =
                    objClass.InvokeMethod("CreateRestorePoint", oInParams, null);

                return(oOutParams != null && (uint)oOutParams["ReturnValue"] == 0);
            }
        }
        private static void RestoreImpl(IEnumerable <SMPersonalDataIndex> entities, RestoreType filter)
        {
            using (PXTransactionScope ts = new PXTransactionScope())
            {
                IEnumerable <IBqlTable> processingItems = RemapToPrimary(entities);

                ProcessImpl(processingItems, true, null);

                if (filter?.DeleteNonRestored == true)
                {
                    CleanNonRestored(processingItems);
                }

                ts.Complete();
            }
        }
Exemplo n.º 19
0
 public JointRestorePoint
 (
     String path,
     IReadOnlyCollection <FileData> files,
     StorageAlgorithmType storageAlgorithmType,
     RestoreType restoreType,
     DateTime creationTime
 ) : base
     (
         path,
         files,
         storageAlgorithmType,
         restoreType,
         creationTime
     )
 {
 }
Exemplo n.º 20
0
        internal Conf_RestoreDlg(string path, RestoreType restoreType)
        {
            InitializeComponent();

            if (restoreType == RestoreType.Backup)
            {
                backup    = true;
                this.Text = "Backup";
            }
            else
            {
                clean = true;
            }

            this.path         = path;
            this.FormClosing += new FormClosingEventHandler(Conf_RestoreDlg_FormClosing);
        }
Exemplo n.º 21
0
        private protected WingType(bool canFly,
                                   ShortPluralDescriptor shortDesc, SimpleDescriptor singleWingDesc, PluralPartDescriptor <WingData> longDesc, PlayerBodyPartDelegate <Wings> playerDesc,
                                   ChangeType <WingData> transform, RestoreType <WingData> restore) : base(PluralHelper(shortDesc), singleWingDesc, LongPluralHelper(longDesc), playerDesc, transform, restore)
        {
            _index = indexMaker++;
            wings.AddAt(this, _index);
            transformBehavior = canFly ? BehaviorOnTransform.CONVERT_TO_LARGE : BehaviorOnTransform.CONVERT_TO_SMALL;             //was wrong, caught in testing.

            wingShortDesc = (_, plural) => shortDesc(plural);

            wingSingleDesc = (_) => singleWingDesc();

            longPluralDesc = longDesc;

            canChangeSize = false;

            changeSizeStr = (x, y) => "";
        }
Exemplo n.º 22
0
        /// <summary>
        ///     Starts system restore
        /// </summary>
        /// <param name="strDescription">The description of the restore</param>
        /// <param name="rt">The type of restore point</param>
        /// <param name="lSeqNum">Returns the sequence number</param>
        /// <param name="creationFrequency">
        ///     Under Win 8 or newer - Minimal amount of minutes since last restore point for this point to be created.
        ///     0 to always create, number for amount of minutes, -1 for default behaviour (24 hours).
        /// </param>
        /// <returns>The status of call</returns>
        /// <seealso>
        ///     <cref>Use EndRestore() or CancelRestore() to end the system restore</cref>
        /// </seealso>
        public static int StartRestore(string strDescription, RestoreType rt, out long lSeqNum, int creationFrequency = -1)
        {
            var            rpInfo = new RestorePointInfo();
            STATEMGRSTATUS rpStatus;

            if (!SysRestoreAvailable())
            {
                lSeqNum = 0;
                return(-1);
            }

            if (creationFrequency >= 0)
            {
                using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", true))
                {
                    Debug.Assert(key != null, "SystemRestore key must exist after SysRestoreAvailable");
                    key.SetValue("SystemRestorePointCreationFrequency", creationFrequency, RegistryValueKind.DWord);
                }
            }

            try
            {
                // Prepare Restore Point
                rpInfo.dwEventType = BeginSystemChange;
                // By default we create a verification system
                rpInfo.dwRestorePtType  = (int)rt;
                rpInfo.llSequenceNumber = 0;
                rpInfo.szDescription    = strDescription;

                SRSetRestorePointW(ref rpInfo, out rpStatus);
            }
            catch (DllNotFoundException)
            {
                lSeqNum = 0;
                return(-1);
            }

            lSeqNum = rpStatus.llSequenceNumber;

            return(rpStatus.nStatus);
        }
Exemplo n.º 23
0
Arquivo: Backup.cs Projeto: s4xack/Oop
        public void CreateRestorePoint(RestoreType restoreType)
        {
            DateTime creationTime = _dateTimeProvider.GetUtcNow();
            IEnumerable <FileData> watchedFiles = _watchedFilePaths.Select(path => _fileRepository.Read(path));
            List <FileData>        files        = restoreType switch
            {
                RestoreType.Full => watchedFiles.ToList(),
                RestoreType.Increment =>
                _restorePoints.Count == 0
                        ? throw new ArgumentException()
                        : watchedFiles.Select(GetDiff).ToList(),
                      _ => throw new ArgumentException()
            };

            RestorePoint restorePoint = _storageAlgorithm.PackRestorePoint(BackupPath, files, restoreType, creationTime);

            _restorePoints.Add(restorePoint);
            _fileRepository.Write(restorePoint.ToPackedFileData());

            Clean();
        }
Exemplo n.º 24
0
        /// <summary>
        /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa378847(v=vs.85).aspx.
        /// </summary>
        ///
        /// <param name="description"> . </param>
        /// <param name="rt">          RestoreType. </param>
        /// <param name="et">          EventType. </param>
        ///
        /// <returns>
        /// A ManagementBaseObject.
        /// </returns>
        public static ManagementBaseObject WmiRestorePoint(String description, RestoreType rt = RestoreType.Checkpoint, EventType et = EventType.BeginSystemChange)
        {
            ManagementScope  scope   = new ManagementScope(@"\\.\root\DEFAULT");
            ManagementPath   path    = new ManagementPath("SystemRestore");
            ObjectGetOptions options = new ObjectGetOptions();
            ManagementClass  process = new ManagementClass(scope, path, options);

            // Obtain in-parameters for the method
            ManagementBaseObject inParams =
                process.GetMethodParameters("CreateRestorePoint");

            // Add the input parameters.
            inParams["Description"]      = description;
            inParams["EventType"]        = (int)et;
            inParams["RestorePointType"] = (int)rt;

            // Execute the method and obtain the return values.
            ManagementBaseObject outParams =
                process.InvokeMethod("CreateRestorePoint", inParams, null);

            return(outParams);
        }
Exemplo n.º 25
0
        //wings that support large wings need to define a behavior on transform - do they keep the large wings?
        private protected WingType(BehaviorOnTransform behaviorOnTransform, WingSizeChangeDelegate changeSizeText, WingShortDesc wingShortDesc, WingSingleDesc singleWingDesc,
                                   PluralPartDescriptor <WingData> longDesc, PlayerBodyPartDelegate <Wings> playerDesc, ChangeType <WingData> transform, RestoreType <WingData> restore)
            : base(WingParser(wingShortDesc), WingSingleParser(singleWingDesc), LongPluralHelper(longDesc), playerDesc, transform, restore)
        {
            _index = indexMaker++;
            wings.AddAt(this, _index);
            transformBehavior = behaviorOnTransform;

            this.wingShortDesc = wingShortDesc;

            this.wingSingleDesc = singleWingDesc;

            longPluralDesc = longDesc;

            canChangeSize = true;

            changeSizeStr = changeSizeText ?? throw new ArgumentNullException(nameof(changeSizeText));
        }
Exemplo n.º 26
0
 public RestoreTaskInfo(MetaRecord record, RestoreType restoreType, string parameter)
 {
     _record      = record;
     _parameter   = parameter;
     _restoreType = restoreType;
 }
Exemplo n.º 27
0
        protected EarType(bool internalEar, ShortPluralDescriptor shortDesc, SimpleDescriptor singleItemDesc, PluralPartDescriptor <EarData> longDesc,
                          PlayerBodyPartDelegate <Ears> playerDesc, ChangeType <EarData> transform, RestoreType <EarData> restore)
            : base(PluralHelper(shortDesc), singleItemDesc, LongPluralHelper(longDesc), playerDesc, transform, restore)
        {
            shortPluralDesc = shortDesc;
            longPluralDesc  = longDesc;

            _index = indexMaker++;
            ears.AddAt(this, id);

            isInternalEar = internalEar;
        }
        /// <summary>
        /// Starts system restore
        /// </summary>
        /// <param name="strDescription">The description of the restore</param>
        /// <param name="rt">The type of restore point</param>
        /// <param name="lSeqNum">Returns the sequence number</param>
        /// <returns>The status of call</returns>
        /// <seealso cref="Use EndRestore() or CancelRestore() to end the system restore"/>
        internal static int StartRestore( string strDescription, RestoreType rt, out long lSeqNum )
        {
            RestorePointInfo rpInfo = new RestorePointInfo();
                        STATEMGRSTATUS rpStatus = new STATEMGRSTATUS();

                        if ( !SysRestoreAvailable() )
                        {
                                lSeqNum = 0;
                                return -1;
                        }

                        try
                        {
                                // Prepare Restore Point
                                rpInfo.dwEventType = BeginSystemChange;
                                // By default we create a verification system
                                rpInfo.dwRestorePtType = (int)rt;
                                rpInfo.llSequenceNumber = 0;
                                rpInfo.szDescription = strDescription;

                                SRSetRestorePointW( ref rpInfo, out rpStatus );
                        }
                        catch ( DllNotFoundException )
                        {
                                lSeqNum = 0;
                                return -1;
                        }

                        lSeqNum = rpStatus.llSequenceNumber;

                        return rpStatus.nStatus;
        }
Exemplo n.º 29
0
 public ParsedData(ActionType actionType, string dataFile, RestoreType restoreType)
 {
     ActionType  = actionType;
     DataFile    = dataFile;
     RestoreType = restoreType;
 }
Exemplo n.º 30
0
 internal FeatheredWings(HairFurColors defaultHair, bool canFly, ShortPluralDescriptor shortDesc, SimpleDescriptor singleWingDesc, PluralPartDescriptor <WingData> longDesc,
                         PlayerBodyPartDelegate <Wings> playerDesc, ChangeType <WingData> transform, RestoreType <WingData> restore)
     : base(canFly, shortDesc, singleWingDesc, longDesc, playerDesc, transform, restore)
 {
     defaultFeatherColor = defaultHair;
 }
Exemplo n.º 31
0
 internal FeatheredWings(HairFurColors defaultHair, BehaviorOnTransform behaviorOnTransform, WingSizeChangeDelegate changeSizeText, WingShortDesc wingShortDesc,
                         WingSingleDesc singleWingDesc, PluralPartDescriptor <WingData> longDesc, PlayerBodyPartDelegate <Wings> playerDesc, ChangeType <WingData> transform,
                         RestoreType <WingData> restore) : base(behaviorOnTransform, changeSizeText, wingShortDesc, singleWingDesc, longDesc, playerDesc, transform, restore)
 {
     defaultFeatherColor = defaultHair;
 }