public SaveProfileForm()
		{
			InitializeComponent();
			profileInfo = new ImgProfile();
			DialogResult = DialogResult.Cancel;
			DSShared.Windows.RegistryInfo ri = new DSShared.Windows.RegistryInfo(this);

			if (!Directory.Exists(XCom.SharedSpace.Instance["CustomDir"].ToString()))
				Directory.CreateDirectory(XCom.SharedSpace.Instance["CustomDir"].ToString());

			saveFile.InitialDirectory = XCom.SharedSpace.Instance["CustomDir"].ToString();
			saveFile.FileName = "profile.pvp";

			txtOutDir.Text = saveFile.InitialDirectory + "\\" + saveFile.FileName;

			saveFile.Filter = "Image Profiles|*" + xcProfile.PROFILE_EXT;			

			foreach (string key in ((Dictionary<string, Palette>)SharedSpace.Instance["Palettes"]).Keys)
				cbPalette.Items.Add(key);

			if (cbPalette.Items.Count > 0)
				cbPalette.SelectedIndex = 0;

			restring();

			DialogResult = DialogResult.Cancel;
		}
Exemple #2
0
		public static List<xcProfile> LoadFile(string inFile)
		{
			StreamReader sr = new StreamReader(inFile);
			VarCollection_Structure vs = new VarCollection_Structure(sr);
			sr.Close();

			List<xcProfile> profileList = new List<xcProfile>();

			foreach (string s in vs.KeyValList.Keys)
			{
				ImgProfile profile = new ImgProfile();
				Dictionary<string, DSShared.KeyVal> info = vs.KeyValList[s].SubHash;
				profile.ext = info["open"].Rest;
				profile.imgHei = int.Parse(info["height"].Rest);
				profile.imgWid = int.Parse(info["width"].Rest);
				profile.desc = s;
				profile.defPal = info["palette"].Rest;
				profile.ext = info["open"].Rest;
				
				if(info.ContainsKey("openSingle") && info["openSingle"]!=null)
					profile.single = info["openSingle"].Rest+info["open"].Rest;

				foreach (IXCImageFile ixc in SharedSpace.Instance.GetImageModList())
					if (ixc.ExplorerDescription == info["codec"].Rest)
					{
						profile.imgType = ixc;
						break;
					}

				profileList.Add(new xcProfile(profile));
			}

			return profileList;
		}
Exemple #3
0
        public SaveProfileForm()
        {
            InitializeComponent();
            profileInfo  = new ImgProfile();
            DialogResult = DialogResult.Cancel;
            DSShared.Windows.RegistryInfo ri = new DSShared.Windows.RegistryInfo(this);

            if (!Directory.Exists(XCom.SharedSpace.Instance["CustomDir"].ToString()))
            {
                Directory.CreateDirectory(XCom.SharedSpace.Instance["CustomDir"].ToString());
            }

            saveFile.InitialDirectory = XCom.SharedSpace.Instance["CustomDir"].ToString();
            saveFile.FileName         = "profile.pvp";

            txtOutDir.Text = saveFile.InitialDirectory + "/" + saveFile.FileName;

            saveFile.Filter = "Image Profiles|*" + xcProfile.PROFILE_EXT;

            foreach (string key in ((Dictionary <string, Palette>)SharedSpace.Instance["Palettes"]).Keys)
            {
                cbPalette.Items.Add(key);
            }

            if (cbPalette.Items.Count > 0)
            {
                cbPalette.SelectedIndex = 0;
            }

            restring();

            DialogResult = DialogResult.Cancel;
        }
