AddVar() public method

public AddVar ( string flag, string val ) : void
flag string
val string
return void
Beispiel #1
0
        public override void Save(string outFile)
        {
            // iterate thru each tileset, call save on them
            VarCollection vc = new VarCollection("Path");
            StreamWriter  sw = new StreamWriter(outFile);

            foreach (string s in tilesets.Keys)
            {
                IXCTileset ts = (IXCTileset)tilesets[s];
                if (ts != null)
                {
                    vc.AddVar("rootPath", ts.MapPath);
                    vc.AddVar("rmpPath", ts.RmpPath);
                    vc.AddVar("blankPath", ts.BlankPath);
                }
            }

            foreach (string v in vc.Variables)
            {
                Variable var = (Variable)vc.Vars[v];
                sw.WriteLine(var.Name + ":" + var.Value);
            }

            foreach (string s in tilesets.Keys)
            {
                if (tilesets[s] != null)
                {
                    ((IXCTileset)tilesets[s]).Save(sw, vc);
                }
            }

            sw.Close();
        }
Beispiel #2
0
		//public override IMap GetMap(ShipDescriptor xCom,ShipDescriptor alien){return new Type1Map(this,xCom,alien);}	

		public override void Save(StreamWriter sw, VarCollection vars)
		{
			sw.WriteLine("Tileset:" + name);
			sw.WriteLine("\ttype:1");

			if (vars.Vars[rootPath] == null)
				sw.WriteLine("\trootpath:" + rootPath);
			else
				sw.WriteLine("\trootpath:" + ((Variable)vars.Vars[rootPath]).Name);

			if (vars.Vars[rmpPath] == null)
				sw.WriteLine("\trmpPath:" + rootPath);
			else
				sw.WriteLine("\trmpPath:" + ((Variable)vars.Vars[rmpPath]).Name);

			if (vars.Vars[blankPath] == null)
				sw.WriteLine("\tblankPath:" + blankPath);
			else
				sw.WriteLine("\tblankPath:" + ((Variable)vars.Vars[blankPath]).Name);

			sw.WriteLine("\tpalette:" + myPal.Name);

			foreach (string str in subsets.Keys)
			{
				Dictionary<string, IMapDesc> h = subsets[str];
				if (h == null)
					continue;

				VarCollection vc = new VarCollection("Deps");
				foreach (string s in h.Keys)
				{
					XCMapDesc id = (XCMapDesc)maps[s];
					if (id == null)
						continue;

					string depList = "";
					if (id.Dependencies.Length > 0)
					{
						int i = 0;
						for (; i < id.Dependencies.Length - 1; i++)
							depList += id.Dependencies[i] + " ";
						depList += id.Dependencies[i];
					}

					vc.AddVar(id.Name, depList);
				}

				sw.WriteLine("\tfiles:" + str);

				foreach (string vKey in vc.Variables)
					((Variable)vc.Vars[vKey]).Write(sw, "\t\t");

				sw.WriteLine("\tend");
			}

			sw.WriteLine("end\n");

			sw.Flush();
		}
Beispiel #3
0
//		public override IMap GetMap(ShipDescriptor xCom, ShipDescriptor alien)
//		{ return new Type1Map(this, xCom, alien); }

        public override void Save(StreamWriter sw, VarCollection vars)
        {
            sw.WriteLine("Tileset:" + name);
            sw.WriteLine("\ttype:1");

            if (vars.Vars[rootPath] == null)
            {
                sw.WriteLine("\trootpath:" + rootPath);
            }
            else
            {
                sw.WriteLine("\trootpath:" + ((Variable)vars.Vars[rootPath]).Name);
            }

            if (vars.Vars[rmpPath] == null)
            {
                sw.WriteLine("\trmpPath:" + rootPath);
            }
            else
            {
                sw.WriteLine("\trmpPath:" + ((Variable)vars.Vars[rmpPath]).Name);
            }

            if (vars.Vars[blankPath] == null)
            {
                sw.WriteLine("\tblankPath:" + blankPath);
            }
            else
            {
                sw.WriteLine("\tblankPath:" + ((Variable)vars.Vars[blankPath]).Name);
            }

            sw.WriteLine("\tpalette:" + myPal.Name);

            foreach (string str in subsets.Keys)
            {
                Dictionary <string, IMapDesc> h = subsets[str];
                if (h != null)
                {
                    VarCollection vc = new VarCollection("Deps");
                    foreach (string s in h.Keys)
                    {
                        XCMapDesc id = (XCMapDesc)maps[s];
                        if (id == null)
                        {
                            continue;
                        }

                        string depList = "";
                        if (id.Dependencies.Length > 0)
                        {
                            int i = 0;
                            for (; i < id.Dependencies.Length - 1; i++)
                            {
                                depList += id.Dependencies[i] + " ";
                            }

                            depList += id.Dependencies[i];
                        }
                        vc.AddVar(id.Name, depList);
                    }

                    sw.WriteLine("\tfiles:" + str);

                    foreach (string vKey in vc.Variables)
                    {
                        ((Variable)vc.Vars[vKey]).Write(sw, "\t\t");
                    }

                    sw.WriteLine("\tend");
                }
            }

            sw.WriteLine("end\n");
            sw.Flush();
        }
Beispiel #4
0
		public override void Save(string outFile)
		{
			//iterate thru each tileset, call save on them
			VarCollection vc = new VarCollection("Path");
			StreamWriter sw = new StreamWriter(outFile);

			foreach(string s in tilesets.Keys)
			{
				IXCTileset ts = (IXCTileset)tilesets[s];
				if(ts==null)
					continue;
				vc.AddVar("rootPath",ts.MapPath);
				vc.AddVar("rmpPath",ts.RmpPath);
				vc.AddVar("blankPath",ts.BlankPath);
			}

			foreach(string v in vc.Variables)
			{
				Variable var = (Variable)vc.Vars[v];
				sw.WriteLine(var.Name+":"+var.Value);
			}

			foreach(string s in tilesets.Keys)
			{
				if(tilesets[s]==null)
					continue;

				((IXCTileset)tilesets[s]).Save(sw,vc);
			}

      sw.Close();
		}