Esempio n. 1
0
        public ActionResult PreSentence(int conflictId)
        {
            var conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var demandeur = conflict.UsersInConflicts.First(c => c.IdUser == conflict.IdCreationUser);

            if (demandeur.IsLawyer != null && demandeur.IsLawyer.Value)
            {
                demandeur = conflict.UsersInConflicts.First(c => c.IdLawyer == conflict.IdCreationUser);
            }
            var defendeur = conflict.UsersInConflicts.First(c => (c.IsLawyer == null || !c.IsLawyer.Value) && c.IdUser != demandeur.IdUser);

            if (demandeur.UserCompany == null || demandeur.UserCompany.Company == null ||
                defendeur.UserCompany == null || defendeur.UserCompany.Company == null)
            {
                TempData["Error"] = "Vous devez renseigner les informations d'entreprises de chaque parties avant de pouvoir générer la pré-sentence";
                return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId }));
            }

            var file      = DocGenerator.GeneratePreSentenceReport(conflict);
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(View("WritePreSentence", new WritePreSentenceModel()
            {
                Conflict = conflict, Url = azureFile.Uri.AbsoluteUri
            }));
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors("AllowAll");

            var info = new JsonRpcInfo
            {
                Description = "Api for JsonRpc chat",
                Title       = "Chat API",
                Version     = "v1",
                Contact     = new JsonRpcContact
                {
                    Name  = "The Dude",
                    Email = "*****@*****.**",
                    Url   = "http://www.thedude.com"
                }
            };

            app.UseJsonRpcApi(info);

            app.UseWebSockets();
            app.AddJsonRpcService <ChatJsonRpcWebSocketService>();
            var doc        = new JsonRpcDoc(info);
            var serviceDoc = DocGenerator.GenerateJsonRpcServiceDoc(typeof(ChatJsonRpcWebSocketService), doc);

            app.Run(async(context) => { await context.Response.WriteAsync("Hello World!"); });
        }
Esempio n. 3
0
        private static async Task MainAsync()
        {
            InitLoggers();
            LogMessage(LogLevel.Info, "Started");
            var generator    = new DocGenerator();
            var outputStream = Console.OpenStandardOutput();

            try
            {
                await generator.GenerateApiDocumentationAsync(typeof(TestMarkerType),
                                                              outputStream,
                                                              new List <IExampleSerializer>
                {
                    new JsonExampleSerializer(),
                    new XmlExampleSerializer()
                });
            }
            catch (Exception exception)
            {
                Logger.LogException("DOC TEST", LogLevel.Warning, exception);
            }

            LogMessage(LogLevel.Info, "Done");
            Console.ReadLine();
        }
Esempio n. 4
0
        public void Invoke(CompositionContainer container)
        {
            var traceListener = new ConsolidatedConsoleTraceListener(new Dictionary<string, string>
                                                                         {
                                                                             {"LostDoc.Core.DocGenerator", "Build"},
                                                                         });

            TraceSources.GeneratorSource.Listeners.Add(traceListener);

            try
            {
                SetTraceLevel();
                
                if (!File.Exists(this.Path))
                {
                    Console.WriteLine("File not found: '{0}'", this.Path);
                    return;
                }

                this.Output = BuildOutputFilePath();

                DocGenerator gen = new DocGenerator(container);

                gen.AssetFilters.AddRange(
                    BuildAssetFilters());

                gen.Enrichers.AddRange(
                    BuildEnrichers());

                gen.AddAssembly(this.Path);
                
                XDocument rawDoc = gen.Generate();

                
                //StringWriter output = new StringWriter();
                //try
                //{
                //    using (
                //        XmlWriter writer = XmlWriter.Create(output,
                //                                            new XmlWriterSettings
                //                                                {
                //                                                    CheckCharacters = true,
                //                                                    Encoding = Encoding.ASCII
                //                                                }))
                //        rawDoc.Save(writer);
                //}
                //catch
                //{
                    
                //}

                rawDoc.Save(this.Output);

            }
            finally
            {
                TraceSources.GeneratorSource.Listeners.Remove(traceListener);
            }
        }