Exemple #4
0
		public xcProfile(ImgProfile profile):base(0,0)
		{			
			imageSize = new System.Drawing.Size(profile.ImgWid, profile.ImgHei);
			codec = profile.ImgType;
			expDesc = profile.Description;
			ext = profile.Extension;
			author = "Profile";
			desc = profile.Description;

			if (profile.OpenSingle != "")
				singleFile = profile.OpenSingle;

			//fileOptions.BmpDialog = true;
			//fileOptions.OpenDialog = true;

			//since we are loading off of an already generic implementation
			//we should let that implementation determine how this format be saved
			//fileOptions.SaveDialog = false;
			//fileOptions.CustomDialog = false;

			fileOptions.Init(false, true, true, false);

			xConsole.AddLine("Profile created: " + desc);

			try
			{
				defPal = XCom.SharedSpace.Instance.GetPaletteTable()[profile.Palette];
			}
			catch
			{
				defPal = XCom.Palette.TFTDBattle;
			}
		}
Exemple #5
0
        public void LoadProfile(string s)
        {
            foreach (xcProfile ip in ImgProfile.LoadFile(s))
            {
                loadedTypes.Add(ip);
            }

            osFilter.SetFilter(IXCImageFile.Filter.Open);
            openDictionary.Clear();
            openFile.Filter = loadedTypes.CreateFilter(osFilter, openDictionary);
        }
Exemple #6
0
        public static List <xcProfile> LoadFile(string inFile)
        {
            StreamReader            sr = new StreamReader(inFile);
            VarCollection_Structure vs = new VarCollection_Structure(sr);

            sr.Close();

            List <xcProfile> profileList = new List <xcProfile>();

            foreach (string s in vs.KeyValList.Keys)
            {
                ImgProfile profile = new ImgProfile();
                Dictionary <string, DSShared.KeyVal> info = vs.KeyValList[s].SubHash;
                profile.ext    = info["open"].Rest;
                profile.imgHei = int.Parse(info["height"].Rest);
                profile.imgWid = int.Parse(info["width"].Rest);
                profile.desc   = s;
                profile.defPal = info["palette"].Rest;
                profile.ext    = info["open"].Rest;

                if (info.ContainsKey("openSingle") && info["openSingle"] != null)
                {
                    profile.single = info["openSingle"].Rest + info["open"].Rest;
                }

                foreach (IXCImageFile ixc in SharedSpace.Instance.GetImageModList())
                {
                    if (ixc.ExplorerDescription == info["codec"].Rest)
                    {
                        profile.imgType = ixc;
                        break;
                    }
                }

                profileList.Add(new xcProfile(profile));
            }

            return(profileList);
        }
Exemple #7
0
        public xcProfile(ImgProfile profile)
            :
            base(0, 0)
        {
            imageSize = new System.Drawing.Size(profile.ImgWid, profile.ImgHei);
            codec     = profile.ImgType;
            expDesc   = profile.Description;
            ext       = profile.Extension;
            author    = "Profile";
            desc      = profile.Description;

            if (profile.OpenSingle != "")
            {
                singleFile = profile.OpenSingle;
            }

//			fileOptions.BmpDialog = true;
//			fileOptions.OpenDialog = true;

            // since it is loading off of an already generic implementation
            // it should let that implementation determine how this format be saved
//			fileOptions.SaveDialog = false;
//			fileOptions.CustomDialog = false;

            fileOptions.Init(false, true, true, false);

            xConsole.AddLine("Profile created: " + desc);

            try
            {
                defPal = XCom.SharedSpace.Instance.GetPaletteTable()[profile.Palette];
            }
            catch
            {
                defPal = XCom.Palette.UFOBattle;
//				defPal = XCom.Palette.TFTDBattle;
            }
        }
