Esempio n. 1
0
        private List <GridAllowedRole> GetGridAllowedRoleFromAllowedRoleList(SerializableList <PageDefinition.AllowedRole> allowedRoles)
        {
            List <RoleInfo>        list  = Resource.ResourceAccess.GetDefaultRoleList();
            List <GridAllowedRole> roles = (from r in list orderby r.Name select new GridAllowedRole {
                RoleId = r.RoleId, RoleName = new StringTT {
                    Text = r.Name, Tooltip = r.Description
                }
            }).ToList();

            if (allowedRoles != null)
            {
                foreach (PageDefinition.AllowedRole allowedRole in allowedRoles)
                {
                    GridAllowedRole role = (from r in roles where r.RoleId == allowedRole.RoleId select r).FirstOrDefault();
                    if (role != null)
                    {
                        ObjectSupport.CopyData(allowedRole, role);
                    }
                }
            }
            GridAllowedRole superuser = (from r in roles where r.RoleId == Resource.ResourceAccess.GetSuperuserRoleId() select r).First();

            superuser.View       = PageDefinition.AllowedEnum.Yes;
            superuser.Edit       = PageDefinition.AllowedEnum.Yes;
            superuser.Remove     = PageDefinition.AllowedEnum.Yes;
            superuser.__editable = false;
            return(roles);
        }
Esempio n. 2
0
 public new Task ImportChunkAsync(int chunk, SerializableList <SerializableFile> fileList, object obj)
 {
     // we're not importing any data
     //if (CanImportOrExport)
     //    DataProvider.ImportChunk(chunk, fileList, obj);
     return(Task.CompletedTask);
 }
Esempio n. 3
0
        public ModLoader()
        {
            bool flag = Application.platform == RuntimePlatform.WindowsPlayer;

            if (flag)
            {
                this.myConsole        = new MyConsole();
                ModLoader.mainConsole = this.myConsole;
            }
            this.performDirCheck();
            ModLoader.translation = new MyTranslationController <ModLoaderLang>(this.getMyDataDirectory(), "ModLoaderTranslations");
            ModLoader.logTag      = ModLoader.translation.autoFormat("@LogTag", new object[0]);
            this.myConsole.tryLogCustom(ModLoader.translation.autoFormat("@EntryMessage", new object[0]), ModLoader.logTag, LogType.Generic);
            SerializableList <string> serializableList = new SerializableList <string>();

            new MyHookListener(delegate(MyHook hook)
            {
                MyKeyDownHook myKeyDownHook = (MyKeyDownHook)hook;
                bool flag2 = myKeyDownHook.keyDown == KeyCode.F12;
                if (flag2)
                {
                    ModLoader.mainConsole.toggleConsole();
                }
                return(hook);
            }, typeof(MyKeyDownHook));
        }
Esempio n. 4
0
        /// <summary>
        /// Helper method used for finding child properties of the specified property, using a property path.
        /// <see cref="SerializableObject.FindProperty(string)"/>.
        /// </summary>
        /// <param name="pathElements">Path elements representing field names and keys to look for.</param>
        /// <param name="elementIdx">Index in the <paramref name="pathElements"/> array to start the search at.</param>
        /// <returns>Property representing the final path element, or null if not found (array index is out of range, or
        ///          property with that path doesn't exist).</returns>
        internal SerializableProperty FindProperty(PropertyPathElement[] pathElements, int elementIdx)
        {
            switch (type)
            {
            case FieldType.Object:
            {
                SerializableObject childObject = GetObject();

                return(childObject.FindProperty(pathElements, elementIdx));
            }

            case FieldType.Array:
            {
                SerializableArray childArray = GetArray();

                return(childArray.FindProperty(pathElements, elementIdx));
            }

            case FieldType.List:
            {
                SerializableList childList = GetList();

                return(childList.FindProperty(pathElements, elementIdx));
            }

            case FieldType.Dictionary:
            {
                SerializableDictionary childDictionary = GetDictionary();

                return(childDictionary.FindProperty(pathElements, elementIdx));
            }
            }

            return(null);
        }
Esempio n. 5
0
 public new Task ImportChunkAsync(int chunk, SerializableList <SerializableFile> fileList, object obj)
 {
     // we don't import visitor data
     return(Task.CompletedTask);
     //if (!Usable) return;
     //DataProvider.ImportChunk(chunk, fileList, obj);
 }
