示例#1
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.StreetDetail == null))
     {
         IStreetDetail streetDetailCasted = item.As <IStreetDetail>();
         if ((streetDetailCasted != null))
         {
             this._parent.StreetDetail = streetDetailCasted;
             return;
         }
     }
     if ((this._parent.Status == null))
     {
         IStatus statusCasted = item.As <IStatus>();
         if ((statusCasted != null))
         {
             this._parent.Status = statusCasted;
             return;
         }
     }
     if ((this._parent.TownDetail == null))
     {
         ITownDetail townDetailCasted = item.As <ITownDetail>();
         if ((townDetailCasted != null))
         {
             this._parent.TownDetail = townDetailCasted;
             return;
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        _logging = IoC.IoC.Get<ILog>();
        _date = IoC.IoC.Get<IDate>();
        _settings = IoC.IoC.Get<ISettings>();
        _emailNotificationItems = IoC.IoC.Get<IEmailNotificationItems>();
        _sendEmail = IoC.IoC.Get<IEmail>();
        _status = IoC.IoC.Get<IStatus>();

        var url = Request.Url.AbsoluteUri;

        if (Request.QueryString["csvfile"] == null)
        {
            numberOfRun += 1;
            _logging.Msg("CroneJob startet, " + numberOfRun);
            if (DateTime.Now.Hour == 8)
            {
                _sendEmail.SendEmail("*****@*****.**", "*****@*****.**", "Cronejob startet kl. 8:00, antal gange det er kørt siden sidst: " + numberOfRun, "");
                numberOfRun = 0;
            }
            url = null;
        }

        Run(url);
    }
示例#3
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='url'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <HostAvailabilityDto> VerifyHostAvailibilityAsync(this IStatus operations, string url, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.VerifyHostAvailibilityWithHttpMessagesAsync(url, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        public async Task <Settings> CorrectAsync(Settings settings, IStatus status)
        {
            return(await Task.Run(() =>
            {
                if (settings == null)
                {
                    throw new System.ArgumentNullException();
                }

                if (settings.DownloadsLanguages == null ||
                    settings.DownloadsLanguages.Length == 0)
                {
                    settings.DownloadsLanguages = defaultLanguages;
                }

                // validate that download languages are actually codes and not language names
                for (var ii = 0; ii < settings.DownloadsLanguages.Length; ii++)
                {
                    var languageOrLanguageCode = settings.DownloadsLanguages[ii];
                    if (languageController.IsLanguageCode(languageOrLanguageCode))
                    {
                        continue;
                    }

                    var code = languageController.GetLanguageCode(languageOrLanguageCode);
                    if (!string.IsNullOrEmpty(code))
                    {
                        settings.DownloadsLanguages[ii] = code;
                    }
                }

                return settings;
            }));
        }
示例#5
0
        public void RegisterUIInfo(IStatus value, bool showName, bool showStatus)
        {
            this.m_UIInfoRootPanel.SetActive(true);
            var waitingToCreate = 2;

            while (waitingToCreate > 0)
            {
                var uiInfoPool = this.m_UIObjInfoPool.Get();
                if (uiInfoPool != null)
                {
                    var uiInfoRect = uiInfoPool.transform as RectTransform;
                    uiInfoPool.owner = value;
                    uiInfoPool.ShowName(showName);
                    uiInfoPool.ShowStatus(showStatus);
                    uiInfoRect.SetParent(m_UIInfoRootPanel.transform);
                    // Reset position
                    uiInfoRect.anchoredPosition = Vector2.zero;
                    uiInfoRect.localScale       = Vector3.one;
                    uiInfoRect.sizeDelta        = Vector2.one;
                    break;
                }
                else
                {
                    var uiInfoPrefab = Instantiate <CUIObjectInfo> (m_UIObjectInfoPrefab);
                    this.m_UIObjInfoPool.Set(uiInfoPrefab);
                    uiInfoPrefab.owner = value;
                }
                waitingToCreate--;
            }
        }
        public virtual void UnpackFile(IAbsoluteFilePath srcFile, IAbsoluteFilePath dstFile, IStatus status = null) {
            var dstPath = dstFile.ParentDirectoryPath;
            dstPath.MakeSurePathExists();
            dstFile.RemoveReadonlyWhenExists();

            Tools.Compression.Unpack(srcFile, dstPath, true, progress: status);
        }
示例#7
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ICompatibleUnit compatibleUnitsCasted = item.As <ICompatibleUnit>();

                if ((compatibleUnitsCasted != null))
                {
                    this._parent.CompatibleUnits.Add(compatibleUnitsCasted);
                }
                if ((this._parent.Status == null))
                {
                    IStatus statusCasted = item.As <IStatus>();
                    if ((statusCasted != null))
                    {
                        this._parent.Status = statusCasted;
                        return;
                    }
                }
                if ((this._parent.TypeMaterial == null))
                {
                    ITypeMaterial typeMaterialCasted = item.As <ITypeMaterial>();
                    if ((typeMaterialCasted != null))
                    {
                        this._parent.TypeMaterial = typeMaterialCasted;
                        return;
                    }
                }
                IPropertyUnit propertyUnitsCasted = item.As <IPropertyUnit>();

                if ((propertyUnitsCasted != null))
                {
                    this._parent.PropertyUnits.Add(propertyUnitsCasted);
                }
            }
示例#8
0
        public async Task <T> DeserializePullAsync <T>(string uri, IStatus status)
        {
            var started             = DateTime.Now;
            var deserializePullTask = await statusController.CreateAsync(status, "Reading serialized data", false);

            T data = default(T);

            if (fileController.Exists(uri))
            {
                using (var readableStream = streamController.OpenReadable(uri))
                    data = Serializer.Deserialize <T>(readableStream);
            }

            await statusController.CompleteAsync(deserializePullTask, false);

            var completed = DateTime.Now;
            var duration  = (completed - started).TotalMilliseconds;

            traceDelegate?.Trace(
                "DePull",
                started.ToFileTimeUtc().ToString(),
                completed.ToFileTimeUtc().ToString(),
                duration.ToString(),
                uri);

            return(data);
        }
示例#9
0
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     m_Target = target as IStatus;
     if (Application.isPlaying == false)
     {
         return;
     }
     GUILayout.Label("***Status***");
     EditorGUILayout.LabelField("Active:", m_Target.GetActive().ToString());
     EditorGUILayout.LabelField("Animation:", m_Target.GetAnimation().ToString());
     EditorGUILayout.LabelField("Object Type:", m_Target.GetObjectType().ToString());
     EditorGUILayout.LabelField("Class Type:", m_Target.GetClassType().ToString());
     EditorGUILayout.LabelField("FSM State Name:", m_Target.GetFSMStateName());
     EditorGUILayout.LabelField("FSM Path:", m_Target.GetFSMName());
     EditorGUILayout.LabelField("Current skill:", m_Target.GetCurrentSkill().ToString());
     EditorGUILayout.LabelField("Did attack:", m_Target.GetDidAttack().ToString());
     GUILayout.Label("***Data***");
     EditorGUILayout.LabelField("ID:", m_Target.GetID());
     EditorGUILayout.LabelField("Name:", m_Target.GetName());
     EditorGUILayout.LabelField("HP:", m_Target.GetCurrentHealth() + " / " + m_Target.GetMaxHealth());
     EditorGUILayout.LabelField("Sanity:", m_Target.GetCurrentSanity() + " / " + m_Target.GetMaxSanity());
     EditorGUILayout.LabelField("Hunger:", m_Target.GetCurrentHunger() + " / " + m_Target.GetMaxHunger());
     EditorGUILayout.LabelField("Attack Damage:", m_Target.GetAttackDamage().ToString());
     EditorGUILayout.LabelField("Physic Defend:", m_Target.GetPhysicDefend().ToString());
     EditorGUILayout.LabelField("Attack Speed:", m_Target.GetAttackSpeed().ToString());
     EditorGUILayout.LabelField("Move Position:", m_Target.GetMovePosition().ToString());
     EditorGUILayout.LabelField("Move Speed:", m_Target.GetMoveSpeed().ToString());
     EditorGUILayout.LabelField("Seek Radius:", m_Target.GetSeekRadius().ToString());
     EditorGUILayout.LabelField("Start Position:", m_Target.GetStartPosition().ToString());
     EditorGUILayout.LabelField("Owner:", m_Target.GetOwner() != null ? m_Target.GetOwner().GetName().ToString() : "NONE");
 }
示例#10
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.Status == null))
     {
         IStatus statusCasted = item.As <IStatus>();
         if ((statusCasted != null))
         {
             this._parent.Status = statusCasted;
             return;
         }
     }
     if ((this._parent.WorkCostDetail == null))
     {
         IWorkCostDetail workCostDetailCasted = item.As <IWorkCostDetail>();
         if ((workCostDetailCasted != null))
         {
             this._parent.WorkCostDetail = workCostDetailCasted;
             return;
         }
     }
     if ((this._parent.WorkTask == null))
     {
         IWorkTask workTaskCasted = item.As <IWorkTask>();
         if ((workTaskCasted != null))
         {
             this._parent.WorkTask = workTaskCasted;
             return;
         }
     }
 }
