예제 #1
0
//end merged
        public override bool IsInitialized()
        {
            foreach (LegacyData element in listOnBodyList)
            {
                if (!element.IsInitialized())
                {
                    return(false);
                }
            }
            foreach (LegacyData element in listInBagList)
            {
                if (!element.IsInitialized())
                {
                    return(false);
                }
            }
            if (HasLegacy)
            {
                if (!Legacy.IsInitialized())
                {
                    return(false);
                }
            }
            foreach (LegacyData element in listInDepotList)
            {
                if (!element.IsInitialized())
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
		public static void ImportData(
			this Business.Media.Entities.NonPersistent.Calendar.BroadcastCalendar target,
			Legacy.Media.Entities.Calendar.BroadcastCalendar source)
		{
			target.DataSourceType = (Business.Media.Enums.BroadcastDataTypeEnum)(Int32)source.DataSourceType;
			((Business.Media.Entities.NonPersistent.Calendar.MediaCalendar)target).ImportData(source);
		}
예제 #3
0
        /// <summary>
        /// Returns true if CurrentPlayerIDs instances are equal
        /// </summary>
        /// <param name="other">Instance of CurrentPlayerIDs to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CurrentPlayerIDs other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Legacy == other.Legacy ||
                     Legacy != null &&
                     Legacy.Equals(other.Legacy)
                 ) &&
                 (
                     Demo == other.Demo ||
                     Demo != null &&
                     Demo.Equals(other.Demo)
                 ));
        }
예제 #4
0
		private static void ImportData(
			this Business.Calendar.Entities.NonPersistent.CalendarMonth target,
			Legacy.Common.Entities.Calendar.CalendarMonth source)
		{
			target.Date = source.Date;
			target.OutputData.ImportData(source.OutputData);
		}
예제 #5
0
        public Task Start(ProxyStartConfig config)
        {
            proxyStartConfig = config;

            Console.Info($"Default protocol version: {config.ProtocolVersion}");
            Console.Info($"Encryption: {config.Encryption}");
            if (config.LoginEncryptionKey.HasValue)
            {
                Console.Info($"Encryption key {config.LoginEncryptionKey.Value}");
            }
            packetRegistry = PacketDefinitionRegistryFactory.CreateClassicClient(proxyStartConfig.ProtocolVersion);

            serverPacketHandler = new ServerPacketHandler(packetRegistry);
            clientPacketHandler = new ClientPacketHandler(packetRegistry);
            serverPacketHandler.RegisterFilter(RedirectConnectToGameServer);
            clientPacketHandler.Subscribe(PacketDefinitions.ExtendedLoginSeed, HandleExtendedLoginSeed);

            LegacyApi = new Legacy(LogConfig, commandHandler, new UltimaServer(serverPacketHandler, SendToServer, packetRegistry), new UltimaClient(clientPacketHandler, SendToClient), Console,
                                   packetRegistry, ConfigRepository, injectionWindow, SoundPlayer);
            UO.Initialize(LegacyApi);

            commandHandler.RegisterCommand(new Command("dump", DumpPacketLog, false, true,
                                                       "Dumps packet log - log of network communication between game client and server. Network communication logs are very useful for diagnosing issues like crashes.",
                                                       executionMode: CommandExecutionMode.Direct));
            commandHandler.RegisterCommand(new Command("help", HelpCommand, false, true, "Shows command help."));

            commandHandler.RegisterCommand(new Command(ListCommandName, ListRunningCommands, false, true,
                                                       "Lists running commands"));

            commandHandler.RegisterCommand(new Command("proxy-latency", PrintProxyLatency, false, true, "Shows proxy latency."));

            serverEndpoint = config.ServerEndPoint;
            return(Main(config.LocalProxyPort, packetRingBufferLogger));
        }