Esempio n. 6
0
 public new Task <DataProviderExportChunk> ExportChunkAsync(int chunk, SerializableList <SerializableFile> fileList)
 {
     // we don't export visitor data
     return(Task.FromResult(new DataProviderExportChunk()));
     //if (!Usable) return false;
     //return DataProvider.ExportChunk(chunk, fileList, out obj);
 }
Esempio n. 7
0
        public async Task <string> RenderAsync(SerializableList <ModuleDefinition.AllowedRole> model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            bool header = PropData.GetAdditionalAttributeValue("Header", true);

            GridModel grid = new GridModel()
            {
                GridDef = GetGridModel(header)
            };

            grid.GridDef.ResourceRedirect = Manager.CurrentModuleEdited;
            grid.GridDef.DirectDataAsync  = (int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                List <ModuleDefinition.GridAllowedRole> list = GetGridAllowedRoleFromAllowedRoleList(model);
                DataSourceResult data = new DataSourceResult {
                    Data  = list.ToList <object>(),
                    Total = list.Count,
                };
                return(Task.FromResult(data));
            };

            hb.Append($@"
<div class='yt_yetawf_moduleedit_allowedroles t_display'>
    {await HtmlHelper.ForDisplayAsAsync(Container, PropertyName, FieldName, grid, nameof(grid.GridDef), grid.GridDef, "Grid", HtmlAttributes: HtmlAttributes)}
</div>");

            return(hb.ToString());
        }
        static void Main(string[] args)
        {
            BinarySerializer a = new BinarySerializer(Encoding.UTF32);

            byte[] testContents = new byte[0];
            SerializableList <double> testList = new SerializableList <double>(a, testContents, sizeof(double));

            testList.Add(1);
            testList.Add(2);
            testList.Add(3);
            testList.Add(4);
            testList.Add(5);
            testList.Add(6);
            testList.Add(7);
            var t = testList.IndexOf(5);

            testList.Insert(t, 15);
            testList.RemoveAt(2);
            t = testList.IndexOf(5);
            testList.Remove(7);
            for (int i0 = 0; i0 < testList.Count; i0++)
            {
                Console.WriteLine(testList[i0]);
            }
            Console.ReadKey();
        }
Esempio n. 9
0
 public Model()
 {
     YetaWFManager.Syncify(async() => {  // this is needed during model validation
         ConfigData = await LoginConfigDataProvider.GetConfigAsync();
     });
     TwoStepAuth = new SerializableList <Role>();
 }
Esempio n. 10
0
            public async Task AddDataAsync()
            {
                DataProviderGetRecords <SiteDefinition> info = await SiteDefinition.GetSitesAsync(0, 0, null, null);

                SiteDomain_List = (from s in info.Data orderby s.SiteDomain select new SelectionItem <string>()
                {
                    Text = s.SiteDomain,
                    Value = s.SiteDomain,
                    Tooltip = this.__ResStr("switchSite", "Switch to site \"{0}\"", s.SiteDomain),
                }).ToList();
                SiteDomain = Manager.CurrentSite.SiteDomain;

                ControlPanelConfigData config = await ControlPanelConfigDataProvider.GetConfigAsync();

                UserId_List = config.Users;
                UserId      = Manager.UserId;

                int superuserRole = Resource.ResourceAccess.GetSuperuserRoleId();

                if (Manager.UserRoles != null && Manager.UserRoles.Contains(superuserRole))
                {
                    SuperuserCurrent = true;// the current user is a superuser
                }
                else if (Manager.HasSuperUserRole)
                {
                    SuperuserStillActive = true;
                }
                else
                {
                    SuperuserStillActive = false;
                }
            }
 public UserDefinition()
 {
     RolesList        = new SerializableList <Role>();
     Created          = DateTime.UtcNow;
     UserStatus       = UserStatusEnum.Approved;
     VerificationCode = Guid.NewGuid().ToString();
     EnabledTwoStepAuthentications = new SerializableList <TwoStepDefinition>();
 }
Esempio n. 12
0
 public new async Task ImportChunkAsync(int chunk, SerializableList <SerializableFile> fileList, object obj)
 {
     if (DataProvider == null)
     {
         return;
     }
     await base.ImportChunkAsync(chunk, fileList, obj);
 }
Esempio n. 13
0
 public ConfigData()
 {
     SameRoleToSameRole     = false;
     AllowedSameRoles       = new SerializableList <Role>();
     MessageAcceptance      = MessageAcceptanceEnum.Always;
     AllowedRolesToAllUsers = new SerializableList <Role>();
     AllUsersToAllowedRoles = new SerializableList <Role>();
 }
Esempio n. 14
0
 private static List <Offer> DeserializeMany(SerializableList list)
 {
     return(list
            .Cast <VariableContainer>()
            .Select(Offer.Deserialize)
            .Where(offer => offer.Count != 0)
            .ToList());
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="getFlota">delegado para obtener la flota de un AcType</param>
 public ControladorBackups(GetFlotaEventHandler getFlota)
 {
     this._backups_lista        = new SerializableList <UnidadBackup>();
     this._backups_clasificados = new Dictionary <string, Dictionary <string, Dictionary <DateTime, List <UnidadBackup> > > >();
     this._AOGs      = new Dictionary <string, Dictionary <string, Dictionary <DateTime, double> > >();
     this._get_flota = getFlota;
     this._rdm       = new Random();
 }
 public RedditCommand()
 {
     CommandSource = RedditCommandSource.Comment;
     Regexes       = new List <CData>();
     ParsingDepth  = 1;
     CommandUsers  = new List <SimpleOrSimpleExpression <string> >();
     RedditAnswers = new SerializableList <RedditAnswer>();
 }
 public new Task <DataProviderExportChunk> ExportChunkAsync(int chunk, SerializableList <SerializableFile> fileList)
 {
     // we don't export search data
     return(Task.FromResult(new DataProviderExportChunk {
         More = false,
     }));
     //if (!SearchDataProvider.IsUsable) return true;
     //return DataProvider.ExportChunk(chunk, fileList, out obj);
 }
Esempio n. 18
0
 public UnifiedSetData()
 {
     UnifiedMode      = PageDefinition.UnifiedModeEnum.SkinDynamicContent;
     Popups           = false;
     UnifiedAnimation = 1000;
     PageList         = new List <string>();
     PageGuids        = new SerializableList <Guid>();
     PageSkin         = new SkinDefinition();
 }
Esempio n. 19
0
 public ConfigFormQuest()
 {
     ShowRunningOnly = false;
     ShowOnce        = true;
     ShowDaily       = true;
     ShowWeekly      = true;
     ShowMonthly     = true;
     ColumnFilter    = null;                             //実際の初期化は FormQuest で行う
 }
Esempio n. 20
0
            public Model()
            {
                Prop1Req = new SerializableList <Role>();
                Prop1    = new SerializableList <Role>();
                List <RoleInfo> allRoles = Resource.ResourceAccess.GetDefaultRoleList();

                Prop1RO = new SerializableList <Role>((from RoleInfo a in allRoles select new Role {
                    RoleId = a.RoleId
                }).ToList());
            }
Esempio n. 21
0
 public new async Task <DataProviderExportChunk> ExportChunkAsync(int chunk, SerializableList <SerializableFile> fileList)
 {
     if (DataProvider == null)
     {
         return(new DataProviderExportChunk {
             More = false
         });
     }
     return(await base.ExportChunkAsync(chunk, fileList));
 }
Esempio n. 22
0
        public void ToStringTest_Net35(string expected, params string[] input)
        {
            //Replacing the delimiter here means that the delimiter in
            // the 'expected' string does not need to be updated
            // if SerializableList.delimiter is changed.
            expected = expected.Replace(",", SerializableList.delimiter);

            string actual = SerializableList.ToString_Net35(new SerializableList <string>(input));

            Assert.AreEqual(expected, actual);
        }
Esempio n. 23
0
        public StepInfo()
        {
            _ActiveTab = 0;

            Steps = new SerializableList <StepEntry> {
                new StepEntry {
                    Caption     = this.__ResStr("dfltCaption", "(Caption)"),
                    Description = this.__ResStr("dfltDesription", "(Description)"),
                },
            };
        }
Esempio n. 24
0
 public PagePanelModule()
 {
     Title             = this.__ResStr("modTitle", "Page Panel");
     Name              = this.__ResStr("modName", "Page Panel");
     Description       = this.__ResStr("modSummary", "Used to display multiple links to pages using the pages' FavIcon. A sample page is available at /Admin/Tests (standard YetaWF site).");
     PageList          = new SerializableList <LocalPage>();
     DefaultImage_Data = new byte[] { };
     UsePartialFormCss = false;
     WantSearch        = false;
     WantFocus         = false;
 }
Esempio n. 25
0
    ////////////////////////////////////////////////////////////////////////////
    /// Implementation of ISerializable (C# .Net)
    ////////////////////////////////////////////////////////////////////////////

    public FarmingAdventurer(SerializationInfo information, StreamingContext context)
    {
        mPlayerAge     = (int)information.GetValue(kPlayerAgeKey, typeof(int));
        mPlayerName    = (string)information.GetValue(kPlayerNameKey, typeof(string));
        mPlayerHealth  = (int)information.GetValue(kPlayerHealthKey, typeof(int));
        mPlayerStamina = (int)information.GetValue(kPlayerStaminaKey, typeof(int));
        mPlayerHeat    = (int)information.GetValue(kPlayerHeatKey, typeof(int));
        mPlayerFood    = (int)information.GetValue(kPlayerFoodKey, typeof(int));
        mPlayerWater   = (int)information.GetValue(kPlayerWaterKey, typeof(int));
        mItemIndicies  = new SerializableList <int>(information, context);
    }
Esempio n. 26
0
            /// <inheritdoc/>
            protected internal override void CloneElement(int index)
            {
                SerializableList serializableList = property.GetList();

                if (index >= 0 && index < list.Count)
                {
                    list.Add(SerializableUtility.Clone(serializableList.GetProperty(index).GetValue <object>()));
                }

                numElements = list.Count;
            }
Esempio n. 27
0
 public Model()
 {
     PageSkinReq   = new SkinDefinition();
     PageSkin      = new SkinDefinition();
     PageSkinRO    = new SkinDefinition();
     PopupSkinReq  = new SkinDefinition();
     PopupSkin     = new SkinDefinition();
     PopupSkinRO   = new SkinDefinition();
     ModuleSkins   = new SerializableList <SkinDefinition>();
     ModuleSkinsRO = new SerializableList <SkinDefinition>();
 }
Esempio n. 28
0
        protected virtual SerializableList <ISettings> LoadChildren()
        {
            SerializableList <ISettings>   result        = new SerializableList <ISettings>();
            OrderingCollection <ISettings> importedNodes = CompositionProvider.GetOrderedExports <ISettings>(this.GetType().FullName);

            foreach (var item in importedNodes)
            {
                result.Add(item.Value);
            }

            return(result);
        }
Esempio n. 29
0
        public ScoreBoard()
        {
            inningScores = new SerializableList <int>();
            for (int i = 0; i < 9; ++i)
            {
                inningScores.d.Add(0);
            }

            R = 0;
            H = 0;
            E = 0;
        }
Esempio n. 30
0
 public LoginSelectorModule() : base()
 {
     Name              = this.__ResStr("modName", "User Login Selector");
     Title             = this.__ResStr("modTitle", "User Login Selector");
     ShowTitle         = false;
     WantFocus         = false;
     WantSearch        = false;
     Print             = false;
     Users             = new SerializableList <User>();
     Description       = this.__ResStr("modSummary", "Used during site development to quickly switch between predefined user accounts. It is normally added to a skin as a skin module. Use the module's Module Settings to add predefined user accounts to the list of accounts offered by this module. In debug builds this module is always shown for easy switching between users during development. In Release builds, this module is only shown to a logged on Superuser.");
     UsePartialFormCss = false;
 }
Esempio n. 31
0
 public override bool ModuleStart()
 {
     SerializableList<ushort> temp = Load<SerializableList<ushort>>();
     if (temp == null)
     {
         Traps = new SerializableList<ushort>();
     }
     else
     {
         Traps = temp;
     }
     return true;
 }
Esempio n. 32
0
 public Sofa()
 {
     Mesurments = new SerializableDictionary<string, string>();
     Fabricts = new SerializableList<Fabricts>();
     Images = new SerializableList<string>();
 }
Esempio n. 33
0
 public SPNode()
 {
     State = "Black";
     Children = new SerializableList<ISPNode>();
 }
Esempio n. 34
0
				public ConfigFormFleetPlus() {
					FleetIconOrder = new SerializableList<Resource.ResourceManager.IconContent>(new List<Resource.ResourceManager.IconContent>() {
						Resource.ResourceManager.IconContent.FleetDocking,
						Resource.ResourceManager.IconContent.FleetSortie,
						Resource.ResourceManager.IconContent.FleetExpedition,
						Resource.ResourceManager.IconContent.FleetDamaged,
						Resource.ResourceManager.IconContent.FleetAnchorageRepairing,
						Resource.ResourceManager.IconContent.FleetNotReplenished,
						Resource.ResourceManager.IconContent.ConditionTired,
						Resource.ResourceManager.IconContent.ConditionSparkle,
					});
					Fleet1InfoIcon = new SerializableList<bool>(new List<bool>() { true, true, false, false, false });
					Fleet2InfoIcon = new SerializableList<bool>(new List<bool>() { true, true, false, false, false });
					Fleet3InfoIcon = new SerializableList<bool>(new List<bool>() { true, true, false, false, false });
					Fleet4InfoIcon = new SerializableList<bool>(new List<bool>() { true, true, false, false, false });
				}
Esempio n. 35
0
				public ConfigFormHeadquarters() {
					BlinkAtMaximum = true;
					Visibility = null;		// フォーム側で設定します
				}
Esempio n. 36
0
 public CWTEObject()
 {
     Categories = new SerializableList<string>();
     Links = new SerializableList<string>();
 }
Esempio n. 37
0
        /// <summary>
        /// Gets the categories document.
        /// </summary>
        /// <returns></returns>
        /// <remarks>Documented by Dev05, 2012-02-07</remarks>
        private XmlDocument GetCategoriesDocument()
        {
            SyndicationFeed feed = new SyndicationFeed();
            feed.Id = Settings.Default.CategoriesFeedId.ToString();
            feed.Title = new TextSyndicationContent("MemoryLifter Module Categories", TextSyndicationContentKind.Plaintext);
            feed.Description = new TextSyndicationContent("Lists all categories with modules available.", TextSyndicationContentKind.Plaintext);
            feed.LastUpdatedTime = new DateTimeOffset(DateTime.Now);

            feed.Authors.Add(new SyndicationPerson("*****@*****.**", "OMICRON", "http://www.memorylifter.com"));
            List<SyndicationItem> items = new List<SyndicationItem>();
            feed.Items = items;

            string filename = Server.MapPath(Path.Combine(Settings.Default.InfoFolder, "categories.xml"));
            if (File.Exists(filename))
            {
                Stream file = File.OpenRead(filename);
                categories = categoriesSerializer.Deserialize(file) as SerializableList<ModuleCategory>;
                file.Close();

                foreach (ModuleCategory category in categories)
                {
                    SyndicationItem item = new SyndicationItem();
                    item.Id = category.Id.ToString();
                    item.Title = new TextSyndicationContent(category.Title, TextSyndicationContentKind.Plaintext);
                    item.Links.Add(new SyndicationLink() { RelationshipType = AtomLinkRelationshipType.Parent.ToString(), Title = category.ParentCategory.ToString() });
                    items.Add(item);
                }
            }

            StringBuilder result = new StringBuilder();
            XmlWriter writer = XmlWriter.Create(result);
            feed.GetAtom10Formatter().WriteTo(writer);
            writer.Flush();

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(result.ToString());
            return doc;
        }
Esempio n. 38
0
 public static SerializableList<string> GetDDFieldsList(CQ dom)
 {
     var data = new SerializableList<string>();
     foreach (var dd in dom.Select(x => x.Cq()))
     {
         var topField = dd[0].InnerText.Trim();
         if (!data.Contains(topField))
         {
             data.Add(ToolsHelper.MakeXmlSafe(topField));
         }
     }
     return data;
 }
Esempio n. 39
0
				public ConfigFormQuest() {
					ShowRunningOnly = false;
					ShowOnce = true;
					ShowDaily = true;
					ShowWeekly = true;
					ShowMonthly = true;
					ColumnFilter = null;		//実際の初期化は FormQuest で行う
				}