示例#11
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IWorkCostDetail workCostDetailsCasted = item.As <IWorkCostDetail>();

                if ((workCostDetailsCasted != null))
                {
                    this._parent.WorkCostDetails.Add(workCostDetailsCasted);
                }
                if ((this._parent.Status == null))
                {
                    IStatus statusCasted = item.As <IStatus>();
                    if ((statusCasted != null))
                    {
                        this._parent.Status = statusCasted;
                        return;
                    }
                }
                ICompatibleUnit compatibleUnitsCasted = item.As <ICompatibleUnit>();

                if ((compatibleUnitsCasted != null))
                {
                    this._parent.CompatibleUnits.Add(compatibleUnitsCasted);
                }
                ICUMaterialItem cUMaterialItemsCasted = item.As <ICUMaterialItem>();

                if ((cUMaterialItemsCasted != null))
                {
                    this._parent.CUMaterialItems.Add(cUMaterialItemsCasted);
                }
            }
示例#12
0
        public void TestEnsureCacheRequestException()
        {
            IConnection conn = initiator.EnsureConnection();

            Channel cacheServiceChannel = (Channel)conn.OpenChannel(CacheServiceProtocol.Instance,
                                                                    "CacheServiceProxy", null, null);

            EnsureCacheRequest ensureCacheRequest =
                (EnsureCacheRequest)cacheServiceChannel.MessageFactory.CreateMessage(EnsureCacheRequest.TYPE_ID);

            ensureCacheRequest.CacheName = null;
            Assert.AreEqual(EnsureCacheRequest.TYPE_ID, ensureCacheRequest.TypeId);
            Assert.IsInstanceOf(typeof(EnsureCacheRequest), ensureCacheRequest);
            Assert.AreEqual(EnsureCacheRequest.TYPE_ID, ensureCacheRequest.TypeId);

            IStatus ensureCacheStatus = cacheServiceChannel.Send(ensureCacheRequest);

            try
            {
                ensureCacheStatus.WaitForResponse(-1);
            }
            catch (PortableException)
            {
                Assert.IsNotNull(ensureCacheStatus);
            }
        }
