public ItemAction(GlobalChangeset gs, DocSetChangeset ds, FileChangeset fs, Change c)
 {
     globalset = gs;
     docset    = ds;
     fileset   = fs;
     change    = c;
 }
        //
        // Loads the `file' from a DocSetChangeset
        //
        XmlDocument LoadDocument(DocSetChangeset ds, string file)
        {
            XmlDocument d       = new XmlDocument();
            string      basedir = (string)providers [ds.DocSet];

            d.Load(basedir + "/" + file);
            return(d);
        }
        void SaveDocument(XmlDocument d, DocSetChangeset docset, FileChangeset fileset)
        {
            string basedir = (string)providers [docset.DocSet];
            string file    = basedir + "/" + fileset.RealFile;

            d.Save(file);
            RenderReview(current_id, current_serial);
        }
예제 #4
0
        public void AddChange(string doc_set, string real_file, string xpath, XmlNode new_node, string node_url)
        {
            FileChangeset new_file_change_set;
            Change        new_change = NewChange(xpath, new_node, node_url);

            if (real_file == null)
            {
                throw new Exception("Could not find real_file. Please talk to Miguel or Ben about this");
            }

            foreach (DocSetChangeset dscs in DocSetChangesets)
            {
                if (dscs.DocSet != doc_set)
                {
                    continue;
                }

                foreach (FileChangeset fcs in dscs.FileChangesets)
                {
                    if (fcs.RealFile != real_file)
                    {
                        continue;
                    }

                    foreach (Change c in fcs.Changes)
                    {
                        if (c.XPath == xpath)
                        {
                            c.NewNode = new_node;
                            c.Serial  = SettingsHandler.Settings.SerialNumber;
                            return;
                        }
                    }

                    fcs.Changes.Add(new_change);
                    return;
                }

                new_file_change_set          = new FileChangeset();
                new_file_change_set.RealFile = real_file;
                new_file_change_set.Changes.Add(new_change);
                dscs.FileChangesets.Add(new_file_change_set);
                return;
            }

            DocSetChangeset new_dcs = new DocSetChangeset();

            new_dcs.DocSet = doc_set;

            new_file_change_set          = new FileChangeset();
            new_file_change_set.RealFile = real_file;

            new_file_change_set.Changes.Add(new_change);
            new_dcs.FileChangesets.Add(new_file_change_set);
            DocSetChangesets.Add(new_dcs);
        }
예제 #5
0
        void Merge(DocSetChangeset dsc, string path)
        {
            Console.WriteLine("Merging changes in {0} ({1})", dsc.DocSet, path);

            foreach (FileChangeset fcs in dsc.FileChangesets)
            {
                if (File.Exists(Path.Combine(path, fcs.RealFile)))
                {
                    Merge(fcs, path);
                }
                else
                {
                    Console.WriteLine("\tCould not find file {0}", Path.Combine(path, fcs.RealFile));
                }
            }
        }
예제 #6
0
        public void RemoveChange(string doc_set, string real_file, string xpath)
        {
            if (real_file == null)
            {
                throw new Exception("Could not find real_file. Please talk to Miguel or Ben about this");
            }

            for (int i = 0; i < DocSetChangesets.Count; i++)
            {
                DocSetChangeset dscs = DocSetChangesets [i] as DocSetChangeset;
                if (dscs.DocSet != doc_set)
                {
                    continue;
                }

                for (int j = 0; j < dscs.FileChangesets.Count; j++)
                {
                    FileChangeset fcs = dscs.FileChangesets [j] as FileChangeset;
                    if (fcs.RealFile != real_file)
                    {
                        continue;
                    }

                    for (int k = 0; k < fcs.Changes.Count; k++)
                    {
                        Change c = fcs.Changes [k] as Change;
                        if (c.XPath == xpath)
                        {
                            fcs.Changes.Remove(c);
                            break;
                        }
                    }
                    if (fcs.Changes.Count == 0)
                    {
                        dscs.FileChangesets.Remove(fcs);
                    }
                }

                if (dscs.FileChangesets.Count == 0)
                {
                    DocSetChangesets.Remove(dscs);
                }
            }
        }