Esempio n. 5
0
        public void Generate_WhenInvokedWithoutSettingsAltered_PublicMethodsAreIncluded()
        {
            var generator = new DocGenerator(_document);
            Type type = typeof(TestClass);
            ClassDescription description = generator.Generate(type);

            Assert.AreEqual(4, description.PublicMethods.Count);
        }
Esempio n. 6
0
        public void GenerateDocs()
        {
            var list = DocGenerator.Generate();

            Assert.IsTrue(list.Count > 0);

            Assert.IsFalse(list.Any(x => x.Description == null));
        }
Esempio n. 7
0
        public void Invoke(CompositionContainer container)
        {
            var traceListener = new ConsolidatedConsoleTraceListener(new Dictionary <string, string>
            {
                { "LostDoc.Core.DocGenerator", "Build" },
            });

            TraceSources.GeneratorSource.Listeners.Add(traceListener);

            try
            {
                SetTraceLevel();

                if (!File.Exists(this.Path))
                {
                    Console.WriteLine("File not found: '{0}'", this.Path);
                    return;
                }

                this.Output = BuildOutputFilePath();

                DocGenerator gen = new DocGenerator(container);

                gen.AssetFilters.AddRange(
                    BuildAssetFilters());

                gen.Enrichers.AddRange(
                    BuildEnrichers());

                gen.AddAssembly(this.Path);

                XDocument rawDoc = gen.Generate();


                //StringWriter output = new StringWriter();
                //try
                //{
                //    using (
                //        XmlWriter writer = XmlWriter.Create(output,
                //                                            new XmlWriterSettings
                //                                                {
                //                                                    CheckCharacters = true,
                //                                                    Encoding = Encoding.ASCII
                //                                                }))
                //        rawDoc.Save(writer);
                //}
                //catch
                //{

                //}

                rawDoc.Save(this.Output);
            }
            finally
            {
                TraceSources.GeneratorSource.Listeners.Remove(traceListener);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Generate a set of documents
        /// </summary>
        /// <param name="numDocs">How many documents to create</param>
        /// <returns>The documents</returns>
        private Document[] SampleDocs(int numDocs)
        {
            //Generate Sections
            Section title = new Section(new Font("Century Gothic", 22), Color.FromArgb(128, 0, 0), 1, 0);
            Section h1    = new Section(new Font("Century Gothic", 16), Color.FromArgb(128, 0, 0), 1, 0);
            Section h2    = new Section(new Font("Century Gothic", 13), Color.FromArgb(128, 0, 0), 1, 0);
            Section h3    = new Section(new Font("Century Gothic", 11, FontStyle.Bold), Color.FromArgb(128, 0, 0), 1, 0);
            Section text1 = new Section(new Font("Century Gothic", 11), 4, 2);
            Section text2 = new Section(new Font("Century Gothic", 11), 4, 2);
            Section text3 = new Section(new Font("Century Gothic", 11), 4, 2);

            //Fill out selectors

            //Title Selector
            title.NextSection.TerminateWeight = 0;
            title.NextSection.AddSection(h1, 4);
            title.NextSection.AddSection(text1, 1);

            //H1 Selector
            h1.NextSection.TerminateWeight = 0;
            h1.NextSection.AddSection(text1, 2);
            h1.NextSection.AddSection(text2, 1);
            h1.NextSection.AddSection(h2, 2);

            //H2 Selector
            h2.NextSection.TerminateWeight = 0;
            h2.NextSection.AddSection(text2, 2);
            h2.NextSection.AddSection(text3, 1);
            h2.NextSection.AddSection(h3, 2);

            //H3 Selector
            h3.NextSection.TerminateWeight = 0;
            h3.NextSection.AddSection(text3, 1);

            //Text1 Selector
            text1.NextSection.TerminateWeight = 1;
            text1.NextSection.AddSection(text1, 4);
            text1.NextSection.AddSection(h1, 1);

            //Text2 Selector
            text2.NextSection.TerminateWeight = 2;
            text2.NextSection.AddSection(text2, 8);
            text2.NextSection.AddSection(h1, 1);
            text2.NextSection.AddSection(h2, 1);

            //Text3 Selector
            text3.NextSection.TerminateWeight = 3;
            text3.NextSection.AddSection(text3, 12);
            text3.NextSection.AddSection(h1, 1);
            text3.NextSection.AddSection(h2, 1);
            text3.NextSection.AddSection(h3, 1);

            //Generate the documents
            DocGenerator docGen = new DocGenerator(title, this);

            return(docGen.GenerateDocSet(numDocs));
        }
Esempio n. 9
0
        // GET: Test
        public FileResult Bodacc()
        {
            var file = DocGenerator.GenerateBodaccReport("414819409");

            return(File(file.FileStream, MimeMapping.GetMimeMapping("pdf")));

            //BodaccReader.BodaccReader br = new BodaccReader.BodaccReader();
            //var elts = br.GetBodacc("414819409");
            //return new ContentResult() { Content = JsonConvert.SerializeObject(elts), ContentType = "application/json" };
        }
Esempio n. 10
0
        public ContentResult GenerateAcceptanceReport(int conflictId)
        {
            var file      = DocGenerator.GenerateAcceptanceDeclaration(BLLConflicts.GetConflict(conflictId), User.Identity.FirstName() + " " + User.Identity.LastName());
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(new ContentResult()
            {
                Content = azureFile.Uri.AbsoluteUri
            });
        }
Esempio n. 11
0
        public void Generate_WhenInvokedAndSettingsAreAltered_PublicMethodsAreNotIncluded()
        {
            var generator = new DocGenerator(_document);
            generator.MethodsToInclude = null;

            Type type = typeof(TestClass);
            ClassDescription description = generator.Generate(type);

            Assert.AreEqual(0, description.PublicMethods.Count);
        }
Esempio n. 12
0
        public ActionResult Sentence(int conflictId)
        {
            var conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var file      = DocGenerator.GenerateSentenceReport(conflict);
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(View("WriteSentence", new WritePreSentenceModel()
            {
                Conflict = conflict, Url = azureFile.Uri.AbsoluteUri
            }));
        }
Esempio n. 13
0
        public void GenerateJsonRpcDoc_Valid_CreatesDoc()
        {
            // ARRANGE
            var info = new JsonRpcInfo
            {
                Contact = new JsonRpcContact
                {
                    Email = "*****@*****.**",
                    Name  = "test",
                    Url   = "www.test.dk"
                },
                Description        = "test",
                Title              = "test",
                Version            = "test",
                JsonRpcApiEndpoint = "/test"
            };

            var attribute = typeof(TestWebSocketService)
                            .GetAttribute <JsonRpcServiceAttribute>();
            // ACT
            var doc = DocGenerator.GenerateJsonRpcDoc(info);

            // ASSERT
            Assert.That(doc.Info.Description, Is.EqualTo(info.Description));
            Assert.That(doc.Info.Title, Is.EqualTo(info.Title));
            Assert.That(doc.Info.Version, Is.EqualTo(info.Version));
            Assert.That(doc.Info.JsonRpcApiEndpoint, Is.EqualTo(info.JsonRpcApiEndpoint));
            Assert.That(doc.Info.Contact.Email, Is.EqualTo(info.Contact.Email));
            Assert.That(doc.Info.Contact.Name, Is.EqualTo(info.Contact.Name));
            Assert.That(doc.Info.Contact.Url, Is.EqualTo(info.Contact.Url));
            Assert.That(doc.Services, Has.Count.EqualTo(1));
            var service = doc.Services.First();

            Assert.That(service.Description, Is.EqualTo(attribute.Description));
            Assert.That(service.Name, Is.EqualTo(attribute.Name));
            Assert.That(service.Path, Is.EqualTo(attribute.Path));
            Assert.That(service.Notifications, Has.Count.EqualTo(1));
            var notification = service.Notifications.First();

            Assert.That(notification.Name, Is.EqualTo("EventWithArgs"));
            Assert.That(notification.Description, Is.EqualTo("test"));
            Assert.That(notification.Parameters, Has.Count.EqualTo(1));
            var parameters = notification.Parameters.First();

            Assert.That(parameters.Name, Is.EqualTo(typeof(TestEventArgs).Name));
            Assert.That(parameters.Required, Is.True);
            Assert.That(parameters.Type, Is.EqualTo(typeof(TestEventArgs)));
            var schema = parameters.Schema;

            Assert.That(schema, Contains.Key("type"));
            Assert.That(schema["type"], Is.EqualTo("object"));
            Assert.That(schema, Contains.Key("$ref"));
            Assert.That(schema["$ref"], Is.EqualTo("#/definitions/TestEventArgs"));
        }
Esempio n. 14
0
        public static void DoIt(string filePath_in)
        {
            DocGenerator _generator = new DocGenerator();

            _generator.Open(
                filePath_in,
                true,
                Notify
                );
            _generator.Build(Notify);
        }
Esempio n. 15
0
        public ActionResult ProcedureClosure(int id, int conflictId)
        {
            var conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var debate    = BLLDebates.GetDebate(id);
            var file      = DocGenerator.GenerateOrdonnanceProcedure(conflict, debate);
            var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName);

            return(View("ProcedureClosure", new ProcedureClosureModel()
            {
                Conflict = conflict, Debat = debate, DocumentUrl = azureFile.Uri.AbsoluteUri
            }));
        }
    //
    // Handles fields, but perhaps this is better done in DocFixer to pull the definitions
    // from the docs?
    //
    public static void ProcessField(Type t, XDocument xdoc, PropertyInfo pi)
    {
        var fieldAttr = pi.GetCustomAttributes(typeof(FieldAttribute), true);

        if (fieldAttr.Length == 0)
        {
            return;
        }

        var export = ((FieldAttribute)fieldAttr [0]).SymbolName;

        var field = xdoc.XPathSelectElement("Type/Members/Member[@MemberName='" + pi.Name + "']");

        if (field == null)
        {
            Console.WriteLine("Warning: {0} document is not up-to-date with the latest assembly", t);
            return;
        }
        var returnType = field.XPathSelectElement("ReturnValue/ReturnType");
        var summary    = field.XPathSelectElement("Docs/summary");
        var remarks    = field.XPathSelectElement("Docs/remarks");

        if (mergeAppledocs)
        {
            if (returnType.Value == "MonoMac.Foundation.NSString" && export.EndsWith("Notification"))
            {
                var mdoc = DocGenerator.GetAppleMemberDocs(t, export);
                if (mdoc == null)
                {
                    Console.WriteLine("Failed to load docs for {0} - {1}", t.Name, export);
                    return;
                }

                var section = DocGenerator.ExtractSection(mdoc);

                //
                // Make this pretty, the first paragraph we turn into the summary,
                // the rest we put in the remarks section
                //
                summary.Value = "";
                summary.Add(section);

                var skipOne = summary.Nodes().Skip(2).ToArray();
                remarks.Value = "";
                remarks.Add(skipOne);
                foreach (var n in skipOne)
                {
                    n.Remove();
                }
            }
        }
    }
Esempio n. 17
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            var but = sender as Button;

            if (but != null)
            {
                var firm = but.CommandParameter as FirmModelWraper;
                if (firm != null)
                {
                    DocGenerator.FirmaData(firm.CurrentFirma);
                }
            }
        }
