Skip to content

Commit

Permalink
Merge pull request #205 from FriendsOfCADability/FixCS0414
Browse files Browse the repository at this point in the history
Fix CS0414 The private field 'field' is assigned but its value is nev…
  • Loading branch information
dsn27 authored Dec 19, 2024
2 parents b971abf + 4234c62 commit f9f0e62
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CADability.Forms/PaintToOpenGL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct state
IntPtr deviceContext = IntPtr.Zero, renderContext = IntPtr.Zero;
IntPtr controlHandle = IntPtr.Zero;
Graphics graphics = null;
byte accumBits = 0, colorBits = 32, depthBits = 16, stencilBits = 0;
byte accumBits = 0, colorBits = 32, depthBits = 16;
static IntPtr MainRenderContext = IntPtr.Zero;
static IntPtr LastRenderContext = IntPtr.Zero;
private static List<System.Drawing.Bitmap> bitmapList = null;
Expand Down
6 changes: 1 addition & 5 deletions CADability/BSpline2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public class BSpline2D : GeneralCurve2D, ISerializable, IDeserializationCallback
//private GeoVector2D[] interdir; // Richtungen an den Stützpunkten
//private double[] interparam; // Parameterwerte an den Stützpunkten
//private GeoPoint2D[] tringulation; // Dreiecks-Zwischenpunkte (einer weniger als interpol)
private bool extendIsValid; // schon berechnet?
private double parameterEpsilon; // ein epsilon, welches sich auf den Parameter bezieht. Abbruch für Iterationen
private double distanceEpsilon; // ein epsilon, welches sich auf die Ausdehnung bezieht. Abbruch für Iterationen
WeakReference<ExplicitPCurve2D> explicitPCurve2D;
Expand All @@ -67,7 +66,6 @@ private void InvalidateCache()
//interdir = null;
//interparam = null;
//tringulation = null;
extendIsValid = false;
nubs = null;
nurbs = null;
explicitPCurve2D = null;
Expand Down Expand Up @@ -277,9 +275,7 @@ private void MakeFlat()
// }
//#endif
// }
#if DEBUG
private static int maxTriangleCount = 0;
#endif

