Пример #1
0
        public VMSnapshotCreateAction(VM vm, string newName, string newDescription,
                                      SnapshotType type, Func <VM, string, string, Image> screenShotProvider)
            : base(vm.Connection, string.Format(Messages.ACTION_VM_SNAPSHOT_TITLE, vm.Name()))
        {
            VM                  = vm;
            _newName            = newName;
            _newDescription     = newDescription;
            _type               = type;
            _screenShotProvider = screenShotProvider;

            switch (type)
            {
            case SnapshotType.QUIESCED_DISK:
                ApiMethodsToRoleCheck.Add("vm.snapshot_with_quiesce");
                break;

            case SnapshotType.DISK_AND_MEMORY:
                ApiMethodsToRoleCheck.Add("vm.checkpoint");
                break;

            case SnapshotType.DISK:
                ApiMethodsToRoleCheck.Add("vm.snapshot");
                break;
            }

            ApiMethodsToRoleCheck.Add("vm.set_name_description", "vm.create_new_blob");
        }
Пример #2
0
 public SnapshotNode(long id, SnapshotType type, uint thisNodeSize, long[] parents, string[] reference)
 {
     this.id           = id;
     this.type         = type;
     this.thisNodeSize = thisNodeSize;
     this.parents      = parents;
     this.reference    = reference;
 }
Пример #3
0
 /// <summary>
 /// 获取监控节点
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static ISnapshotNode GetSnapshotNode(SnapshotType type)
 {
     if (SnapshotCreateDic.ContainsKey(type))
     {
         return(SnapshotCreateDic[type]);
     }
     return(InvalidNode);
 }
Пример #4
0
        public void SetType(SnapshotType type)
        {
            if (type < (SnapshotType) 128)
                WriteByte((byte) type);
            else
                WriteBytes(BitConverter.GetBytes((ushort) type).Reverse().ToArray());

            SnapshotCount++;
        }
        public Task ExecuteAsync(UserId userId, SnapshotType snapshotType)
        {
            userId.AssertNotNull("userId");

            return(this.queueService.AddMessageToQueueAsync(
                       Shared.Constants.RequestSnapshotQueueName,
                       new CreateSnapshotMessage(userId, snapshotType),
                       null,
                       SnapshotDelay));
        }
Пример #6
0
 private void OnEnable()
 {
     _oldSelectedType   = 0;
     _outputCurIndex    = 0;
     _outputOldIndex    = 0;
     _outputNewIndex    = 0;
     _snapshotDesc      = null;
     _oldInputTabOption = -1;
     _snapshotMgr.RefreshSnapshotType(_selectedType);
 }
Пример #7
0
 public override string ToString()
 {
     if (!TimeStamp.HasValue)
     {
         return(SnapshotType.ToString());
     }
     else
     {
         return(String.Format(@"{0:yyyy-MM-dd hh\:mm} - {1}", TimeStamp, SnapshotType.ToString()));
     }
 }
Пример #8
0
 public override string ToString()
 {
     if (SnapshotType == SentoniServiceReference.SnapshotType.Current)
     {
         return(String.Format("Last update at {0:T}", TimeStamp));
     }
     else
     {
         return(String.Format("{0} snapshot taken at {1:g}", SnapshotType.ToString(), TimeStamp));
     }
 }
Пример #9
0
        private async Task PerformTest(SnapshotType snapshotType)
        {
            this.queueService.Setup(
                v =>
                v.AddMessageToQueueAsync(
                    Fifthweek.Payments.Shared.Constants.RequestSnapshotQueueName,
                    new CreateSnapshotMessage(UserId, snapshotType),
                    null,
                    RequestSnapshotService.SnapshotDelay)).Returns(Task.FromResult(0));

            await this.target.ExecuteAsync(UserId, snapshotType);
        }
Пример #10
0
 /// <summary>
 /// Starts a new Snapshot
 /// </summary>
 /// <param name="type">Snapshot type</param>
 public void StartSnapshot(SnapshotType type)
 {
     if (type < (SnapshotType)128) // less than a 'Char' or 'Byte' (8bits)
     {
         this.Add <Byte>((Byte)type);
     }
     else
     {
         this.Add <Byte[]>(BitConverter.GetBytes((ushort)type).Reverse().ToArray());
     }
     this.SnapshotCount++;
 }
Пример #11
0
 /// <summary>
 /// Starts a new Snapshot
 /// </summary>
 /// <param name="type">Snapshot type</param>
 public void StartSnapshot(SnapshotType type)
 {
     if (type < (SnapshotType)128) // less than a 'Char' or 'Byte' (8bits)
     {
         this.Add<Byte>((Byte)type);
     }
     else
     {
         this.Add<Byte[]>(BitConverter.GetBytes((ushort)type).Reverse().ToArray());
     }
     this.SnapshotCount++;
 }