示例#13
0
    public virtual void EdgeGrab(GameObject edge)
    {
        animator.SetTrigger("EdgeGrab");
        if (IsTumbling)
        {
            statusManager.RemoveStatus(tumblingStatus);
            IsTumbling = false;
        }
        if (IsHelpless)
        {
            statusManager.RemoveStatus(helplessStatus);
            IsHelpless = false;
        }
        if (movementStatus != null)
        {
            statusManager.RemoveStatus(movementStatus);
        }
        CanGrabEdge    = false;
        isGrabbingEdge = true;
        IgnoreMainJoystick(true);
        grabbingEdge = edge;
        OnLand();
        edgeGrabIntangibilityStatus = new IntangibilityStatus(40); //Grant Intangibility based on percentage
        statusManager.AddStatus(edgeGrabIntangibilityStatus);
        Velocity = Vector2.zero;
        DisableMovement();
        Face(edge.transform.parent.gameObject);
        this.gameObject.transform.position = grabbingEdge.transform.position + this.gameObject.transform.position - edgeGrabTransform.position;

        TimerManager.instance.StartTimer(EdgeGrabDurationTimer);

        edge.GetComponent <EdgeBehaviour>().AttachFighter(this.gameObject);
    }
示例#14
0
        public string Force(IStatus s)
        {
            string log = null;

            //RuleHelper.Require(s, new List<string> { "LV", "EXP" });

            Limited exp = s["EXP"] as Limited;

            if (exp != null)
            {
                int levelup = 0;
                while (exp.Max == exp.Value)
                {
                    exp.Value -= exp.Max;
                    exp.Max   += s["LV"].Get() * 100;
                    s["LV"].Add(1);
                    levelup++;
                }

                if (levelup > 0)
                {
                    log = $":event: {levelup} Level UP! you are now {s["LV"]}.";
                }
            }

            return(log);
        }
示例#15
0
    public void Set(IStatus status)
    {
        if (doll)
        {
            Destroy(doll.gameObject);
        }

        GameObject source = (GameObject)Resources.Load("Prefabs/Players_new/" + status.iRace);

        doll = (GameObject)Instantiate(source, parentPrefab);

        doll_trans = doll.transform;

        doll_trans.position = Vector3.zero;
        doll_trans.rotation = Quaternion.Euler(Vector3.up * euler);

        Destroy(doll.GetComponent <ICharacter> ());
        Destroy(doll.GetComponent <NavMeshAgent> ());

        doll.GetComponentInChildren <RawImage> ().texture = null;

        rend = doll_trans.GetComponentInChildren <SkinnedMeshRenderer> ();

        Renderer[] rends = GetComponentsInChildren <SkinnedMeshRenderer> ();

        if (rends.Length > 2)
        {
            IPersonView.SetToManyRenderer(status, rends);
        }
        else
        {
            IPersonView.SetToRenderer(status, rend);
        }
    }