예제 #6
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Legacy != null)
         {
             hashCode = hashCode * 59 + Legacy.GetHashCode();
         }
         if (Demo != null)
         {
             hashCode = hashCode * 59 + Demo.GetHashCode();
         }
         return(hashCode);
     }
 }
        public void MergeFrom(ConsolidationStrategy other)
        {
            if (other == null)
            {
                return;
            }
            switch (other.StrategyCase)
            {
            case StrategyOneofCase.None:
                if (None == null)
                {
                    None = new global::Google.Apps.Drive.Activity.V2.ConsolidationStrategy.Types.NoConsolidation();
                }
                None.MergeFrom(other.None);
                break;

            case StrategyOneofCase.Legacy:
                if (Legacy == null)
                {
                    Legacy = new global::Google.Apps.Drive.Activity.V2.ConsolidationStrategy.Types.Legacy();
                }
                Legacy.MergeFrom(other.Legacy);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
예제 #8
0
        public void Initialize(RavenTransaction tx)
        {
            var tree = tx.InnerTransaction.CreateTree(PrefixesOfReduceOutputDocumentsToDeleteTree);

            if (tx.InnerTransaction.ReadTree(Legacy.LegacyReduceOutputsTreeName) != null)
            {
                Legacy.ConvertLegacyPrefixesToDeleteTree(tx);
            }

            _prefixesOfReduceOutputDocumentsToDelete = new ConcurrentDictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            using (var it = tree.Iterate(false))
            {
                if (it.Seek(Slices.BeforeAllKeys))
                {
                    do
                    {
                        var toDelete = GetPrefixToDeleteAndOriginalPatternFromCurrent(it);

                        if (_prefixesOfReduceOutputDocumentsToDelete.TryAdd(toDelete.Prefix, toDelete.OriginalPattern) == false)
                        {
                            throw new InvalidOperationException($"Could not add '{toDelete.Prefix}' prefix to list of items to delete (pattern - '{toDelete.OriginalPattern}')");
                        }
                    } while (it.MoveNext());
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Returns true if PlayerProfile instances are equal
        /// </summary>
        /// <param name="other">Instance of PlayerProfile to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PlayerProfile other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Legacy == other.Legacy ||
                     Legacy != null &&
                     Legacy.Equals(other.Legacy)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.SequenceEqual(other.Properties)
                 ));
        }
예제 #10
0
        public HeadlessClient(Legacy legacyApi, IConsole console, HeadlessStartConfig startConfig)
        {
            this.legacyApi             = legacyApi;
            this.console               = console;
            this.startConfig           = startConfig;
            packetRegistry             = PacketDefinitionRegistryFactory.CreateClassicClient(startConfig.ClientVersion);
            diagnosticProvider         = new InfusionDiagnosticPushStreamProvider(LogConfig, console);
            serverDiagnosticPushStream =
                new CompositeDiagnosticPushStream(new ConsoleDiagnosticPushStream(packetLogger, "headless -> server", packetRegistry),
                                                  new InfusionBinaryDiagnosticPushStream(DiagnosticStreamDirection.ClientToServer, diagnosticProvider.GetStream));
            serverDiagnosticPullStream = new ConsoleDiagnosticPullStream(packetLogger, "server -> headless", packetRegistry);

            serverConnection = new ServerConnection(ServerConnectionStatus.Initial, serverDiagnosticPullStream,
                                                    serverDiagnosticPushStream, packetRegistry, startConfig.Encryption);
            serverConnection.PacketReceived += ServerConnectionOnPacketReceived;
            ultimaServer = new UltimaServer(serverPacketHandler, SendToServer, packetRegistry);

            serverPacketHandler = new ServerPacketHandler(packetRegistry);
            clientPacketHandler = new ClientPacketHandler(packetRegistry);
            serverEndpoint      = startConfig.ServerEndPoint;

            ultimaClient = new UltimaClient(clientPacketHandler, SendToClient);

            serverPacketHandler.RegisterFilter(FilterServerPacket);
            serverPacketHandler.Subscribe(PacketDefinitions.GameServerList, HandleGameServerList);
            serverPacketHandler.Subscribe(PacketDefinitions.CharactersStartingLocations, HandleCharactersStartingLocationsPacket);
            serverPacketHandler.Subscribe(PacketDefinitions.EnableLockedClientFeatures, HandleEnableLockedClientFeatures);

            clientPacketHandler.Subscribe(PacketDefinitions.LoginRequest, HandleLoginRequest);
            clientPacketHandler.Subscribe(PacketDefinitions.GameServerLoginRequest, HandleGameServerLoginRequest);
            clientPacketHandler.Subscribe(PacketDefinitions.SelectServerRequest, HandleSelectServerRequest);
        }
		public static void ImportLegacyData(this LibraryPage target, Legacy.Entities.LibraryPage legacy)
		{
			target.ExtId = legacy.Identifier;
			target.Name = legacy.Name;
			target.Order = legacy.Order;
			target.Settings.EnableColumnTitles = legacy.EnableColumnTitles;
			target.Settings.ApplyForAllColumnTitles = legacy.ApplyForAllColumnTitles;

			foreach (var libraryFolder in legacy.Folders)
			{
				var targetFolder = WallbinEntity.CreateEntity<LibraryFolder>();
				targetFolder.Page = target;
				targetFolder.ImportLegacyData(libraryFolder);
				target.Folders.Add(targetFolder);
			}

			if (legacy.EnableColumnTitles)
				foreach (var columnTitle in legacy.ColumnTitles)
				{
					var targetColumnTitle = WallbinEntity.CreateEntity<ColumnTitle>();
					targetColumnTitle.Page = target;
					targetColumnTitle.ImportLegacyData(columnTitle);
					target.ColumnTitles.Add(targetColumnTitle);
				}
		}
예제 #12
0
		public static void ImportData(
			this Business.Common.Entities.NonPersistent.Common.DateRange target,
			Legacy.Common.Entities.Common.DateRange source)
		{
			target.StartDate = source.StartDate;
			target.FinishDate = source.FinishDate;
		}
예제 #13
0
        public bool RedeemToken(ulong guildId, string token)
        {
            var model = GetTokenModel();
            var match = model.TokenList.FirstOrDefault(x => x.Token == token);

            if (match == null)
            {
                return(false);
            }

            var configSave = Legacy.GetPremiumConfig(guildId) ?? new LegacyIntegration.LegacyPremium
            {
                GuildId    = guildId,
                ExpiryDate = DateTime.UtcNow - TimeSpan.FromMinutes(5)
            };

            if (configSave.ExpiryDate < DateTime.UtcNow - TimeSpan.FromHours(1))
            {
                configSave.ExpiryDate = DateTime.UtcNow - TimeSpan.FromMinutes(5);
            }
            configSave.ExpiryDate = configSave.ExpiryDate + TimeSpan.FromDays(match.Days);
            Legacy.SaveConfig(configSave);
            model.TokenList.Remove(match);
            SaveTokenModel(model);
            return(true);
        }
예제 #14
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Schedule.Station target, 
			Legacy.Media.Entities.Schedule.Station source)
		{
			target.Name = source.Name;
			target.Logo = source.Logo;
			target.Available = source.Available;
		}
예제 #15
0
		public static void ImportData(
			this Common.Core.Objects.Output.ContractSettings target,
			Legacy.Common.Entities.Common.ContractSettings source)
		{
			target.ShowDisclaimer = source.ShowDisclaimer;
			target.ShowSignatureLine = source.ShowSignatureLine;
			target.RateExpirationDate = source.RateExpirationDate;
		}
예제 #16
0
		private static void ImportData(
			this Business.Calendar.Entities.NonPersistent.CalendarDay target,
			Legacy.Common.Entities.Calendar.CalendarDay source)
		{
			target.Date = source.Date;
			target.Comment = source.Comment;
			target.Logo.ImportData(source.Logo);
		}
예제 #17
0
 public Targeting(Legacy api, InjectionHost host, IClientPacketSubject client, LegacyApi.Targeting targeting)
 {
     this.api = api;
     this.api.TargetInfoReceived += HandleTargetInfoReceived;
     this.host      = host;
     this.targeting = targeting;
     client.Subscribe(PacketDefinitions.TargetCursor, HandleClientTargetCursor);
 }
예제 #18
0
 internal LightObserver(IServerPacketSubject serverPacketHandler, UltimaClient client, Player player, Legacy legacy)
 {
     this.client = client;
     this.player = player;
     this.legacy = legacy;
     serverPacketHandler.RegisterFilter(FilterBlockedServerPackets);
     serverPacketHandler.Subscribe(PacketDefinitions.PersonalLightLevel, HandlePersonalLightLevelPacket);
 }
예제 #19
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Schedule.Daypart target, 
			Legacy.Media.Entities.Schedule.Daypart source)
		{
			target.Name = source.Name;
			target.Code = source.Code;
			target.Available = source.Available;
		}