예제 #7
0
        public DocSetChangeset GetFrom(int starting_serial_id)
        {
            DocSetChangeset dsc = null;

            foreach (FileChangeset fcs in FileChangesets)
            {
                object o = fcs.GetFrom(starting_serial_id);
                if (o == null)
                {
                    continue;
                }
                if (dsc == null)
                {
                    dsc        = new DocSetChangeset();
                    dsc.DocSet = DocSet;
                }
                dsc.FileChangesets.Add(o);
            }
            return(dsc);
        }
예제 #8
0
	//
	// Loads the `file' from a DocSetChangeset
	//
	XmlDocument LoadDocument (DocSetChangeset ds, string file)
	{
		XmlDocument d = new XmlDocument ();
		string basedir = (string) providers [ds.DocSet];
		d.Load (basedir + "/" + file);
		return d;
	}
예제 #9
0
	void SaveDocument (XmlDocument d, DocSetChangeset docset, FileChangeset fileset)
	{
		string basedir = (string) providers [docset.DocSet];
		string file = basedir + "/" + fileset.RealFile;
		
		d.Save (file);
		RenderReview (current_id, current_serial);
	}
예제 #10
0
		public ItemAction (GlobalChangeset gs, DocSetChangeset ds, FileChangeset fs, Change c)
		{
			globalset = gs;
			docset = ds;
			fileset = fs;
			change = c;
		}
예제 #11
0
		public FileAction (GlobalChangeset gs, DocSetChangeset ds, FileChangeset fs)
		{
			globalset = gs;
			docset = ds;
			fileset = fs;
		}
예제 #12
0
		void Merge (DocSetChangeset dsc, string path)
		{
			Console.WriteLine ("Merging changes in {0} ({1})", dsc.DocSet, path);
			
			foreach (FileChangeset fcs in dsc.FileChangesets) {
				if (File.Exists (Path.Combine (path, fcs.RealFile)))
					Merge (fcs, path);
				else
					Console.WriteLine ("\tCould not find file {0}", Path.Combine (path, fcs.RealFile));
			}
		}
예제 #13
0
		public DocSetChangeset GetFrom (int starting_serial_id)
		{
			DocSetChangeset dsc = null;
			
			foreach (FileChangeset fcs in FileChangesets){
				object o = fcs.GetFrom (starting_serial_id);
				if (o == null)
					continue;
				if (dsc == null){
					dsc = new DocSetChangeset ();
					dsc.DocSet = DocSet;
				}
				dsc.FileChangesets.Add (o);
			}
			return dsc;
		}
예제 #14
0
		public void AddChange (string doc_set, string real_file, string xpath, XmlNode new_node, string node_url)
		{
			FileChangeset new_file_change_set;
			Change new_change = NewChange (xpath, new_node, node_url);
			
			if (real_file == null)
				throw new Exception ("Could not find real_file. Please talk to Miguel or Ben about this");
			
			foreach (DocSetChangeset dscs in DocSetChangesets) {
				if (dscs.DocSet != doc_set) 
					continue;

				foreach (FileChangeset fcs in dscs.FileChangesets) {
					if (fcs.RealFile != real_file)
						continue;
					
					foreach (Change c in fcs.Changes) {
						if (c.XPath == xpath) {
							c.NewNode = new_node;
							c.Serial = SettingsHandler.Settings.SerialNumber;
							return;
						}
					}

					fcs.Changes.Add (new_change);
					return;
					
				}
				
				new_file_change_set = new FileChangeset ();
				new_file_change_set.RealFile = real_file;
				new_file_change_set.Changes.Add (new_change);
				dscs.FileChangesets.Add (new_file_change_set);
				return;
					
			}
			
			DocSetChangeset new_dcs = new DocSetChangeset ();
			new_dcs.DocSet = doc_set;
			
			new_file_change_set = new FileChangeset ();
			new_file_change_set.RealFile = real_file;
			
			new_file_change_set.Changes.Add (new_change);
			new_dcs.FileChangesets.Add (new_file_change_set);
			DocSetChangesets.Add (new_dcs);
		}
예제 #15
0
 public FileAction(GlobalChangeset gs, DocSetChangeset ds, FileChangeset fs)
 {
     globalset = gs;
     docset    = ds;
     fileset   = fs;
 }