示例#16
0
        public IStatus Update(string appId, string value)
        {
            IStatus status = GetById(appId);

            status = Update(status, value);
            return(status);
        }
        public override bool Append(IStatus status)
        {
            if (status == null)
                throw new ArgumentNullException("status");  // $NON-NLS-1

            switch (status.Level) {
                case Severity.Error:
                    if (this.flags[APPEND_ERRORS]) {
                        return this.baseAppender.Append(status);
                    }
                    break;

                case Severity.Warning:
                    if (this.flags[APPEND_WARNINGS]) {
                        return this.baseAppender.Append(status);
                    }
                    break;

                case Severity.Information:
                    if (this.flags[APPEND_INFOS]) {
                        return this.baseAppender.Append(status);
                    }
                    break;

                case Severity.None:
                default:
                    return this.baseAppender.Append(status);
            }

            return false;
        }
示例#18
0
 public void UpdateStatus(IStatus status)
 {
     lock (this)
     {
         this.messageQueue.Enqueue(status);
     }
 }
示例#19
0
 void EventNotifier(object owner)
 {
     while (true)
     {
         try
         {
             IStatus message = this.messageQueue.Dequeue(true) as IStatus;
             if (message != null)
             {
                 foreach (IStatusObserver observer in this.observers)
                 {
                     observer.OnStatusChanged(message);
                 }
             }
             else
             {
                 // Shall exit thread.
                 break;
             }
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex);
         }
     }
 }
示例#20
0
 void AssertValidStatus(IStatus status)
 {
     if (status == null)
     {
         throw new ArgumentNullException();
     }
 }
示例#21
0
        public static void setStatus(IStatus obj, string participant, string change = null)
        {
            if (!String.IsNullOrEmpty(change))
            {
                obj.StateMostrar = change;
                return;
            }

            switch (participant)
            {
            case "DEBTOR": obj.StateMostrar = Utils.setStatusToQueryDebtor(obj);
                break;

            case "SUPPLIER": obj.StateMostrar = Utils.setStatusToQuerySupplier(obj);
                break;

            case "CONFIRMANT": obj.StateMostrar = Utils.setStatusToQueryConfirmant(obj);
                break;

            case "FACTOR": obj.StateMostrar = Utils.setStatusToQueryFactor(obj.State);
                break;

            case "BACKOFFICE": obj.StateMostrar = Utils.setStatusToQueryBackoffice(obj.State);
                break;

            default: obj.StateMostrar = obj.State;
                break;
            }
        }
示例#22
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                if ((this._parent.Status == null))
                {
                    IStatus statusCasted = item.As <IStatus>();
                    if ((statusCasted != null))
                    {
                        this._parent.Status = statusCasted;
                        return;
                    }
                }
                if ((this._parent.TypeAsset == null))
                {
                    ITypeAsset typeAssetCasted = item.As <ITypeAsset>();
                    if ((typeAssetCasted != null))
                    {
                        this._parent.TypeAsset = typeAssetCasted;
                        return;
                    }
                }
                ICompatibleUnit compatibleUnitsCasted = item.As <ICompatibleUnit>();

                if ((compatibleUnitsCasted != null))
                {
                    this._parent.CompatibleUnits.Add(compatibleUnitsCasted);
                }
            }
        public async Task ConstrainAsync(string uri, IStatus status)
        {
            var prefix = collectionController.Reduce(uriPrefixes, uri.StartsWith).SingleOrDefault();

            if (string.IsNullOrEmpty(prefix))
            {
                return;
            }

            // don't limit rate for the first N requests, even if they match rate limit prefix
            if (++rateLimitRequestsCount <= passthroughCount)
            {
                return;
            }

            var now     = DateTime.UtcNow;
            var elapsed = (int)(now - lastRequestToUriPrefix[prefix]).TotalSeconds;

            if (elapsed < requestIntervalSeconds)
            {
                var limitRateTask = await statusController.CreateAsync(status, "Limit request rate to avoid temporary server block");

                await constrainExecutionAsyncDelegate.ConstrainAsync(requestIntervalSeconds - elapsed, status);

                await statusController.CompleteAsync(limitRateTask);
            }

            lastRequestToUriPrefix[prefix] = now;
        }
示例#24
0
        public static void BuildStr(StringBuilder sb, string indentation, IStatus s)
        {
            string prefix;

            if (s.HasChildren)
            {
                prefix = indentation + "+ ";
            }
            else
            {
                prefix = indentation + "|-";
            }

            if (format != null)
            {
                string dateStr = s.Date.ToString(format);
                sb.Append(dateStr).Append(" ");
            }
            sb.Append(prefix).Append(s).AppendLine();

            if (s.Exception != null)
            {
                AppendThrowable(sb, s.Exception);
            }
            if (s.HasChildren)
            {
                using (IEnumerator <IStatus> ite = s.GetEnumerator())
                    while (ite.MoveNext())
                    {
                        IStatus child = ite.Current;
                        BuildStr(sb, indentation + "  ", child);
                    }
            }
        }
