Beispiel #1
0
 public TrackUsage(IAppSettings appSettings, IInternalSettings internalSettings, InstanceType instanceType)
 {
     this.appSettings = appSettings;
     this.instanceType = instanceType;
     SetTrackingQueryString(internalSettings);
     SetupBrowser();
     TrackAppUsage(TrackingType.AppLoad);
 }
Beispiel #2
0
        static async Task<DescribeSpotPriceHistoryResponse> GetSpotPricesFromRegion(string region, InstanceType instanceType, string description)
        {
            AmazonEC2Client client = GetEC2Client(region);

            var request = new DescribeSpotPriceHistoryRequest();
            request.StartTime = DateTime.UtcNow - TimeSpan.FromMinutes(10.0);
            request.InstanceTypes = new List<string>() { instanceType.Value };
            request.ProductDescriptions = new List<string>() { description };
            return await client.DescribeSpotPriceHistoryAsync(request);
        }
        public VersionControl(InstanceType instanceType, ITrackUsage trackUsage)
        {
            this.trackUsage = trackUsage;
            InstanceType = instanceType;
            lastUpdateCheck = DateTime.MinValue;

            SetVersionName();

            var instance = InstanceType == InstanceType.Stable ? "" : $" ({InstanceType})";
            AppName = $"Gallifrey {instance}";
        }
        // GET: Instance
        public ActionResult Index(int page=1, int pageSize=20, string instanceNameFilter="", InstanceType? typeFilter=null, bool? publicFilter = null, bool? closedFilter = null, bool? lockedFilter = null, InstanceUserLevel? levelFilter = null)
        {
            ViewBag.Page = page;
            ViewBag.PageSize = pageSize;
            ViewBag.Count = _service.GetUserInstanceCount(instanceNameFilter, typeFilter, publicFilter, closedFilter, lockedFilter, levelFilter, User.Identity.GetUserId()).ToPayload<int>();
            ViewBag.Pages = (ViewBag.Count + pageSize - 1) / pageSize;

            var list = _mapper.Map<IEnumerable<Models.UserInstanceModel>>(_service.GetUserInstances(page, pageSize, instanceNameFilter, typeFilter, publicFilter, closedFilter, lockedFilter, levelFilter, User.Identity.GetUserId()).ToListPayload<Domain.UserInstance>());

            return View(list);
        }