Пример #12
0
        public void SetType(SnapshotType type)
        {
            if (type < (SnapshotType)128)
            {
                WriteByte((byte)type);
            }
            else
            {
                WriteBytes(BitConverter.GetBytes((ushort)type).Reverse().ToArray());
            }

            SnapshotCount++;
        }
        public Task ExecuteAsync(UserId userId, SnapshotType snapshotType)
        {
            this.userId       = userId;
            this.snapshotType = snapshotType;

            if (this.throwException)
            {
                throw new SnapshotException();
            }

            if (this.connectionFactory != null)
            {
                Assert.IsTrue(this.connectionFactory.ConnectionDisposed);
            }

            return(Task.FromResult(0));
        }
Пример #14
0
 /// <summary>
 /// 应用层输入
 /// </summary>
 private void DrawAppInput()
 {
     _selectedType = (SnapshotType)EditorGUILayout.EnumFlagsField("监控类型", _selectedType);
     if (_oldSelectedType != _selectedType)
     {
         _snapshotMgr.RefreshSnapshotType(_selectedType);
     }
     _oldSelectedType = _selectedType;
     GUILayout.Label("监控器数量:" + _snapshotMgr.SnapshotCount);
     if (Application.isPlaying)
     {
         DrawSnapshot();
     }
     else
     {
         EditorGUILayout.HelpBox("只能在游戏状态拍快照!", MessageType.Error);
     }
 }
Пример #15
0
        public Task ExecuteAsync(UserId userId, SnapshotType snapshotType)
        {
            switch (snapshotType)
            {
            case SnapshotType.Subscriber:
                return(this.createSubscriberSnapshot.ExecuteAsync(userId));

            case SnapshotType.SubscriberChannels:
                return(this.createSubscriberChannelsSnapshot.ExecuteAsync(userId));

            case SnapshotType.CreatorChannels:
                return(this.createCreatorChannelsSnapshot.ExecuteAsync(userId));

            case SnapshotType.CreatorFreeAccessUsers:
                return(this.createCreatorFreeAccessUsersSnapshot.ExecuteAsync(userId));
            }

            throw new InvalidOperationException("Unknown snapshot type: " + snapshotType);
        }
Пример #16
0
        public IEnumerable<Snapshot> GetSnapshots(SnapshotType snapshotType)
        {
            IEnumerable<Snapshot> result;
            using (var sqlConnection = _dataAccess.GetOpenConnectionArt())
            {
                var teamId = _userService.GetCurrentUser().Team.Id;
                var userName = _userService.GetCurrentUser().Name;

                result =
                    sqlConnection.Query<Snapshot>("usp_Snapshot_Sel", new
                    {
                        TeamId = teamId,
                        SnapshotType = (int)snapshotType,
                        CreatorName = userName
                    }, commandType: CommandType.StoredProcedure);
            }

            return result;

        }
Пример #17
0
        private Func<VM, String, String, Image> _screenShotProvider; // 3 parameters: vm, username, password (username and password can be null)

        #endregion Fields

        #region Constructors

        public VMSnapshotCreateAction(VM vm, string NewName, string newDescription, SnapshotType type,Func<VM,String,String,Image> screenShotProvider )
            : base(vm.Connection, String.Format(Messages.ACTION_VM_SNAPSHOT_TITLE, vm.Name))
        {
            this.VM = vm;
            this.NewName = NewName;
            this.m_Type = type;
            _screenShotProvider = screenShotProvider;
            this.m_NewDescription = newDescription;
            switch (type)
            {
                case SnapshotType.QUIESCED_DISK:
                    ApiMethodsToRoleCheck.Add("vm.snapshot_with_quiesce");
                    break;
                case SnapshotType.DISK_AND_MEMORY:
                    ApiMethodsToRoleCheck.Add("vm.checkpoint");
                    break;
                case SnapshotType.DISK:
                    ApiMethodsToRoleCheck.Add("vm.snapshot");
                    break;
            }
            ApiMethodsToRoleCheck.Add("vm.set_name_description");
        }
Пример #18
0
        /// <summary>
        /// 绘制导出编辑
        /// </summary>
        private void DrawOutput()
        {
            using (var scope = new GUILayout.HorizontalScope())
            {
                SnapshotConfig.OutputFolder = EditorGUILayout.TextField("输出目录", SnapshotConfig.OutputFolder);
                if (GUILayout.Button("浏览"))
                {
                    SnapshotConfig.OutputFolder = EditorUtility.OpenFolderPanel("监控数据输出目录", SnapshotConfig.OutputFolder, "");
                }
            }
            using (var scope = new GUILayout.VerticalScope("Box"))
            {
                _outputTabOption = GUILayout.Toolbar(_outputTabOption, new string[] { "输出快照", "输出对比" });
                EditorGUILayout.Space();
                _outputSelectedType = (SnapshotType)EditorGUILayout.EnumFlagsField("输出监控类型", _outputSelectedType);
                switch (_outputTabOption)
                {
                case 0:
                    _outputCurIndex = ShowIntPopup("数据索引", _outputCurIndex, 0, _snapshotMgr.SnapshotIndex + 1);
                    break;

                case 1:
                    using (var scope2 = new GUILayout.HorizontalScope())
                    {
                        _outputOldIndex = ShowIntPopup("旧数据索引", _outputOldIndex, 0, _snapshotMgr.SnapshotIndex + 1);
                        _outputNewIndex = ShowIntPopup("新数据索引", _outputNewIndex, _outputOldIndex + 1, _snapshotMgr.SnapshotIndex - _outputOldIndex);
                    }
                    _outputIsIncrease = GUILayout.Toggle(_outputIsIncrease, "是否只打印增量");

                    break;
                }
                using (var scope3 = new GUILayout.HorizontalScope())
                {
                    DrawOutputBtn();
                }
            }
        }
