// 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 ); } } }
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(); }
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 ); }
public ChannelRenewal() { // Bootstrap XRegistry.AStorage = new AppStorage(); SProvider = new ServiceProvider(); TaskLog = new XRegistry( "<tasklog />", "tasklog.xml" ); SavedChannels = new XRegistry( "<channels />", "channels.xml" ); }
public BookInfoView() { LayoutSettings = new XRegistry( AppKeys.TS_CXML, TFileName ); SectionBgs = new Dictionary<string, BgContext>(); InitParams(); }
public void Reload() { LayoutSettings = new XRegistry( "<NaN />", LayoutSettings.Location ); ApplyBackgrounds(); }
public BgContext( XRegistry LayoutSettings, string Section ) { this.LayoutSettings = LayoutSettings; this.Section = Section; }
public static void DestroyParams( XRegistry Settings ) { Settings.RemoveParameter( "PPValues" ); }
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 ); }
private void ResetServer( object sender, RoutedEventArgs e ) { ServerReg = new XRegistry( "<Server />", FileLinks.ROOT_SETTING + "Server.xml", false ); ServerReg.Save(); RefreshServers(); }
public ServiceProvider() { Settings = new XRegistry( "<services />", "services.xml" ); }
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; }
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 ); } }
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 ); }
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(); }
public NavList() { LayoutSettings = new XRegistry( AppKeys.TS_CXML, TFileName ); InitParams(); }
public ContentReader() { LayoutSettings = new XRegistry( AppKeys.TS_CXML, TFileName ); InitParams(); }
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 ); }
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; }