Esempio n. 18
0
        private static IEnumerable <XObject> GenerateAttributeArgument(IProcessingContext context,
                                                                       CustomAttributeTypedArgument cata)
        {
            // TODO this needs to be cleaned up, and fixed
            context.AddReference(AssetIdentifier.FromMemberInfo(cata.ArgumentType));
            yield return(new XAttribute("type", AssetIdentifier.FromMemberInfo(cata.ArgumentType)));

            if (cata.ArgumentType.IsEnum)
            {
                if (
                    cata.ArgumentType.GetCustomAttributesData().Any(
                        ca =>
                        ca.Constructor.DeclaringType ==
                        typeof(FlagsAttribute)))
                {
                    string   flags = Enum.ToObject(cata.ArgumentType, cata.Value).ToString();
                    string[] parts = flags.Split(',');

                    yield return
                        (new XElement("literal",
                                      new XAttribute("value", cata.Value),
                                      Array.ConvertAll(parts,
                                                       s => new XElement("flag", new XAttribute("value", s.Trim())))));
                }
                else
                {
                    string value = Enum.GetName(cata.ArgumentType, cata.Value);
                    if (value != null)
                    {
                        yield return(new XElement("literal", new XAttribute("value", value)));
                    }

                    yield return(new XElement("literal", new XAttribute("value", cata.Value)));
                }
            }
            else if (cata.ArgumentType == typeof(Type))
            {
                XElement tmp = new XElement("tmp");
                DocGenerator.GenerateTypeRef(context.Clone(tmp), (Type)cata.Value, "value");
                yield return(tmp.Attribute("value"));

                foreach (XElement xElement in tmp.Elements())
                {
                    yield return(xElement);
                }
            }
            else // TODO fix how this encodes unprintable characters
            {
                yield return(new XAttribute("value", cata.Value.ToString().Replace("\0", "\\0")));
            }
        }
