public GenericWindow(WinFormsBase f, string file)
 {
     wpf = null;
     winform = f;
     tool = Tools.Items.FirstOrDefault(x => x.type == f.GetType());
     fileName = file;
 }
Exemple #2
0
        public Bild(WPFBase parent) : base(parent)
        {
            InitializeComponent();

            this.ShowInTaskbar   = false;
            this.Fenstergroessen = false;
        }
 public GenericWindow(WPFBase w, string file)
 {
     wpf = w;
     tool = Tools.Items.FirstOrDefault(x => x.type == w.GetType());
     winform = null;
     fileName = file;
 }
Exemple #4
0
        public Einstellungen(WPFBase parent) : base(parent)
        {
            this.WindowName = "Einstellungen";
            InitializeComponent();

            this.tabAllgemeinIcon.Source = ResourceConstants.WheelIcon;
            Layout.WindowBackgrounds.Add(this.Tabs);
        }
Exemple #5
0
        public EditToDo(WPFBase parent) : base(parent)
        {
            InitializeComponent();

            this.Fenstergroessen = false;
            this.WindowName      = "EditToDo";

            this.saveCancel.Speichern += SaveCancel_Speichern;
            this.saveCancel.Abbrechen += SaveCancel_Abbrechen;
        }
        public static IMEPackage OpenMEPackage(string pathToFile, WPFBase wpfWindow = null, WinFormsBase winForm = null)
        {
            IMEPackage package = null;

            if (!openPackages.ContainsKey(pathToFile))
            {
                ushort version;
                ushort licenseVersion;
                using (FileStream fs = new FileStream(pathToFile, FileMode.Open, FileAccess.Read))
                {
                    fs.Seek(4, SeekOrigin.Begin);
                    version        = fs.ReadValueU16();
                    licenseVersion = fs.ReadValueU16();
                }

                if (version == ME3Package.VERSION && licenseVersion == ME3Package.LICENSE)
                {
                    package = ME3ConstructorDelegate(pathToFile);
                }
                else if (version == 512 && licenseVersion == 130)
                {
                    package = ME2ConstructorDelegate(pathToFile);
                }
                else if (version == 491 && licenseVersion == 1008)
                {
                    package = ME1ConstructorDelegate(pathToFile);
                }
                else
                {
                    throw new FormatException("Not an ME1, ME2, or ME3 package file.");
                }
                package.noLongerUsed += Package_noLongerUsed;
                openPackages.Add(pathToFile, package);
            }
            else
            {
                package = openPackages[pathToFile];
            }

            if (wpfWindow != null)
            {
                package.RegisterTool(new GenericWindow(wpfWindow, Path.GetFileName(pathToFile)));
                addToPackagesInTools(package);
            }
            else if (winForm != null)
            {
                package.RegisterTool(new GenericWindow(winForm, Path.GetFileName(pathToFile)));
                addToPackagesInTools(package);
            }
            else
            {
                package.RegisterUse();
            }
            return(package);
        }
        public static IMEPackage OpenMEPackage(string pathToFile, WPFBase wpfWindow = null, WinFormsBase winForm = null)
        {
            IMEPackage package = null;
            if (!openPackages.ContainsKey(pathToFile))
            {
                ushort version;
                ushort licenseVersion;
                using (FileStream fs = new FileStream(pathToFile, FileMode.Open, FileAccess.Read))
                {
                    fs.Seek(4, SeekOrigin.Begin);
                    version = fs.ReadValueU16();
                    licenseVersion = fs.ReadValueU16();
                }

                if (version == 684 && licenseVersion == 194)
                {
                    package = ME3ConstructorDelegate(pathToFile);
                }
                else if (version == 512 && licenseVersion == 130)
                {
                    package = ME2ConstructorDelegate(pathToFile);
                }
                else if (version == 491 && licenseVersion == 1008)
                {
                    package = ME1ConstructorDelegate(pathToFile);
                }
                else
                {
                    throw new FormatException("Not an ME1, ME2, or ME3 package file.");
                }
                package.noLongerUsed += Package_noLongerUsed;
                openPackages.Add(pathToFile, package);
            }
            else
            {
                package = openPackages[pathToFile];
            }

            if (wpfWindow != null)
            {
                package.RegisterTool(new GenericWindow(wpfWindow, Path.GetFileName(pathToFile)));
                addToPackagesInTools(package);
            }
            else if (winForm != null)
            {
                package.RegisterTool(new GenericWindow(winForm, Path.GetFileName(pathToFile)));
                addToPackagesInTools(package);
            }
            else
            {
                package.RegisterUse();
            }
            return package;
        }