private bool FindInflectionPoint(double su, GeoPoint2D pl, GeoVector2D dir1l, GeoVector2D dir2l, double eu, GeoPoint2D pr, GeoVector2D dir1r, GeoVector2D dir2r, out double par)
{
GeoPoint2D pm;
Expand Down
7 changes: 3 additions & 4 deletions CADability/ConstructAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7137,7 +7137,7 @@ protected void Finish()
* in der Callback Methode ausführen. Dann kann man immer noch Escape drücken, wenns zu lange dauart (Vervielfältigen, Schraffur)
*/
Thread backgroundTask;
bool finishedBackgroundTask, syncCallBack;
bool finishedBackgroundTask;
Delegate CallbackOnDone;
private void StartThread(object pars)
{ // das läuft im background thread
Expand Down Expand Up @@ -7165,7 +7165,6 @@ protected void StartBackgroundTask(Delegate MethodToInvoke, Delegate CallbackOnD
{
//System.Diagnostics.Trace.WriteLine("StartBackgroundTask");
backgroundTask = new Thread(new ParameterizedThreadStart(StartThread));
syncCallBack = true;
backgroundTask.Start(new object[] { MethodToInvoke, CallbackOnDone, invokeParameters });
//System.Diagnostics.Trace.WriteLine("StartBackgroundTask-Done");
}
Expand Down Expand Up @@ -7196,8 +7195,8 @@ protected void WaitForBackgroundTask()
bool stop = false;
lock (this)
{ // sind wir schon über den kritischen Punkt in der Ausführung, d.h. ist die Berechnung schon fertig
if (finishedBackgroundTask) stop = true;
else syncCallBack = false;
if (finishedBackgroundTask)
stop = true;
}
if (stop)
{ // hier abbrechen, da wir schon über den kritischen Punkt sind und syncCallBack nicht mehr rechtzeitig gesetzt werden konnte
Expand Down
5 changes: 0 additions & 5 deletions CADability/Edge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ public class Edge : ISerializable, IGeoObjectOwner, IDeserializationCallback, IC
private Vertex v1, v2;
private bool oriented; // obsolete, if false (forwardOnPrimaryFace, forwardOnSecondaryFace) have not yet been calculated
enum EdgeKind { unknown, sameSurface, tangential, sharp }
private EdgeKind edgeKind = EdgeKind.unknown;
internal BRepOperation.EdgeInfo edgeInfo; // only used for BRepOperation
// TODO: überprüfen, ob isPartOf und startAtOriginal, endAtOriginal noch gebraucht wird (evtl. zu einem Objekt machen)
// TODO: ist owner nicht immer primaryFace?
Expand Down Expand Up @@ -818,7 +817,6 @@ public override int GetHashCode()
}
internal Edge()
{
edgeKind = EdgeKind.unknown;
hashCode = hashCodeCounter++; //
#if DEBUG
if (hashCode == 1214)
Expand Down Expand Up @@ -1761,7 +1759,6 @@ internal void SetPrimary(Face primaryFace, ICurve2D curveOnPrimaryFace, bool for
this.curveOnPrimaryFace = curveOnPrimaryFace;
this.forwardOnPrimaryFace = forwardOnPrimaryFace;
oriented = true;
edgeKind = EdgeKind.unknown;
}
internal void SetPrimary(Face fc, bool forward)
{
Expand All @@ -1770,7 +1767,6 @@ internal void SetPrimary(Face fc, bool forward)
if (!forward) curveOnPrimaryFace.Reverse();
forwardOnPrimaryFace = forward;
oriented = true;
edgeKind = EdgeKind.unknown;
}
internal void SetSecondary(Face fc, bool forward)
{
Expand All @@ -1779,7 +1775,6 @@ internal void SetSecondary(Face fc, bool forward)
if (!forward) curveOnSecondaryFace.Reverse();
forwardOnSecondaryFace = forward;
oriented = true;
edgeKind = EdgeKind.unknown;
}
internal void UpdateInterpolatedDualSurfaceCurve()
{
Expand Down
2 changes: 0 additions & 2 deletions CADability/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ void IEnumerator.Reset()
public class LookedUpEnumerable<T> : IEnumerable<T>, IEnumerator<T>, IEnumerator
{
IEnumerable<T> toEnumerate;
int currentIndex;
IEnumerator<T> currentEnumerator;
Dictionary<T, T> lookUp;
public LookedUpEnumerable(IEnumerable<T> enumerable, Dictionary<T, T> lookUp)
{
toEnumerate = enumerable;
currentIndex = 0;
currentEnumerator = null;
this.lookUp = lookUp;
currentEnumerator = enumerable.GetEnumerator();
Expand Down
1 change: 0 additions & 1 deletion CADability/Face.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6737,7 +6737,6 @@ private void TryAssureTriangles(double precision)
}
}
}
static int maxtime = 0;
internal void AssureTriangles(double precision)
{
lock (lockTriangulationRecalc)
Expand Down
2 changes: 0 additions & 2 deletions CADability/GeoVectorProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ private enum DisplayCoordinateSystem { local, absolute, both };
private Plane drawingPlane; // spiegelt die aktuelle drawingplane wieder
private bool displayZComponent; // true: z-Wert darstellen, false: nur x,y-Werte darstellen
private bool alwaysAbsoluteCoordinateSystem; // immer im basoluten Koordinatensystem darstellen
private bool alwaysZComponent; // immer z-Wert darstellen

/// <summary>
/// Delegate definition for the <see cref="SelectionChangedEvent"/>
Expand Down Expand Up @@ -134,7 +133,6 @@ private void InitFormat(IFrame frame)
displayZComponent = true;
}
alwaysAbsoluteCoordinateSystem = false;
alwaysZComponent = false;
displayMode = (DisplayMode)frame.GetIntSetting("Formatting.Vector.Mode", 0);
numberFormatInfo = (NumberFormatInfo)CultureInfo.CurrentCulture.NumberFormat.Clone();
int decsym = Settings.GlobalSettings.GetIntValue("Formatting.Decimal", 0); // Systemeinstellung | Punkt | Komma
Expand Down
3 changes: 0 additions & 3 deletions CADability/IntegerProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class IntegerProperty : EditableProperty<int>, ISerializable, ISettingCha
private string text;
private bool readOnly;
private bool IsSetting;
private bool settingChanged;
private bool highlight;
private int minValue; // Grenzen für die Eingabe
private int maxValue;
Expand Down Expand Up @@ -51,7 +50,6 @@ private void Initialize(object ObjectWithInt, string PropertyName, string resour
}
}
IntChanged();
settingChanged = false;
}
public IntegerProperty(object ObjectWithInt, string PropertyName, string resourceId)
{
Expand Down Expand Up @@ -169,7 +167,6 @@ public void SetInt(int d)
{
if (d == internalValue)
return;
settingChanged = true;
internalValue = d;
if (SetIntEvent != null)
{
Expand Down
2 changes: 0 additions & 2 deletions CADability/MultipleChoiceProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class MultipleChoiceProperty : PropertyEntryImpl
//protected ImageList images; // die ImageList (kann fehlen)
protected string selectedText; // der ausgewählte Text
protected string unselectedText; // der Text, wenn nichts ausgewählt ist (wenn null, dann ganz leer)
private bool popup;
/// <value>
/// Back reference to any user item. Not used by the MultipleChoiceProperty object itself.
/// </value>
Expand Down Expand Up @@ -59,7 +58,6 @@ public MultipleChoiceProperty(string resourceId, int InitialSelection)
/// </summary>
public MultipleChoiceProperty()
{
popup = true;
}
//private int ImageIndex(int Index)
//{
Expand Down
8 changes: 3 additions & 5 deletions CADability/NameProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,29 @@ public class NameProperty : IShowPropertyImpl
{
private object ObjectWithName;
private PropertyInfo TheProperty;
private bool IsSetting;

public NameProperty(object ObjectWithName, string PropertyName, string resourceId)
{
IsSetting = false;
this.ObjectWithName = ObjectWithName;
base.resourceId = resourceId;
TheProperty = ObjectWithName.GetType().GetProperty(PropertyName);
if (TheProperty == null) TheProperty = ObjectWithName.GetType().BaseType.GetProperty(PropertyName); // besser rekursiv
}

private void SetName(string s)
{
MethodInfo mi = TheProperty.GetSetMethod();
object[] prm = new object[1];
prm[0] = s;
try
{
IsSetting = true;
mi.Invoke(ObjectWithName, prm);
}
finally
{
IsSetting = false;

}

}
private string GetName()
{
Expand Down
4 changes: 2 additions & 2 deletions CADability/ParallelHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace CADability
public class ParallelHelper
{
#if DEBUG
private static string lmfa = ""; // to have an object to lock access to maxFailedAttempts
static int maxFailedAttempts = 0;
//private static string lmfa = ""; // to have an object to lock access to maxFailedAttempts
//static int maxFailedAttempts = 0;
static HashSet<string> debug = new HashSet<string>();
#endif
class LockMultiple : IDisposable
Expand Down
1 change: 0 additions & 1 deletion CADability/ProjectedModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public enum Kind { HardEdge, SoftEdge, ContourEdge }
[Serializable]
public class ProjectedModel : ISerializable, IDeserializationCallback, IJsonSerialize
{
static bool DoBackgroundPaint = false; // immer false, keine Hidden lines mehr!
#region Konzept:
/* Konzept zum ProjectedModel:
* Die Klasse ProjectedModel hält einen QuadTree, der die Objekte für die 2D Darstellung enthält.
Expand Down

0 comments on commit f9f0e62

Please sign in to comment.