Пример #19
0
 public static void ApplyMusicSnapshot(SnapshotType snapshot, float delayTime, float transitionTime)
 {
     ApplyMusicSnapshot(GetSnapshot(snapshot), delayTime, transitionTime);
 }
 public void VerifyCalledWith(UserId userId, SnapshotType snapshotType)
 {
     Assert.AreEqual(userId, this.userId);
     Assert.AreEqual(snapshotType, this.snapshotType);
 }
Пример #21
0
 public Snapshot(SnapshotType t, Commit c)
 {
     SnapshotType = t;
     Commit       = c;
 }
Пример #22
0
        /// <summary>
        /// Captures a snapshot of the map view.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="type">Type of file format.</param>
        /// <param name="quality">An integer value representing the quality for encoding from 1 to 100.</param>
        /// <param name="path">A string representing the file path for a snapshot.</param>
        /// <privilege>http://tizen.org/privilege/mapservice</privilege>
        /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
        /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
        /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
        /// <exception cref="System.InvalidOperationException">Thrown when a native operation failed to allocate memory and connect to the service.</exception>
        public void CaptureSnapshot(SnapshotType type, int quality, string path)
        {
            var err = Interop.ViewSnapshot.ViewCaptureSnapshot(handle, (Interop.ViewSnapshotFormatType)type, quality, path);

            err.ThrowIfFailed("Failed to create snapshot for the view");
        }
Пример #23
0
 /// <summary>
 /// 是否包含监控类型
 /// </summary>
 /// <param name="srcMask">已选监控掩码</param>
 /// <param name="target">目标监控类型</param>
 /// <returns></returns>
 static public bool ContainType(SnapshotType srcMask, SnapshotType target)
 {
     return((srcMask & target) != 0);
 }
Пример #24
0
 /// <summary>
 /// 直接根据类型获取生命线,包括缓存内数据
 /// </summary>
 /// <param name="snapshotType">监控类型</param>
 /// <returns></returns>
 public SnapshotNodeDataLife this[SnapshotType snapshotType] {
     get => _lifeDic.ContainsKey(snapshotType) ? _lifeDic[snapshotType] : TryGetLife(_lifeCache, snapshotType);
Пример #25
0
 public SnapshotOptions(string storageProvider, string shardingStrategy, SnapshotType snapshotType)
     : base(storageProvider, shardingStrategy)
 {
     this.SnapshotType = snapshotType;
 }
Пример #26
0
        public static AudioMixerSnapshot GetSnapshot(SnapshotType type)
        {
            switch (type)
            {
            case SnapshotType.Normal:
                return(NormalSnapshot);

            case SnapshotType.NormalAlt:
                return(NormalAltSnapshot);

            case SnapshotType.NormalSoft:
                return(NormalSoftSnapshot);

            case SnapshotType.NormalSofter:
                return(NormalSofterSnapshot);

            case SnapshotType.NormalFlange:
                return(NormalFlangeSnapshot);

            case SnapshotType.NormalFlangier:
                return(NormalFlangierSnapshot);

            case SnapshotType.Action:
                return(ActionSnapshot);

            case SnapshotType.ActionAndSub:
                return(ActionAndSubSnapshot);

            case SnapshotType.SubArea:
                return(SubAreaSnapshot);

            case SnapshotType.Silent:
                return(SilentSnapshot);

            case SnapshotType.SilentFlange:
                return(SilentFlangeSnapshot);

            case SnapshotType.Off:
                return(OffSnapshot);

            case SnapshotType.TensionOnly:
                return(TensionOnlySnapshot);

            case SnapshotType.NormalGramaphone:
                return(NormalGramaphoneSnapshot);

            case SnapshotType.ActionOnly:
                return(ActionOnlySnapshot);

            case SnapshotType.MainOnly:
                return(MainOnlySnapshot);

            case SnapshotType.HKDecline2:
                return(HKDecline2Snapshot);

            case SnapshotType.HKDecline3:
                return(HKDecline3Snapshot);

            case SnapshotType.HKDecline4:
                return(HKDecline4Snapshot);

            case SnapshotType.HKDecline5:
                return(HKDecline5Snapshot);

            case SnapshotType.HKDecline6:
                return(HKDecline6Snapshot);

            default:
                return(NormalSnapshot);
            }
        }
Пример #27
0
 public Snapshots(SnapshotType snapshotType)
 {
     _snapshotType = snapshotType;
 }
Пример #28
0
 public SnapshotsGet(SnapshotType snapshotType)
 {
     SnapshotType = snapshotType;
 }