示例#25
0
 public ProfesorController(ITeacher teacher, IContactType contactType,
                           IDocumentType documentType, ICountry country, ICity city,
                           IAddressType addressType, IStatus status, IEducationType educationType,
                           ITeacherEducation teacherEducation, INationality nationality, IMatirialStatus matirialStatus, IProvince province,
                           ITeacherHiringType teacherHiringType, ITeacherFileType teacherFileType, ITeacherFile teacherFile,
                           IWebHostEnvironment hostingEnv, IConfiguration config, IContactAddress contactAddress, IContactCommunication contactCommunication, IUniversity university
                           )
 {
     _teacher              = teacher;
     _contactType          = contactType;
     _documentType         = documentType;
     _country              = country;
     _city                 = city;
     _addressType          = addressType;
     _status               = status;
     _educationType        = educationType;
     _teacherEducation     = teacherEducation;
     _nationality          = nationality;
     _matirialStatus       = matirialStatus;
     _province             = province;
     _teacherHiringType    = teacherHiringType;
     _teacherFileType      = teacherFileType;
     _teacherFile          = teacherFile;
     _hostingEnv           = hostingEnv;
     _config               = config;
     _contactAddress       = contactAddress;
     _contactCommunication = contactCommunication;
     _university           = university;
 }
示例#26
0
        public void SyncChargeStatus()
        {
            chargebitEntities db = new chargebitEntities();

            try
            {
                List <Resrouce_interface> apis = (from api in db.Resrouce_interface where string.IsNullOrEmpty(api.CallBackUrl) && !string.IsNullOrEmpty(api.QueryStatusUrl) && api.Resource_id == 10 orderby api.CallBackUrl select api).ToList <Resrouce_interface>();
                foreach (Resrouce_interface api in apis)
                {
                    if (api.Synchronized == false && string.IsNullOrEmpty(api.CallBackUrl))
                    {
                        Logger.Info("Processing order status for resourceId:" + api.Resource_id);
                        IStatus chargeMgr = null;
                        object  o         = null;
                        o         = Assembly.Load(api.Interface_assemblyname).CreateInstance(api.Interface_classname);
                        chargeMgr = (IStatus)o;
                        chargeMgr.GetChargeStatus(api.Resource_id);
                        Logger.Info("Done!");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex);
            }
            finally
            {
                if (db != null)
                {
                    db.Dispose();
                }
            }
        }
 public TicketDetailsAgentController(
     IDisplayTickets displayTickets,
     IPriority priority,
     IStatus status,
     ITicketsReply ticketsReply,
     IAttachments attachments,
     ITicketHistory ticketHistory,
     ITickets tickets,
     IProfile profile,
     ICategory category,
     ITicketEscalationHistory iticketEscalationHistory,
     IUserMaster userMaster
     )
 {
     _displayTickets           = displayTickets;
     _priority                 = priority;
     _status                   = status;
     _ticketsReply             = ticketsReply;
     _attachments              = attachments;
     _ticketHistory            = ticketHistory;
     _tickets                  = tickets;
     _profile                  = profile;
     _category                 = category;
     _iticketEscalationHistory = iticketEscalationHistory;
     _userMaster               = userMaster;
 }
示例#28
0
 void WriteProgress(IStatus status)
 {
     _action = status.Action;
     Console.Write("\r" + status.Action + ":" + GetProgressComponent(status.Progress) +
                   GetSpeedComponent(status.Speed)
                   + "                    ");
 }
示例#29
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ICrew crewsCasted = item.As <ICrew>();

                if ((crewsCasted != null))
                {
                    this._parent.Crews.Add(crewsCasted);
                }
                if ((this._parent.Status == null))
                {
                    IStatus statusCasted = item.As <IStatus>();
                    if ((statusCasted != null))
                    {
                        this._parent.Status = statusCasted;
                        return;
                    }
                }
                if ((this._parent.ValidityInterval == null))
                {
                    IDateTimeInterval validityIntervalCasted = item.As <IDateTimeInterval>();
                    if ((validityIntervalCasted != null))
                    {
                        this._parent.ValidityInterval = validityIntervalCasted;
                        return;
                    }
                }
            }
 public static void EnsureSuccess(this IStatus status)
 {
     if (!status.IsSuccessful)
     {
         throw new DguvValidationException(status.GetStatusText());
     }
 }
        public async Task <string[]> CorrectAsync(string[] usernamePassword, IStatus status)
        {
            if (usernamePassword == null ||
                usernamePassword.Length < 2)
            {
                usernamePassword = new string[2];
            }

            var emptyUsername = string.IsNullOrEmpty(usernamePassword[0]);
            var emptyPassword = string.IsNullOrEmpty(usernamePassword[1]);

            if (emptyUsername)
            {
                usernamePassword[0] =
                    await inputController.RequestInputAsync("Please enter your GOG.com username (email):");
            }

            if (emptyPassword)
            {
                usernamePassword[1] =
                    await inputController.RequestPrivateInputAsync(
                        string.Format(
                            "Please enter password for {0}:",
                            usernamePassword[0]));
            }

            return(usernamePassword);
        }