예제 #20
0
        public override int SerializedSize()
        {
            int size = memoizedSerializedSize;

            if (size != -1)
            {
                return(size);
            }
            size = 0;
            if (HasOperate)
            {
                size += pb::CodedOutputStream.ComputeInt32Size(1, Operate);
            }
            if (HasFightValue)
            {
                size += pb::CodedOutputStream.ComputeInt32Size(2, FightValue);
            }
            {
                foreach (LegacyData element in listOnBodyList)
                {
                    int subsize = element.SerializedSize();
                    size += pb::CodedOutputStream.ComputeTagSize((int)3) + pb::CodedOutputStream.ComputeRawVarint32Size((uint)subsize) + subsize;
                }
            }
            {
                foreach (LegacyData element in listInBagList)
                {
                    int subsize = element.SerializedSize();
                    size += pb::CodedOutputStream.ComputeTagSize((int)4) + pb::CodedOutputStream.ComputeRawVarint32Size((uint)subsize) + subsize;
                }
            }
            if (HasResult)
            {
                size += pb::CodedOutputStream.ComputeInt32Size(5, Result);
            }
            {
                int subsize = Legacy.SerializedSize();
                size += pb::CodedOutputStream.ComputeTagSize((int)6) + pb::CodedOutputStream.ComputeRawVarint32Size((uint)subsize) + subsize;
            }
            {
                foreach (LegacyData element in listInDepotList)
                {
                    int subsize = element.SerializedSize();
                    size += pb::CodedOutputStream.ComputeTagSize((int)7) + pb::CodedOutputStream.ComputeRawVarint32Size((uint)subsize) + subsize;
                }
            }
            if (HasDrawId)
            {
                size += pb::CodedOutputStream.ComputeInt32Size(8, DrawId);
            }
            if (HasHaveMoneyNum)
            {
                size += pb::CodedOutputStream.ComputeInt32Size(9, HaveMoneyNum);
            }
            memoizedSerializedSize = size;
            return(size);
        }
예제 #21
0
    //Properties



    //Methods
    //Add a new cellphone according to the preference of the client.
    public void AddCellphone()
    {
        int    opc            = 0;
        double version        = 0;
        string brand          = string.Empty,
               model          = string.Empty;
        string newPhoneNumber = Generator.GeneratePhoneNumber();

        System.Collections.Generic.List <string> models = new System.Collections.Generic.List <string>();
        models.Add("Legacy");
        models.Add("Smartphone: Android");
        models.Add("Smartphone: IOS");


        System.Console.WriteLine("Let's add another cellphone");
        System.Console.WriteLine("Select the type");
        opc = Tools.Menu(models);
        switch (opc)
        {
        case 1:
            //Addinga legacy phone

            Legacy oldSchool = new Legacy(newPhoneNumber);
            System.Console.WriteLine("new Legacy cellphone added");
            System.Console.WriteLine("New phone Number is {0}", newPhoneNumber);
            this.Cellphones.Add(oldSchool);
            break;

        case 2:     //Adding android phone, with its attributes
            System.Console.WriteLine("New Android phone");
            version = Tools.NumberValidation <double>(1.0, 10.0, Tools.InRange, "Please add the Operative System Version");
            brand   = Tools.StringValidator("Please input the brand of the new android phone");
            model   = Tools.StringValidator("Please input the model of the new android phone");
            Android androidPhone = new Android(newPhoneNumber, version, brand, model);
            this.Cellphones.Add(androidPhone);
            System.Console.WriteLine("New Android phone added");
            break;

        case 3:    //Adding IOS phone, with its attributes
            System.Console.WriteLine("New IOS phone");
            version = Tools.NumberValidation <double>(1.0, 10.0, Tools.InRange, "Please add the Operative System Version");
            IOS iosPhone = new IOS(newPhoneNumber, version, this.UserFirstName, this.UserLastName);
            this.Cellphones.Add(iosPhone);
            System.Console.WriteLine("New IOS phone added");
            break;

        case 4:
            System.Console.WriteLine("Process Finished");
            break;

        default:
            System.Console.WriteLine("How do I get here?");
            break;
        }
    }
예제 #22
0
        static CommentTasksProvider()
        {
            IdeApp.Initialized += (sender, args) => {
                IdeApp.Workspace.SolutionLoaded      += OnSolutionLoaded;
                IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceItemClosed;

                Legacy.Initialize();
            };

            CommentTag.SpecialCommentTagsChanged += OnSpecialTagsChanged;
        }
