Ejemplo n.º 1
0
 public MainPageViewModel(Interfaces.IDialogService dialogService,
     IEventAggregator eventAggregator,INavigationService navigationService)
 {
     this._dialogService = dialogService;
     this._eventAggregator = eventAggregator;
     this._navigationService = navigationService;
 }
        public Dictionary <string, List <Interfaces> > GetChoosedInterfaceByIsValid(string isValid = "")
        {
            var userInterList = db.GetCollection <UserInterface>().Where(o => o.AccessID == Session["AccessID"].ToString()).ToList();

            if (isValid != "")
            {
                userInterList = db.GetCollection <UserInterface>().Where(o => o.AccessID == Session["AccessID"].ToString()).Where(o => o.IsValid == isValid).ToList();
            }

            Dictionary <string, List <Interfaces> > selectDic = new Dictionary <string, List <Interfaces> >();

            foreach (UserInterface inter in userInterList)
            {
                Interfaces sel = db.GetCollection <Interfaces>().Where(o => o.CategoryCode == inter.CategoryCode).ToList().First();
                if (sel != null)
                {
                    if (!selectDic.ContainsKey(inter.TypeName))
                    {
                        selectDic.Add(inter.TypeName, new List <Interfaces>());
                    }

                    selectDic[inter.TypeName].Add(sel);
                }
            }
            return(selectDic);
        }
Ejemplo n.º 3
0
        public override bool Apply(Interfaces.IVimHost host)
        {
            string reg_text = _register.GetText(host);
            if (reg_text == null) {
                return false;
            }

            if (_register.IsTextLines) {
                string text = reg_text;
                for (int i = 0; i < (this.Repeat - 1); i++) {
                    text = text + host.LineBreak + reg_text;
                }

                host.OpenLineBelow();
                host.InsertTextAtCurrentPosition(text);
            }
            else {
                string text = "";
                for (int i = 0; i < this.Repeat; i++) {
                    text = text + reg_text;
                }

                host.CaretRight();
                host.InsertTextAtCurrentPosition(text);
            }

            if (host.IsCurrentPositionAtEndOfLine()) {
                host.MoveToEndOfLine();
                host.CaretLeft();
            }

            return true;
        }
Ejemplo n.º 4
0
 public void RemoveConnections()
 {
     foreach (Interface inter in Interfaces.Where(x => x.IsConnected).ToList())
     {
         inter.RemoveConnection();
     }
 }
Ejemplo n.º 5
0
        private void TrackStatus(Interfaces i)
        {
            SAPTestHelper.Current.SAPGuiSession.StartTransaction("ZIDOCAUDREP");

            SAPTestHelper.Current.MainWindow.FindByName <GuiCTextField>("S_CREDAT-LOW").Text  = DateTime.Now.AddMonths(-1).ToString("dd.MM.yyyy");
            SAPTestHelper.Current.MainWindow.FindByName <GuiCTextField>("S_CREDAT-HIGH").Text = DateTime.Now.ToString("dd.MM.yyyy");
            SAPTestHelper.Current.MainWindow.FindByName <GuiCTextField>("S_CRETIM-LOW").Text  = "00:00:00";
            SAPTestHelper.Current.MainWindow.FindByName <GuiCTextField>("S_CRETIM-HIGH").Text = "24:00:00";
            SAPTestHelper.Current.MainWindow.FindByName <GuiCTextField>("S_STATUS-LOW").Text  = "*";
            SAPTestHelper.Current.MainWindow.FindByName <GuiCTextField>("P_DIRECT").Text      = "2";


            SAPTestHelper.Current.MainWindow.FindByName <GuiRadioButton>("R_OTHERS").Select();
            SAPTestHelper.Current.MainWindow.FindByName <GuiCTextField>("S_MESTYP-LOW").Text = i.MsgType;

            SAPTestHelper.Current.MainWindow.FindByName <GuiCheckBox>("P_DOWNLD").Selected = true;
            SAPTestHelper.Current.MainWindow.FindByName <GuiRadioButton>("P_FILE").Select();
            SAPTestHelper.Current.MainWindow.FindByName <GuiTextField>("P_CPATH").Text = _data.GetAIF56File(i.Id);

            SAPTestHelper.Current.MainWindow.FindByName <GuiRadioButton>("P_DOC").Select();

            SAPTestHelper.Current.MainWindow.FindByName <GuiButton>("%_S_IDOCNO_%_APP_%-VALU_PUSH").Press();

            List <string> idocNumbers = new List <string>();

            var myTasks = i.Tasks.Where(m => m.Mid == _data.MissionId).ToList();

            foreach (var t in myTasks)
            {
                idocNumbers.AddRange(t.LH7IDocs.Select(s => s.IDocNumber));
            }


            SAPTestHelper.Current.PopupWindow.FindDescendantByProperty <GuiTableControl>().SetBatchValues(idocNumbers);
            SAPTestHelper.Current.PopupWindow.FindByName <GuiButton>("btn[8]").Press();

            SAPTestHelper.Current.MainWindow.FindByName <GuiButton>("btn[8]").Press();

            if (SAPTestHelper.Current.PopupWindow != null)
            {
                SAPTestHelper.Current.PopupWindow.FindByName <GuiButton>("btn[0]").Press();
            }


            var itg_IDocNumbers = Tools.GetDataEntites <IDoc>(_data.GetAIF56File(i.Id));

            using (var db = new AIFDbContext()) {
                foreach (var item in itg_IDocNumbers)
                {
                    var iDoc     = item.GetIDocs();
                    var iDocInDB = db.LH7IDocs.SingleOrDefault(s => s.IDocNumber == iDoc.IDocNumber);
                    if (iDocInDB != null)
                    {
                        db.LH7IDocs.Remove(iDocInDB);
                    }
                    db.LH7IDocs.Add(iDoc);
                }
                db.SaveChanges();
            }
        }