Esempio n. 19
0
        public static DocGenerator Get()
        {
            if (_generator != null)
            {
                return(_generator);
            }

            lock (_lock)
            {
                if (_generator != null)
                {
                    return(_generator);
                }
                return(_generator = new DocGenerator());
            }
        }
Esempio n. 20
0
        public static void Main(string[] args)
        {
            CommandLine.Parser.Default.ParseArguments <Options>(args)
            .WithParsed(o =>
            {
                Config config = Config.Default;

                if (!File.Exists(o.XmlFile))
                {
                    throw new Exception(
                        string.Format("The file could not be found: {0}", o.XmlFile));
                }

                if (!File.Exists(o.AssemblyPath))
                {
                    throw new Exception(
                        string.Format("The file could not be found: {0}", o.AssemblyPath));
                }

                if (o.ConfigFile != null && !File.Exists(o.ConfigFile))
                {
                    throw new Exception(
                        string.Format("The file could not be found: {0}", o.XmlFile));
                }

                var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + o.AssemblyPath;

                Console.WriteLine("Using assembly at path " + assemblyPath);
                var assembly = Assembly.LoadFile(assemblyPath);

                if (o.ConfigFile != null)
                {
                    config = JsonConvert.DeserializeObject <Config>(o.ConfigFile);
                }

                var rootElement = XElement.Load(o.XmlFile);
                var types       = Parser.ParseXml(rootElement, config);

                DocGenerator.GenerateDoc(types, assembly);
            });
        }