예제 #23
0
		public static void ImportData(
			this Common.Core.Objects.Images.ImageSource target,
			Legacy.Common.Entities.Common.ImageSource source)
		{
			if (source == null || !source.ContainsData) return;
			target.IsDefault = source.IsDefault;
			target.BigImage = source.BigImage;
			target.SmallImage = source.SmallImage;
			target.TinyImage = source.TinyImage;
			target.XtraTinyImage = source.XtraTinyImage;
			target.FileName = source.FileName;
		}
예제 #24
0
    static void Main()
    {
        var legacyObject = new Legacy();

        legacyObject.GetItems().ToObservable()
        .Merge(
            Observable.FromEventPattern <IntEventArgs>(legacyObject, "NewItem")
            .Select(e => e.EventArgs.Value))
        .Subscribe(Console.WriteLine);

        Console.ReadLine();
    }
예제 #25
0
        private void ResultsListBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (resultsListBox.SelectedItem == null)
            {
                return;
            }

            Legacy       selectedLegacy = resultsWithId[resultsListBox.SelectedItem.ToString()];
            LegacyViewer ev             = new LegacyViewer(selectedLegacy.Copy(), null, null);

            ev.Show();
        }
예제 #26
0
        static void Main(string[] args)
        {
            string s1 = "abc";

            Console.WriteLine(s1.ToString());

            int?x = null;

            string s2 = new Legacy().GetNullString();  // no error!!
            string?s3 = new ThisIsnew().GetNullString();
            string s4 = new ThisIsnew().GetAString();
        }
예제 #27
0
		public static void ImportData(
			this Business.Common.Entities.NonPersistent.Summary.CustomSummaryItem target,
			Legacy.Common.Entities.Summary.CustomSummaryItem source)
		{
			target.Order = source.Order;
			target.ShowValue = source.ShowValue;
			target.ShowDescription = source.ShowDescription;
			target.ShowMonthly = source.ShowMonthly;
			target.ShowTotal = source.ShowTotal;
			target.Value = source.Value;
			target.Description = source.Description;
			target.Monthly = source.Monthly;
			target.Total = source.Total;
		}
예제 #28
0
        public static void Initialize(CommandHandler commandHandler)
        {
            Program.commandHandler = commandHandler;
            commandHandler.RegisterCommand(new Command("dump", DumpPacketLog,
                                                       "Dumps packet log - log of network communication between game client and server. Network communication logs are very useful for diagnosing issues like crashes.",
                                                       executionMode: CommandExecutionMode.Direct));
            commandHandler.RegisterCommand(new Command("help", HelpCommand, "Shows command help."));
            commandHandler.RegisterCommand(new Command(ListCommandName, ListRunningCommands,
                                                       "Lists running commands"));
            commandHandler.RegisterCommand(new Command("proxy-latency", PrintProxyLatency, "Shows proxy latency."));

            legacyApi = new Legacy(Configuration, commandHandler, new UltimaServer(serverPacketHandler, SendToServer), new UltimaClient(clientPacketHandler, SendToClient), Console);
            UO.Initialize(legacyApi);
        }
예제 #29
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Option.OptionProgram target,
			Legacy.Media.Entities.Options.OptionProgram source)
		{
			target.Name = source.Name;
			target.Index = source.Index;
			target.Station = source.Station;
			target.Logo.ImportData(source.Logo);
			target.Day = source.Day;
			target.Time = source.Time;
			target.Length = source.Length;
			target.Rate = source.Rate;
			target.Spot = source.Spot;
		}
예제 #30
0
        public static void Initialize()
        {
            Runtime.ServiceProvider.WhenServiceInitialized <CompositionManager> (compositionManager => {
                var todoListProvider              = compositionManager.GetExportedValue <ITodoListProvider> ();
                todoListProvider.TodoListUpdated += OnTodoListUpdated;
            });

            Runtime.ServiceProvider.WhenServiceInitialized <RootWorkspace> (workspace => {
                workspace.SolutionLoaded      += OnSolutionLoaded;
                workspace.WorkspaceItemClosed += OnWorkspaceItemClosed;
                Legacy.Initialize();
            });
            CommentTag.SpecialCommentTagsChanged += OnSpecialTagsChanged;
        }
예제 #31
0
    public override void Write(Utf8JsonWriter writer, TMessage value, JsonSerializerOptions options)
    {
        // Note: This logic replicates Google.Protobuf. Should follow their lead.
        var paths        = (IList <string>)value.Descriptor.Fields[FieldMask.PathsFieldNumber].Accessor.GetValue(value);
        var firstInvalid = paths.FirstOrDefault(p => !Legacy.IsPathValid(p));

        if (firstInvalid == null)
        {
            writer.WriteStringValue(string.Join(",", paths.Select(Legacy.ToJsonName)));
        }
        else
        {
            throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {firstInvalid}.");
        }
    }
예제 #32
0
		public static void ImportData(
			this Business.Common.Entities.NonPersistent.Summary.BaseSummarySettings target,
			Legacy.Common.Entities.Summary.BaseSummarySettings source)
		{
			target.ShowAdvertiser = source.ShowAdvertiser;
			target.ShowDecisionMaker = source.ShowDecisionMaker;
			target.ShowPresentationDate = source.ShowPresentationDate;
			target.ShowFlightDates = source.ShowFlightDates;
			target.ShowMonthly = source.ShowMonthly;
			target.ShowTotal = source.ShowTotal;
			target.TableOutput = source.TableOutput;
			target.SlideHeader = source.SlideHeader;
			target.MonthlyValue = source.MonthlyValue;
			target.TotalValue = source.TotalValue;
		}