示例#32
0
        public int CompareTo(IStatus other)
        {
            var actionState = ((Action == RepoStatus.Waiting) || (Action == RepoStatus.Finished)) &&
                              (other.Action != RepoStatus.Waiting) && (other.Action != RepoStatus.Finished)
                ? 1
                : 0;

            if (actionState != 0)
            {
                return(actionState);
            }

            if ((Progress > 0.00) && (Progress < 100.0) && ((other.Progress <= 0.00) || (other.Progress >= 100)))
            {
                return(-1);
            }

            if (((Progress <= 0.00) || (Progress >= 100)) && ((other.Progress <= 0.00) || (other.Progress >= 100)))
            {
                return(0);
            }

            if ((other.Progress > 0.00) && (other.Progress < 100.0) && ((Progress <= 0.00) || (Progress >= 100)))
            {
                return(1);
            }

            return(Progress.CompareTo(other.Progress));
        }
示例#33
0
        /// <summary>
        /// Used by clients to send data over an established connection in a connection-oriented protocol
        /// </summary>
        /// <param name="message">Message data</param>
        /// <param name="receiver">Connected receiver of message</param>
        /// <returns>A status indicating result of the operation</returns>
        public IStatus <string> Stream(byte[] message, INetworkNode receiver)
        {
            Socket recipient = null;

            if (ConnectedServer != null && ConnectedServer.GetHashCode() == receiver.GetHashCode())//check if its server
            {
                recipient = ConnectedServer.Socket;
            }
            else
            {
                foreach (var client in ConnectedClients.Keys)
                {
                    if (client.GetHashCode() == receiver.GetHashCode())
                    {
                        recipient = client.Socket;
                    }
                }
            }

            IStatus <string> status = Util.Container.CreateInstance <IStatus <string> >();

            if (recipient == null)
            {
                status.IsSuccess     = false;
                status.StatusMessage = "No matching server or client node found in the list of connected nodes";
            }
            else
            {
                recipient.Send(message);
                status.IsSuccess     = true;
                status.StatusMessage = "Message Sent";
            }
            return(status);
        }
        public override bool Append(IStatus status)
        {
            if (status == null)
                throw new ArgumentNullException("status");

            if (predicate(status))
                return base.Append(status);
            else
                return false;
        }
示例#35
0
 public DownloadAndInstaller(IFileDownloader downloader, StatusRepo statusRepo, string file,
     IAbsoluteDirectoryPath destination, IRestarter restarter) {
     _downloader = downloader;
     _statusRepo = statusRepo;
     _file = file;
     _destination = destination;
     _restarter = restarter;
     _sourceFile = Common.Paths.TempPath.GetChildFileWithName(_file);
     _progress = new Status(_file, statusRepo, 0, 0, default(TimeSpan?), RepoStatus.Downloading);
 }
示例#36
0
 private GumballMachine(int numberGumballs)
 {
     noQuarterState = new NoQuarterState(this);
     hasQuarterState = new HasQuarterState(this);
     soldOutState = new SoldOutState(this);
     soldState = new SoldState(this);
     winnerSoldState = new WinnerSoldState(this);
     state = soldOutState;
     gumballsCount = numberGumballs;
     if (gumballsCount > 0)
         state = noQuarterState;
 }
示例#37
0
 public EmailNotification(ILog logging, IDate date, ISettings settings, IEmailNotificationItems emailNotificationItems, IEmail sendEmail, IStatus status,
     String emailFrom, String url)
 {
     _settings = settings;
     _emailNotificationItems = emailNotificationItems;
     _sendEmail = sendEmail;
     _status = status;
     _date = date;
     _log = logging;
     _emailFrom = emailFrom;
     _url = url;
 }
示例#38
0
        public void RequestComplete(IStatus obj)
        {
            if (obj == null) return;

            if (obj.Success)
            {
                //obj.Value // Message on success
                // close this window
            }
            else
            {
                //obj.Message; // Error message
            }
        }
示例#39
0
        public int CompareTo(IStatus other) {
            var actionState = ((Action == RepoStatus.Waiting) || (Action == RepoStatus.Finished)) &&
                              (other.Action != RepoStatus.Waiting) && (other.Action != RepoStatus.Finished)
                ? 1
                : 0;
            if (actionState != 0)
                return actionState;

            if ((Progress > 0.00) && (Progress < 100.0) && ((other.Progress <= 0.00) || (other.Progress >= 100)))
                return -1;

            if (((Progress <= 0.00) || (Progress >= 100)) && ((other.Progress <= 0.00) || (other.Progress >= 100)))
                return 0;

            if ((other.Progress > 0.00) && (other.Progress < 100.0) && ((Progress <= 0.00) || (Progress >= 100)))
                return 1;

            return Progress.CompareTo(other.Progress);
        }