Esempio n. 21
0
        public ActionResult Assign(int conflictId, string arbiterId)
        {
            var conflict  = BLLConflicts.GetConflictForArbitration(conflictId);
            var demandeur = conflict.UsersInConflicts.First(c => c.IdUser == conflict.IdCreationUser);

            if (demandeur.IsLawyer != null && demandeur.IsLawyer.Value)
            {
                demandeur = conflict.UsersInConflicts.First(c => c.IdLawyer == conflict.IdCreationUser);
            }
            var defendeur = conflict.UsersInConflicts.First(c => (c.IsLawyer == null || !c.IsLawyer.Value) && c.IdUser != demandeur.IdUser);

            if (demandeur.UserCompany == null || demandeur.UserCompany.Company == null || !demandeur.UserCompany.Company.isFilled() ||
                defendeur.UserCompany == null || defendeur.UserCompany.Company == null || !defendeur.UserCompany.Company.isFilled())
            {
                TempData["Error"] = "Vous devez avoir rempli les formulaires administratif des parties (adresses,rcs,etc) avant de pouvoir assigner le cas.";
                return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId }));
            }



            BLLArbiter.AssignArbiterToConflict(conflictId, arbiterId);
            var arbiter = BLLUsers.GetUserById(arbiterId);


            //Generate Mission Order and save it on cloud
            var stream = DocGenerator.GenerateMissionOrder(conflictId);
            var blob   = AzureFileHelper.AddFile(conflictId, stream.FileStream, stream.FileName);

            stream.FileStream.Dispose();
            BLLLegalDocuments.AddLegalDocument(new LegalDocument()
            {
                IdConflict = conflictId, Filename = stream.FileName, Url = blob.Uri.AbsoluteUri, Type = (int)LegalDocumentTypeEnum.MissionAct
            });
            Guid guid = Guid.NewGuid();

            FastArbitreEmails.NewMissionOrder(arbiter.Email, blob.Uri.AbsoluteUri, Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid);

            return(RedirectToAction("Centre"));
        }