예제 #33
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = TotalSpent.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalReceived.GetHashCode();
         hashCode = (hashCode * 397) ^ Balance.GetHashCode();
         hashCode = (hashCode * 397) ^ Txi;
         hashCode = (hashCode * 397) ^ Txo;
         hashCode = (hashCode * 397) ^ TxsCount;
         hashCode = (hashCode * 397) ^ (Legacy != null ? Legacy.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Addresses != null ? Addresses.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #34
0
 public LegacyViewer(Legacy legacy, EventHandler <Legacy> SuccessCallback)
 {
     InitializeComponent();
     displayedLegacy = legacy;
     fillValues(legacy);
     if (SuccessCallback != null)
     {
         setEditingMode(true);
         this.SuccessCallback += SuccessCallback;
     }
     else
     {
         setEditingMode(false);
     }
 }
예제 #35
0
        public void Update()
        {
            var objModules = new ModuleController();

            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.History, History.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateModuleSetting(_moduleId, SettingName.DescriptionLength, DescriptionLength.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.EditorHeight, EditorHeight.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.DefaultViewType, Utilities.ViewTypeToString(DefaultViewType));
            objModules.UpdateModuleSetting(_moduleId, SettingName.Legacy, Legacy.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.TemplateType, TemplateType);
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.TemplateName, TemplateName);
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.TemplateLocation, TemplateLocation);

            DataCache.RemoveCache(CacheConstants.SettingsCacheKeyFormat(_moduleId, _tabModuleId));
        }
예제 #36
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="format"></param>
        /// <param name="provider"></param>
        public string ToString(string format, IFormatProvider provider)
        {
            if (string.IsNullOrEmpty(format))
            {
                format = "G";
            }

            if (provider == null)
            {
                provider = CultureInfo.CurrentCulture;
            }

            switch (format)
            {
            case "G":
            case "g":
                return(ToString("E", provider));

            case "C":
                return(Code ?? string.Empty);

            case "N":
                return(DisplayName ?? string.Empty);

            case "I":
                return(ImportOnly.ToString());

            case "L":
                return(Legacy.ToString());

            case "E":
                return(!string.IsNullOrEmpty(Code) && !string.IsNullOrEmpty(DisplayName) ?
                       $"{ToString("C", provider)} - {ToString("N", provider)}" :
                       !string.IsNullOrEmpty(DisplayName) ? ToString("N", provider) :
                       !string.IsNullOrEmpty(Code) ? ToString("C", provider) :
                       string.Empty);

            case "e":
                return(!string.IsNullOrEmpty(Code) && !string.IsNullOrEmpty(DisplayName) ?
                       $"{ToString("N", provider)} - {ToString("C", provider)}" :
                       !string.IsNullOrEmpty(DisplayName) ? ToString("N", provider) :
                       !string.IsNullOrEmpty(Code) ? ToString("C", provider) :
                       string.Empty);

            default:
                throw new FormatException($"Format string '{format}' is not valid.");
            }
        }
예제 #37
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Section.Content.ScheduleSection target,
			Legacy.Media.Entities.Section.ScheduleSection source)
		{
			target.Name = source.Name;
			target.Index = source.Index;

			target.ShowRate = source.ShowRate;
			target.ShowRating = source.ShowRating;
			target.ShowTime = source.ShowTime;
			target.ShowDay = source.ShowDay;
			target.ShowDaypart = source.ShowDaypart;
			target.ShowStation = source.ShowStation;
			target.ShowProgram = source.ShowProgram;
			target.ShowLenght = source.ShowLenght;
			target.ShowCPP = source.ShowCPP;
			target.ShowGRP = source.ShowGRP;
			target.ShowSpots = source.ShowSpots;
			target.ShowEmptySpots = source.ShowEmptySpots;
			target.ShowCost = source.ShowCost;
			target.ShowLogo = source.ShowLogo;

			target.ShowTotalPeriods = source.ShowTotalPeriods;
			target.ShowTotalSpots = source.ShowTotalSpots;
			target.ShowTotalGRP = source.ShowTotalGRP;
			target.ShowTotalCPP = source.ShowTotalCPP;
			target.ShowAverageRate = source.ShowAverageRate;
			target.ShowTotalRate = source.ShowTotalRate;
			target.ShowNetRate = source.ShowNetRate;
			target.ShowDiscount = source.ShowDiscount;

			target.OutputPerQuater = source.OutputPerQuater;
			target.OutputMaxPeriods = source.OutputMaxPeriods;
			target.OutputNoBrackets = source.OutputNoBrackets;
			target.UseDecimalRates = source.UseDecimalRates;
			target.UseGenericDateColumns = source.UseGenericDateColumns;

			foreach (var oldProgram in source.Programs)
			{
				var program = new Business.Media.Entities.NonPersistent.Section.Content.Program(target);
				program.ImportData(oldProgram);
				target.Programs.Add(program);
			}
			target.Summary.ImportData(source.Summary);
			target.ContractSettings.ImportData(source.ContractSettings);
		}
예제 #38
0
        static void Main(string[] args)
        {
            var legacy = new Legacy();

            legacy.Foo(null); // passing null is ok

            var newer = new ThisIsNew();

            newer.Foo(null !); // passing null is not ok

            Book[] books = new Book[3];
            books[0] = new Book("Professional C# 7");
            Console.WriteLine(books[0].Title);
            string publisher = books[0].Publisher ?? string.Empty;

            Console.WriteLine(books[0].Publisher !);
        }
예제 #39
0
        static void Main(string[] args)
        {
            var miguel = new Person("Miguel", "de Icaza");
            int length = GetLengthOfMiddleName(miguel);

            Console.WriteLine(length);

            var    old = new Legacy();
            string s1  = old.GetANullString(); // no error
            // Console.WriteLine(s1.ToUpper()); // legacy no error, runtime exception
            var    newglory = new NewAndGlory();
            string?s2       = newglory.GetANullString();
            string s3       = newglory.GetAString();
            var    sc       = new SomeClass();
            string?s4       = sc.Foo();
            string s5       = sc.Foo() !; // dammit
        }
