mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-17 04:02:52 +00:00
Use file scoped namespaces
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using Sharp7.Rx.Interfaces;
|
||||
using Shouldly;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using DeepEqual.Syntax;
|
||||
using DeepEqual.Syntax;
|
||||
using NUnit.Framework;
|
||||
using Sharp7.Rx.Enums;
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
|
||||
namespace Sharp7.Rx.Basics
|
||||
{
|
||||
namespace Sharp7.Rx.Basics;
|
||||
|
||||
internal class ConcurrentSubjectDictionary<TKey, TValue> : IDisposable
|
||||
{
|
||||
private readonly object dictionaryLock = new object();
|
||||
@@ -125,4 +123,3 @@ namespace Sharp7.Rx.Basics
|
||||
public ISubject<TValue> Subject { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace Sharp7.Rx.Basics;
|
||||
|
||||
namespace Sharp7.Rx.Basics
|
||||
{
|
||||
internal class DisposableItem<TValue> : IDisposable
|
||||
{
|
||||
private readonly Action disposeAction;
|
||||
@@ -34,4 +32,3 @@ namespace Sharp7.Rx.Basics
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
namespace Sharp7.Rx.Basics;
|
||||
|
||||
namespace Sharp7.Rx.Basics
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a task scheduler that ensures a maximum concurrency level while
|
||||
/// running on top of the ThreadPool.
|
||||
@@ -143,4 +137,3 @@ namespace Sharp7.Rx.Basics
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Concurrent;
|
||||
using Sharp7.Rx.Interfaces;
|
||||
|
||||
namespace Sharp7.Rx
|
||||
{
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
internal class CacheVariableNameParser : IS7VariableNameParser
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, S7VariableAddress> addressCache = new ConcurrentDictionary<string, S7VariableAddress>(StringComparer.OrdinalIgnoreCase);
|
||||
@@ -17,4 +16,3 @@ namespace Sharp7.Rx
|
||||
|
||||
public S7VariableAddress Parse(string input) => addressCache.GetOrAdd(input, inner.Parse);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Sharp7.Rx.Enums
|
||||
{
|
||||
namespace Sharp7.Rx.Enums;
|
||||
|
||||
public enum ConnectionState
|
||||
{
|
||||
Initial,
|
||||
@@ -7,4 +7,3 @@
|
||||
DisconnectedByUser,
|
||||
ConnectionLost
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Sharp7.Rx.Enums
|
||||
{
|
||||
namespace Sharp7.Rx.Enums;
|
||||
|
||||
internal enum CpuType
|
||||
{
|
||||
S7_300,
|
||||
@@ -7,4 +7,3 @@
|
||||
S7_1200,
|
||||
S7_1500
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Sharp7.Rx.Enums
|
||||
{
|
||||
namespace Sharp7.Rx.Enums;
|
||||
|
||||
internal enum DbType
|
||||
{
|
||||
Bit,
|
||||
@@ -10,4 +10,3 @@
|
||||
DInteger,
|
||||
ULong
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Sharp7.Rx.Enums
|
||||
{
|
||||
namespace Sharp7.Rx.Enums;
|
||||
|
||||
internal enum Operand : byte
|
||||
{
|
||||
Input = 69,
|
||||
@@ -7,4 +7,3 @@
|
||||
Marker = 77,
|
||||
Db = 68,
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace Sharp7.Rx.Enums
|
||||
{
|
||||
namespace Sharp7.Rx.Enums;
|
||||
|
||||
public enum TransmissionMode
|
||||
{
|
||||
Cyclic = 3,
|
||||
OnChange = 4,
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace Sharp7.Rx.Extensions;
|
||||
|
||||
namespace Sharp7.Rx.Extensions
|
||||
{
|
||||
internal static class DisposableExtensions
|
||||
{
|
||||
public static void AddDisposableTo(this IDisposable disposable, CompositeDisposable compositeDisposable)
|
||||
@@ -10,4 +9,3 @@ namespace Sharp7.Rx.Extensions
|
||||
compositeDisposable.Add(disposable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Reactive.Concurrency;
|
||||
using System.Reactive.Concurrency;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Sharp7.Rx.Extensions
|
||||
{
|
||||
namespace Sharp7.Rx.Extensions;
|
||||
|
||||
internal static class ObservableExtensions
|
||||
{
|
||||
public static IObservable<T> DisposeMany<T>(this IObservable<T> source)
|
||||
@@ -80,4 +79,3 @@ namespace Sharp7.Rx.Extensions
|
||||
return retryCount > 0 ? reDoCount(deferedObs, retryCount) : reDo(deferedObs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Sharp7.Rx.Enums;
|
||||
using Sharp7.Rx.Interfaces;
|
||||
|
||||
namespace Sharp7.Rx.Extensions
|
||||
{
|
||||
namespace Sharp7.Rx.Extensions;
|
||||
|
||||
public static class PlcExtensions
|
||||
{
|
||||
public static IObservable<TReturn> CreateDatatransferWithHandshake<TReturn>(this IPlc plc, string triggerAddress, string ackTriggerAddress, Func<IPlc, Task<TReturn>> readData, bool initialTransfer)
|
||||
@@ -71,4 +69,3 @@ namespace Sharp7.Rx.Extensions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sharp7.Rx.Enums;
|
||||
|
||||
namespace Sharp7.Rx.Interfaces
|
||||
{
|
||||
namespace Sharp7.Rx.Interfaces;
|
||||
|
||||
[NoReorder]
|
||||
public interface IPlc : IDisposable
|
||||
{
|
||||
@@ -15,4 +13,3 @@ namespace Sharp7.Rx.Interfaces
|
||||
IObservable<ConnectionState> ConnectionState { get; }
|
||||
ILogger Logger { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using Sharp7.Rx.Enums;
|
||||
|
||||
namespace Sharp7.Rx.Interfaces
|
||||
{
|
||||
namespace Sharp7.Rx.Interfaces;
|
||||
|
||||
[NoReorder]
|
||||
internal interface IS7Connector : IDisposable
|
||||
{
|
||||
@@ -23,4 +19,3 @@ namespace Sharp7.Rx.Interfaces
|
||||
|
||||
Task<Dictionary<string, byte[]>> ExecuteMultiVarRequest(IReadOnlyList<string> variableNames);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace Sharp7.Rx.Interfaces
|
||||
{
|
||||
namespace Sharp7.Rx.Interfaces;
|
||||
|
||||
internal interface IS7VariableNameParser
|
||||
{
|
||||
S7VariableAddress Parse(string input);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
namespace Sharp7.Rx
|
||||
{
|
||||
public static class S7ErrorCodes
|
||||
{
|
||||
/// <summary>
|
||||
@@ -24,4 +22,3 @@ namespace Sharp7.Rx
|
||||
return !notDisconnectedErrorCodes.Contains(errorCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.Buffers.Binary;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Sharp7.Rx.Enums;
|
||||
|
||||
namespace Sharp7.Rx
|
||||
{
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
internal static class S7ValueConverter
|
||||
{
|
||||
public static TValue ConvertToType<TValue>(byte[] buffer, S7VariableAddress address)
|
||||
@@ -82,4 +81,3 @@ namespace Sharp7.Rx
|
||||
[FieldOffset(0)] public float Single;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using JetBrains.Annotations;
|
||||
using Sharp7.Rx.Enums;
|
||||
|
||||
namespace Sharp7.Rx
|
||||
{
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
[NoReorder]
|
||||
internal class S7VariableAddress
|
||||
{
|
||||
@@ -13,4 +13,3 @@ namespace Sharp7.Rx
|
||||
public byte Bit { get; set; }
|
||||
public DbType Type { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using Sharp7.Rx.Enums;
|
||||
using Sharp7.Rx.Interfaces;
|
||||
|
||||
namespace Sharp7.Rx
|
||||
{
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
internal class S7VariableNameParser : IS7VariableNameParser
|
||||
{
|
||||
private static readonly Regex regex = new Regex(@"^(?<operand>db{1})(?<dbNr>\d{1,4})\.?(?<type>dbx|x|s|string|b|dbb|d|int|dbw|w|dint|dul|dulint|dulong|){1}(?<start>\d+)(\.(?<bitOrLength>\d+))?$", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant);
|
||||
@@ -81,4 +79,3 @@ namespace Sharp7.Rx
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Sharp7.Rx.Settings
|
||||
{
|
||||
namespace Sharp7.Rx.Settings;
|
||||
|
||||
internal class PlcConnectionSettings
|
||||
{
|
||||
public int CpuMpiAddress { get; set; }
|
||||
@@ -7,4 +7,3 @@
|
||||
public int Port { get; set; }
|
||||
public int RackNumber { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sharp7.Rx.Basics;
|
||||
using Sharp7.Rx.Enums;
|
||||
@@ -14,8 +9,8 @@ using Sharp7.Rx.Interfaces;
|
||||
using Sharp7.Rx.Resources;
|
||||
using Sharp7.Rx.Settings;
|
||||
|
||||
namespace Sharp7.Rx
|
||||
{
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
internal class Sharp7Connector : IS7Connector
|
||||
{
|
||||
private readonly BehaviorSubject<ConnectionState> connectionStateSubject = new BehaviorSubject<ConnectionState>(Enums.ConnectionState.Initial);
|
||||
@@ -276,4 +271,3 @@ namespace Sharp7.Rx
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Sharp7.Rx.Basics;
|
||||
using Sharp7.Rx.Enums;
|
||||
@@ -15,8 +10,8 @@ using Sharp7.Rx.Extensions;
|
||||
using Sharp7.Rx.Interfaces;
|
||||
using Sharp7.Rx.Settings;
|
||||
|
||||
namespace Sharp7.Rx
|
||||
{
|
||||
namespace Sharp7.Rx;
|
||||
|
||||
public class Sharp7Plc : IPlc
|
||||
{
|
||||
protected readonly CompositeDisposable Disposables = new CompositeDisposable();
|
||||
@@ -281,4 +276,3 @@ namespace Sharp7.Rx
|
||||
Dispose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user