示例#40
0
        public SolutionParser(ProjectEnumerator projectEnumerator, DacParserBuilder dacParserBuilder, IStatus statusDisplay)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            statusDisplay.SetStatus("Finding Sql Projects...");
            var projects = projectEnumerator.EnumerateProjects();

            int count = 1;
            if (DebugLogging.Enable)
            {
                OutputWindowMessage.WriteMessage("Solution: Found {0} projects", projects.Count);
            }

            foreach (var project in projects)
            {
                statusDisplay.SetStatus(string.Format("Enumerating project {0} of {1} - project: {2}", count++, projects.Count, project.Name));

                if (!File.Exists(project.DacPath))
                {
                    if (DebugLogging.Enable)
                    {
                        OutputWindowMessage.WriteMessage("Solution: Did not find dacpac for project - path: {0}", project.DacPath);
                    }
                    continue;
                }

                var dac = dacParserBuilder.Build(project.DacPath);

                _projectList.Add(project.Name);
                _projects.Add(project.Name, new VsProject(project.PreDeployScriptPath, project.PostDeployScriptPath, dac.GetTableDefinitions(), project.Name, File.GetLastWriteTime(project.DacPath)));
            }

            stopwatch.Stop();
            statusDisplay.SetStatus(string.Format("Complete...Process took {0} seconds", stopwatch.ElapsedMilliseconds / 1000));

            if (DebugLogging.Enable)
            {
                OutputWindowMessage.WriteMessage("Solution: Enumerate Complete...Process took {0} seconds", stopwatch.ElapsedMilliseconds / 1000);
            }
        }
示例#41
0
 public IStatus Delete(IStatus instance)
 {
     using (var cmd = new DBCommand())
     {
         try
         {
             StatusDAL.Delete(cmd, instance);
             cmd.Commit();
             return instance;
         }
         catch (Exception ex)
         {
             cmd.RollBack();
             using (var builder = new MessageBuilder())
             {
                 string err = builder.AppendLine("删除状态信息错误!").AppendLine(ex).Message;
                 throw new Exception(err);
             }
         }
     }
 }
示例#42
0
        void SumChangedPack(IStatus status) {
            status.Action = RepoStatus.Summing;
            var packFile = GetPackFile(status.Item);
            var sum = RepoTools.TryGetChecksum(packFile, status.Item);
            lock (WdVersion.Pack) {
                WdVersion.Pack[status.Item] = sum;
            }

            var wd = WdVersion.Pack.ContainsKey(status.Item) ? WdVersion.Pack[status.Item] : "-1";
            var pack = PackVersion.Pack.ContainsKey(status.Item) ? PackVersion.Pack[status.Item] : "-1";
            if (wd != pack)
                throw new ChecksumException($"{status.Item}. Got: {wd}, Expected: {pack}");
        }
示例#43
0
 public IStatus Update(IStatus item, string value)
 {
     return StatusBLL.Update(item, value);
 }
示例#44
0
        void SumChangedPack(IStatus status) {
            status.Action = RepoStatus.Summing;
            var packFile = GetPackFile(status.Item);
            var sum = RepoTools.TryGetChecksum(packFile, status.Item);
            lock (WdVersion.Pack) {
                WdVersion.Pack[status.Item] = sum;
            }

            var wd = WdVersion.Pack.ContainsKey(status.Item) ? WdVersion.Pack[status.Item] : "-1";
            var pack = PackVersion.Pack.ContainsKey(status.Item) ? PackVersion.Pack[status.Item] : "-1";
            if (wd != pack) {
                throw new ChecksumException(String.Format("{0}. Got: {1}, Expected: {2}",
                    status.Item, wd, pack));
            }
        }
 void ProcessIFDirectory(IAbsoluteDirectoryPath source, IAbsoluteDirectoryPath destination,
     IAbsoluteDirectoryPath tempPath, IStatus status) {
     using (new TmpDirectory(tempPath))
         ExtractFolder(source, tempPath, destination, status);
 }
示例#46
0
        protected virtual void ChangedWd(IStatus status, string change, bool changesOnly) {
            status.Action = RepoStatus.Unpacking;
            var dstFile = GetWdFile(change);
            var changePack = change + ArchiveFormat;
            var srcFile = GetPackFile(changePack);

            if (!srcFile.Exists) {
                this.Logger().Warn("Can't find archive: {0}", changePack);
                return;
            }

            RepoTools.UnpackFile(srcFile, dstFile, status);

            if (changesOnly)
                Tools.FileUtil.Ops.DeleteWithRetry(srcFile.ToString());

            status.Action = RepoStatus.Summing;
            var sum = RepoTools.TryGetChecksum(dstFile, change);
            lock (WdVersion.WD)
                WdVersion.WD[change] = sum;
            status.Action = RepoStatus.Finished;
        }