예제 #40
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Snapshot.Snapshot target,
			Legacy.Media.Entities.Snapshot.Snapshot source)
		{
			target.Index = source.Index;
			target.Name = source.Name;
			target.Comment = source.Comment;
			target.Logo.ImportData(source.Logo);
			if (source.TotalWeeks.HasValue)
				target.TotalWeeks = source.TotalWeeks.Value;

			target.ShowLineId = source.ShowLineId;
			target.ShowLogo = source.ShowLogo;
			target.ShowStation = source.ShowStation;
			target.ShowProgram = source.ShowProgram;
			target.ShowDaypart = source.ShowDaypart;
			target.ShowLenght = source.ShowLenght;
			target.ShowTime = source.ShowTime;
			target.ShowRate = source.ShowRate;
			target.ShowWeeklyCost = source.ShowCost;
			target.ShowSpotsX = source.ShowSpotsX;
			target.ShowTotalRow = source.ShowTotalRow;
			target.UseDecimalRates = source.UseDecimalRates;
			target.ShowSpotsPerWeek = source.ShowSpotsPerWeek;

			target.ShowWeeklySpots = source.ShowTotalSpots;
			target.ShowAverageRate = source.ShowAverageRate;

			target.ContractSettings.ImportData(source.ContractSettings);

			foreach (var oldProgram in source.Programs)
			{
				var program = new Business.Media.Entities.NonPersistent.Snapshot.SnapshotProgram(target);
				program.ImportData(oldProgram);
				target.Programs.Add(program);
			}
			target.RebuildProgramIndexes();

			foreach (var oldActiveWeek in source.ActiveWeeks)
			{
				var activeWeek = new Business.Common.Entities.NonPersistent.Common.DateRange();
				activeWeek.ImportData(oldActiveWeek);
				target.ActiveWeeks.Add(activeWeek);
			}
		}
예제 #41
0
		public static void ImportData(
			this Business.Media.Entities.NonPersistent.Calendar.MediaCalendar target,
			Legacy.Common.Entities.Calendar.BaseCalendar source)
		{
			target.Days.Clear();
			foreach (var oldCalendarDay in source.Days)
			{
				Business.Calendar.Entities.NonPersistent.CalendarDay day;
				if (target.Schedule.Settings.MondayBased)
					day = new Business.Calendar.Entities.NonPersistent.CalendarDayMondayBased(target);
				else
					day = new Business.Calendar.Entities.NonPersistent.CalendarDaySundayBased(target);
				day.ImportData(oldCalendarDay);
				target.Days.Add(day);
			}

			target.Months.Clear();
			foreach (var oldCalendarMonths in source.Months)
			{
				Business.Calendar.Entities.NonPersistent.CalendarMonth month;
				if (target.Schedule.Settings.MondayBased)
					month = new Business.Media.Entities.NonPersistent.Calendar.CalendarMonthMediaMondayBased(target);
				else
					month = new Business.Media.Entities.NonPersistent.Calendar.CalendarMonthMediaSundayBased(target);
				month.ImportData(oldCalendarMonths);
				target.Months.Add(month);
			}

			target.Notes.Clear();
			foreach (var oldNote in source.Notes)
			{
				Business.Calendar.Entities.NonPersistent.CalendarNote note;
				if (target is Business.Media.Entities.NonPersistent.Calendar.BroadcastCalendar)
					note = new Business.Media.Entities.NonPersistent.Calendar.MediaDataNote((Business.Media.Entities.NonPersistent.Calendar.BroadcastCalendar)target);
				else
					note = new Business.Calendar.Entities.NonPersistent.CommonCalendarNote(target);
				note.ImportData(oldNote);
				target.Notes.Add(note);
			}

			target.UpdateDaysCollection();
			target.UpdateMonthCollection();
			target.UpdateNotesCollection();
		}
예제 #42
0
        /// <summary>
        /// Checks to see if bSearch is a search option on right-click of folders
        /// </summary>
        /// <returns>True - set, False - not set</returns>

        public static bool IsSearchOption()
        {
            if (Legacy.CheckIfOldSearchOption())
            {
                Legacy.RemoveOldSearchOption();
            }

            Microsoft.Win32.RegistryKey _key = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(@"Directory\shell\bSearch", false);

            // key exists
            if (_key != null)
            {
                _key.Close();
                return(true);
            }

            // key doesn't
            return(false);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (strategyCase_ == StrategyOneofCase.None)
            {
                hash ^= None.GetHashCode();
            }
            if (strategyCase_ == StrategyOneofCase.Legacy)
            {
                hash ^= Legacy.GetHashCode();
            }
            hash ^= (int)strategyCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #44
0
        internal static LogLineType GetLogLineType(string line, FahLogType fahLogType)
        {
            var logLineType = Common.DetermineLineType(line);

            if (logLineType == LogLineType.Unknown)
            {
                switch (fahLogType)
                {
                case FahLogType.Legacy:
                    logLineType = Legacy.DetermineLineType(line);
                    break;

                case FahLogType.FahClient:
                    logLineType = FahClient.DetermineLineType(line);
                    break;
                }
            }
            return(logLineType);
        }
예제 #45
0
        public void Update()
        {
            var objModules = new ModuleController();

            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.History, History.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateModuleSetting(_moduleId, SettingName.DescriptionLength, DescriptionLength.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.EditorHeight, EditorHeight.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.DefaultViewType, Utilities.ViewTypeToString(DefaultViewType));
            objModules.UpdateModuleSetting(_moduleId, SettingName.Legacy, Legacy.ToString(CultureInfo.InvariantCulture));
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.TemplateType, TemplateType);
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.TemplateName, TemplateName);
            objModules.UpdateTabModuleSetting(_tabModuleId, SettingName.TemplateLocation, TemplateLocation);


            ModuleController.SynchronizeModule(_moduleId);
            // DataCache.RemoveCache(ModuleController.CacheKey(_moduleId) + "_viewType");
            // Module caching has been updated in 5.2.0, this method is no longer used

            DataCache.RemoveCache(CacheConstants.SettingsCacheKeyFormat(_moduleId, _tabModuleId));
        }