Esempio n. 22
0
 public SwGeneratorController()
 {
     _storage   = DocumentStorageFactory.Get();
     _generator = DocGeneratorFactory.Get();
 }
Esempio n. 23
0
        static void Main(string[] args)
        {
            if (String.IsNullOrEmpty(Command))
            {
                Help.Print();
                return;
            }
#if !DEBUG
            try
            {
#endif
            switch (Command)
            {
            case "docs":
            {
                DocGenerator.Run();
                break;
            }

            case "sort":
            {
                TableSorter.Run();
                break;
            }

            case "pack":
            {
                PackGenerator.Run();
                break;
            }

            case "build":
            {
                // TODO: compiler command
                WriteLine("Sorry, this command isn't implemented yet :(");
                break;
            }

            case "help":
            {
                foreach (var name in GetPaths())
                {
                    WriteLine($"'{name}'");

                    switch (name.ToLower())
                    {
                    case "docs":
                        DocGenerator.GetHelp();
                        break;

                    case "sort":
                        TableSorter.GetHelp();
                        break;

                    case "pack":
                        PackGenerator.GetHelp();
                        break;

                    case "help":
                        WriteLine("Are you serious?");
                        break;

                    default:
                        WriteLine($"No help info found for '{name}'");
                        break;
                    }
                    WriteLine();
                }
                break;
            }

            default:
                WriteLine($"Unknown command: '{Command}'");
                break;
            }
#if !DEBUG
        }

        catch (Exception ex)
        {
            ForegroundColor = ConsoleColor.Red;
            WriteLine(ex.Message);
            ResetColor();
            Environment.Exit(1);
        }
#endif
        }