Exemple #8
0
        public PckViewForm()
        {
            InitializeComponent();

            #region shared space information

            var consoleSharedSpace = new ConsoleSharedSpace(new SharedSpace());
            console              = consoleSharedSpace.GetNewConsole();
            console.FormClosing += delegate(object sender, FormClosingEventArgs e)
            {
                e.Cancel = true;
                console.Hide();
            };
            FormClosed += (sender, e) => console.Close();

            sharedSpace = SharedSpace.Instance;
            sharedSpace.GetObj("PckView", this);
            sharedSpace.GetObj("AppDir", Environment.CurrentDirectory);
            sharedSpace.GetObj("CustomDir", Environment.CurrentDirectory + "/custom");
            sharedSpace.GetObj("SettingsDir", Environment.CurrentDirectory + "/settings");

            xConsole.AddLine("Current directory: " + sharedSpace["AppDir"]);
            xConsole.AddLine("Custom directory: " + sharedSpace["CustomDir"].ToString());
            #endregion

            _totalViewPck      = new TotalViewPck();
            _totalViewPck.Dock = DockStyle.Fill;
            DrawPanel.Controls.Add(_totalViewPck);

            _totalViewPck.View.DoubleClick     += new EventHandler(doubleClick);
            _totalViewPck.ViewClicked          += new PckViewMouseClicked(viewClicked);
            _totalViewPck.XCImageCollectionSet += new XCImageCollectionHandler(v_XCImageCollectionSet);
            _totalViewPck.ContextMenu           = makeContextMenu();

            SaveMenuItem.Visible = false;

            sharedSpace["Palettes"] = new Dictionary <string, Palette>();
            palMI = new Dictionary <Palette, MenuItem>();

            AddPalette(Palette.UFOBattle, miPalette);
            AddPalette(Palette.UFOGeo, miPalette);
            AddPalette(Palette.UFOGraph, miPalette);
            AddPalette(Palette.UFOResearch, miPalette);
            AddPalette(Palette.TFTDBattle, miPalette);
            AddPalette(Palette.TFTDGeo, miPalette);
            AddPalette(Palette.TFTDGraph, miPalette);
            AddPalette(Palette.TFTDResearch, miPalette);

            currPal = Palette.UFOBattle;
//			currPal = Palette.TFTDBattle;

            palMI[currPal].Checked = true;              // kL_ufoPalette
            _totalViewPck.Pal      = currPal;           // kL_ufoPalette

            editor          = new Editor(null);
            editor.Closing += new CancelEventHandler(editorClosing);

            if (editor != null)                                 // kL_ufoPalette
            {
                editor.Palette = currPal;                       // kL_ufoPalette
            }
            RegistryInfo ri = new RegistryInfo(this, "PckView");
            ri.AddProperty("FilterIndex");
            ri.AddProperty("SelectedPalette");

            if (!File.Exists("hq2xa.dll"))
            {
                miHq2x.Visible = false;
            }

            loadedTypes         = new LoadOfType <IXCImageFile>();
            loadedTypes.OnLoad += new LoadOfType <IXCImageFile> .TypeLoadDelegate(loadedTypes_OnLoad);

            sharedSpace["ImageMods"] = loadedTypes.AllLoaded;

//			loadedTypes.OnLoad += new LoadOfType<IXCFile>.TypeLoadDelegate(sortLoaded);

            loadedTypes.LoadFrom(Assembly.GetExecutingAssembly());
            loadedTypes.LoadFrom(Assembly.GetAssembly(typeof(XCom.Interfaces.IXCImageFile)));

            if (Directory.Exists(sharedSpace["CustomDir"].ToString()))
            {
                //Console.WriteLine("Custom directory exists: " + sharedSpace["CustomDir"].ToString());
                xConsole.AddLine("Custom directory exists: " + sharedSpace["CustomDir"].ToString());
                foreach (string s in Directory.GetFiles(sharedSpace["CustomDir"].ToString()))
                {
                    if (s.EndsWith(".dll"))
                    {
                        xConsole.AddLine("Loading dll: " + s);
                        loadedTypes.LoadFrom(Assembly.LoadFrom(s));
                    }
                    else if (s.EndsWith(xcProfile.PROFILE_EXT))
                    {
                        foreach (xcProfile ip in ImgProfile.LoadFile(s))
                        {
                            loadedTypes.Add(ip);
                        }
                    }
                }
            }

            osFilter = new OpenSaveFilter();
            osFilter.SetFilter(IXCImageFile.Filter.Open);

            openDictionary = new Dictionary <int, IXCImageFile>();
            saveDictionary = new Dictionary <int, IXCImageFile>();

            osFilter.SetFilter(IXCImageFile.Filter.Open);
            string filter = loadedTypes.CreateFilter(osFilter, openDictionary);
            openFile.Filter = filter;
        }