예제 #46
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Option.OptionSummary target,
			Legacy.Media.Entities.Options.OptionSummary source)
		{
			target.SpotType = (Business.Media.Enums.SpotType)(Int32)source.SpotType;
			target.ApplySettingsForAll = source.ApplySettingsForAll;
			target.ShowLineId = source.ShowLineId;
			target.ShowLogo = source.ShowLogo;
			target.ShowCampaign = source.ShowCampaign;
			target.ShowComments = source.ShowComments;
			target.ShowSpots = source.ShowSpots;
			target.ShowCost = source.ShowCost;
			target.ShowTotalPeriods = source.ShowTotalPeriods;
			target.ShowTotalCost = source.ShowTotalCost;
			target.ShowTallySpots = source.ShowTallySpots;
			target.ShowTallyCost = source.ShowTallyCost;
			target.ShowSpotsX = source.ShowSpotsX;
			target.UseDecimalRates = source.UseDecimalRates;

			target.ContractSettings.ImportData(source.ContractSettings);
		}
예제 #47
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Snapshot.SnapshotProgram target,
			Legacy.Media.Entities.Snapshot.SnapshotProgram source)
		{
			target.Name = source.Name;
			target.Index = source.Index;
			target.Station = source.Station;
			target.Logo.ImportData(source.Logo);
			target.Daypart = source.Daypart;
			target.Length = source.Length;
			target.Time = source.Time;
			target.Rate = source.Rate;

			target.MondaySpot = source.MondaySpot;
			target.TuesdaySpot = source.TuesdaySpot;
			target.WednesdaySpot = source.WednesdaySpot;
			target.ThursdaySpot = source.ThursdaySpot;
			target.FridaySpot = source.FridaySpot;
			target.SaturdaySpot = source.SaturdaySpot;
			target.SundaySpot = source.SundaySpot;
		}
예제 #48
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Section.Content.Program target,
			Legacy.Media.Entities.Section.Program source)
		{
			target.Name = source.Name;
			target.Day = source.Day;
			target.Index = source.Index;
			target.Logo.ImportData(source.Logo);
			target.Station = source.Station;
			target.Daypart = source.Daypart;
			target.Time = source.Time;
			target.Length = source.Length;
			target.Rate = source.Rate;
			target.Rating = source.Rating;
			target.SummaryItem.ImportData(source.SummaryItem);
			foreach (var oldSpot in source.Spots)
			{
				var spot = new Business.Media.Entities.NonPersistent.Section.Content.Spot(target);
				spot.ImportData(oldSpot);
				target.Spots.Add(spot);
			}
		}
예제 #49
0
		private static void ImportData(
			this Business.Calendar.Entities.NonPersistent.CalendarNote target,
			Legacy.Common.Entities.Calendar.CalendarNote source)
		{
			if (source.Note is Legacy.Common.Entities.Common.TextItem)
			{
				var sourceTextItem = (Legacy.Common.Entities.Common.TextItem)source.Note;
				target.Note = new Common.Core.Objects.Output.TextItem(sourceTextItem.Text, sourceTextItem.IsBold);
			}
			else if (source.Note is Legacy.Common.Entities.Common.TextGroup)
			{
				var sourceTextGroup = (Legacy.Common.Entities.Common.TextGroup)source.Note;
				target.Note = new Common.Core.Objects.Output.TextGroup(
					sourceTextGroup.Separator,
					sourceTextGroup.BorderLeft,
					sourceTextGroup.BorderRight);
				((Common.Core.Objects.Output.TextGroup)target.Note).ImportData(sourceTextGroup);
			}

			target.StartDay = source.StartDay;
			target.FinishDay = source.FinishDay;
			target.BackgroundColor = source.BackgroundColor;
			target.UserAdded = source.UserAdded;
		}
예제 #50
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Option.OptionSet target,
			Legacy.Media.Entities.Options.OptionSet source)
		{
			target.Index = source.Index;
			target.Name = source.Name;
			target.Comment = source.Comment;
			target.Logo.ImportData(source.Logo);
			target.TotalPeriods = source.TotalPeriods;

			target.ShowLineId = source.ShowLineId;
			target.ShowLogo = source.ShowLogo;
			target.ShowStation = source.ShowStation;
			target.ShowProgram = source.ShowProgram;
			target.ShowDay = source.ShowDay;
			target.ShowTime = source.ShowTime;
			target.ShowRate = source.ShowRate;
			target.ShowLenght = source.ShowLenght;
			target.ShowSpots = source.ShowSpots;
			target.ShowCost = source.ShowCost;
			target.ShowSpotsX = source.ShowSpotsX;
			target.UseDecimalRates = source.UseDecimalRates;
			target.ShowTotalSpots = source.ShowTotalSpots;
			target.ShowTotalCost = source.ShowTotalCost;
			target.ShowAverageRate = source.ShowAverageRate;
			target.SpotType = (Business.Media.Enums.SpotType)(Int32)source.SpotType;

			target.ContractSettings.ImportData(source.ContractSettings);

			foreach (var oldProgram in source.Programs)
			{
				var program = new Business.Media.Entities.NonPersistent.Option.OptionProgram(target);
				program.ImportData(oldProgram);
				target.Programs.Add(program);
			}
		}