Beispiel #5
0
 /// <summary>
 /// returns an XlCommandBarControl by Index, not 0 based
 /// </summary>
 /// <param name="i"></param>
 /// <returns></returns>
 public XlCommandBarControl this[int index]
 {
     get
     {
         object[] paramArray = new object[1];
         paramArray[0] = index;
         object comRef = InstanceType.InvokeMember("Item", BindingFlags.GetProperty, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
         XlCommandBarControl newClass = new XlCommandBarControl(this, comRef);
         ListChildReferences.Add(newClass);
         return(newClass);
     }
 }
 public XlRange this[string adress]
 {
     get
     {
         object[] paramArray = new object[1];
         paramArray[0] = adress;
         object  returnValue = InstanceType.InvokeMember("Range", BindingFlags.GetProperty, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
         XlRange newClass    = new XlRange(this, returnValue);
         ListChildReferences.Add(newClass);
         return(newClass);
     }
 }
Beispiel #7
0
        /// <inheritdoc/>
        public InstancePack CreateInstance(InstanceLogger logger, InstanceType type, object settings)
        {
            IInstance instance;

            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            switch (type)
            {
            case InstanceType.Server:
                var s = settings as HttpServerSettings;
                if (s == null)
                {
                    throw new InvalidSettingsTypeException();
                }
                instance = new HttpServer(s, logger);
                break;

            case InstanceType.Client:
                var c = settings as HttpClientSettings;
                if (c == null)
                {
                    throw new InvalidSettingsTypeException();
                }
                instance = new HttpClient(c, logger);
                break;

            default:
                var p = settings as DefaultProxySettings;
                if (p == null)
                {
                    throw new InvalidSettingsTypeException();
                }
                var srv = p.Server as HttpServer;
                if (srv != null)
                {
                    srv.SetLogger(logger);
                }
                var factory = p.ClientFactory as HttpClientFactory;
                if (factory != null)
                {
                    factory.SetLogger(logger);
                }
                instance = new DefaultProxy(p);
                break;
            }
            var view = new DefaultInstanceView();
            var cont = new DefaultInstanceController(view, instance, logger, createChannelViewFactory());

            view.SetController(cont);
            return(new InstancePack(view, cont, type));
        }
Beispiel #8
0
 internal Aggregator GetAggregator(TBaseStatus status, InstanceType type)
 {
     if (type == InstanceType.Feed)
     {
         Aggregator agg = valueAggs[status];
         if (agg != null)
         {
             return(agg);
         }
     }
     return(defaultAggs[type]);
 }
        public XlScript Add()
        {
            object   returnValue = InstanceType.InvokeMember("Add", BindingFlags.InvokeMethod, null, ComReference, null, XlLateBindingApiSettings.XlThreadCulture);
            XlScript newClass    = new XlScript(this, returnValue);

            if (null == returnValue)
            {
                return(null);
            }
            ListChildReferences.Add(newClass);
            return(newClass);
        }
        public bool Find(string target, int startLine, int startColumn, int endLine, int endColumn)
        {
            object[] paramArray = new object[2];
            paramArray[0] = target;
            paramArray[1] = startLine;
            paramArray[2] = startColumn;
            paramArray[3] = endLine;
            paramArray[4] = endColumn;
            object returnValue = InstanceType.InvokeMember("Find", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);

            return((bool)returnValue);
        }
Beispiel #11
0
        public X Get <X>(string propertyName)
        {
            X value = default(X);

            try
            {
                value = (X)InstanceType.InvokeMember(propertyName, System.Reflection.BindingFlags.GetProperty, null, UnderlyingObject, null);
            }
            catch (Exception ex) { LastError = ex; }
            // UnderlyingObject.
            return(value);
        }
Beispiel #12
0
        public static void Run(InstanceType instance)
        {
            //Ensure that all TLS protocols are supported
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 |
                                                   SecurityProtocolType.Tls11 |
                                                   SecurityProtocolType.Tls |
                                                   SecurityProtocolType.Ssl3;

            var mainWindow = new MainWindow(instance);

            mainWindow.Show();
        }
Beispiel #13
0
    /// <summary>
    /// Добавить исполнител на площадку
    /// </summary>
    /// <param name="actor">GameObject префаба</param>
    private void InstanceActor(string holder, InstanceType type)
    {
        ActorCommandButton actorCommandButton = Instantiate(instancePrefabs[(int)(type)],
                                                            Vector3.zero,
                                                            Quaternion.Euler(0, 0, 180)).GetComponent <ActorCommandButton>();

        SubscribingToAnEvent(actorCommandButton);
        actorCommandButton.ButtonCliccked += menuController.AllToDefaultExcludeThis;
        actorCommandButton.ObjectDeleted  += UnsubscribingToAnEvent;
        ReturnToDefaultState();
        actorCommandButton.SetOptions(holder);
    }
        /// <summary>
        /// Bind a newly created instance of InstanceType to BindType.
        /// InstanceType must be child of Bindtype.
        /// The definition of the type must have a constructor with attribute [Inject].
        /// The class definition must have either [Singleton] or [Prototype] declared.
        /// If the type is declared as a [Singleton], the same instance will be returned.
        /// If the type is declared as a [Prototype], a new cloned instance will be returned instead.
        /// If [ID] is declared, the object is binded with the value of ID, otherwise it will be binded to default id.
        /// </summary>
        /// <typeparam name="BindType"></typeparam>
        /// <typeparam name="InstanceType"></typeparam>
        public void BindNewInstance <BindType, InstanceType>() where InstanceType : BindType
        {
            InstanceType newInstance = NewInstance <InstanceType>();
            string       id          = DEFAULT;
            ID           idAttribute = newInstance.GetType().GetCustomAttribute <ID>();

            if (idAttribute != null)
            {
                id = idAttribute.Id;
            }
            Bind <BindType>(newInstance, id);
        }
Beispiel #15
0
        public VersionControl(InstanceType instanceType)
        {
            InstanceType     = instanceType;
            lastUpdateCheck  = DateTime.MinValue;
            updateErrorCount = 0;
            Interlocked.Exchange(ref updateCheckOngoing, -1);

            SetVersionName();

            var instance = InstanceType == InstanceType.Stable ? "" : $" ({InstanceType})";

            AppName = $"Gallifrey{instance}";
        }
Beispiel #16
0
 private static string FormatInstanceType(InstanceType type)
 {
     return(type switch
     {
         InstanceType.AutoQuest => "Auto Quest",
         InstanceType.CirclePokemon => "Circle Pokemon",
         InstanceType.CircleRaid => "Circle Raid",
         InstanceType.SmartCircleRaid => "Smart Raid",
         InstanceType.PokemonIV => "Pokemon IV",
         InstanceType.Bootstrap => "Bootstrap",
         InstanceType.FindTTH => "Spawnpoint TTH Finder",
         _ => type.ToString(),
     });
        public XlOLEObjects OLEObjects()
        {
            object returnValue = InstanceType.InvokeMember("OLEObjects", BindingFlags.GetProperty, null, ComReference, null, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlOLEObjects newClass = new XlOLEObjects(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }
        public void TestCombinedStateCapture()
        {
            var objUnderTest = new InstanceType();

            var combinedState = RollbarAssistant.CaptureState(objUnderTest, nameof(objUnderTest));

            RollbarAssistant.CaptureState(typeof(StaticType), combinedState);

            Assert.AreEqual(
                RollbarAssistant.CaptureState(objUnderTest, nameof(objUnderTest)).Count + RollbarAssistant.CaptureState(typeof(StaticType)).Count
                , combinedState.Count
                );
        }
 public static string InstanceTypeToString(InstanceType type)
 {
     return(type switch
     {
         InstanceType.AutoQuest => "auto_quest",
         InstanceType.CirclePokemon => "circle_pokemon",
         InstanceType.CircleRaid => "circle_raid",
         InstanceType.SmartCircleRaid => "smart_raid",
         InstanceType.PokemonIV => "pokemon_iv",
         InstanceType.Bootstrap => "bootstrap",
         InstanceType.FindTTH => "find_tth",
         _ => type.ToString(),
     });
        public void TestCaptureStateOfObjectInstance()
        {
            var objUnderTest = new InstanceType();

            var stateVars = RollbarAssistant.CaptureState(objUnderTest, nameof(objUnderTest));

            Assert.AreEqual(2 + 4, stateVars.Count);

            foreach (var key in stateVars.Keys)
            {
                Console.WriteLine($"{key} = {stateVars[key]}");
            }
        }
Beispiel #21
0
        public override void SetIndexedItem(QsParameter[] indices, QsValue value)
        {
            var pi = InstanceType.GetProperty("Item"
                                              , System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public
                                              );
            var gs = pi.GetSetMethod();

            var r = Root.QsParametersToNativeValues(gs, indices);

            var nativeValue = Root.QsToNativeConvert(pi.PropertyType, value);

            pi.SetValue(_NativeObject, nativeValue, r);
        }
        public XlCharacters Characters()
        {
            object returnValue = InstanceType.InvokeMember("Characters", BindingFlags.InvokeMethod, null, ComReference, null, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlCharacters newClass = new XlCharacters(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }
Beispiel #23
0
        public XlShapeRange Duplicate()
        {
            object returnValue = InstanceType.InvokeMember("Duplicate", BindingFlags.InvokeMethod, null, ComReference, null, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlShapeRange newClass = new XlShapeRange(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }
Beispiel #24
0
        public void Register <T>(InstanceType i_InstanceType = InstanceType.SingleInstance) where T : class
        {
            switch (i_InstanceType)
            {
            case InstanceType.EachResolve:
                r_Container.Register <T>();
                break;

            case InstanceType.SingleInstance:
                r_Container.Register <T>(new PerContainerLifetime());
                break;
            }
        }
Beispiel #25
0
        public XlOLEObject Duplicate()
        {
            object returnValue = InstanceType.InvokeMember("Duplicate", BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding, null, ComReference, null, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlOLEObject newClass = new XlOLEObject(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }
Beispiel #26
0
        protected override void Execute(CodeActivityContext context)
        {
            try
            {
                var cmd = new EC2Connector(AccessKey.Get(context), SecretKey.Get(context), Region.Get(context));

                cmd.CreateInstance(AmiID.Get(context), KeyPairName.Get(context), InstanceType.Get(context));
                Response.Set(context, "Complete");
            }
            catch (Exception e)
            {
                Error.Set(context, e.Message);
            }
        }
Beispiel #27
0
        public static void Singletons(InstanceType instanceType)
        {
            switch (instanceType)
            {
            case InstanceType.Singlethread_SimpleSingleton:
            {
                Console.WriteLine("单线程执行之后,你会发现构造函数只执行了一次,而静态实例方法执行了很多次,也就是相当于实例化了一次");
                for (int i = 0; i < 5; i++)
                {
                    SimpleSingleton.Instance.CallMethod();
                }
            }
            break;

            case InstanceType.Multithread_SimpleSingleton:
            {
                Console.WriteLine("多线程执行后,你会发现执行了多次构造函数");
                TaskFactory taskFactory1 = new TaskFactory();
                for (int i = 0; i < 5; i++)
                {
                    taskFactory1.StartNew(() => { SimpleSingleton.Instance.CallMethod(); });
                }
            }
            break;

            case InstanceType.Multithread_SingleLockedSingleton:
            {
                Console.WriteLine("多线程执行后,你会发现执行了1次构造函数,而静态实例方法执行了很多次");

                TaskFactory taskFactory2 = new TaskFactory();
                for (int i = 0; i < 5; i++)
                {
                    taskFactory2.StartNew(() => { SingleLockedSingleton.Instance.CallMethod(); });
                }
            }
            break;

            case InstanceType.Multithread_DoubleLockedSingleton:
            {
                Console.WriteLine("多线程执行后,你会发现执行了1次构造函数,静态实例方法也只执行1次");

                TaskFactory taskFactor3 = new TaskFactory();
                for (int i = 0; i < 5; i++)
                {
                    taskFactor3.StartNew(() => { DoubleLockedSingleton.Instance.CallMethod(); });
                }
            }
            break;
            }
        }
Beispiel #28
0
        public void RegisterInterface <TInterface, TComponent>(InstanceType i_InstanceType = InstanceType.SingleInstance)
            where TInterface : class where TComponent : class, TInterface
        {
            switch (i_InstanceType)
            {
            case InstanceType.EachResolve:
                r_Container.Register <TInterface, TComponent>();
                break;

            case InstanceType.SingleInstance:
                r_Container.Register <TInterface, TComponent>(new PerContainerLifetime());
                break;
            }
        }
    public static void OpenTheLastInstanceSelectUI(InstanceType instanceType)
    {
        ChapterResume      chapterResume      = DungeonManager.Instance.listChapterResume.Find((ChapterResume a) => a.dungeonType == (DungeonType.ENUM)instanceType);
        List <ChapterInfo> dataByInstanceType = DungeonManager.Instance.GetDataByInstanceType((int)instanceType);

        if (dataByInstanceType.get_Count() == 0)
        {
            return;
        }
        InstanceManagerUI.LastOpenInstanceID = DungeonManager.Instance.GetTheLastInstaceID(instanceType);
        InstanceSelectUI instanceSelectUI = UIManagerControl.Instance.OpenUI("InstanceSelectUI", null, true, UIType.FullScreen) as InstanceSelectUI;

        instanceSelectUI.RefreshUIByInstanceID(InstanceManagerUI.LastOpenInstanceID);
    }
Beispiel #30
0
        /// <summary>
        /// Create a new StatusInstance and add it to this tracker, updating the value of the given status.
        /// Returns the newly created instance, if successfully added, or null, if not.
        /// </summary>
        /// <param name="status">The status to which the instance will add its value</param>
        /// <param name="value">The amount by which the instance will increase the given status</param>
        /// <param name="cancelPriority">An instance with lower cancel priority will be cancelled before an instance with
        /// higher priority when Cancel() is called on its status.</param>
        /// <param name="type">
        /// The InstanceType determines whether the instance will feed, suppress, or prevent its status.
        /// (Feed is the default and most common. When a status is cancelled, its "Feed" StatusInstances are removed.)
        /// </param>
        public StatusInstance <TObject> Add(TBaseStatus status, int value = 1, int cancelPriority                   = 0,
                                            InstanceType type             = InstanceType.Feed, int?overrideSetIndex = null)
        {
            var instance = new StatusInstance <TObject>(status, value, cancelPriority, type, overrideSetIndex);

            if (AddStatusInstance(instance))
            {
                return(instance);
            }
            else
            {
                return(null);
            }
        }
Beispiel #31
0
        public VersionControl(InstanceType instanceType, AppType appType, ITrackUsage trackUsage)
        {
            this.trackUsage = trackUsage;
            InstanceType    = instanceType;
            AppType         = appType;
            lastUpdateCheck = DateTime.MinValue;

            SetVersionName();

            var instance = InstanceType == InstanceType.Stable ? "" : string.Format(" ({0})", InstanceType);
            var appName  = AppType == AppType.Classic ? "Gallifrey Classic" : "Gallifrey";

            AppName = string.Format("{0}{1}", appName, instance);
        }
Beispiel #32
0
        public void instanceInstanceType()
        {
            List <Instance> instanceList = Instance.index(cloudID);

            Assert.IsNotNull(instanceList);
            Assert.IsTrue(instanceList.Count > 0);
            string   instanceID   = instanceList[0].ID;
            Instance testInstance = Instance.show(cloudID, instanceID, "full");

            Assert.IsNotNull(testInstance);
            InstanceType it = testInstance.instanceType;

            Assert.IsTrue(true);//no exception
        }
Beispiel #33
0
 public void Insert(int index, MsoSegmentType segmentType, MsoEditingType editingType, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3)
 {
     object[] paramArray = new object[9];
     paramArray[0] = index;
     paramArray[1] = segmentType;
     paramArray[2] = editingType;
     paramArray[3] = x1;
     paramArray[4] = y1;
     paramArray[5] = x2;
     paramArray[6] = y2;
     paramArray[7] = x3;
     paramArray[8] = y3;
     InstanceType.InvokeMember("Insert", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
 }
Beispiel #34
0
        public XlFormatCondition Add(XlFormatConditionType type)
        {
            object[] paramArray = new object[1];
            paramArray[0] = type;
            object            returnValue = InstanceType.InvokeMember("Add", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
            XlFormatCondition newClass    = new XlFormatCondition(this, returnValue);

            if (null == returnValue)
            {
                return(null);
            }
            ListChildReferences.Add(newClass);
            return(newClass);
        }
Beispiel #35
0
        private static void FormatAndDisplayPrices(List<SpotPrice> spotPrices, InstanceType instanceType)
        {
            //var latestLinux = spotPrices.Where(p => p.InstanceType == instanceType).Where(p => p.ProductDescription.Value.Contains("Linux/")).OrderByDescending(p => p.Timestamp).First();
            //var latestWindows = spotPrices.Where(p => p.InstanceType == instanceType).Where(p => p.ProductDescription.Value.Contains("Windows")).OrderByDescending(p => p.Timestamp).First();
            //Console.WriteLine($"{latestLinux.AvailabilityZone}: {latestLinux.Price} ({(DateTime.Now - latestLinux.Timestamp).TotalMinutes} ago");
            //Console.WriteLine(latestWindows.Dump());

            //GetLatestPricesByType(InstanceType.C4Xlarge, "Linux/UNIX (Amazon VPC)");
            //GetLatestPricesByType(InstanceType.C4Xlarge, "Windows (Amazon VPC)");

            GetLatestPricesByType(InstanceType.C42xlarge, "Linux/UNIX (Amazon VPC)");
            //GetLatestPricesByType(InstanceType.C42xlarge, "Windows (Amazon VPC)");

            GetLatestPricesByType(InstanceType.C44xlarge, "Linux/UNIX (Amazon VPC)");
        }
        public MainWindow(InstanceType instance)
        {
            InitializeComponent();

            var gallifrey = new Backend(instance);
            modelHelpers = new ModelHelpers(gallifrey, FlyoutsControl);
            exceptionlessHelper = new ExceptionlessHelper(modelHelpers);
            exceptionlessHelper.RegisterExceptionless();
            var viewModel = new MainViewModel(modelHelpers);
            modelHelpers.RefreshModel();
            modelHelpers.SelectRunningTimer();

            DataContext = viewModel;

            gallifrey.NoActivityEvent += GallifreyOnNoActivityEvent;
            gallifrey.ExportPromptEvent += GallifreyOnExportPromptEvent;
            SystemEvents.SessionSwitch += SessionSwitchHandler;

            Height = gallifrey.Settings.UiSettings.Height;
            Width = gallifrey.Settings.UiSettings.Width;
            ThemeHelper.ChangeTheme(gallifrey.Settings.UiSettings.Theme, gallifrey.Settings.UiSettings.Accent);

            if (gallifrey.VersionControl.IsAutomatedDeploy)
            {
                PerformUpdate(false, true);
                var updateHeartbeat = new Timer(TimeSpan.FromMinutes(1).TotalMilliseconds);
                updateHeartbeat.Elapsed += AutoUpdateCheck;
                updateHeartbeat.Enabled = true;
            }

            var idleDetectionHeartbeat = new Timer(TimeSpan.FromSeconds(30).TotalMilliseconds);
            idleDetectionHeartbeat.Elapsed += IdleDetectionCheck;
            idleDetectionHeartbeat.Enabled = true;

            var flyoutOpenCheck = new Timer(100);
            flyoutOpenCheck.Elapsed += FlyoutOpenCheck;
            flyoutOpenCheck.Enabled = true;
        }
        public MainWindow(InstanceType instance, AppType appType)
        {
            InitializeComponent();

            ExceptionlessClient.Default.Configuration.ApiKey = "e7ac6366507547639ce69fea261d6545";
            ExceptionlessClient.Default.Configuration.DefaultTags.Add("Unknown_Version_Pre_Startup");
            ExceptionlessClient.Default.Configuration.Enabled = true;
            ExceptionlessClient.Default.SubmittingEvent += ExceptionlessSubmittingEvent;
            ExceptionlessClient.Default.Register();

            var gallifrey = new Backend(instance, appType);

            ExceptionlessClient.Default.Configuration.DefaultTags.Clear();
            ExceptionlessClient.Default.Configuration.DefaultTags.Add(gallifrey.VersionControl.VersionName.Replace("\n", " - "));

            var viewModel = new MainViewModel(gallifrey, this);
            viewModel.RefreshModel();
            viewModel.SelectRunningTimer();
            DataContext = viewModel;

            gallifrey.NoActivityEvent += GallifreyOnNoActivityEvent;
            gallifrey.ExportPromptEvent += GallifreyOnExportPromptEvent;
            SystemEvents.SessionSwitch += SessionSwitchHandler;

            Height = gallifrey.Settings.UiSettings.Height;
            Width = gallifrey.Settings.UiSettings.Width;
            Title = gallifrey.VersionControl.AppName;
            ThemeHelper.ChangeTheme(gallifrey.Settings.UiSettings.Theme);

            if (gallifrey.VersionControl.IsAutomatedDeploy)
            {
                PerformUpdate(false, true);
                var updateHeartbeat = new Timer(60000);
                updateHeartbeat.Elapsed += delegate { PerformUpdate(false, false); };
                updateHeartbeat.Enabled = true;
            }
        }
Beispiel #38
0
 public static void Run(InstanceType instance, AppType appType)
 {
     var mainWindow = new MainWindow(instance, appType);
     mainWindow.Show();
 }
Beispiel #39
0
 public void Check_Service_Type(IServiceProvider provider, InstanceType expected)
 {
     // Assert
     ((CuteProvider)provider).Type.Should().Be(expected);
 }
Beispiel #40
0
 public FactoryAttribute( InstanceType Type )
 {
     this.Type = Type;
 }
Beispiel #41
0
        static void GetLatestPricesByType(InstanceType instanceType,
            string description)
        {
            AmazonEC2Client client = GetEC2Client("ap-southeast-2");
            var regions = client.DescribeRegions().Regions.Select(r => r.RegionName);
            var filteredRegions = DisableRegions(regions);
            ConcurrentBag<SpotPrice> latestPrices = new ConcurrentBag<SpotPrice>();
            Parallel.ForEach(filteredRegions, (region) =>
            {
                var prices = GetSpotPricesFromRegion(region, instanceType, description);
                prices.Wait();
                var latest = prices.Result.SpotPriceHistory.OrderByDescending(p => p.Timestamp).First();
                latestPrices.Add(latest);
                //Console.WriteLine($"{latest.AvailabilityZone}:\t${latest.Price} ({(DateTime.Now - latest.Timestamp).TotalMinutes} ago");
            });

            var ordered = latestPrices.OrderBy(p => float.Parse(p.Price));//.ThenByDescending(p=> p.Timestamp);
            Console.WriteLine(instanceType);
            Console.WriteLine();
            foreach (var price in ordered)
            {
                TimeSpan spanSince = DateTime.Now - price.Timestamp;
                string fuzzyTimestamp = (spanSince > TimeSpan.FromMinutes(1))
                    ? spanSince.TotalMinutes + " minutes ago"
                    : spanSince.TotalSeconds + " seconds ago";
                Console.WriteLine($"{price.Price}:\t{price.AvailabilityZone},\t{price.ProductDescription}\t({fuzzyTimestamp})");
            }

            Console.WriteLine();



        }
Beispiel #42
0
        private void buildTypes()
        {
            new BuiltinsModule(this);
            State bt = Builtin.Table;

            objectType = newClass("object", bt);
            BaseType = newClass("type", bt, objectType);
            BaseTuple = newClass("tuple", bt, objectType);
            BaseList = newClass("list", bt, objectType);
            BaseListInst = new InstanceType(BaseList);
            BaseArray = newClass("array", bt);
            BaseDict = newClass("dict", bt, objectType);
            ClassType numClass = newClass("int", bt, objectType);
            BaseModule = newClass("module", bt);
            BaseFile = newClass("file", bt, objectType);
            BaseFileInst = new InstanceType(BaseFile);
            BaseFunction = newClass("function", bt, objectType);
            BaseClass = newClass("classobj", bt, objectType);
        }
Beispiel #43
0
 /// <summary>
 /// Generates a single instance.
 /// </summary>
 private static InstanceData GenerateInstance(InstanceType type, string file, DataCollector dungeonData, List<Enemy> enemyData)
 {
     Console.WriteLine("File " + file);
       LinkGenerator.CurrentDungeon = file;
       var location = Constants.DataGuidesRaw;
       if (type == InstanceType.fractal)
     location = Constants.DataFractalsRaw;
       if (type == InstanceType.dungeon)
     location = Constants.DataDungeonsRaw;
       if (type == InstanceType.raid)
     location = Constants.DataRaidsRaw;
       var encounterData = EncounterGenerator.ReadInstance(location, file, enemyData);
       if (encounterData == null)
     return null;
       if (encounterData.Paths == null)
     return encounterData;
       if (type == InstanceType.dungeon)
     dungeonData.AddDungeon(file, encounterData.Paths);
       if (type == InstanceType.fractal)
     dungeonData.AddFractal(encounterData.Paths);
       if (type == InstanceType.raid)
     dungeonData.AddRaid(file, encounterData.Paths);
       return encounterData;
 }
            private InstanceEntry ParseInstance(InstanceType type)
            {
                InstanceEntry c = new InstanceEntry();
                c._type = type;

                while (_reader.ReadAttribute())
                    if (_reader.Name.Equals("url", true))
                        c._url = _reader.Value[0] == '#' ? (string)(_reader.Value + 1) : (string)_reader.Value;

                while (_reader.BeginElement())
                {
                    if (_reader.Name.Equals("skeleton", true))
                        c.skeletons.Add(_reader.Value[0] == '#' ? (string)(_reader.Value + 1) : (string)_reader.Value);

                    if (_reader.Name.Equals("bind_material", true))
                        while (_reader.BeginElement())
                        {
                            if (_reader.Name.Equals("technique_common", true))
                                while (_reader.BeginElement())
                                {
                                    if (_reader.Name.Equals("instance_material", true))
                                        c._material = ParseMatInstance();
                                    _reader.EndElement();
                                }
                            _reader.EndElement();
                        }

                    _reader.EndElement();
                }

                return c;
            }
Beispiel #45
0
        public Backend(InstanceType instanceType, AppType appType)
        {
            settingsCollection = SettingsCollectionSerializer.DeSerialize();
            trackUsage = new TrackUsage(settingsCollection.AppSettings, settingsCollection.InternalSettings, instanceType, appType);
            versionControl = new VersionControl(instanceType, appType, trackUsage);
            jiraTimerCollection = new JiraTimerCollection(settingsCollection.ExportSettings);
            jiraTimerCollection.exportPrompt += OnExportPromptEvent;
            jiraConnection = new JiraConnection(trackUsage);
            idleTimerCollection = new IdleTimerCollection();
            ActivityChecker = new ActivityChecker(jiraTimerCollection, settingsCollection.AppSettings);
            ActivityChecker.NoActivityEvent += OnNoActivityEvent;
            hearbeat = new Timer(1800000);
            hearbeat.Elapsed += HearbeatOnElapsed;
            hearbeat.Start();

            if (Settings.AppSettings.TimerRunningOnShutdown.HasValue)
            {
                var timer = jiraTimerCollection.GetTimer(Settings.AppSettings.TimerRunningOnShutdown.Value);
                if (timer != null && timer.DateStarted.Date == DateTime.Now.Date)
                {
                    JiraTimerCollection.StartTimer(Settings.AppSettings.TimerRunningOnShutdown.Value);
                }

                Settings.AppSettings.TimerRunningOnShutdown = null;
                SaveSettings(false);
            }

            HearbeatOnElapsed(this, null);
        }
        public VersionControl(InstanceType instanceType, AppType appType, ITrackUsage trackUsage)
        {
            this.trackUsage = trackUsage;
            InstanceType = instanceType;
            AppType = appType;
            lastUpdateCheck = DateTime.MinValue;

            SetVersionName();

            var instance = InstanceType == InstanceType.Stable ? "" : string.Format(" ({0})", InstanceType);
            var appName = AppType == AppType.Classic ? "Gallifrey Classic" : "Gallifrey";

            AppName = string.Format("{0}{1}", appName, instance);
        }
Beispiel #47
0
 internal static void Warning(InstanceType instanceType)
 {
     DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Warning, Prefix + String.Empty.ToString());
 }
 public ApplicationServiceResponse Clone(int originalInstanceId, InstanceType instanceType, string instanceName, string userId)
 {
     throw new NotImplementedException();
 }
Beispiel #49
0
 public void Check_Service_Type(IOrganizationServiceFactory factory, InstanceType expected)
 {
     // Assert
     ((CuteFactory)factory).Provider.Type.Should().Be(expected);
 }
 public ApplicationServiceResponse GetUserInstanceCount(string instanceNameFilter, InstanceType? typeFilter, bool? publicFilter, bool? closedFilter, bool? lockedFilter, InstanceUserLevel? levelFilter, string userId)
 {
     return ApplicationServiceResponse<int>.Create(
         ApplicationServiceResult.Success,
         _userInstanceRepository.Count(
             instanceNameFilter,
             typeFilter,
             publicFilter,
             closedFilter,
             lockedFilter,
             levelFilter,
             userId));
 }
Beispiel #51
0
        public Backend(InstanceType instanceType)
        {
            settingsCollection = SettingsCollectionSerializer.DeSerialize();
            trackUsage = new TrackUsage(settingsCollection.AppSettings, settingsCollection.InternalSettings, instanceType);
            versionControl = new VersionControl(instanceType, trackUsage);
            jiraTimerCollection = new JiraTimerCollection(settingsCollection.ExportSettings, trackUsage);
            jiraTimerCollection.exportPrompt += OnExportPromptEvent;
            jiraConnection = new JiraConnection(trackUsage);
            idleTimerCollection = new IdleTimerCollection();
            ActivityChecker = new ActivityChecker(jiraTimerCollection, settingsCollection.AppSettings);
            withThanksCreator = new WithThanksCreator();
            premiumChecker = new PremiumChecker();

            ActivityChecker.NoActivityEvent += OnNoActivityEvent;
            var cleanUpAndTrackingHearbeat = new Timer(TimeSpan.FromMinutes(15).TotalMilliseconds);
            cleanUpAndTrackingHearbeat.Elapsed += CleanUpAndTrackingHearbeatOnElapsed;
            cleanUpAndTrackingHearbeat.Start();

            exportedHeartbeatMutex = new Mutex(false);
            var jiraExportHearbeat = new Timer(TimeSpan.FromMinutes(10).TotalMilliseconds);
            jiraExportHearbeat.Elapsed += JiraExportHearbeatHearbeatOnElapsed;
            jiraExportHearbeat.Start();

            if (Settings.AppSettings.TimerRunningOnShutdown.HasValue)
            {
                var timer = jiraTimerCollection.GetTimer(Settings.AppSettings.TimerRunningOnShutdown.Value);
                if (timer != null && timer.DateStarted.Date == DateTime.Now.Date)
                {
                    JiraTimerCollection.StartTimer(Settings.AppSettings.TimerRunningOnShutdown.Value);
                }

                Settings.AppSettings.TimerRunningOnShutdown = null;
                SaveSettings(false);
            }
        }
 public ProcessContainerAttribute(InstanceType type)
 {
     Type = type;
 }
Beispiel #53
0
 public static void Run(InstanceType instance, ResourceDictionary resources)
 {
     WalkDictionary(resources);
     var mainWindow = new MainWindow(instance);
     mainWindow.Show();
 }
 public ApplicationServiceResponse GetUserInstances(int page, int pageSize, string instanceNameFilter, InstanceType? typeFilter, bool? publicFilter, bool? closedFilter, bool? lockedFilter, InstanceUserLevel? levelFilter, string userId)
 {
     return ApplicationServiceListResponse<Domain.UserInstance>.Create(
         ApplicationServiceResult.Success,
         _userInstanceRepository.Find(
             CalculateSkip(page, pageSize),
             pageSize,
             instanceNameFilter,
             typeFilter,
             publicFilter,
             closedFilter,
             lockedFilter,
             levelFilter,
             userId,
             x => x.InstanceName,
             false));
 }
Beispiel #55
0
 public void Check_Service_Type(IOrganizationService service, InstanceType expected)
 {
     // Assert
     ((CuteService)service).Provider.Type.Should().Be(expected);
 }
        /// <summary>
        /// Create a new appointment
        /// </summary>
        public Appointment()
        {
            Created = DateUtil.NowUtc;
            range = new DateTimeRange(Created, Created);

            Body = string.Empty;
            Subject = string.Empty;
            Location = string.Empty;
            Comment = string.Empty;
            Organizer = string.Empty;

            BusyStatus = BusyStatus.Free;
            ResponseStatus = ResponseStatus.None;
            InstanceType = InstanceType.Single;
            MeetingStatus = MeetingStatus.Tentative;

            IsPrivate = false;
            AllDayEvent = false;

            HRef = string.Empty;
        }
 internal static void Warning(InstanceType instanceType)
 {
     throw new System.NotImplementedException();
 }