Ejemplo n.º 6
0
        public static Interfaces GetInterfaces()
        {
            var UnformattedInterfaces = Analyzer.GetInterfaces();
            var FormattedInterfaces   = Interfaces.GetFromStringResult(UnformattedInterfaces);

            return(FormattedInterfaces);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Remove the selected profile.
        /// </summary>
        private async Task RemoveProfileAsync()
        {
            BusyStateManager.EnterBusy();
            BusyStateManager.SetMessage(SeverityType.Info, "Removing selected profile.");

            /* Temporary store selected interface and WiFi profile so they can be restored after deletion. */
            Guid selectedInterfaceId = SelectedInterface.Id;
            int  profilePosition     = SelectedWiFiProfile.Position;

            await _mainController.DeleteProfileAsync(SelectedWiFiProfile);

            await DownloadProfilesAsync();

            /* Restore selected interface and position of selected WiFi profile. */
            Profile selectedWifiProfile = WiFiProfiles.Where(x => x.Id == selectedInterfaceId &&
                                                             x.Position == profilePosition).FirstOrDefault();

            if (selectedWifiProfile == default(Profile))
            {
                selectedWifiProfile = WiFiProfiles.Where(x => x.Id ==
                                                         selectedInterfaceId).OrderByDescending(x => x.Position).FirstOrDefault();
            }

            Interface selectedInterface = Interfaces.Where(x => x.Id == selectedInterfaceId).FirstOrDefault();

            SelectedInterface = selectedInterface == default(Interface) ?
                                Interfaces.FirstOrDefault() : selectedInterface;
            if (selectedWifiProfile != default(Profile))
            {
                SelectedWiFiProfile = selectedWifiProfile;
            }

            BusyStateManager.SetMessage(SeverityType.None);
            BusyStateManager.ExitBusy();
        }
Ejemplo n.º 8
0
        public void QueryTest()
        {
            var query = new RestRequest(Method.GET);

            query.Resource      = "api/device";
            query.RequestFormat = DataFormat.Json;
            var resp = _client.Execute(query);

            Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode);
            const String ExpectedResponse = "[{\"Enabled\":false,\"Value\":0.0,\"ID\":0,\"LastUpdate\":\"2015-04-21T13:28:10.5439104\",\"Name\":\"light1\",\"Class\":\"LightSwitch\"},{\"Enabled\":false,\"State\":0,\"ID\":1,\"LastUpdate\":\"2015-04-21T13:28:10.5442048\",\"Name\":\"Kitchen Ceiling Fan\",\"Class\":\"CeilingFan\"},{\"Enabled\":false,\"SetPoint\":0.0,\"Value\":0.0,\"ID\":2,\"LastUpdate\":\"2015-04-21T13:28:10.5442048\",\"Name\":\"HVAC\",\"Class\":\"Thermostat\"}]";

            Assert.IsTrue(resp.Content.Length > 0);
            var resp_obj = JArray.Parse(resp.Content);
            var test_obj = JArray.Parse(ExpectedResponse);

            Assert.AreEqual(resp_obj.Count, test_obj.Count);

            foreach (var obj in resp_obj)
            {
                var resp_dev = Interfaces.DeserializeDevice(obj.ToString(), null, null, _frame);
                foreach (var exp_obj in test_obj)
                {
                    var exp_dev = Interfaces.DeserializeDevice(exp_obj.ToString(), null, null, _frame);
                    if (resp_dev.ID.DeviceID == exp_dev.ID.DeviceID)
                    {
                        Assert.AreEqual(resp_dev.ID.DeviceID, exp_dev.ID.DeviceID);
                        Assert.IsTrue(resp_dev.UpdateOk);
                        Assert.AreEqual(exp_dev.Name, resp_dev.Name);
                        Assert.AreEqual(exp_dev.Class, resp_dev.Class);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Create a new interface instance and context
        /// </summary>
        /// <param name="name"></param>
        /// <returns>New context created</returns>
        public IntPtr CreateInterface(int pipe_id, string name)
        {
            // Always try to make a map
            var(context, iface, is_map) = Context.CreateInterface(name, true);

            if (context == IntPtr.Zero)
            {
                return(IntPtr.Zero);
            }

            if (!is_map)
            {
                Log.WriteLine("Context.CreateInterface didnt create map (is_map expected to be true)");
                return(IntPtr.Zero);
            }

            iface.ClientId    = Id;
            iface.InterfaceId = -1;

            if (is_map)
            {
                iface.InterfaceId = Server.CreateInterface(pipe_id, Id, name);

                var map = (IBaseInterfaceMap)iface;
                map.PipeId = pipe_id;
            }

            Interfaces.Add(iface);

            return(context);
        }
Ejemplo n.º 10
0
 public void AddMessage(Protocol.IMessage message, Interfaces.IUserAgent user)
 {
     lock (this)
     {
         mQueue.Enqueue(new MessageToken { Message = message, UserAgent = user });
     }
 }
Ejemplo n.º 11
0
 public override bool Apply(Interfaces.IVimHost host)
 {
     this.OnBeforeInsert(host);
     Modes.ModeInsert mode = new Modes.ModeInsert(host, host.CurrentMode, this);
     host.CurrentMode = mode;
     return true;
 }
Ejemplo n.º 12
0
 public void SendPacketNeededAck(Interfaces.IPacket Packet)
 {
     lock (DictionaryLock)
     {
         packetIdCounter.Next();
         Packet.PacketId = new UDPClientServerCommons.Usefull.PacketIdCounter(packetIdCounter.Value);
         packetsWaitingForAck.Add(packetIdCounter.Value, Packet);
     }
     if (packetsWaitingForAck.Count == 0)
     {
         //theres no packages that needed ack
         //so the timer has stoped
         //it needs to be started again when needed
         AckTimer.Change(0, 10);
     }
     else
         switch (packetsWaitingForAck.Count)
         {
             case (1):
                 AckTimer.Change(0, 2*_SENDING_DELAY);
                 break;
             default:
                 AckTimer.Change(0, _SENDING_DELAY);
                 break;
         }
 }
 public PolicyDesignerErrorProvider(
     Interfaces.IErrorProviderCollection errorProviderCollection,
     ErrorProvider errorProvider)
 {
     m_parentCollection = errorProviderCollection;
     m_errorProvider = errorProvider;
 }
Ejemplo n.º 14
0
        public override void Clear()
        {
            Accessibility        = default;
            DeclarationModifiers = default;

            if (Interfaces == null)
            {
                Interfaces = new List <ReferenceBuilder>();
            }
            else
            {
                Interfaces.Clear();
            }

            Name = default;

            if (TypeParameters == null)
            {
                TypeParameters = new List <TypeParameterConfig>();
            }
            else
            {
                TypeParameters.Clear();
            }

            _members.Clear();
        }
		/// <summary>
		/// Inicjalizuje obiekt.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="nation"></param>
		/// <param name="controller"></param>
		/// <param name="showStatistics"></param>
		public PlayerInfo(string name, Interfaces.Units.INation nation, IPlayerController controller, bool showStatistics)
		{
			this.Name = name;
			this.Nation = nation;
			this.Controller = controller;
			this.ShowStatistics = showStatistics;
		}
Ejemplo n.º 16
0
        /// <summary>
        /// Filters <see cref="Type"/>s based on the interfaces they implement.
        /// </summary>
        /// <param name="type">The <see cref="Type"/> to filter.</param>
        /// <param name="mustBeRequired">This check will only be performed with this argument matches the value of the
        /// <see cref="RequireInterfaces"/> property.</param>
        /// <returns>True if the <paramref name="type"/> should be included; false if it was filtered out.</returns>
        /// <exception cref="TypeFilterException"><paramref name="mustBeRequired"/> is true, <see cref="RequireInterfaces"/>
        /// is true, and the <paramref name="type"/> does not implement the required <see cref="Interfaces"/>.</exception>
        bool FilterInterfaces(Type type, bool mustBeRequired)
        {
            if (mustBeRequired != RequireInterfaces)
            {
                return(true);
            }

            if (Interfaces == null || Interfaces.IsEmpty())
            {
                return(true);
            }

            var i       = type.GetInterfaces();
            var isValid = (MatchAllInterfaces ? Interfaces.All(i.Contains) : Interfaces.Any(i.Contains));

            if (!isValid)
            {
                if (RequireInterfaces)
                {
                    const string errmsg = "Type `{0}` does not have the required interfaces: `{1}`.";
                    var          err    = string.Format(errmsg, type, GetTypeString(Interfaces));
                    if (log.IsFatalEnabled)
                    {
                        log.Fatal(err);
                    }
                    throw new TypeFilterException(err);
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 17
0
        private void ImplementInterfaceHelper()
        {
            foreach (var method in Interfaces.SelectMany(i => i.GetMethods()))
            {
                var newMethod = TypeBuilder.DefineMethod(
                    method.Name,
                    method.Attributes ^ MethodAttributes.Abstract,
                    method.CallingConvention,
                    method.ReturnType,
                    method.ReturnParameter.GetRequiredCustomModifiers(),
                    method.ReturnParameter.GetOptionalCustomModifiers(),
                    method.GetParameters().Select(p => p.ParameterType).ToArray(),
                    method.GetParameters().Select(p => p.GetRequiredCustomModifiers()).ToArray(),
                    method.GetParameters().Select(p => p.GetOptionalCustomModifiers()).ToArray()
                    );

                var methodBody = newMethod.GetILGenerator();

                var hasReturnType = method.ReturnType != typeof(void);

                if (hasReturnType)
                {
                    methodBody.Emit(OpCodes.Ldnull);
                }

                // return;
                methodBody.Emit(OpCodes.Ret);
            }
        }
Ejemplo n.º 18
0
 public void OnMouseRightClick(Interfaces.MouseEventArgs e)
 {
     if (MouseRightClick != null)
     {
         MouseRightClick(this, e);
     }
 }
Ejemplo n.º 19
0
    protected virtual EditableEntity GetEditableEntity(Interfaces.IValueHolder valueHolder)
    {
        if (valueHolder == null)
            throw new NullReferenceException("valueHolder can't be null");

        valueHolder.GetKeySynonym = new Interfaces.GetKeySynonymDelegate(this.GetKeySynonym);
        EditableEntity entity = this.CreateEditableEntityInstance();
        string[] keys;

        if (this.IsNew)
        {
            keys = this.GetPrimaryKeysForNewEntity();
            entity.AddNew();
            foreach (string key in keys)
            {
                entity[key] = valueHolder[key];
            }
            return entity;
        }

        keys = this.GetPrimaryKeys();
        foreach (string key in keys)
        {
            if (!entity.SetWhereParamValue(key, valueHolder[key]))
                throw new Exception(string.Format("Can't set SqlClientEntity where parameter [{0}] to value [{1}]", key, valueHolder[key]));
        }

        if (!entity.Load())
            throw new Exception("Can't load SqlClientEntity of type " + entity.GetType());

        return entity;
    }
Ejemplo n.º 20
0
 /// <summary>
 /// Should be called after a node is created to set parent referneces
 /// This allows interfaces, volumes, etc. to poll through the provider
 /// </summary>
 public void SetReferences()
 {
     Interfaces?.ForEach(i => i.Node = this);
     Volumes?.ForEach(v => v.Node    = this);
     Apps?.ForEach(a => a.Node       = this);
     Services?.ForEach(s => s.Node   = this);
 }
Ejemplo n.º 21
0
 public void OnMouseMove(Interfaces.MouseMoveEventArgs e)
 {
     if (MouseMove != null)
     {
         MouseMove(this, e);
     }
 }
Ejemplo n.º 22
0
 private void AddInterface(ITypeDefinition interfce, StringBuilder key)
 {
     if (interfce.Namespace == "")
     {
         lock (Interfaces)
         {
             foreach (var typeArg in interfce.TypeParameters)
             {
                 foreach (var constraint in typeArg.DirectBaseTypes)
                 {
                     key.Append(constraint.Name);
                 }
             }
             if (Interfaces.ContainsKey(key.ToString()))
             {
                 return;
             }
             Interfaces.Add(key.ToString(), new InterfaceProperties(interfce));
         }
     }
     else
     {
         AddNamespace(key, interfce);
     }
 }
Ejemplo n.º 23
0
 public override bool DisplayOptionToUser(IOption option, Interfaces.IScriptBaseObject iteratorObject)
 {
     try
     {
         if (option.DisplayToUserValue.HasValue)
         {
             return option.DisplayToUserValue.Value;
         }
         if (string.IsNullOrEmpty(option.DisplayToUserFunction))
         {
             return true;
         }
         if (iteratorObject == null)
         {
             object[] parameters = new object[0];
             return (bool)Loader.Instance.CallTemplateFunction(option.DisplayToUserFunction, ref parameters);
         }
         else
         {
             object[] parameters = new object[] { iteratorObject };
             return (bool)Loader.Instance.CallTemplateFunction(option.DisplayToUserFunction, ref parameters);
         }
     }
     catch (MissingMethodException)
     {
         object[] parameters = new object[] { iteratorObject };
         return (bool)Loader.Instance.CallTemplateFunction(option.DisplayToUserFunction, ref parameters);
     }
 }
Ejemplo n.º 24
0
 public DebugLogEventArgs(Data.DebugLogLevel level, Interfaces.IPlugin p, Exception e, string msg)
 {
     Plugin = p;
     Message = msg;
     Level = level;
     Exception = e;
 }
Ejemplo n.º 25
0
        public NamespaceInfo(AssemblyInfo assemblyInfo, string @namespace, List <Type> types, XElement xmlDocs)
        {
            Assembly = assemblyInfo;

            Namespace = @namespace;

            foreach (var type in types)
            {
                var typeInfo = new TypeInfo(type, xmlDocs);
                Types.Add(typeInfo);

                if (type.IsClass)
                {
                    Classes.Add(typeInfo);
                }
                else if (type.IsInterface)
                {
                    Interfaces.Add(typeInfo);
                }
                else if (type.IsEnum)
                {
                    Enums.Add(typeInfo);
                }
            }
        }
        public SyncMenuViewModel(
            Interfaces.ICollectorReceiptManager receiptManager, 
            Interfaces.IGoogleManager googleManager,
            IEventAggregator eventAggregator)
        {
            if (receiptManager == null)
            {
                throw new ArgumentNullException("receiptManager");
            }

            if (googleManager == null)
            {
                throw new ArgumentNullException("googleManager");
            }

            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }

            this.eventAggregator = eventAggregator;
            this.receiptManager = receiptManager;
            this.googleManager = googleManager;

            this.eventAggregator.GetEvent<Events.StartSyncEvent>().Subscribe((o) =>
            {
                this.StartSync();
            });       
        }
Ejemplo n.º 27
0
    public override async Task Load()
    {
        BaseClassStr     = Node.GetAttribute("baseClass");
        _abstract        = Node.GetAttribute <bool>("abstract", false);
        _nullableDefault = Node.GetAttribute <bool>("nullableDefault", ProtoGen.NullableDefault);

        if (NeedsReflectionGeneration)
        {
            Interfaces.Add(LoquiInterfaceDefinitionType.ISetter, nameof(ILoquiReflectionSetter));
        }

        if (ObjectNamedKey.TryFactory(BaseClassStr, ProtoGen.Protocol, out var baseClassObjKey))
        {
            if (!gen.ObjectGenerationsByObjectNameKey.TryGetValue(baseClassObjKey, out ObjectGeneration baseObj) ||
                !(baseObj is ClassGeneration))
            {
                throw new ArgumentException($"Could not resolve base class object: {BaseClassStr}");
            }
            else
            {
                ClassGeneration baseClass = baseObj as ClassGeneration;
                BaseClass = baseClass;
                baseClass._derivativeClasses.Add(this);
            }
        }
#if NETSTANDARD2_0
        WiredBaseClassTCS.TrySetResult(true);
#else
        WiredBaseClassTCS.TrySetResult();
#endif

        await base.Load();
    }
Ejemplo n.º 28
0
        public string GetContractType()
        {
            if (ContractTags != null)
            {
                if (ContractTags.Contains("fa2"))
                {
                    return("FA2");
                }

                if (ContractTags.Contains("fa1-2"))
                {
                    return("FA12");
                }
            }

            if (Interfaces == null)
            {
                return("FA2");
            }

            if (Interfaces.FirstOrDefault(i => i == "TZIP-12" || i == "TZIP-012" || i.StartsWith("TZIP-012")) != null)
            {
                return("FA2");
            }

            if (Interfaces.FirstOrDefault(i => i == "TZIP-7" || i == "TZIP-007" || i.StartsWith("TZIP-007")) != null)
            {
                return("FA12");
            }

            return("FA2");
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Gets the interface info for the given interface type (defined in managed code)
        /// </summary>
        /// <param name="type">The interface type</param>
        /// <returns>The interface info for the given type</returns>
        public static ManagedInterface GetManagedInterface(Type type)
        {
            ManagedInterface result;

            Interfaces.TryGetValue(type, out result);
            return(result);
        }
Ejemplo n.º 30
0
 public static void Inscribe(Game.ConquerStructures.Society.ArsenalType Type, uint Donation, Interfaces.IConquerItem item, Game.Entity Entity)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
     cmd.Insert("guild_arsenalsdonation").Insert("d_uid", Entity.UID).Insert("guild_uid", Entity.GuildID).Insert("name", Entity.Name).Insert("item_uid", item.UID).Insert("item_donation", Donation).Insert("item_arsenal_type", (byte)Type).Execute();
     cmd = new MySqlCommand(MySqlCommandType.UPDATE);
     cmd.Update("items").Set("Inscribed", 1).Where("UID", item.UID).Execute();
 }
        private void DetectElementsInFile(CodeElements elements)
        {
            foreach (CodeElement element in elements)
            {
                if (element is CodeClass)
                {
                    Classes.Add(element as CodeClass);
                }

                if (element is CodeEnum)
                {
                    Enums.Add(element as CodeEnum);
                }

                if (element is CodeStruct)
                {
                    Structs.Add(element as CodeStruct);
                }

                if (element is CodeInterface)
                {
                    Interfaces.Add(element as CodeInterface);
                }

                DetectElementsInFile(element.Children);
            }
        }
Ejemplo n.º 32
0
        protected override void DoInteraction(Client client, Interfaces.ItemStack item)
        {
            base.DoInteraction(client, item);

            if (client != null && !Chraft.Interfaces.ItemStack.IsVoid(item))
            {
                if (item.Type == (short)Chraft.World.BlockData.Items.Shears && !Data.Sheared)
                {
                    // Drop wool when sheared
                    sbyte count = (sbyte)Server.Rand.Next(2, 4);
                    if (count > 0)
                        Server.DropItem(World, UniversalCoords.FromWorld(Position.X, Position.Y, Position.Z), new Interfaces.ItemStack((short)Chraft.World.BlockData.Blocks.Wool, count, (short)Data.WoolColor));
                    Data.Sheared = true;

                    SendMetadataUpdate();
                }
                else if (item.Type == (short)Chraft.World.BlockData.Items.Ink_Sack)
                {
                    // Set the wool colour of this Sheep based on the item.Durability
                    // Safety check. Values of 16 and higher (color do not exist) may crash the client v1.8.1 and below
                    if (item.Durability >= 0 && item.Durability <= 15)
                    {
                        //this.Data.WoolColor = (WoolColor)Enum.ToObject(typeof(WoolColor), (15 - item.Durability));
                        Data.WoolColor = DyeColorToWoolColor((MetaData.Dyes)Enum.ToObject(typeof(MetaData.Dyes), item.Durability));
                        SendMetadataUpdate();
                    }
                }
            }
        }
Ejemplo n.º 33
0
        static void Main(string region  = null,
                         string session = null,
                         string package = null,
                         string project = null,
                         string[] args  = null)
        {
            switch (region)
            {
            case "OO1":
                Basic.RunStuff(null);
                break;

            case "OO2":
                Interfaces.RunStuff(null);
                break;

            case "OO3":
                AbstractClasses.RunStuff(null);
                break;

            case "OO4":
                Polymorphism.RunStuff(null);
                break;

            default:
                break;
            }
        }
 public MethodParamPair(
     MethodParamResult method,
     Interfaces.IEventInput input)
 {
     _method = method;
     _params = input;
 }
Ejemplo n.º 35
0
        public ActionResult Import(HttpPostedFileBase file, int?id, string name, int?year, string budgetType)
        {
            if (!Authorized(RoleType.SystemManager))
            {
                return(Error(Loc.Dic.error_no_permission));
            }
            if (file != null && file.ContentLength <= 0)
            {
                return(Error(Loc.Dic.error_invalid_form));
            }
            if (string.IsNullOrEmpty(budgetType))
            {
                return(Error(Loc.Dic.Error_chooseMonthelyOrYearlyBudget));
            }
            if (!(budgetType == "Month" || budgetType == "Year"))
            {
                return(Error(Loc.Dic.Error_no_budgetType));
            }


            if (id.HasValue)
            {
                string moved = Interfaces.ImportBudget(file.InputStream, CurrentUser.CompanyId, id.Value, budgetType);
                if (moved == "OK")
                {
                    return(RedirectToAction("index"));
                }
                else
                {
                    return(Error(moved));
                }
            }
            else if (year.HasValue)
            {
                if (year.Value > DateTime.Now.Year + 10 || year.Value < DateTime.Now.Year - 1)
                {
                    return(Error(Loc.Dic.error_invalid_budget_year));
                }

                using (BudgetsRepository budgetsRepository = new BudgetsRepository(CurrentUser.CompanyId))
                {
                    Budget newBudget = new Budget();
                    newBudget.Name      = name;
                    newBudget.Year      = year.Value;
                    newBudget.CompanyId = CurrentUser.CompanyId;
                    newBudget.IsActive  = false;
                    budgetsRepository.Create(newBudget);
                    string moved = Interfaces.ImportBudget(file.InputStream, CurrentUser.CompanyId, newBudget.Id, budgetType);
                    if (moved == "OK")
                    {
                        return(RedirectToAction("index"));
                    }
                    else
                    {
                        return(Error(moved));
                    }
                }
            }
            return(Error(Loc.Dic.error_invalid_form));
        }
Ejemplo n.º 36
0
        public override INHibernateProxy GetProxy(object id, ISessionImplementor session)
        {
            INHibernateProxy proxy;

            try
            {
                var behaviorInfo = _behaviorConfigurator.GetProxyInformation(PersistentClass);


                var initializer = new LazyInitializer(EntityName, PersistentClass, id, GetIdentifierMethod,
                                                      SetIdentifierMethod, ComponentIdType, session);

                IInterceptor[] interceptors = behaviorInfo.Interceptors
                                              .Select(i => _kernel.Resolve(i))
                                              .OfType <IInterceptor>()
                                              .Union(new[] { initializer }).ToArray();

                Type[] interfaces = Interfaces.Union(behaviorInfo.AdditionalInterfaces).ToArray();

                object obj2 = IsClassProxy
                                                ? ProxyGenerator.CreateClassProxy(PersistentClass, interfaces, interceptors)
                                : ProxyGenerator.CreateInterfaceProxyWithoutTarget(interfaces[0], interfaces,
                                                                                   new IInterceptor[] { initializer });
                initializer._constructed = true;
                proxy = (INHibernateProxy)obj2;
            }
            catch (Exception exception)
            {
                log.Error("Creating a proxy instance failed", exception);
                throw new HibernateException("Creating a proxy instance failed", exception);
            }
            return(proxy);
        }
Ejemplo n.º 37
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            foreach (var attr in Attributes)
            {
                sb.AppendLine(attr.ToString());
            }
            sb.AppendLine($"namespace {NamespaceName}");
            sb.AppendLine("{");
            foreach (string interfaceLine in Interfaces.BreakIntoLines())
            {
                sb.AppendLine($"\t{interfaceLine}");
            }
            foreach (string classLine in Classes.BreakIntoLines())
            {
                sb.AppendLine($"\t{classLine}");
            }
            foreach (string enumLine in Enums.BreakIntoLines())
            {
                sb.AppendLine($"\t{enumLine}");
            }
            foreach (string structLine in Structs.BreakIntoLines())
            {
                sb.AppendLine($"\t{structLine}");
            }
            sb.AppendLine("}");
            return(sb.ToString());
        }
Ejemplo n.º 38
0
 public void Configure(Interfaces.Configuration c)
 {
     foreach (Uri uri in c.SlaveWsdlUrls)
     {
         clients.Add(new KeyValueBaseSlaveClient(uri));
     }
 }
Ejemplo n.º 39
0
        private void InitializeNetworkMeter()
        {
            _interfaces = new List <NetworkInterface>();
            /// Detecting Network Adaptors Using
            List <NetworkInterface> nics = NetworkInterface.GetAllNetworkInterfaces().Where(network =>
                                                                                            network.OperationalStatus == OperationalStatus.Up &&
                                                                                            (network.NetworkInterfaceType == NetworkInterfaceType.Ethernet ||
                                                                                             network.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)).ToList();

            /// If none is active get all of them :)
            if (nics.Count == 0)
            {
                nics = NetworkInterface.GetAllNetworkInterfaces().Where(network =>
                                                                        (network.NetworkInterfaceType == NetworkInterfaceType.Ethernet ||
                                                                         network.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)).ToList();
            }

            /// Add Items To the combo item source
            nics.ForEach(i => Interfaces.Add(i));
            //Set the selected interface to the first one
            if (Interfaces.Count > 0)
            {
                SelectedInterface = Interfaces.First();
            }
            OnPropertyChanged("Interfaces");
            OnPropertyChanged("SelectedInterface");
        }
Ejemplo n.º 40
0
 protected override async Task GenerateClassLine(StructuredStringBuilder sb)
 {
     using (var args = sb.Class(ObjectName))
     {
         args.Abstract = Abstract;
         args.Partial  = true;
         if (HasLoquiBaseObject && HasNonLoquiBaseObject)
         {
             throw new ArgumentException("Cannot define both a loqui and non-loqui base class");
         }
         if (HasLoquiBaseObject)
         {
             args.BaseClass = BaseClassName;
         }
         else if (HasNonLoquiBaseObject && SetBaseClass)
         {
             args.BaseClass = NonLoquiBaseClass;
         }
         args.Interfaces.Add(Interface(getter: false, internalInterface: true));
         args.Interfaces.Add($"ILoquiObjectSetter<{ObjectName}>");
         args.Interfaces.Add(Interfaces.Get(LoquiInterfaceType.Direct));
         args.Interfaces.Add(await GetApplicableInterfaces(LoquiInterfaceType.Direct).ToListAsync());
         args.Interfaces.Add(ProtoGen.Interfaces);
         args.Interfaces.Add(gen.Interfaces);
         args.Interfaces.Add($"IEquatable<{Interface(getter: true, internalInterface: true)}>");
     }
 }
        public void DrawWithEffect(Interfaces.IDrawableGeom geom)
        {
            /*if (_cNode != null)
            {
                View = _cNode.View;
                Projection = _cNode.Projection;
            }*/
            if (geom.Ready)
            {
                object oldState = null;
                if (_samplerstate != null)
                {
                    oldState = BasicEffect.GraphicsDevice.SamplerStates[0];
                    BasicEffect.GraphicsDevice.SamplerStates[0] = _samplerstate;
                }

                _deviceReference.BlendState = BlendState.AlphaBlend;
                _deviceReference.DepthStencilState = EquestriEngine.DepthState;

                foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
                {
                    pass.Apply();

                    _deviceReference.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(
                        PrimitiveType.TriangleList, geom.Vertices, 0, geom.Vertices.Length,
                        geom.Indices, 0, 2);
                }
                if (oldState != null)
                    BasicEffect.GraphicsDevice.SamplerStates[0] = oldState as SamplerState;
            }
            else
                Systems.ConsoleWindow.WriteLine("Failed to draw geometry");
        }
Ejemplo n.º 42
0
        public bool IsOfType(IObjectSpecImmutable specification)
        {
            if (specification == this)
            {
                return(true);
            }
            if (Interfaces.Any(interfaceSpec => interfaceSpec.IsOfType(specification)))
            {
                return(true);
            }

            // match covariant generic types
            if (Type.IsGenericType && IsCollection)
            {
                Type otherType = specification.Type;
                if (otherType.IsGenericType && Type.GetGenericArguments().Count() == 1 && otherType.GetGenericArguments().Count() == 1)
                {
                    if (Type.GetGenericTypeDefinition() == (typeof(IQueryable <>)) && Type.GetGenericTypeDefinition() == otherType.GetGenericTypeDefinition())
                    {
                        Type genericArgument       = Type.GetGenericArguments().Single();
                        Type otherGenericArgument  = otherType.GetGenericArguments().Single();
                        Type otherGenericParameter = otherType.GetGenericTypeDefinition().GetGenericArguments().Single();
                        if ((otherGenericParameter.GenericParameterAttributes & GenericParameterAttributes.Covariant) != 0)
                        {
                            if (otherGenericArgument.IsAssignableFrom(genericArgument))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(Superclass != null && Superclass.IsOfType(specification));
        }
Ejemplo n.º 43
0
 static Local()
 {
     NativeFunctions = (GameModeBaseInterface *)Interfaces.Get(Core.Name.Make("GameModeBase")).ToPointer();
     Debug.Assert(NativeFunctions != null);
     NativeFunctions->Validate();
     Unused = Marshal.GetDelegateForFunctionPointer <UnusedDelegate>(NativeFunctions->Unused);
 }
Ejemplo n.º 44
0
        /*************** END DEBUG MODE METHOD *************/

        static public bool AddDeviceBlob(JObject blob)
        {
            string blob_string = blob.ToString();
            Device dev         = Interfaces.CreateDevices(blob_string, new TimeFrame());       // to convert the JSON blob to an actual Device object.

            ulong devID   = (ulong)blob ["deviceID"];
            ulong roomID  = (ulong)blob ["roomID"];
            ulong houseID = (ulong)blob ["houseID"];

            FullID fullID = new FullID();

            fullID.DeviceID = devID;
            fullID.RoomID   = roomID;
            fullID.HouseID  = houseID;

            deviceBlobs.Add(fullID, dev);

            if (deviceBlobs.Contains(dev))
            {
                // Arjun -- add push notification code here

                return(true);
            }

            return(false);
        }
Ejemplo n.º 45
0
        public override VimPoint Move(Interfaces.IVimHost host)
        {
            if (host.IsCurrentPositionAtEndOfLine()) {
                return host.CurrentPosition;
            }

            VimPoint bak = host.CurrentPosition;

            for (int i = 0; i < this.Repeat; i++) {
                do {
                    if (host.IsCurrentPositionAtEndOfLine()) {
                        host.MoveCursor(bak);
                        return host.CurrentPosition;
                    }

                    host.CaretRight();
                    char ch = host.GetCharAtCurrentPosition();

                    if (ch == _toSearch) {
                        break;
                    }
                }
                while (true);
            }

            return host.CurrentPosition;
        }
Ejemplo n.º 46
0
 private void HandleItem(TypeDefinition tdef)
 {
     _tdef = tdef;
     Attributes.Bind(tdef);
     Interfaces.Bind(tdef);
     CustomAttributes.Bind(tdef);
 }
Ejemplo n.º 47
0
            private async Task PollNetworkUtilizationAsync()
            {
                var utilizationTable = _canQueryAdapterUtilization
                                           ? "Win32_PerfRawData_Tcpip_NetworkAdapter"
                                           : "Win32_PerfRawData_Tcpip_NetworkInterface";

                var query = $@"
                    SELECT Name,
                           Timestamp_Sys100NS,
                           BytesReceivedPersec,
                           BytesSentPersec,
                           PacketsReceivedPersec,
                           PacketsSentPersec
                      FROM {utilizationTable}";

                var queryTime    = DateTime.UtcNow.ToEpochTime();
                var combinedUtil = new Interface.InterfaceUtilization
                {
                    DateEpoch = queryTime,
                    InAvgBps  = 0,
                    OutAvgBps = 0
                };

                using (var q = Wmi.Query(Endpoint, query))
                {
                    foreach (var data in await q.GetDynamicResultAsync().ConfigureAwait(false))
                    {
                        var perfData = new PerfRawData(this, data);
                        var name     = perfData.Identifier;
                        var iface    = Interfaces.Find(i => name == GetCounterName(i.Name));
                        if (iface == null)
                        {
                            continue;
                        }

                        iface.InBps  = (float)perfData.GetCalculatedValue("BytesReceivedPersec", 10000000);
                        iface.OutBps = (float)perfData.GetCalculatedValue("BytesSentPersec", 10000000);
                        iface.InPps  = (float)perfData.GetCalculatedValue("PacketsReceivedPersec", 10000000);
                        iface.OutPps = (float)perfData.GetCalculatedValue("PacketsSentPersec", 10000000);

                        var util = new Interface.InterfaceUtilization
                        {
                            DateEpoch = queryTime,
                            InAvgBps  = iface.InBps,
                            OutAvgBps = iface.OutBps
                        };

                        var netData = NetHistory.GetOrAdd(iface.Name, k => new List <Interface.InterfaceUtilization>(1024));
                        UpdateHistoryStorage(netData, util);

                        if (PrimaryInterfaces.Contains(iface))
                        {
                            combinedUtil.InAvgBps  += util.InAvgBps;
                            combinedUtil.OutAvgBps += util.OutAvgBps;
                        }
                    }
                }

                UpdateHistoryStorage(CombinedNetHistory, combinedUtil);
            }
Ejemplo n.º 48
0
 private void RipUpdateEvent(object source, ElapsedEventArgs e)
 {
     foreach (var @interface in Interfaces.Where(item => (item.RipEnabled)))
     {
         @interface.Send(RipPacketFactory.CreateEthernetPacket(@interface, Routes.Where(item => !Equals(item.Origin, @interface))));
     }
 }
Ejemplo n.º 49
0
        private Interfaces.IAuthenticationResponse RequestAuthentication(Interfaces.IAuthenticationRequest request)
        {
            Identifier id;
            if (!Identifier.TryParse(request.Url, out id))
            {
                _logger.Info(string.Format("OpenID Error...invalid url. url='{0}'", request.Url));
                return Factory.AuthenticationResponse(Interfaces.AuthenticationState.Errored);
            }

            try
            {
                var authenticationRequest = _openIdRelyingParty.CreateRequest(request.Url);
                var fetch = new FetchRequest();
                fetch.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
                fetch.Attributes.AddRequired(WellKnownAttributes.Name.First);
                fetch.Attributes.AddRequired(WellKnownAttributes.Name.Last);
                authenticationRequest.AddExtension(fetch);

                var actionResult = authenticationRequest.RedirectingResponse.AsActionResult();
                return Factory.AuthenticationResponse(actionResult);
            }
            catch (ProtocolException ex)
            {
                _logger.Error("OpenID Exception...", ex);
                return Factory.AuthenticationResponse(Interfaces.AuthenticationState.Errored);
            }
        }
Ejemplo n.º 50
0
        public bool Add(Interfaces.IConquerItem item, Enums.ItemUse use)
        {
            try
            {
                if (item.Position < 20)
                {
                    if (objects[item.Position - 1] == null)
                    {
                        objects[item.Position - 1] = item;
                        item.Mode = Enums.ItemMode.Default;

                        if (use != Enums.ItemUse.None)
                        {
                            UpdateItemview(item);
                            EntityEquipment equips = new EntityEquipment(true);
                            equips.ParseHero(Owner);
                            Owner.Send(equips);
                            item.Send(Owner);
                            Owner.LoadItemStats(item);
                        }
                        return true;
                    }
                    else return false;
                }
                else return false;
            }
            catch { return false; }
        }
Ejemplo n.º 51
0
 public bool Add(Interfaces.IConquerItem item)
 {
     try
     {
         if (item.Position > 19)
             return false;
         if (objects[item.Position - 1] == null)
         {
             UpdateItemview(item);
             objects[item.Position - 1] = item;
             item.Position = item.Position;
             item.Send(Owner);
             EntityEquipment equips = new EntityEquipment(true);
             equips.ParseHero(Owner);
             Owner.Send(equips);
             Owner.LoadItemStats(item);
             Owner.SendScreenSpawn(Owner.Entity, false);
             return true;
         }
         else return false;
     }
     catch (Exception e)
     {
         Program.SaveException(e);
         Console.WriteLine(e.ToString());
         return false;
     }
 }
Ejemplo n.º 52
0
        public string FindPathToType(string name)
        {
            var classType = Classes.Where(c => c.IsExported).FirstOrDefault(cl => cl.Name == name);

            if (classType != null)
            {
                return(classType.GetPath());
            }

            var interfaceType = Interfaces.Where(i => i.IsExported).FirstOrDefault(cl => cl.Name == name);

            if (interfaceType != null)
            {
                return(interfaceType.GetPath());
            }

            var enumType = Enumerations.Where(e => e.IsExported).FirstOrDefault(cl => cl.Name == name);

            if (enumType != null)
            {
                return(enumType.GetPath());
            }

            foreach (var nspace in Namespaces.Where(n => n.IsExported))
            {
                var path = nspace.FindPathToType(name);
                if (path != null)
                {
                    return(path);
                }
            }

            return(null);
        }
Ejemplo n.º 53
0
 public static Track ConvertToTrack(Interfaces.ITrack item)
 {
     return new Track
     {
         Name = item.Name,
         Greyhounds = GetGreyHounds(item.Greyhounds)
     };
 }
        public override void Deploy(Interfaces.IPasswordInterface ui, Interfaces.IUIHandler current)
        {
            base.Deploy(ui, current);

            ui.Password = "******";
            ui.PasswordChar = (char)'\0';
            ui.Prompt = "Set Password";
        }
Ejemplo n.º 55
0
 /// <summary>
 /// Print matrix
 /// </summary>
 /// <param name="matrix">Input matrix to print</param>
 /// <param name="player">Input player</param>
 public override void PrintMatrix(Interfaces.IMatrix matrix, Interfaces.IPlayer player)
 {
     Console.Clear();
     var output = new StringBuilder();
     output.AppendLine("Light Mode");
     output.AppendLine(this.GetPrintFrame(matrix, player));
     this.PrintLine(output.ToString());
 }
Ejemplo n.º 56
0
		public Interfaces.IConnector ConnectTcp(IPAddress ip, int port, Interfaces.IFactory factory)
		{
			Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
			socket.Blocking = true;
			socket.Connect(new IPEndPoint(ip, port));
			this.AddConnection(socket, factory);
			return new Connector(this, socket);
		}
Ejemplo n.º 57
0
        public override VimPoint Move(Interfaces.IVimHost host)
        {
            VimGlobalInfo.FindWordRecord = new VimFindWordRecord(_wordToSearch, VimFindWordRecord.FindOptions.UserRegex);

            host.FindNextWord(VimGlobalInfo.FindWordRecord);

            return host.CurrentPosition;
        }
Ejemplo n.º 58
0
        public override VimPoint Move(Interfaces.IVimHost host)
        {
            for (int i = 0; i < this.Repeat; i++) {
                host.MoveToNextWord();
            }

            return host.CurrentPosition;
        }
Ejemplo n.º 59
0
        public override bool Apply(Interfaces.IVimHost host)
        {
            for (int i = 0; i < this.Repeat; i++) {
                host.Redo();
            }

            return true;
        }
Ejemplo n.º 60
0
        public void KontoOeffnen(Interfaces.IKonto Konto)
        {
            if (_Konten.Any(r => r.KtoNr == Konto.KtoNr))
                throw new Exception("Der Kunde hat bereits ein Konto mit der Kontonummer " + Konto.KtoNr);

            _Konten.Add(Konto);

        }