예제 #51
0
		private static void ImportData(
			this Business.Online.Configuration.DigitalPackageSettings target, 
			Legacy.Common.Entities.Digital.DigitalPackageSettings source)
		{
			target.EnableCategory = source.EnableCategory;
			target.EnableGroup = source.EnableGroup;
			target.EnableProduct = source.EnableProduct;
			target.EnableImpressions = source.EnableImpressions;
			target.EnableCPM = source.EnableCPM;
			target.EnableRate = source.EnableRate;
			target.EnableInvestment = source.EnableInvestment;
			target.EnableInfo = source.EnableInfo;
			target.EnableScreenshot = source.EnableScreenshot;

			target.ShowCategory = source.ShowCategory;
			target.ShowGroup = source.ShowGroup;
			target.ShowProduct = source.ShowProduct;
			target.ShowImpressions = source.ShowImpressions;
			target.ShowCPM = source.ShowCPM;
			target.ShowRate = source.ShowRate;
			target.ShowInvestment = source.ShowInvestment;
			target.ShowInfo = source.ShowInfo;
			target.ShowScreenshot = source.ShowScreenshot;
		}
예제 #52
0
		public static void ImportData(
			this Common.Core.Objects.Output.TextGroup target,
			Legacy.Common.Entities.Common.TextGroup source)
		{
			foreach (var oldItem in source.Items)
			{
				if (oldItem is Legacy.Common.Entities.Common.TextGroup)
				{
					var oldTextGroup = (Legacy.Common.Entities.Common.TextGroup)oldItem;
					var textGroup = new Common.Core.Objects.Output.TextGroup(
						oldTextGroup.Separator,
						oldTextGroup.BorderLeft,
						oldTextGroup.BorderRight);
					textGroup.ImportData(oldTextGroup);
					target.Items.Add(textGroup);
				}
				else if (oldItem is Legacy.Common.Entities.Common.TextItem)
				{
					var oldTextItem = (Legacy.Common.Entities.Common.TextItem)oldItem;
					var textItem = new Common.Core.Objects.Output.TextItem(oldTextItem.Text, oldTextItem.IsBold);
					target.Items.Add(textItem);
				}
			}
		}
예제 #53
0
 /**
 * Constructs a new RtfWriter that listens to the specified Document and
 * writes its output to the Stream.
 *
 * @param doc The Document that this RtfWriter listens to
 * @param os The Stream to write to
 */
 protected RtfWriter2(Legacy.Text.Document doc, Stream os)
     : base(doc, os)
 {
     doc.AddDocListener(this);
     rtfDoc = new RtfDocument();
 }
예제 #54
0
 /**
 * Static method to generate RtfWriters
 *
 * @param doc The Document that this RtfWriter listens to
 * @param os The Stream to write to
 * @return The new RtfWriter
 */
 public static RtfWriter2 GetInstance(Legacy.Text.Document doc, Stream os)
 {
     return new RtfWriter2(doc, os);
 }
예제 #55
0
 /**
 * Set a HeaderFooter to be displayed at a certain position
 *
 * @param headerFooter The HeaderFooter to set
 * @param displayAt The display location to use
 */
 public void SetHeaderFooter(Legacy.Text.HeaderFooter headerFooter, int displayAt)
 {
     this.mode = MODE_MULTIPLE;
     switch (displayAt) {
         case RtfHeaderFooter.DISPLAY_ALL_PAGES:
             headerAll = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
             break;
         case RtfHeaderFooter.DISPLAY_FIRST_PAGE:
             headerFirst = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
             break;
         case RtfHeaderFooter.DISPLAY_LEFT_PAGES:
             headerLeft = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
             break;
         case RtfHeaderFooter.DISPLAY_RIGHT_PAGES:
             headerRight = new RtfHeaderFooter(this.document, headerFooter, this.type, displayAt);
             break;
     }
 }
예제 #56
0
		private static void ImportData(
			this Business.Media.Entities.NonPersistent.Snapshot.SnapshotSummary target,
			Legacy.Media.Entities.Snapshot.SnapshotSummary source)
		{
			target.ApplySettingsForAll = source.ApplySettingsForAll;
			target.ShowLineId = source.ShowLineId;
			target.ShowLogo = source.ShowLogo;
			target.ShowCampaign = source.ShowCampaign;
			target.ShowComments = source.ShowComments;
			target.ShowSpots = source.ShowSpots;
			target.ShowCost = source.ShowCost;
			target.ShowTotalWeeks = source.ShowTotalWeeks;
			target.ShowTotalCost = source.ShowTotalCost;
			target.ShowTallySpots = source.ShowTallySpots;
			target.ShowTallyCost = source.ShowTallyCost;
			target.ShowSpotsX = source.ShowSpotsX;
			target.UseDecimalRates = source.UseDecimalRates;

			target.ContractSettings.ImportData(source.ContractSettings);
		}
예제 #57
0
        LayerEditor copyLayer( Legacy.Layer oldLayer )
        {
            var newLayer = new LayerEditor( null, oldLayer.Name )
                {
                    Visible = oldLayer.Visible,
                    ScrollSpeed = oldLayer.ScrollSpeed
                } ;

            convertCustomProperties( oldLayer.CustomProperties, newLayer.ItemProperties.CustomProperties) ;

            newLayer.Items.AddRange( oldLayer.Items.Select( convertItem ) ) ;

            newLayer.Items.ForEach( i => i.ParentLayer = newLayer ) ;

            return newLayer ;
        }
예제 #58
0
 // Disables the specified flag.
 public void Disable(Legacy flag)
 {
     Compatibility &= ~flag;
 }
예제 #59
0
 // Enables the specified flag.
 public void Enable(Legacy flag)
 {
     Compatibility |= flag;
 }
예제 #60
0
 // Returns true if flag is enabled.
 public bool IsEnabled(Legacy flag)
 {
     return (Compatibility & flag) != (Legacy)0;
 }