示例#47
0
 void ProcessChangedPack(IStatus status, bool changesOnly) {
     var it = Tools.FileUtil.RemoveExtension(status.Item, ArchiveFormat);
     var wd = WdVersion.WD.ContainsKey(it) ? WdVersion.WD[it] : null;
     var pack = PackVersion.WD.ContainsKey(it) ? PackVersion.WD[it] : null;
     if (wd != pack)
         ChangedWd(status, it, changesOnly);
 }
示例#48
0
 async Task TryProcessPackChange(IStatus status, bool changesOnly) {
     var done = false;
     try {
         await ChangedPack(status).ConfigureAwait(false);
         try {
             if (MultiThreadingSettings.PackInclUnpack)
                 ProcessChangedPack(status, changesOnly);
             done = true;
         } catch (Exception e) {
             this.Logger().FormattedWarnException(e);
         }
     } finally {
         if (done)
             EndOutput(status);
         else
             FailedOutput(status);
     }
 }
示例#49
0
 protected virtual void StartOutput(IStatus status) {
     this.Logger().Info("Start Processing {0}", status.Item);
     status.StartOutput(GetPackFile(status.Item).ToString());
 }
示例#50
0
 protected virtual void FailedOutput(IStatus status) {
     this.Logger().Info("Failed Processing {0}", status.Item);
     status.FailOutput(GetPackFile(status.Item).ToString());
 }
示例#51
0
 Spec GetPackSpec(IStatus status) => DownloadManager.GetSpec(status.Item, GetPackFile(status.Item), status);
        public bool Equals(IStatus other)
        {
            if (other == null)
                return false;

            return object.Equals(this.Exception, other.Exception)
                && this.FileLocation == other.FileLocation
                && this.Level == other.Level
                && this.Message == other.Message
                && object.Equals(this.Component, other.Component)
                && this.ErrorCode == other.ErrorCode;
        }
示例#53
0
 /// <summary>
 /// Initialize with IStatus
 /// </summary>
 /// <param name="status"></param>
 /// <returns>self reference</returns>
 public ILog init(IStatus status)
 {
     this.status = status;
     return this;
 }
 public void Setup()
 {
     _status = new Status154();
     _ticket = Substitute.For<ITicket>();
     _ticketHelper = Substitute.For<ITicketHelper>();
 }
 void ExtractFolder(IAbsoluteDirectoryPath rootPath, IAbsoluteDirectoryPath tempPath,
     IAbsoluteDirectoryPath destination, IStatus status) {
     destination = destination.GetChildDirectoryWithName("addons");
     destination.MakeSurePathExists();
     var files = Directory.GetFiles(Path.Combine(rootPath.ToString(), "addons"), "*.ifa");
     var i = 0;
     foreach (var f in files) {
         ProcessPbo(f, tempPath, destination);
         i++;
         status.Update(null, ((double)i / files.Length) * 100);
     }
 }
示例#56
0
        protected virtual async Task ChangedPack(IStatus status) {
            var completed = false;

            while (!completed)
                completed = await TryChangedPack(status).ConfigureAwait(false);
        }
        static IStatus AppendCore(IStatusAppender source, IStatus status)
        {
            if (source == null)
                throw new ArgumentNullException("source"); // $NON-NLS-1

            source.Append(status);
            return status;
        }
示例#58
0
 void TryHandleWd(IStatus status, bool changesOnly) {
     try {
         ChangedWd(status, status.Item, changesOnly);
         var wd = WdVersion.WD.ContainsKey(status.Item) ? WdVersion.WD[status.Item] : "-1";
         var pack = PackVersion.WD.ContainsKey(status.Item) ? PackVersion.WD[status.Item] : "-1";
         if (wd != pack)
             throw new ChecksumException($"{status.Item}. Got: {wd}, Expected: {pack}");
         EndOutput(status);
     } catch (Exception e) {
         this.Logger().FormattedWarnException(e);
         FailedOutput(status);
     }
 }
 void WriteProgress(IStatus status) {
     _action = status.Action;
     Console.Write("\r" + status.Action + ":" + GetProgressComponent(status.Progress) +
                   GetSpeedComponent(status.Speed)
                   + "                    ");
 }
示例#60
0
 async Task<bool> TryChangedPack(IStatus status) {
     try {
         await DownloadManager.FetchFileAsync(GetPackSpec(status)).ConfigureAwait(false);
         SumChangedPack(status);
         return true;
         //            } catch (HostListExhausted) {
         //                StatusRepo.Abort();
         //                throw;
     } catch (ChecksumException e) {
         this.Logger().FormattedWarnException(e);
         return false;
     }
 }