Beispiel #1
0
        // I am LHS, Always favor Master
        public void Sync( XRegistry MergeReg, bool IsMaster, Func<XParameter, XParameter, bool> LHSWin )
        {
            XParameter[] LHSs = Parameters();
            XParameter[] RHSs = MergeReg.Parameters();

            IEnumerable<XParameter> All = new List<XParameter>( LHSs ).Concat( RHSs );

            foreach ( XParameter US in All )
            {
                XParameter LHS = LHSs.Contains( US ) ? US : Parameter( US.Id );
                XParameter RHS = RHSs.Contains( US ) ? US : MergeReg.Parameter( US.Id );

                if ( LHS == null && !IsMaster )
                {
                    SetParameter( RHS );
                }
                else if ( RHS == null && !IsMaster )
                {
                    RemoveParameter( LHS.Id );
                }
                else if ( !( LHS == null || RHS == null ) )
                {
                    if ( !LHSWin( LHS, RHS ) ) SetParameter( RHS );
                }
            }
        }
Beispiel #2
0
        private void SetTemplate()
        {
            ServerReg = new XRegistry( "<Server />", FileLinks.ROOT_SETTING + "Server.xml" );
            ToggleSettings( EnableSS.IsOn = Properties.ENABLE_SERVER_SEL );
            MaxPing.Value = Properties.SERVER_MAX_PING;

            RefreshServers();
        }
Beispiel #3
0
        public SHMember()
        {
            WillLogin = false;

            AuthReg = new XRegistry( "<SHAuth />", FileLinks.ROOT_SETTING + FileLinks.SH_AUTH_REG );

            XParameter MemberAuth = AuthReg.Parameter( "member-auth" );
            if ( MemberAuth != null ) RestoreAuth( MemberAuth );
        }
Beispiel #4
0
        public ChannelRenewal()
        {
            // Bootstrap
            XRegistry.AStorage = new AppStorage();
            SProvider = new ServiceProvider();

            TaskLog = new XRegistry( "<tasklog />", "tasklog.xml" );
            SavedChannels = new XRegistry( "<channels />", "channels.xml" );
        }
Beispiel #5
0
 public BookInfoView()
 {
     LayoutSettings = new XRegistry( AppKeys.TS_CXML, TFileName );
     SectionBgs = new Dictionary<string, BgContext>();
     InitParams();
 }
Beispiel #6
0
 public void Reload()
 {
     LayoutSettings = new XRegistry( "<NaN />", LayoutSettings.Location );
     ApplyBackgrounds();
 }
Beispiel #7
0
 public BgContext( XRegistry LayoutSettings, string Section )
 {
     this.LayoutSettings = LayoutSettings;
     this.Section = Section;
 }
Beispiel #8
0
 public static void DestroyParams( XRegistry Settings )
 {
     Settings.RemoveParameter( "PPValues" );
 }
Beispiel #9
0
        public static ProcConvoy RestoreParams( XRegistry Settings, object Payload = null )
        {
            XParameter PPParams = Settings.Parameter( "PPValues" );
            if ( PPParams == null ) return new ProcConvoy( new ProcPassThru(), Payload );

            ProcParameter Proc = new ProcParameter();
            Proc.SetParamDefs( Settings.Parameter( "PPValues" ) );

            return new ProcConvoy( Proc, Payload );
        }
Beispiel #10
0
        private void ResetServer( object sender, RoutedEventArgs e )
        {
            ServerReg = new XRegistry( "<Server />", FileLinks.ROOT_SETTING + "Server.xml", false );
            ServerReg.Save();

            RefreshServers();
        }
Beispiel #11
0
 public ServiceProvider()
 {
     Settings = new XRegistry( "<services />", "services.xml" );
 }
Beispiel #12
0
        public bool Open( XRegistry ZDef )
        {
            IsLoading = true;

            try
            {
                XParameter Param = ZDef.Parameter( "Procedures" );
                PM = new ProcManager( Param );
                NotifyChanged( "ProcList" );

                SetBanner();

                return true;
            }
            catch( InvalidFIleException )
            {
                ProcManager.PanelMessage( ID, () => Res.RSTR( "InvalidXML" ), LogType.ERROR );
            }
            catch( Exception ex )
            {
                Logger.Log( ID, ex.Message, LogType.ERROR );
            }
            finally
            {
                IsLoading = false;
            }

            return false;
        }
Beispiel #13
0
        private async void SaveAs( object sender, RoutedEventArgs e )
        {
            IStorageFile ISF = await AppStorage.SaveFileAsync( "XML", new List<string>() { ".xml" } );
            if ( ISF == null ) return;

            try
            {
                XRegistry XReg = new XRegistry( "<ProcSpider />", null );
                XReg.SetParameter( RootManager.ToXParam() );
                await ISF.WriteString( XReg.ToString() );
                ProcManager.PanelMessage( ID, Res.RSTR( "Saved", ISF.Name ), LogType.INFO );
            }
            catch( Exception ex )
            {
                ProcManager.PanelMessage( ID, ex.Message, LogType.ERROR );
                ProcManager.PanelMessage( ID, () => Res.RSTR( "SaveFailed" ), LogType.ERROR );
            }
        }
Beispiel #14
0
 private void ExportProcedures( object sender, RoutedEventArgs e )
 {
     XRegistry XReg = new XRegistry( "<ProcSpider />", TargetFile );
     XReg.SetParameter( RootManager.ToXParam() );
     XReg.Save();
     ProcManager.PanelMessage( ID, () => Res.RSTR( "Saved" ), LogType.INFO );
 }
Beispiel #15
0
 private void ReadXReg( XRegistry XReg )
 {
     XParameter Param = XReg.Parameters().FirstOrDefault();
     if ( Param != null ) PM.ReadParam( Param );
 }
 public NotificationService()
 {
     SavedChannels = new XRegistry( "<channels />", "channels.xml" );
     CreateChannelRenewalTrigger();
 }
Beispiel #17
0
        public NavList()
        {
			LayoutSettings = new XRegistry( AppKeys.TS_CXML, TFileName );
            InitParams();
        }
Beispiel #18
0
        public ContentReader()
        {
			LayoutSettings = new XRegistry( AppKeys.TS_CXML, TFileName );
            InitParams();
        }
Beispiel #19
0
        public static void StoreParams( ProcConvoy Convoy, XRegistry Settings )
        {
            ProcParameter Defs = ( ProcParameter ) ProcManager.TracePackage( Convoy, ( P, C ) => P is ProcParameter )?.Dispatcher;
            if ( Defs == null ) return;

            XParameter PDefs = new XParameter( "PPValues" );
            Defs.AssignParamDefs( PDefs );

            Settings.SetParameter( PDefs );
        }
Beispiel #20
0
        private ZoneSpider ReadZone( string ZData, bool Init = false )
        {
            ZoneSpider ZS = new ZoneSpider();
            XRegistry ZDef = new XRegistry( ZData, null, false );

            if ( ZS.Open( ZDef ) )
            {
                // Remove the old Zone
                if ( Init )
                {
                    AddZone( ZS );
                }
                else
                {
                    RemoveZone( Zones.FirstOrDefault( x => x.ZoneId == ZS.ZoneId ) );
                    AddZone( ZS );
                    var j = Task.Run( () => { Shared.Storage.WriteString( ZS.MetaLocation, ZData ); } );
                }

                return ZS;
            }

            return null;
        }