Esempio n. 24
0
        public override void Invoke(CompositionContainer container)
        {
            var traceListener = new ConsolidatedConsoleTraceListener
                                {
                                    { TraceSources.GeneratorSource, "Build" },
                                    { TraceSources.AssemblyLoader, "Loader" },
                                    { TraceSources.AssetResolverSource, "Resolver" },
                                };

            using (traceListener)
            {
                this.ConfigureTraceLevels(traceListener);

                DocGenerator gen = new DocGenerator(container);
                gen.AssetFilters.Add(new ComObjectTypeFilter());
                gen.AssetFilters.Add(new CompilerGeneratedFilter());
                if (!this.IncludeNonPublic.IsPresent)
                    gen.AssetFilters.Add(new PublicTypeFilter());

                gen.AssetFilters.Add(new PrivateImplementationDetailsFilter());
                gen.AssetFilters.Add(new DynamicallyInvokableAttributeFilter());
                gen.AssetFilters.Add(new CompilerGeneratedFilter());
                gen.AssetFilters.Add(new LogicalMemberInfoVisibilityFilter());
                gen.AssetFilters.Add(new SpecialNameMemberInfoFilter());

                if (!string.IsNullOrWhiteSpace(this.Filter))
                    gen.AssetFilters.Add(new AssetGlobFilter { Include = this.Filter });

                XmlDocEnricher docEnricher = new XmlDocEnricher();
                gen.Enrichers.Add(docEnricher);


                if (!string.IsNullOrEmpty(this.NamespaceDocPath))
                {
                    var namespaceEnricher = new ExternalNamespaceDocEnricher();
                    if (System.IO.Path.IsPathRooted(this.NamespaceDocPath))
                        namespaceEnricher.Load(this.NamespaceDocPath);
                    else if (
                        File.Exists(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.Path),
                                                           this.NamespaceDocPath)))
                        namespaceEnricher.Load(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.Path),
                                                                      this.NamespaceDocPath));
                    else
                        namespaceEnricher.Load(this.NamespaceDocPath);

                    gen.Enrichers.Add(namespaceEnricher);
                }


                if (!File.Exists(this.Path))
                {
                    Console.WriteLine("File not found: '{0}'", this.Path);
                    return;
                }

                if (this.IncludeBclDocComments.IsPresent)
                {
                    string winPath = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
                    string bclDocPath = System.IO.Path.Combine(winPath, @"microsoft.net\framework\",
                                                               string.Format("v{0}.{1}.{2}",
                                                                             Environment.Version.Major,
                                                                             Environment.Version.Minor,
                                                                             Environment.Version.Build),
                                                               @"en\");


                    docEnricher.AddPath(bclDocPath);

                    bclDocPath = System.IO.Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
                        @"Reference Assemblies\Microsoft\Framework\.NETFramework",
                        string.Format("v{0}.{1}",
                                      Environment.Version.Major,
                                      Environment.Version.Minor));

                    docEnricher.AddPath(bclDocPath);
                }


                var assemblyName = AssemblyName.GetAssemblyName(this.Path);

                XDocument rawDoc = gen.Generate(this.Path);

                string fileName = System.IO.Path.Combine(this.Output ?? System.IO.Path.GetDirectoryName(this.Path),
                                                         string.Format("{0}_{1}.ldoc",
                                                                       System.IO.Path.GetFileName(this.Path),
                                                                       assemblyName.Version));

                this.Output = System.IO.Path.GetFullPath(fileName);

                if (!Directory.Exists(System.IO.Path.GetDirectoryName(fileName)))
                    Directory.CreateDirectory(System.IO.Path.GetDirectoryName(fileName));

                rawDoc.Save(fileName);

            }

        }
    public static int Main(string [] args)
    {
        string dir      = null;
        string lib      = null;
        var    debug    = Environment.GetEnvironmentVariable("DOCFIXER");
        bool   debugDoc = false;

        DocGenerator.DebugDocs = false;

        for (int i = 0; i < args.Length; i++)
        {
            var arg = args [i];
            if (arg == "-h" || arg == "--help")
            {
                Help();
                return(0);
            }
            if (arg == "--appledocs")
            {
                mergeAppledocs = true;
                continue;
            }
            if (arg == "--debugdoc")
            {
                DocGenerator.DebugDocs = true;
                debugDoc = true;
                continue;
            }

            if (lib == null)
            {
                lib = arg;
            }
            else
            {
                dir = arg;
            }
        }

        if (dir == null)
        {
            Help();
            return(1);
        }

        if (File.Exists(Path.Combine(dir, "en")))
        {
            Console.WriteLine("The directory does not seem to be the root for documentation (missing `en' directory)");
            return(1);
        }
        assembly_dir = Path.Combine(dir, "en");
        assembly     = Assembly.LoadFrom(lib);

        foreach (Type t in assembly.GetTypes())
        {
            if (debugDoc)
            {
                string str = DocGenerator.GetAppleDocFor(t);
                if (str == null)
                {
                    Console.WriteLine("Could not find docs for {0}", t);
                }

                continue;
            }

            if (debug != null && t.FullName != debug)
            {
                continue;
            }

            var btas = t.GetCustomAttributes(typeof(BaseTypeAttribute), true);
            if (btas.Length > 0)
            {
                ProcessNSO(t, (BaseTypeAttribute)btas [0]);
            }
        }

        Console.WriteLine("saving");
        SaveDocs();

        return(0);
    }
Esempio n. 26
0
 protected override void Add()
 {
     DocGenerator.GenerateDdsSales(Month, Year, false);
 }
Esempio n. 27
0
        public DocGeneratorTests()
        {
            Mock <ILogger> logger = new Mock <ILogger>();

            this.generator = new DocGenerator(logger.Object);
        }
Esempio n. 28
0
 protected override void AddNew()
 {
     DocGenerator.GenerateDdsSalesF(Context, Month, Year);
 }
Esempio n. 29
0
 static void createDoc()
 {
     DocGenerator.start();
 }
Esempio n. 30
0
 protected override void Delete()
 {
     Visible = Visibility.Visible;
     DocGenerator.GenerateViesF(Context, Month, Year, model);
     Visible = Visibility.Hidden;
 }
Esempio n. 31
0
 private void GenDeclareFile(object sender, DoWorkEventArgs e)
 {
     DocGenerator.GenrateDeclarF(Context, Month, Year, model);
 }
Esempio n. 32
0
        public FileResult GetBodaccReport(string siret)
        {
            var file = DocGenerator.GenerateBodaccReport(siret);

            return(File(file.FileStream, "application/pdf", "RapportBodacc-" + siret + ".pdf"));
        }