Exemple #8
0
        public static bool Show(Core core, WPFBase parent, int cosplan_nr)
        {
            EditToDo edit = new EditToDo(parent)
            {
                core       = core,
                cosplan_nr = cosplan_nr
            };

            edit.ShowDialog();
            return(edit.Saved);
        }
        public static ME1Package OpenME1Package(string pathToFile, WPFBase wpfWindow = null, WinFormsBase winForm = null)
        {
            IMEPackage pck = OpenMEPackage(pathToFile, wpfWindow, winForm);
            ME1Package pcc = pck as ME1Package;

            if (pcc == null)
            {
                pck.Release(wpfWindow, winForm);
                throw new FormatException("Not an ME1 package file.");
            }
            return(pcc);
        }
        public static IMEPackage OpenME1Package(string pathToFile, WPFBase wpfWindow = null, WinFormsBase winForm = null, bool forceLoadFromDisk = false)
        {
            IMEPackage pck = OpenMEPackage(pathToFile, wpfWindow, winForm, forceLoadFromDisk);

            if (pck.Game == MEGame.ME1)
            {
                return(pck);
            }

            pck.Release(wpfWindow, winForm);
            throw new FormatException("Not an ME1 package file.");
        }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cosplan"></param>
        /// <returns>False if Cosplan got deleted. Else True.</returns>
        public static bool Show(WPFBase parent, Core core, int cosplan)
        {
            Cosplan c = new Cosplan(parent)
            {
                core    = core,
                cosplan = new Cosplans()
                {
                    Where = "Nummer = " + cosplan
                }
            };

            c.cosplan.Read();
            c.ShowDialog();

            return(!c.geloescht);
        }
        public static IMEPackage OpenMEPackage(string pathToFile, WPFBase wpfWindow = null, WinFormsBase winForm = null, bool forceLoadFromDisk = false)
        {
            IMEPackage package;

            pathToFile = Path.GetFullPath(pathToFile); //STANDARDIZE INPUT
            if (forceLoadFromDisk || !openPackages.ContainsKey(pathToFile))
            {
                ushort version;
                ushort licenseVersion;

                using (FileStream fs = new FileStream(pathToFile, FileMode.Open, FileAccess.Read))
                {
                    fs.Seek(4, SeekOrigin.Begin);
                    version        = fs.ReadUInt16();
                    licenseVersion = fs.ReadUInt16();
                }


                if (version == MEPackage.ME3UnrealVersion && licenseVersion == MEPackage.ME3LicenseeVersion ||
                    version == MEPackage.ME2UnrealVersion && licenseVersion == MEPackage.ME2LicenseeVersion ||
                    version == MEPackage.ME1UnrealVersion && licenseVersion == MEPackage.ME1LicenseeVersion)
                {
                    package = MEConstructorDelegate(pathToFile, MEGame.Unknown);
                }
                else if (version == 868 && licenseVersion == 0)
                {
                    //UDK
                    package = UDKConstructorDelegate(pathToFile, false);
                }
                else
                {
                    throw new FormatException("Not an ME1, ME2, ME3, or UDK package file.");
                }

                if (!forceLoadFromDisk)
                {
                    package.noLongerUsed += Package_noLongerUsed;
                    openPackages.TryAdd(pathToFile, package);
                }
            }
            else
            {
                package = openPackages[pathToFile];
            }

            if (wpfWindow != null)
            {
                package.RegisterTool(new GenericWindow(wpfWindow, Path.GetFileName(pathToFile)));
                addToPackagesInTools(package);
            }
            else if (winForm != null)
            {
                package.RegisterTool(new GenericWindow(winForm, Path.GetFileName(pathToFile)));
                addToPackagesInTools(package);
            }
            else
            {
                package.RegisterUse();
            }
            return(package);
        }
Exemple #13
0
 public Base4Windows(WPFBase parent) : base(parent)
 {
     Layout.WindowBackgrounds.Add(this);
 }
 public void Dispose()
 {
     if (wpf != null)
     {
         wpf.Closed -= wpfClosed;
         wpf = null;
     }
     else if (winform != null)
     {
         winform.FormClosed -= winformClosed;
         winform = null;
     }
     Disposing?.Invoke(this, EventArgs.Empty);
 }
 public static ME1Package OpenME1Package(string pathToFile, WPFBase wpfWindow = null, WinFormsBase winForm = null)
 {
     IMEPackage pck = OpenMEPackage(pathToFile, wpfWindow, winForm);
     ME1Package pcc = pck as ME1Package;
     if (pcc == null)
     {
         pck.Release(wpfWindow, winForm);
         throw new FormatException("Not an ME1 package file.");
     }
     return pcc;
 }
Exemple #16
0
 public Cosplan(WPFBase parent) : base(parent)
 {
     this.WindowName = "Cosplan";
     InitializeComponent();
 }